Issue metadata
Sign in to add a comment
|
Test runner should wait for document.fonts.ready |
||||||||||||||||||||||||
Issue description
Not doing so is the most likely the cause of flakiness when tests use web fonts.
We found some web-font-related flakiness can be fixed by adding a script:
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
window.onload = function () {
document.fonts.ready.then(function () { testRunner.notifyDone(); });
};
}
</script>
https://codereview.chromium.org/2706033008
AFAIU, test runner waits for document lifecycle to be done after onload event. Can we consider doing the above (document.fonts.ready) in the test runner, without needing to inject the script to all tests?
foolip@, ksakamoto@, and I discussed on this a bit, then at public-test-infra@w3.org, subject "Ref-test image flakiness when web fonts are used" here:
https://lists.w3.org/Archives/Public/public-test-infra/2017JanMar/thread.html#msg24
Given James and Geoffrey look good with the approach, foolip@ and I briefly discussed and think we'd better try this out in Blink first and see if it works as expected.
WDYT?
An investigation doc before the discussion is here FYI:
https://docs.google.com/document/d/11v0QEy8rvoNlFadAc4o3aaz9DMSnmRYmL4qpRJeD7Dc/edit?usp=sharing
,
Mar 30 2017
Aren't "-expected.html" tests ref tests? The CL https://codereview.chromium.org/2706033008 is about the flakiness of a ref test in fast/css3-text. If you meant by testharness and JS tests, I agree. When tests calls testRunner.waitUntilDone() or setup({ explicit_done: true }), we don't have to--or shouldn't?--do this. If a test is JS test but doesn't call waitUntilDone(), I'm not sure if we can detect that. Probably waiting for document.fonts.ready is harmless, but as foolip@ said in the public-test-infra@, I'm not sure it doesn't break web font tests that expects to timeout etc. ksakamoto@ might know better?
,
Mar 30 2017
Inside LayoutTest/external/wpt/, there's a MANIFEST.json, and in issue 268729 things were changed such that we no longer rename the references, so there are no *-expected.html files in that subdirectory. My idea was to do this extra waiting only for things that are considered reftests in MANIFEST.json. But I'd like to hear what jeffcarp@ and qyearsley@ thinks about this.
,
Mar 30 2017
AFAIK all the our web font tests that test behavior while loading use waitUntilDone(), so waiting document.fonts.ready in all reftests without waitUntilDone() would be OK.
,
Mar 30 2017
Excellent, it's great to have uncovered a source of flakiness :-D As foolip@ noted in #11, reference tests in external/wpt are listed in MANIFEST.json along with their reference files... and now that csswg-test is merged into web-platform-tests, this also applies to all of those tests. Although the way that we run reference tests is the same for wpt and for all of the other layout tests. So the timing of the pixel dumps for reference tests is determined by our test runner; explicitly adding the above snippet using testRunner works for individual layout tests outside of wpt, but we couldn't include anything referencing testRunner in wpt. kojii@, ksakamoto@, is the next step to try to inject that JS snippet when running all tests? Do we know if this will make running the tests much slower?
,
Mar 31 2017
> kojii@, ksakamoto@, is the next step to try to inject that JS snippet when running all tests? I was thinking to change the test runner C++ code to do the equivalent thing as JS, and hoped to find someone familiar with test runner. I didn't think about injecting JS code, but that might work too. I happened to find BlinkTestRunner::TestFinished() is where we force layout/paint by calling updateAllLifecyclePhases(), and then take screenshots. So somewhere before that, we should wait for document.fonts.ready being resolved either from C++ or by injecting JS? > Do we know if this will make running the tests much slower? To my knowledge, I don't think so. It will create a resolved Promise unless fonts are loading, but that should be cheap. If you choose to inject JS, ".then()" will run in the next microtask, but that should be cheap too.
,
Apr 3 2017
,
Apr 4 2017
,
Apr 5 2017
,
Apr 6 2017
Isn't this an upstream issue for WPT too?
,
Apr 6 2017
Yes, wptrunner (which isn't how we run LayoutTests/external/wpt) would also need some changes in how reftests are run.
,
Apr 6 2017
,
Apr 19 2017
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by foolip@chromium.org
, Mar 30 2017