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:
1 parent
a7ba01fc77
commit
57a005c19f
48 files changed
+6239
-6
No files matched your search
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright (C) 2026 Bryan Joshua Pedini
|
||||
|
||||
import { createHash } from 'node:crypto';
|
||||
import { expect, type World } from './fixtures';
|
||||
import { zp, type ApiClient } from './api';
|
||||
import { waitForZone } from './dig';
|
||||
import { servedZone } from './verify';
|
||||
import type { Ui } from './ui';
|
||||
|
||||
export function zoneInput(zone: string) {
|
||||
return { name: zone, ns: 'ns.example.net.', mbox: 'hostmaster.example.net.', extra_ns: [], ttl: 300, refresh: 3600, retry: 600, expire: 604800, minttl: 300 };
|
||||
}
|
||||
|
||||
export async function createZone(client: ApiClient, zone: string): Promise<string> {
|
||||
const response = await client.post('/zones', zoneInput(zone));
|
||||
expect(response.status, response.text).toBe(201);
|
||||
return zp(zone);
|
||||
}
|
||||
|
||||
export async function checkZone(world: World, client: ApiClient, zone: string): Promise<void> {
|
||||
const response = await client.get(`${zp(zone)}/check`);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.json.problems.filter((p: { severity: string }) => p.severity === 'error')).toEqual([]);
|
||||
await waitForZone(world.g, zone, { recorder: world.recorder });
|
||||
await servedZone(world, zone);
|
||||
}
|
||||
|
||||
export function address(name: string, ip: string, ttl = 300) {
|
||||
return { name, type: 'A' as const, ttl, data: { ip } };
|
||||
}
|
||||
|
||||
export async function addAddress(client: ApiClient, zonePath: string, name: string, ip: string) {
|
||||
const response = await client.post(`${zonePath}/records`, address(name, ip));
|
||||
expect(response.status, response.text).toBe(201);
|
||||
return response.json.record;
|
||||
}
|
||||
|
||||
export async function restartWithSessions(world: World, ...browsers: Ui[]): Promise<void> {
|
||||
const cookies = await Promise.all(browsers.map((browser) => browser.cookie()));
|
||||
await world.restart();
|
||||
for (let i = 0; i < browsers.length; i++) {
|
||||
const cookie = cookies[i];
|
||||
expect(Boolean(cookie && cookie === await browsers[i].cookie()), 'browser cookie survives app restart').toBe(true);
|
||||
const hash = createHash('sha256').update(cookie!).digest();
|
||||
expect(await world.db.sessionExists(hash), 'the stored SHA-256 session survives app restart').toBe(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user