Files
EventSnap/e2e/specs/09-mobile/sheet-escape.spec.ts
fabi a3c0082c4b test(e2e): update suite for shipped features + gate Chromium-only perms
The running test container had been built from an older tree; rebuilding it to
pick up current app code surfaced several tests that predated shipped
security/UX features:

- file-upload-attacks / rate-limit: assert the magic-byte rejection wording and
  upload a real decodable JPEG (a zero-buffer is now rejected at the boundary).
- ddos: open SSE via the single-use /stream/ticket flow, not the dead ?token=.
- recover-page / join: the PIN field auto-submits on the 4th digit, so don't
  race an explicit submit click against the ensuing navigation.
- gestures-doubletap / sheet-escape: target the lightbox by aria-labelledby and
  anchor the radio accessible-name match at the start (gated dialog semantics).

playwright.config: camera/mic/clipboard are Chromium-only permissions (they threw
"Unknown permission: camera" on firefox/webkit and failed the test at context
creation); grant them per-Chromium-project. firefox-android drops the
unsupported isMobile flag.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 22:12:05 +02:00

40 lines
1.6 KiB
TypeScript

/**
* Critical a11y fix — bottom sheets on /account (data-mode warning and
* leave-confirm) now respond to Escape via the focusTrap action. They were
* previously click-only, blocking keyboard / switch-control users.
*/
import { test, expect } from '../../fixtures/test';
test.describe('Mobile a11y — sheets dismiss on Escape', () => {
test('data-mode warning sheet closes on Escape', async ({ page, guest, signIn }) => {
const g = await guest('SheetEsc');
await signIn(page, g);
await page.goto('/account');
// Click the "Original" radio in the Datennutzung section to open the warning sheet.
// The radio's accessible name is its title + description ("Original Lädt die
// Originaldateien…"), so anchor on the start, not the end.
const originalRadio = page.getByRole('radio', { name: /^Original/i });
await originalRadio.click();
const sheet = page.locator('[role="dialog"][aria-labelledby="data-mode-title"]');
await expect(sheet).toBeVisible();
await page.keyboard.press('Escape');
await expect(sheet).not.toBeVisible({ timeout: 2_000 });
});
test('leave-confirm sheet (built on ConfirmSheet) closes on Escape', async ({ page, guest, signIn }) => {
const g = await guest('LeaveEsc');
await signIn(page, g);
await page.goto('/account');
await page.getByRole('button', { name: /Event verlassen/i }).click();
const sheet = page.getByTestId('confirm-sheet');
await expect(sheet).toBeVisible();
await page.keyboard.press('Escape');
await expect(sheet).not.toBeVisible({ timeout: 2_000 });
});
});