Press once whatever a second press would open over or undo
tests / feature (8.4) (push) Successful in 1m50s
tests / feature (8.5) (push) Successful in 1m54s
tests / browser (chrome, chromium) (push) Successful in 7m52s
tests / browser (firefox, firefox) (push) Successful in 11m56s
tests / browser (safari, webkit) (push) Successful in 12m35s
tests / feature (8.4) (push) Successful in 1m50s
tests / feature (8.5) (push) Successful in 1m54s
tests / browser (chrome, chromium) (push) Successful in 7m52s
tests / browser (firefox, firefox) (push) Successful in 11m56s
tests / browser (safari, webkit) (push) Successful in 12m35s
The browser plugin runs every call on a page again when its first attempt takes over a second, and on the runner a press can. For most presses that costs nothing. For two kinds it breaks the test: a press that opens a dialog, a sheet, a full-screen view or a modal rail over its own trigger, whose second press can never land, and a press that changes state a second one would change again — a menu trigger, a toggle, a chip, a range picker's day, a paging key, a Save. The bottom sheet with preset heights timed out on WebKit that way after the date picker had on Firefox. Every such press in the browser suite now goes through pressOnce(), 253 of them across sixteen files, not only the ones the runner happened to catch; focus moves inside an open view, Escape, links and plain "set" actions keep the retry, which is harmless for them. Two samples that were still racing the machine: - The standard side sheet's exit is caught half-way with its motion stretched, as every other mid-exit sample is, and fullSpeed() takes the stretch off again before the test times a reopen against the real exit. Under load on Linux WebKit it had failed two runs in five; it passes ten in ten. - The switch-and-checkbox row measures its widths once, so it now waits for the resize to land and the brand face to load before it does. Browser 300 passed on Firefox and WebKitGTK in a Linux container held to two busy cores, and on Chrome, Firefox and WebKit on macOS. Feature 1159 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ad230e0f48
commit
ebdc2ef2e1
+16
-1
@@ -67,12 +67,23 @@ function slowMotion(mixed $page, string $duration = '3s'): mixed
|
||||
$css = collect($tokens)->map(fn (string $token): string => "{$token}: {$duration} !important;")->implode(' ');
|
||||
|
||||
$page->script(<<<JS
|
||||
document.head.insertAdjacentHTML('beforeend', '<style>:root { {$css} }</style>')
|
||||
document.head.insertAdjacentHTML('beforeend', '<style data-slow-motion>:root { {$css} }</style>')
|
||||
JS);
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes slowMotion() back off, for a test that samples one exit and then goes on to time the next
|
||||
* against the real durations.
|
||||
*/
|
||||
function fullSpeed(mixed $page): mixed
|
||||
{
|
||||
$page->script("document.querySelectorAll('style[data-slow-motion]').forEach((style) => style.remove())");
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JS expression answering whether `$element` has finished whatever it animates — chained as an
|
||||
* assertScript() after an open, before a test stretches motion and samples the exit, or before it
|
||||
@@ -132,6 +143,10 @@ function onceInPage(string $expression): string
|
||||
* a menu, or the full-screen range picker, which re-renders every day of every month it holds on
|
||||
* each press. Assert on `$page` again. The plugin retrying every action is the cause, and every
|
||||
* press in the suite is exposed to it; these are the ones slow and undoable enough to have shown it.
|
||||
*
|
||||
* The rule is every press that opens a covering layer (a dialog, a sheet, a full-screen view, a
|
||||
* modal picker, a menu) or changes state a second press would alter (a toggle, a day cell, a
|
||||
* paging key, a chip or switch, a grip, a Save or close), not only the ones a failure has caught.
|
||||
*/
|
||||
function pressOnce(mixed $page): Webpage
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user