From 2206c8e09b7cdb9c25917e030e3b93fe5e4d7be9 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Mon, 14 Sep 2026 13:39:17 +0200 Subject: [PATCH] Point the containment browser tests at their own sheet and card Plan step 32. Phase E put a standard side sheet (containment.md, step 23) above the modal one on the showcase page, so the first `[data-sheet]` scrim the test pressed belonged to it; the test now presses the modal sheet's own scrim. The preset-heights bottom sheet's button made "Bottom sheet" match two buttons under Playwright's strict locators; it is matched by its exact label. The actionable card test chained an assertion on script(), which returns the script's value rather than the page. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- tests/Browser/ContainmentTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Browser/ContainmentTest.php b/tests/Browser/ContainmentTest.php index 4aaa6a31..19a134b4 100644 --- a/tests/Browser/ContainmentTest.php +++ b/tests/Browser/ContainmentTest.php @@ -183,7 +183,8 @@ it('slides a side sheet in, traps the page, and closes on the scrim', function ( ->assertScript("getComputedStyle({$sheet}).display !== 'none'") ->assertScript("document.querySelector('header').closest('[aria-hidden=\"true\"]') !== null"); - $page->script("document.querySelector('[data-sheet] > [aria-hidden=\"true\"]').click()"); + // This sheet's own scrim: the standard side sheet above it on the page is a `[data-sheet]` too. + $page->script("{$sheet}.parentElement.querySelector(':scope > [aria-hidden=\"true\"]').click()"); $page->assertScript("getComputedStyle({$sheet}).display === 'none'") ->assertScript("document.querySelector('header').closest('[aria-hidden=\"true\"]') === null"); @@ -193,7 +194,7 @@ it('dismisses a bottom sheet dragged down past a quarter of its height', functio $sheet = "document.querySelector('#containment section[role=\"dialog\"]')"; $page = containment() - ->click('#containment button:has-text("Bottom sheet")') + ->click('#containment button:has(> span:text-is("Bottom sheet"))') ->assertScript("getComputedStyle({$sheet}).display !== 'none'") ->wait(0.5); @@ -232,8 +233,9 @@ it('makes a directly actionable card the one tab stop, answering Enter', functio $page->script("window.__opened = 0; document.querySelector('{$card} [data-list-open]').addEventListener('click', (event) => { event.preventDefault(); window.__opened++ })"); - $page->script("document.querySelector('{$card}').focus()") - ->assertScript("document.activeElement.matches('{$card}')"); + $page->script("document.querySelector('{$card}').focus()"); + + $page->assertScript("document.activeElement.matches('{$card}')"); $page->keys($card, 'Enter') ->assertScript('window.__opened === 1');