Files
firefox/testing/web-platform/tests/css/css-paint-api/no-op-animation.https.html
Xida Chen 1065d48821 Bug 1736070 [wpt PR 31273] - Deflaky a css-paint-api/ layout test, a=testonly
Automatic update from web-platform-tests
Deflaky a css-paint-api/ layout test

The root cause of the flakiness is that the layout test has a
text editing field, and at the end of the test when capturing
screenshot, the cursor is at the text field, and the cursor
will blink. So when the screenshot is captured, the cursor
may or may not show up in the result, which makes it flaky.

The solution to this is simple, simply adding a new
"selectAll" command at the end of the test such that the
cursor no longer stays at the text editing field.

I have tried this test locally, without this CL, it fails
about 50 out of 100 runs, and with this CL there is no
failure.

Bug: 1259804
Change-Id: I795a7c9205cd777bf2a0545262824bc87c901dc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3225904
Reviewed-by: Kevin Ellis <[email protected]>
Commit-Queue: Xida Chen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#932139}

--

wpt-commits: 60dc4798c579ccfc6e276822cb8f66dc9dfbfa1c
wpt-pr: 31273
2021-10-29 10:23:39 +00:00

51 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/">
<link rel="match" href="no-op-animation-ref.html">
<style>
#container {
}
.animate {
background-image: paint(foo);
animation: anim 1s;
}
@keyframes anim {
0% { --foo: rgb(200, 0, 0); }
}
</style>
<script src="/common/reftest-wait.js"></script>
<body "lightyellow" contenteditable="true"="0">
<div id="container">=</div>
<script id="code" type="text/worklet">
registerPaint('foo', class {
static get inputProperties() { return ['--foo']; }
paint() {}
});
</script>
<script>
CSS.registerProperty({
name: '--foo',
syntax: '<color>',
initialValue: 'rgb(0, 0, 0)',
inherits: false
});
var code = document.getElementById('code').textContent;
var blob = new Blob([code], {type: 'text/javascript'});
CSS.paintWorklet.addModule(URL.createObjectURL(blob)).then(function() {
document.getElementById('container').classList.add('animate');
edit();
});
function edit() {
document.execCommand("selectAll");
document.execCommand("InsertHTML",false,"<pre></pre>");
document.execCommand("InsertHTML",false,"<div>i</div>");
document.execCommand("indent");
document.execCommand("selectAll");
takeScreenshot();
}
</script>
</body>
</html>