Compare commits

...

5 Commits

Author SHA1 Message Date
logaritmisk 64f35e5a57 merge: fix CI — Node 22, Playwright install, deterministic pending-state tests, testTimeout (#25)
CI / web (push) Successful in 7m32s
2026-06-09 11:57:32 +02:00
logaritmisk 3aff10557c ci: make the logout pending-state test deterministic (gate, not delay)
CI / web (push) Successful in 4m35s
Same timing-window race as object-new-page: the 50ms delay let the logout
resolve (menu unmounts on me=null) before findByText caught 'Signing out…'
on the slow CI runner. Hold the logout open with a promise released only
after the pending state is asserted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:51:35 +02:00
logaritmisk e8fe24f755 ci: raise vitest testTimeout to 20s for the resource-constrained runner
CI / web (push) Failing after 3m50s
The 'narrow: detail renders inside a portaled drawer' test lazy-loads the
drawer chunk and exceeded the 5s default on the slow CI container (setup
alone took ~486s). Bump testTimeout on both vitest projects.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:44:30 +02:00
logaritmisk fc170ccf10 ci: install Playwright chromium for the storybook vitest project; deterministic in-flight test
CI / web (push) Failing after 4m5s
- CI runs the @vitest/browser-playwright (storybook) project, which needs the
  chromium browser downloaded — add 'playwright install --with-deps chromium'.
- object-new-page in-flight test held the create mutation open with a 50ms
  delay and raced the pending-state assertion (failed under CI timing); gate it
  on a promise released only after asserting 'saving…', so it's deterministic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:37:20 +02:00
logaritmisk 3ae9d87e6e ci: bump Node 20 → 22 so pnpm 11 (needs Node ≥22.13) runs
CI / web (push) Failing after 2m25s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:29:58 +02:00
4 changed files with 28 additions and 6 deletions
+2 -1
View File
@@ -20,12 +20,13 @@ jobs:
version: 11
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm exec playwright install --with-deps chromium
- run: pnpm test
- run: pnpm build
- run: pnpm check:size
+11 -3
View File
@@ -1,7 +1,7 @@
import { expect, test } from "vitest";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { delay, http, HttpResponse } from "msw";
import { http, HttpResponse } from "msw";
import { Routes, Route } from "react-router-dom";
import { server } from "../test/server";
import { renderApp } from "../test/render";
@@ -72,11 +72,15 @@ test("partial create: fields PUT fails -> edit page shows the 'created' banner a
test("in-flight submit: button disabled + shows Saving…, create fires exactly once on double-click", async () => {
let postCount = 0;
let release!: () => void;
const gate = new Promise<void>((resolve) => {
release = resolve;
});
server.use(
http.post("/api/admin/objects", async () => {
postCount += 1;
await delay(50);
await gate;
return HttpResponse.json({ id: "new-id-3" }, { status: 201 });
}),
);
@@ -91,9 +95,13 @@ test("in-flight submit: button disabled + shows Saving…, create fires exactly
await userEvent.click(button);
await userEvent.click(button);
await waitFor(() => expect(screen.getByText(/saving…/i)).toBeInTheDocument());
// The mutation is held open by `gate`, so the pending state is observed
// deterministically (no reliance on a timing window).
expect(await screen.findByText(/saving…/i)).toBeInTheDocument();
expect(screen.getByRole("button", { name: /saving…/i })).toBeDisabled();
release();
await waitFor(() => expect(screen.getByText("detail view")).toBeInTheDocument());
expect(postCount).toBe(1);
});
+11 -2
View File
@@ -1,7 +1,7 @@
import { expect, test } from "vitest";
import { screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { delay, http, HttpResponse } from "msw";
import { http, HttpResponse } from "msw";
import { server } from "../test/server";
import { renderApp } from "../test/render";
import { UserMenu } from "./user-menu";
@@ -35,9 +35,13 @@ test("opens the menu showing email + role and signs out", async () => {
});
test("shows a pending state on Sign out while logging out", async () => {
let release!: () => void;
const gate = new Promise<void>((resolve) => {
release = resolve;
});
server.use(
http.post("/api/admin/logout", async () => {
await delay(50);
await gate;
return new HttpResponse(null, { status: 204 });
}),
);
@@ -50,5 +54,10 @@ test("shows a pending state on Sign out while logging out", async () => {
const menu = within(document.body);
await userEvent.click(await menu.findByText("Sign out"));
// The logout is held open by `gate`, so the pending state is observed
// deterministically (no reliance on a timing window).
expect(await menu.findByText(/signing out/i)).toBeInTheDocument();
release();
await waitFor(() => expect(menu.queryByText(/signing out/i)).toBeNull());
});
+4
View File
@@ -28,6 +28,9 @@ export default defineConfig({
extends: true,
test: {
environment: "jsdom",
// The CI runner is heavily resource-constrained; lazy-loaded chunks
// (e.g. the object-detail drawer) can exceed the 5s default.
testTimeout: 20000,
globals: true,
setupFiles: ["./src/test/setup.ts"],
environmentOptions: {
@@ -46,6 +49,7 @@ export default defineConfig({
})],
test: {
name: 'storybook',
testTimeout: 20000,
browser: {
enabled: true,
headless: true,