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>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import type { Page, Locator } from '@playwright/test';
|
|
|
|
export class RecoverPage {
|
|
readonly page: Page;
|
|
readonly nameInput: Locator;
|
|
readonly pinInput: Locator;
|
|
readonly submitButton: Locator;
|
|
readonly errorMessage: Locator;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
this.nameInput = page.getByTestId('recover-name-input');
|
|
this.pinInput = page.getByTestId('recover-pin-input');
|
|
this.submitButton = page.getByTestId('recover-submit');
|
|
this.errorMessage = page.getByTestId('recover-error');
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/recover');
|
|
}
|
|
|
|
async recover(name: string, pin: string) {
|
|
await this.nameInput.fill(name);
|
|
// Filling the 4th digit fires the form's auto-submit ($effect on
|
|
// pin.length === 4, see pin-auto-submit.spec). An explicit submit click would
|
|
// race the ensuing navigation and detach mid-click, so only click as a
|
|
// fallback if the button is still around (e.g. a partial / failed PIN).
|
|
await this.pinInput.fill(pin);
|
|
if (await this.submitButton.isEnabled().catch(() => false)) {
|
|
await this.submitButton.click().catch(() => {
|
|
/* auto-submit already navigated — nothing to click */
|
|
});
|
|
}
|
|
}
|
|
}
|