Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for <summary>'s activation behavior #4539

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Jan 13, 2017

Follows whatwg/html#2256.

@wpt-pr-bot
Copy link
Collaborator

@wpt-stability-bot
Copy link

wpt-stability-bot commented Jan 13, 2017

Firefox

Testing revision 2065c4f
Starting 10 test iterations
All results were stable

All results

/html/semantics/interactive-elements/the-summary-element/activation-behavior.html
Subtest Results
OK
Should close an open details if all conditions are met PASS
Should open a closed details if another summary element *nested inside a span* precedes the summary PASS
Should open a closed details if a span element precedes the summary PASS
toggle events should be coalesced even when using the activation behavior of a summary PASS
Should stay closed if the summary element is nested inside a span element PASS
Should open a closed details if all conditions are met PASS
Should stay closed if another summary element precedes the summary PASS
Should open a closed details even if the summary is not being rendered PASS
Should open a closed details even if the details is not being rendered PASS

@wpt-stability-bot
Copy link

wpt-stability-bot commented Jan 13, 2017

Chrome

Testing revision 5d41b89
Starting 10 test iterations

Unstable results

Test Subtest Results
/html/semantics/interactive-elements/the-summary-element/activation-behavior.html Should close an open details if all conditions are met FAIL: 3/10, PASS: 7/10
/html/semantics/interactive-elements/the-summary-element/activation-behavior.html Should open a closed details if another summary element *nested inside a span* precedes the summary FAIL: 3/10, PASS: 7/10
/html/semantics/interactive-elements/the-summary-element/activation-behavior.html Should open a closed details if a span element precedes the summary FAIL: 3/10, PASS: 7/10
/html/semantics/interactive-elements/the-summary-element/activation-behavior.html toggle events should be coalesced even when using the activation behavior of a summary FAIL: 3/10, PASS: 7/10
/html/semantics/interactive-elements/the-summary-element/activation-behavior.html Should open a closed details if all conditions are met FAIL: 3/10, PASS: 7/10

All results

/html/semantics/interactive-elements/the-summary-element/activation-behavior.html
Subtest Results
OK
Should close an open details if all conditions are met FAIL: 3/10, PASS: 7/10
Should open a closed details if another summary element *nested inside a span* precedes the summary FAIL: 3/10, PASS: 7/10
Should open a closed details if a span element precedes the summary FAIL: 3/10, PASS: 7/10
toggle events should be coalesced even when using the activation behavior of a summary FAIL: 3/10, PASS: 7/10
Should stay closed if the summary element is nested inside a span element PASS
Should open a closed details if all conditions are met FAIL: 3/10, PASS: 7/10
Should stay closed if another summary element precedes the summary PASS
Should open a closed details even if the summary is not being rendered FAIL
Should open a closed details even if the details is not being rendered FAIL

@domenic
Copy link
Member Author

domenic commented Jan 13, 2017

Any ideas on what would be causing this test to be unstable in Chrome? Is the stability checker on the fritz perchance, or is this some actual bug in my tests that I just can't decipher?

@sideshowbarker
Copy link
Member

Is the stability checker on the fritz perchance, or is this some actual bug in my tests that I just can't decipher?

The stability checker is working as designed as far as I know. At least I’m not aware of anything that’s known to have broken in it recently.

As far as the test failures, maybe @jgraham has some insight.

@zcorpan
Copy link
Member

zcorpan commented Jan 14, 2017

I can't reproduce the unstable results, having reloaded the test ~20 times. :-(

@jugglinmike
Copy link
Contributor

I can confirm instability in the following contexts:

  • GNU/Linux: Chromium version 57.0.2979.0 (64-bit)
  • macOS: Google Chrome version 55.0.2883.95

Firefox Nightly behaves as expected on both platforms.

It looks like Chromium does not update the <details> element when a click event is triggered during initial page rendering:

<details>
  <summary id="d">Summary</summary>
  Content
</details>

<script>document.getElementById('d').click();</script>

Demo: https://bl.ocks.org/jugglinmike/e5f13288f675836e2cca8aec8d2a2424

Note that the click event is still created and propagated as expected.

The test is reported as flaky because a DOM with more elements (such as the one under test) occasionally prompts Chromium to honor the click.

Demo: https://bl.ocks.org/jugglinmike/661f878cc5448a86072c40c3d3336a93

The flakyness may be more prominent when the document is loaded directly (in other words, not from within an <iframe>): https://bl.ocks.org/jugglinmike/raw/661f878cc5448a86072c40c3d3336a93

So this may be a bug Chromium. Probably I'm overlooking some reality of expected behavior during DOM loading, but just in case this is legitimate, I've filed a report on the Chromium issue tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=681711

@domenic
Copy link
Member Author

domenic commented Jan 17, 2017

Thanks so much @jugglinmike, that's super-valuable! I added my diagnosis of the Chrome issue in https://bugs.chromium.org/p/chromium/issues/detail?id=681711#c2 .

Now the question becomes, what is our strategy for merging or not merging tests that expose flakiness bugs in engines? Should I work around the Chrome bug (e.g. delay for some time to wait for the page to render and all layout objects to be created before starting the test suite), thus giving Chrome a free pass here? Or should we merge anyway, despite Travis not wanting us to? @gsnedders, @jgraham, thoughts?

@jgraham
Copy link
Contributor

jgraham commented Jan 17, 2017

So the problem with flaky tests is that they will tend to just be disabled when you import them, so you end up without coverage for either the original issue or the flakiness. So unfortunately it's probably better to work around the issue in the test.

The counterargument in this case is that Chrome may not import the test immediately anyway so hopefully the bug will be fixed by the time that the test is imported into the Blink repo.

Basically I'm happy for you to take either path in this specific case.

@zcorpan
Copy link
Member

zcorpan commented Jan 19, 2017

I think if you work around a bug in a test, it would be good to have a separate test testing the bug you're working around, or at least an issue in web-platform-tests repo to add such a test.

@domenic
Copy link
Member Author

domenic commented Jan 19, 2017

I think if you work around a bug in a test, it would be good to have a separate test testing the bug you're working around, or at least an issue in web-platform-tests repo to add such a test.

Wouldn't such a separate test not pass the stability checker?

@domenic
Copy link
Member Author

domenic commented Jan 19, 2017

Since tkent fixed the suspected Chrome bug already I think we should merge this as-is. However, I don't have privileges to do so since the stability checker failed. @jgraham, is that something you can do?

@sideshowbarker sideshowbarker merged commit 05e370d into master Jan 19, 2017
@sideshowbarker sideshowbarker deleted the summary-activation branch January 19, 2017 22:05
domenic added a commit to whatwg/html that referenced this pull request Jan 19, 2017
Fixes #2246. This also fixes the value that the open attribute is set to
to be the empty string, instead of "open", matching existing
implementations.

Tests at web-platform-tests/wpt#4539 show that
both implementers of <details> follow these same semantics, despite
there having been no spec previously. The only exception is that Blink
included a being-rendered check, but that was removed; see
https://bugs.chromium.org/p/chromium/issues/detail?id=681711.

There's still some discussion ongoing as to whether we should change the
content models to disallow interactive descendants of <summary>
elements, happening in #2272.
@zcorpan
Copy link
Member

zcorpan commented Jan 19, 2017

Depends on how you write the test. You could repeat the unstable thing in the test say 50 times and fail the test if it ever gives an unexpected result. Or you could let it have unstable result, I suppose.

@zcorpan
Copy link
Member

zcorpan commented Jan 19, 2017

Or in some cases you can make one of the relevant things take a long time to complete, like here maybe having a slow-loading stylesheet...

alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
Fixes whatwg#2246. This also fixes the value that the open attribute is set to
to be the empty string, instead of "open", matching existing
implementations.

Tests at web-platform-tests/wpt#4539 show that
both implementers of <details> follow these same semantics, despite
there having been no spec previously. The only exception is that Blink
included a being-rendered check, but that was removed; see
https://bugs.chromium.org/p/chromium/issues/detail?id=681711.

There's still some discussion ongoing as to whether we should change the
content models to disallow interactive descendants of <summary>
elements, happening in whatwg#2272.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants