Catch an exit half-way on a slow machine, not only on a fast one
tests / feature (8.4) (push) Successful in 1m45s
tests / feature (8.5) (push) Successful in 2m0s
tests / browser (chrome, chromium) (push) Successful in 8m6s
tests / browser (firefox, firefox) (push) Failing after 12m52s
tests / browser (safari, webkit) (push) Failing after 13m1s
tests / feature (8.4) (push) Successful in 1m45s
tests / feature (8.5) (push) Successful in 2m0s
tests / browser (chrome, chromium) (push) Successful in 8m6s
tests / browser (firefox, firefox) (push) Failing after 12m52s
tests / browser (safari, webkit) (push) Failing after 13m1s
The browser suite passes on every engine here and fails on the runner, which takes three times as long: each failing test triggers a close and then samples for an in-between state — a rail part-way out, a scrim part-way faded, a menu's exit copy part-way sunk — and a starved runner takes its one sample after the 150-650ms exit has already finished. So the tests that assert *that* something animates now stretch every motion duration token to three seconds first (`slowMotion()`, beside `ready()` in tests/Pest.php; ActionsTest's own copy of it goes). The two polling helpers grew their budget to match: the rail panel and the sheet slide on emphasized-accelerate, which is under 1% of its travel at a quarter of the way through, so a 300ms window no longer reached the threshold once the exit itself was three seconds long. The two full-screen date picker tests waited for a resize through click()'s own retry, which ate the whole 15s budget on Firefox; they now wait for the new width and a settled document first. The bottom sheet's preset test waits for its entry to finish before pressing the grip. `hold()` in search.js reads the view's animations a frame after the closed state, as the rail's settle() does, but one frame is not always enough: an engine that starts them on its next tick shows none, and the full-screen layout would end at once, mid-exit. An empty list is now asked again on the following frame. Feature 1159 passed. Browser 299 passed on Chrome, Firefox and WebKit, and again on WebKit under ten spinning cores. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
145f60aa11
commit
94d6e31432
@@ -647,7 +647,10 @@ it('reads expanded while a modal rail is open over the page, and collapsed once
|
||||
* Closes a rail with the given script and reports whether, sampling every few ms in the page
|
||||
* itself, it was ever caught part-way: the whole close in one round trip, since a separate
|
||||
* `script` and `assertScript` apiece already take as long as the 200ms exit (see ContainmentTest's
|
||||
* scrim fades).
|
||||
* scrim fades). Called after slowMotion(), so the panel's own close — on the emphasized-accelerate
|
||||
* easing, which stays close to its start for a good part of its run — still needs a couple of
|
||||
* seconds of that stretched exit before its position has moved the couple of pixels `$partWay`
|
||||
* looks for; 2000ms (400 × 5ms) covers that with room to spare, short of the full exit ending.
|
||||
*/
|
||||
function caughtMidClose(mixed $page, string $close, string $partWay): bool
|
||||
{
|
||||
@@ -655,7 +658,7 @@ function caughtMidClose(mixed $page, string $close, string $partWay): bool
|
||||
(async () => {
|
||||
{$close}
|
||||
|
||||
for (let i = 0; i < 60; i++) {
|
||||
for (let i = 0; i < 400; i++) {
|
||||
if ({$partWay}) return true
|
||||
await new Promise((resolve) => setTimeout(resolve, 5))
|
||||
}
|
||||
@@ -686,6 +689,8 @@ it('slides the compact rail out on close, rather than making it vanish', functio
|
||||
->assertScript(RAIL.".hasAttribute('data-md-open')")
|
||||
->assertScript(settled(RAIL_PANEL).' && Math.round('.RAIL_PANEL.'.getBoundingClientRect().left) === 0');
|
||||
|
||||
slowMotion($page);
|
||||
|
||||
expect(caughtMidClose($page, "document.querySelector('[data-md-navigation-rail-scrim]').click()", slidingOut(RAIL_PANEL)))->toBeTrue();
|
||||
|
||||
$page->assertScript('getComputedStyle('.RAIL_PANEL.").display === 'none'")
|
||||
@@ -704,6 +709,8 @@ it('slides a rail that hides when collapsed out on close, rather than making it
|
||||
->assertScript("{$rail}.hasAttribute('data-md-open')")
|
||||
->assertScript(settled($panel)." && Math.round({$panel}.getBoundingClientRect().left) === 0 && Math.round({$panel}.getBoundingClientRect().width) === 256");
|
||||
|
||||
slowMotion($page);
|
||||
|
||||
expect(caughtMidClose($page, "{$rail}.querySelector(':scope > [data-md-navigation-rail-scrim]').click()", slidingOut($panel)))->toBeTrue();
|
||||
|
||||
$page->assertScript("getComputedStyle({$panel}).display === 'none'")
|
||||
@@ -721,6 +728,8 @@ it('fades a modal rail\'s scrim out on close while the rail stands collapsed in
|
||||
|
||||
$fading = "(getComputedStyle({$scrim}).display !== 'none' && parseFloat(getComputedStyle({$scrim}).opacity) > 0.02 && parseFloat(getComputedStyle({$scrim}).opacity) < 0.98)";
|
||||
|
||||
slowMotion($page);
|
||||
|
||||
expect(caughtMidClose($page, "{$scrim}.click()", $fading))->toBeTrue();
|
||||
|
||||
// The panel goes straight back into the layout: only the scrim was over the page.
|
||||
|
||||
Reference in New Issue
Block a user