diff --git a/tests/Browser/TimepickerTest.php b/tests/Browser/TimepickerTest.php index 2a752d11..85edb8d9 100644 --- a/tests/Browser/TimepickerTest.php +++ b/tests/Browser/TimepickerTest.php @@ -346,7 +346,13 @@ it('moves the period selector between AM and PM with arrow keys, as a radio grou ->click('#meeting') ->assertAttribute($am, 'role', 'radio') ->assertAttribute($am, 'aria-checked', 'true') - ->assertAttribute($pm, 'aria-checked', 'false'); + ->assertAttribute($pm, 'aria-checked', 'false') + // show() moves focus to the dial from inside Alpine's $nextTick, which Livewire's bundled + // Alpine defers with a real setTimeout(0) rather than a microtask: wait for the dialog to + // actually open before stealing focus onto the period selector, or .focus() below is a no-op + // on a still-closed and the element beneath it keeps focus instead. + ->wait(0.15) + ->assertScript("document.querySelector('#meeting-dialog').open"); $page->script("document.querySelector('{$am}').focus()");