have it prepare itself

This commit is contained in:
KingKDot
2026-07-15 12:21:57 -05:00
parent 8ad81efdc3
commit 9954d813c2
2 changed files with 20 additions and 14 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "bun run scripts/run-tests-isolated.ts", "test": "bun run scripts/run-tests-isolated.ts",
"test:e2e": "playwright test", "test:e2e": "bun run test:e2e:prepare && playwright test",
"test:e2e:prepare": "bun run build:css && bun run vendor",
"test:e2e:install": "playwright install chromium", "test:e2e:install": "playwright install chromium",
"dev": "bun --watch src/index.ts", "dev": "bun --watch src/index.ts",
"start": "bun run build && bun dist/index.js", "start": "bun run build && bun dist/index.js",
+18 -13
View File
@@ -79,11 +79,7 @@ test.describe("authentication and authorization", () => {
}); });
test("admin page sweep loads without browser errors", async ({ page }) => { test("admin page sweep loads without browser errors", async ({ page }) => {
// This test validates each page's static/HTTP initialization. Opening two test.setTimeout(60_000);
// long-lived sockets for every rapid hard navigation would only exercise the
// server's WebSocket rate limiter; socket lifecycle is covered separately.
await page.routeWebSocket(/.*/, (socket) => socket.close());
const issues = collectBrowserIssues(page);
await login(page); await login(page);
const routes = [ const routes = [
@@ -104,13 +100,22 @@ test("admin page sweep loads without browser errors", async ({ page }) => {
["/purgatory", "#enrollment-table"], ["/purgatory", "#enrollment-table"],
] as const; ] as const;
for (const [path, selector] of routes) { const context = page.context();
const response = await page.goto(path); await page.close();
expect(response?.status(), `${path} should return 200`).toBe(200);
await expect(page.locator("#top-nav"), `${path} should mount navigation`).toBeVisible();
await expect(page.locator(selector).first(), `${path} should render ${selector}`).toBeVisible();
await page.waitForTimeout(250);
}
expect(issues).toEqual([]); for (const [path, selector] of routes) {
const routePage = await context.newPage();
// This sweep validates static/HTTP initialization. Opening two long-lived
// sockets per page would only exercise the server's WebSocket rate limiter;
// socket lifecycle is covered by the Turbo navigation test.
await routePage.routeWebSocket(/.*/, (socket) => socket.close());
const issues = collectBrowserIssues(routePage);
const response = await routePage.goto(path);
expect(response?.status(), `${path} should return 200`).toBe(200);
await expect(routePage.locator("#top-nav"), `${path} should mount navigation`).toBeVisible();
await expect(routePage.locator(selector).first(), `${path} should render ${selector}`).toBeVisible();
await routePage.waitForTimeout(250);
expect(issues, `${path} should not log browser errors`).toEqual([]);
await routePage.close();
}
}); });