diff --git a/tests/e2e/editor-baseline-1377.spec.ts b/tests/e2e/editor-baseline-1377.spec.ts index 984e6e51..7f2afed3 100644 --- a/tests/e2e/editor-baseline-1377.spec.ts +++ b/tests/e2e/editor-baseline-1377.spec.ts @@ -54,7 +54,10 @@ function tabHit(pane: Locator, file: string): Locator { } function tabFor(pane: Locator, file: string): Locator { - return pane.locator(EDITOR_SELECTORS.tab).filter({ hasText: file }); + // The dirty/active state lives on the outer `.ed-tab` span that wraps the file's `.ed-tab-hit`. + return pane.locator( + `${EDITOR_SELECTORS.tab}:has(${EDITOR_SELECTORS.tabHit}[data-tip="${file}"])`, + ); } function closeButton(pane: Locator, file: string): Locator { @@ -263,7 +266,8 @@ async function scenarioAccessibility(page: Page): Promise { await expect(workspace.locator(EDITOR_SELECTORS.tablist)).toHaveCount(1); await expect(pane.getByRole("tab", { name: APP_FILE })).toBeVisible(); - // Alt+Arrow switches the active tab from the keyboard while focus stays within the tablist. + // Alt+ArrowRight reorders the active tab within the tablist via the keyboard; focus stays on a + // tab so a keyboard user does not lose their place. const appTab = tabHit(pane, APP_FILE); await appTab.focus(); await appTab.press("Alt+ArrowRight"); @@ -293,6 +297,8 @@ async function scenarioAccessibility(page: Page): Promise { await closeButton(pane, APP_FILE).click(); const dialog = workspace.locator(EDITOR_SELECTORS.dirtyDialog); await expect(dialog).toBeVisible(); + // The modal labels itself via its heading, takes focus on open, and Escape dismisses it. + await expect(dialog).toHaveAttribute("aria-labelledby", EDITOR_SELECTORS.dirtyDialogTitleId); await expect(dialog).toBeFocused(); await page.keyboard.press("Escape"); await expect(dialog).toBeHidden(); diff --git a/tests/e2e/support/editorWorkspace.ts b/tests/e2e/support/editorWorkspace.ts index b0358406..bb0e7d74 100644 --- a/tests/e2e/support/editorWorkspace.ts +++ b/tests/e2e/support/editorWorkspace.ts @@ -23,7 +23,9 @@ export const EDITOR_SELECTORS = { sidebarRestore: ".ed-sidebar-restore[aria-label='Show project tree']", treeRow: "button.tr-row", tablist: ".ed-tablist[role='tablist'][aria-label='Open documents']", - tab: ".ed-tab[role='tab']", + // The outer tab element carries the `active`/`data-dirty` state; `role='tab'` and the + // `data-tip`/`aria-selected` affordances live on the inner `.ed-tab-hit` button it wraps. + tab: ".ed-tab", tabHit: ".ed-tab-hit", tabLabel: ".ed-tab-label", tabClose: ".ed-tab-close",