diff --git a/src/components/ConfirmDialog.tsx b/src/components/ConfirmDialog.tsx index 48e1439..8bdc0b9 100644 --- a/src/components/ConfirmDialog.tsx +++ b/src/components/ConfirmDialog.tsx @@ -30,7 +30,7 @@ export function ConfirmDialog({ }; return ( - + {title}

{message}

diff --git a/tests/accessibility.spec.ts b/tests/accessibility.spec.ts index 7bd3ba0..ed9580f 100644 --- a/tests/accessibility.spec.ts +++ b/tests/accessibility.spec.ts @@ -39,14 +39,18 @@ test.describe('Accessibility smoke', () => { // Open the confirm dialog by clicking the row delete button await page.getByRole('button', { name: /^Delete sample\.pdf$/i }).first().click(); - // Title and dialog role visible + // Title and dialog semantics are present const heading = page.getByRole('heading', { name: 'Delete Document' }); await expect(heading).toBeVisible({ timeout: 10000 }); - const dialog = heading.locator('xpath=ancestor::*[@role="dialog"][1]'); - await expect(dialog).toBeVisible(); + const dialog = page.getByRole('dialog', { name: 'Delete Document' }).first(); + await expect(dialog).toHaveAttribute('aria-modal', 'true'); + + // The visible panel content is rendered and includes destructive action + const panel = page.getByTestId('confirm-dialog-panel').first(); + await expect(panel).toBeVisible(); // Has a destructive action (Delete) - await expect(dialog.getByRole('button', { name: 'Delete' })).toBeVisible(); + await expect(panel.getByRole('button', { name: /^Delete$/ })).toBeVisible(); // Close with Escape to avoid deleting test data await page.keyboard.press('Escape'); diff --git a/tests/helpers.ts b/tests/helpers.ts index 8c19785..a8d2182 100644 --- a/tests/helpers.ts +++ b/tests/helpers.ts @@ -497,37 +497,44 @@ export async function expectProcessingTransition(page: Page) { // Expect navigator.mediaSession.playbackState to equal given state export async function expectMediaState(page: Page, state: 'playing' | 'paused') { - // WebKit (and sometimes other engines) may not reliably update navigator.mediaSession.playbackState. - // Fallback heuristics: - // 1. Prefer mediaSession if it matches desired state. - // 2. Otherwise inspect any