- 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
33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
// 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('.', '\\.')));
|
|
});
|