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
+46
-24
@@ -94,8 +94,11 @@ it('moves between tabs with the arrow keys, skipping disabled ones, and tells Li
|
||||
->assertAttribute('#share-people', 'tabindex', '0')
|
||||
->assertAttribute('#share-files', 'tabindex', '-1');
|
||||
|
||||
$page->keys('#share-people', 'ArrowRight')
|
||||
->assertSeeIn('#tab', 'activity')
|
||||
// Each arrow key sends its own wire:model.live request and moves one tab further: pressOnce(),
|
||||
// tests/Pest.php.
|
||||
pressOnce($page)->keys('#share-people', 'ArrowRight');
|
||||
|
||||
$page->assertSeeIn('#tab', 'activity')
|
||||
->assertScript("document.activeElement.id === 'share-activity'")
|
||||
->assertScript("getComputedStyle(document.querySelector('#share-activity [data-md-tab-indicator]')).opacity === '1'");
|
||||
|
||||
@@ -103,8 +106,9 @@ it('moves between tabs with the arrow keys, skipping disabled ones, and tells Li
|
||||
->assertSeeIn('#tab', 'files')
|
||||
->assertScript("document.activeElement.id === 'share-files'");
|
||||
|
||||
$page->keys('#share-files', 'ArrowLeft')
|
||||
->assertSeeIn('#tab', 'activity');
|
||||
pressOnce($page)->keys('#share-files', 'ArrowLeft');
|
||||
|
||||
$page->assertSeeIn('#tab', 'activity');
|
||||
});
|
||||
|
||||
it('sends a request per click with wire:model.live, but nothing until then with plain wire:model', function () {
|
||||
@@ -166,23 +170,32 @@ it('switches the theme from a toggle, a cycle and a picker', function () {
|
||||
->assertScript("document.documentElement.dataset.theme === 'light'")
|
||||
->assertAttribute('#toggle', 'aria-pressed', 'false');
|
||||
|
||||
$page->click('#toggle')
|
||||
->assertScript("document.documentElement.dataset.theme === 'dark'")
|
||||
// A theme toggle flips on every press: pressOnce(), tests/Pest.php.
|
||||
pressOnce($page)->click('#toggle');
|
||||
|
||||
$page->assertScript("document.documentElement.dataset.theme === 'dark'")
|
||||
->assertAttribute('#toggle', 'aria-pressed', 'true')
|
||||
->assertScript('document.querySelector(\'input[name="material-theme"][value="dark"]\').checked');
|
||||
|
||||
$page->click('#cycle')
|
||||
->assertScript("document.documentElement.dataset.themeChoice === 'system'")
|
||||
->click('#cycle')
|
||||
->assertScript("document.documentElement.dataset.themeChoice === 'light'");
|
||||
// A cycling toggle a retry would cycle twice: pressOnce(), tests/Pest.php.
|
||||
pressOnce($page)->click('#cycle');
|
||||
|
||||
$page->assertScript("document.documentElement.dataset.themeChoice === 'system'");
|
||||
|
||||
pressOnce($page)->click('#cycle');
|
||||
|
||||
$page->assertScript("document.documentElement.dataset.themeChoice === 'light'");
|
||||
});
|
||||
|
||||
it('turns section tabs into a picker on a phone', function () {
|
||||
barsProbe()
|
||||
$page = barsProbe()
|
||||
->resize(400, 800)
|
||||
->assertScript("getComputedStyle(document.querySelector('[data-md-section-nav] nav')).display === 'none'")
|
||||
->click('[data-md-section-nav-picker] button')
|
||||
->assertScript("document.querySelector('[data-md-section-nav-picker] [popover]').matches(':popover-open')")
|
||||
->assertScript("getComputedStyle(document.querySelector('[data-md-section-nav] nav')).display === 'none'");
|
||||
|
||||
// Opens the picker menu over the button that triggers it: pressOnce(), tests/Pest.php.
|
||||
pressOnce($page)->click('[data-md-section-nav-picker] button');
|
||||
|
||||
$page->assertScript("document.querySelector('[data-md-section-nav-picker] [popover]').matches(':popover-open')")
|
||||
// A menu of places: the current section is the page, not a checked choice.
|
||||
->assertAttribute('[data-md-section-nav-picker] [role="menuitem"][href="#profile"]', 'aria-current', 'page')
|
||||
->assertScript("! document.querySelector('[data-md-section-nav-picker] [role=\"menuitem\"][href=\"#security\"]').hasAttribute('aria-current')");
|
||||
@@ -308,8 +321,10 @@ it('shows the app bar overflow at exactly 599 and 600px', function () {
|
||||
it('moves the keyboard through an app bar\'s overflow menu, and closes it once the width no longer shows it', function () {
|
||||
$page = appBarOverflowProbe()->resize(599, 800);
|
||||
|
||||
$page->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button')
|
||||
->assertScript("document.querySelector('#bar [data-md-app-bar-overflow=\"compact\"] [data-md-menu-popover]').matches(':popover-open')")
|
||||
// A menu's trigger toggles, so it is pressed once: pressOnce() in tests/Pest.php.
|
||||
pressOnce($page)->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button');
|
||||
|
||||
$page->assertScript("document.querySelector('#bar [data-md-app-bar-overflow=\"compact\"] [data-md-menu-popover]').matches(':popover-open')")
|
||||
->keys(':focus', 'ArrowDown')
|
||||
->assertScript("document.activeElement.textContent.includes('Star')")
|
||||
->keys(':focus', 'ArrowDown')
|
||||
@@ -322,8 +337,10 @@ it('moves the keyboard through an app bar\'s overflow menu, and closes it once t
|
||||
|
||||
// Reopen it, then resize across 600px: the compact menu's trigger is no longer shown, so the
|
||||
// menu it opened closes rather than staying open anchored to nothing.
|
||||
$page->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button')
|
||||
->assertScript("document.querySelector('#bar [data-md-app-bar-overflow=\"compact\"] [data-md-menu-popover]').matches(':popover-open')")
|
||||
// A menu's trigger toggles, so it is pressed once: pressOnce() in tests/Pest.php.
|
||||
pressOnce($page)->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button');
|
||||
|
||||
$page->assertScript("document.querySelector('#bar [data-md-app-bar-overflow=\"compact\"] [data-md-menu-popover]').matches(':popover-open')")
|
||||
->resize(900, 800)
|
||||
->assertScript("! document.querySelector('#bar [data-md-app-bar-overflow=\"compact\"] [data-md-menu-popover]').matches(':popover-open')")
|
||||
->assertNoJavaScriptErrors();
|
||||
@@ -332,13 +349,18 @@ it('moves the keyboard through an app bar\'s overflow menu, and closes it once t
|
||||
it('runs a wire:click action from either the icon button or its overflow menu item', function () {
|
||||
$page = appBarOverflowProbe()->resize(900, 800);
|
||||
|
||||
$page->click('#bar [data-md-app-bar-action] [aria-label="Star"]')
|
||||
->assertSeeIn('#stars', '1');
|
||||
// A counter a retry would double: pressOnce(), tests/Pest.php.
|
||||
pressOnce($page)->click('#bar [data-md-app-bar-action] [aria-label="Star"]');
|
||||
|
||||
$page->resize(599, 800)
|
||||
->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button')
|
||||
->click('[role="menuitem"]:has-text("Star")')
|
||||
->assertSeeIn('#stars', '2');
|
||||
$page->assertSeeIn('#stars', '1');
|
||||
|
||||
$page->resize(599, 800);
|
||||
|
||||
// Opens the overflow menu, then a counter a retry would double: pressOnce(), tests/Pest.php.
|
||||
pressOnce($page)->click('#bar [data-md-app-bar-overflow="compact"] [data-md-menu-trigger] button')
|
||||
->click('[role="menuitem"]:has-text("Star")');
|
||||
|
||||
$page->assertSeeIn('#stars', '2');
|
||||
});
|
||||
|
||||
function toolbarScaffoldProbe()
|
||||
|
||||
Reference in New Issue
Block a user