test(e2e): add playwright harness and test stack

- test(e2e): add playwright harness and test stack
- test(e2e): add core flow
- fix(ui): preserve same-origin browser form submissions
- fix(ui): offer reload inside stale edit dialogs
- test(e2e): add persona session and accessibility suites
- test(e2e): preserve per-run artifacts and clean pulled images
- test(e2e): verify import and audit state across navigation
- test(e2e): tighten verification helpers and persona checks
- test(e2e): bound response body reads of the browser observer
- test: recover review compatibility assertions
- test: stabilize audit and user flow assertions
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent a7ba01fc77
commit 57a005c19f
48 files changed
+6239 -6

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (C) 2026 Bryan Joshua Pedini
import { test, expect } from '../harness/fixtures';
import { createZone } from '../harness/personas';
test.use({ group: 'session' });
test('an idle session expires with an open record form', async ({ world }) => {
test.setTimeout(world.g.idleTimeoutMs + 90_000);
const account = await world.bootstrapAdmin();
const client = await world.apiAs(account);
const user = await world.uiAs(account);
const zone = world.zoneName();
const zonePath = await createZone(client, zone);
await user.openZone(zone);
await user.page.click('#record-add');
await user.page.selectOption('#rec-type', 'A');
await user.page.fill('#rec-name', 'pending');
await user.page.fill('#rec-f-ip', '192.0.2.30');
await world.ledger.settle();
const auditMark = await world.db.auditMaxId();
await new Promise((resolve) => setTimeout(resolve, world.g.idleTimeoutMs + 1000));
const refused = user.page.waitForResponse((res) => res.url().endsWith(`/api/v1${zonePath}/records`) && res.request().method() === 'POST');
await user.page.click('#rec-submit');
expect((await refused).status()).toBe(401);
await expect(user.page).toHaveURL(/\/login\?next=/);
expect(await world.db.auditSince(auditMark)).toEqual([]);
expect((await world.db.records(zone)).map((row) => row.record_type).sort()).toEqual(['NS', 'SOA']);
await user.login(account.username, account.password);
await expect(user.page).toHaveURL(new RegExp(zonePath.replaceAll('.', '\\.')));
});