Truly independent web browser
Tests/LibWeb: Sample transition-basics.html at fixed times
Jelle Raaijmakerseefb030d3b9e
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex efbdb79fc8e..086d95658ca 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1207,7 +1207,6 @@ Text/input/wpt-import/encoding/unsupported-labels.window.html; Animation tests are flakyText/input/css/cubic-bezier-infinite-slope-crash.html-Text/input/css/transition-basics.html; Times out on CI, possibly animation related: https://github.com/LadybirdBrowser/ladybird/issues/7742Crash/wpt-import/editing/crashtests/designMode-caret-change.htmldiff --git a/Tests/LibWeb/Text/expected/css/transition-basics.txt b/Tests/LibWeb/Text/expected/css/transition-basics.txtindex 3dc8cb78ad8..6b48230f538 100644--- a/Tests/LibWeb/Text/expected/css/transition-basics.txt+++ b/Tests/LibWeb/Text/expected/css/transition-basics.txt@@ -1,5 +1,5 @@left starts at: 0px-shortly after starting, left is >= 0px? true and < 200px? true-half-way through, left is > 0px? true and < 200px? true-near the end, left is > 0px? true and < 200px? true+left 0ms into the transition: 0px+left 500ms into the transition: 100px+left 950ms into the transition: 190pxafter the transition, left is: 200pxdiff --git a/Tests/LibWeb/Text/input/css/transition-basics.html b/Tests/LibWeb/Text/input/css/transition-basics.htmlindex 3571f4d0be5..b8230ab3c65 100644--- a/Tests/LibWeb/Text/input/css/transition-basics.html+++ b/Tests/LibWeb/Text/input/css/transition-basics.html@@ -19,30 +19,20 @@</style><div id="box"></div><script>- asyncTest(async done => {+ test(() => {let box = document.getElementById("box");println(`left starts at: ${getComputedStyle(box).left}`);box.classList.add("move");- setTimeout(() => {- let left = parseFloat(getComputedStyle(box).left);- println(`shortly after starting, left is >= 0px? ${left >= 0} and < 200px? ${left < 200}`);- }, 1);- setTimeout(() => {- let left = parseFloat(getComputedStyle(box).left);- println(`half-way through, left is > 0px? ${left > 0} and < 200px? ${left < 200}`);- }, 500);- setTimeout(() => {- let left = parseFloat(getComputedStyle(box).left);- println(`near the end, left is > 0px? ${left > 0} and < 200px? ${left < 200}`);- }, 950);- setTimeout(() => {- // FIXME: This is a hack to make it recompute the style, otherwise we get 0px for the left value.- // Figure out why!- box.style.top = "0px";- println(`after the transition, left is: ${getComputedStyle(box).left}`);- done();- }, 1050);+ const transition = box.getAnimations()[0];+ transition.pause();+ for (const time of [0, 500, 950]) {+ transition.currentTime = time;+ println(`left ${time}ms into the transition: ${Math.round(parseFloat(getComputedStyle(box).left))}px`);+ }++ transition.finish();+ println(`after the transition, left is: ${getComputedStyle(box).left}`);});</script></html>