gecko-dev/testing/web-platform/tests/web-animations/timing-model/animations/reverse-running-animation.html
Kevin Ellis 18ebeb4350 Bug 1606726 [wpt PR 21012] - Fix test flakiness in reverse-running-animation, a=testonly
Automatic update from web-platform-tests
Fix test flakiness in reverse-running-animation

The animation was often finishing before the screenshot resulting in a
failure. Extended the duration of the animation and starting the
animation from the midpoint should address the flakiness without
needlessly extending the run time of the test.

Bug: 1029543
Change-Id: I32e7794ff77a3b26e7d7f260f80d4b00bbc9d6f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986212
Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728253}

--

wpt-commits: b00f0cedac3a1e6dd42beb5884b303eac03e6c4b
wpt-pr: 21012
2020-01-08 00:49:59 +00:00

70 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="UTF-8">
<title>reverse running animation</title>
<link rel="match" href="reverse-running-animation-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="../../testcommon.js"></script>
<style>
#box, #overlay {
/* Add a border to ensure that anti-aliasing does not leak blue pixels
outside of the element's bounds. */
border: 1px solid white;
height: 40px;
position: absolute;
top: 40px;
width: 40px;
}
#box {
background: blue;
left: 40px;
z-index: 1;
}
#overlay {
background: white;
left: 140px;
z-index: 2;
}
#notes {
position: absolute;
left: 0px;
top: 100px;
}
body {
backgrond: white;
}
</style>
<body>
<div id="box"></div>
<div id="overlay"></div>
<p id="notes">
This test reverses the animation shortly after the box starts moving. If
any blue pixels are visible the test has failed.
</p>
</body>
<script>
onload = async function() {
// Double rAF to ensure that we are not bogged down during initialization
// and the compositor is ready.
waitForAnimationFrames(2).then(() => {
const elem = document.getElementById('box');
const anim = elem.animate([
{ transform: 'translateX(100px)' },
{ transform: 'translateX(100px)', offset: 0.49 },
{ transform: 'translateX(200px)', offset: 0.51 },
{ transform: 'translateX(200px)' }
], {
duration: 10000,
});
anim.ready.then(() => {
anim.currentTime = 5000;
requestAnimationFrame(() => {
anim.reverse();
takeScreenshotDelayed(1000);
});
});
});
};
</script>