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

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:
surtic86
2026-09-18 16:15:25 +02:00
co-authored by Claude Opus 5
parent ad230e0f48
commit ebdc2ef2e1
17 changed files with 1170 additions and 578 deletions
+32 -16
View File
@@ -90,8 +90,10 @@ it('toggles a filter chip with a click and with Space, and grows its check in',
$page = chipShowcase()->assertNoJavaScriptErrors();
$page->click('#chips label:has-text("Documents")')
->assertScript(filterInput('documents').'.checked')
// A filter chip toggles on every press: pressOnce(), tests/Pest.php.
pressOnce($page)->click('#chips label:has-text("Documents")');
$page->assertScript(filterInput('documents').'.checked')
->assertScript("Math.round({$check('documents')}) === 18")
->assertScript('getComputedStyle('.filterInput('documents').".parentElement).backgroundColor !== 'rgba(0, 0, 0, 0)'")
->assertScript("window.eval(\"Alpine.\$data(document.querySelector('#chips input[value=documents]')).kinds.join(',')\") === 'photos,documents'");
@@ -100,12 +102,16 @@ it('toggles a filter chip with a click and with Space, and grows its check in',
// because WebKit leaves form controls out of the Tab order unless full keyboard access is on.
$page->keys('#content', 'Tab');
$page->script(filterInput('archives').'.focus()');
$page->keys(':focus', 'Space')
->assertScript(filterInput('archives').'.checked')
// Space toggles a filter chip on every press: pressOnce(), tests/Pest.php.
pressOnce($page)->keys(':focus', 'Space');
$page->assertScript(filterInput('archives').'.checked')
->assertScript("Math.round({$check('archives')}) === 18");
$page->keys(':focus', 'Space')
->assertScript('! '.filterInput('archives').'.checked')
pressOnce($page)->keys(':focus', 'Space');
$page->assertScript('! '.filterInput('archives').'.checked')
->assertScript("Math.round({$check('archives')}) === 0");
});
@@ -116,8 +122,10 @@ it('binds filter chips to a Livewire array, and a server change reaches them aft
$page->assertScript("{$input('photos')}.checked && ! {$input('documents')}.checked");
$page->click('label:has-text("Documents")')
->assertSeeIn('#kinds', 'photos,documents');
// A filter chip toggles on every press: pressOnce(), tests/Pest.php.
pressOnce($page)->click('label:has-text("Documents")');
$page->assertSeeIn('#kinds', 'photos,documents');
$page->click('button:has-text("Only video")')
->assertSeeIn('#kinds', 'video')
@@ -129,14 +137,18 @@ it('binds filter chips to a Livewire array, and a server change reaches them aft
it('removes a Livewire input chip with its button and with Delete, focusing the chip after it', function () {
$page = chipProbe();
$page->click('button[aria-label="Remove js"]')
->assertSeeIn('#tags', 'php,css')
// The remove button vanishes once its chip is gone: pressOnce(), tests/Pest.php.
pressOnce($page)->click('button[aria-label="Remove js"]');
$page->assertSeeIn('#tags', 'php,css')
->assertScript("document.querySelector('button[aria-label=\"Remove js\"]') === null");
$page->script("document.querySelector('button[aria-label=\"Remove php\"]').focus()");
$page->keys(':focus', 'Delete')
->assertScript("document.querySelector('#tags').textContent === 'css'")
// Removes the focused chip, whose button then vanishes: pressOnce(), tests/Pest.php.
pressOnce($page)->keys(':focus', 'Delete');
$page->assertScript("document.querySelector('#tags').textContent === 'css'")
->assertScript("document.querySelector('button[aria-label=\"Remove php\"]') === null")
->assertScript("document.activeElement.getAttribute('aria-label') === 'Remove css'");
});
@@ -150,8 +162,10 @@ it('removes an Alpine input chip with Backspace, focusing the chip before it', f
$page->assertScript("{$remove('ben')} !== null");
$page->script("{$remove('ben')}.focus()");
$page->keys(':focus', 'Backspace')
->assertScript("{$remove('ben')} === null")
// Removes the focused chip, whose button then vanishes: pressOnce(), tests/Pest.php.
pressOnce($page)->keys(':focus', 'Backspace');
$page->assertScript("{$remove('ben')} === null")
->assertScript("{$remove('anna')} !== null && {$remove('chiara')} !== null")
->assertScript("document.activeElement.getAttribute('aria-label') === 'Remove anna@example.com'");
});
@@ -245,8 +259,10 @@ it('shows a scroll button only on the edge the row can still scroll towards, in
->assertScript("{$row}.scrollWidth > {$row}.clientWidth")
->assertScript("! ({$shown('start')}) && ({$shown('end')})");
$page->click('[data-md-chip-scroll="end"]')
->wait(0.8)
// A paging key a retry would page twice: pressOnce(), tests/Pest.php.
pressOnce($page)->click('[data-md-chip-scroll="end"]');
$page->wait(0.8)
->assertScript("Math.abs({$row}.scrollLeft) > 0")
->assertScript("({$shown('start')})");