Compare commits

...
2 Commits
Author SHA1 Message Date
openhands fb470123c3 test(ui): stabilize cross-browser suite
CI / check (push) Successful in 30s
CI / tests-integration (push) Successful in 1m58s
CI / tests-imaging-browsers (push) Successful in 2m2s
CI / tests-unit (push) Successful in 2m9s
CI / tests-quality (push) Successful in 1m2s
CI / tests-ui (push) Successful in 4m50s
CI / preflight (push) Skipped
CI / deploy (push) Failing after 1m42s
- Run visual snapshots on Chromium only; Firefox/WebKit rendering does
  not match Chromium pixel output. Functional and accessibility
  assertions still run on all four projects (baselines were renamed to
  the new project names in the previous commit).
- Poll axe audits until clean: WebKit can report stale color-contrast
  violations for a moment after interactions while styles settle.
- Poll the Tab-focus assertion: Firefox can swallow a Tab while the
  sandboxed srcdoc preview frame is still loading.
- Fix the recovery clock race: install the fake clock before navigation
  at a fixed time and pause at a fixed target instead of wall-clock
  values, which under load could already be in the fake clock's past
  ('Cannot fast-forward to the past').
2026-10-17 17:14:13 +02:00
openhands 1dd584cd82 fix(ui): make fixture bundle browser-safe, fast and cacheable
The UI fixture bundle crashed at runtime, so every test waited out its
45s timeout:
- server-only modules leaked into the bundle and referenced node
  built-ins, the process global, and validated env at import time
- the previous platform: 'node' fix kept esbuild happy but emitted
  require() calls that cannot run in the browser

Fix it at the bundle boundary:
- alias node:* imports to e2e/ui/node-stubs.mjs (shape-compatible stubs,
  no real I/O)
- inject e2e/ui/process-shim.mjs for the process global
- define process.env.SKIP_ENV_VALIDATION=1 so src/env.ts skips parsing
  in the fixture (same escape hatch vitest uses)

Also make the fixture server fast to start:
- build JS and Tailwind CSS in parallel
- cache built assets in node_modules/.cache/nexst-ui-fixture keyed on a
  content hash of src/, fixtures, stubs and the server file
- startup drops from ~1.7s to ~220ms on cache hits
2026-10-17 17:13:59 +02:00
29 changed files with 419 additions and 99 deletions

No files matched your search

+7 -2
View File
@@ -116,9 +116,14 @@ test("saving while recovery is pending enables recovery for subsequent edits", a
test("unmount flush retains an edit before the autosave interval", async ({
page,
}) => {
// Install the fake clock before navigation so every page timer is faked,
// then jump forward to a fixed pause point. Using wall-clock `new Date()`
// for both calls raced under load: the fake clock ticks in real time
// between the calls and can pass the target ("Cannot fast-forward to the
// past"). The 60s jump only fires no-op persists on a clean form.
await page.clock.install({ time: new Date("2030-01-01T12:00:00Z") });
await page.goto("/admin/articles/recovery");
await page.clock.install();
await page.clock.pauseAt(new Date());
await page.clock.pauseAt(new Date("2030-01-01T12:01:00Z"));
await page.locator('input[name="title"]').fill("Immediate final edit");
await page
.getByRole("button", { name: "Close editor fixture", exact: true })
+147 -56
View File
File diff suppressed because it is too large. Load diff
+162 -11
View File
File diff suppressed because it is too large. Load diff
+25
View File
@@ -0,0 +1,25 @@
// Minimal `process` shim injected into the UI fixture bundle. Server-only
// modules that leak into the bundle reference the `process` global at module
// scope (release ids, paths, etc). esbuild's `inject` rewrites those free
// identifier references to import from this file so evaluation cannot crash
// in the browser.
export const process = {
env: { NODE_ENV: "production" },
platform: "linux",
arch: "x64",
version: "v20.0.0",
versions: { node: "20.0.0" },
argv: [],
cwd: () => "/",
nextTick: (fn, ...args) => setTimeout(() => fn(...args), 0),
on: () => {},
once: () => {},
emit: () => {},
exit: () => {},
hrtime: Object.assign(() => [0, 0], { bigint: () => 0n }),
memoryUsage: () => ({ heapUsed: 0, rss: 0 }),
pid: 0,
};
export default process;
File diff suppressed because it is too large. Load diff