Skip to content

ci(site): run the explorer's browser tests - #35

Merged
Mearman merged 6 commits into
mainfrom
feat/site-browser-ci
Oct 29, 2026
Merged

Mearman merged 6 commits into
mainfrom
feat/site-browser-ci

Conversation

@Mearman

@Mearman Mearman commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #29.

The explorer's browser checks are now Playwright tests in e2e/ and run in CI as one job, Browser. The suite is the three scripts from the build sessions turned into TypeScript under the repo's lint rules with real assertions: operations and cancelling a count that never finishes, the form and the JSON view as one model, every kind of node in trilean's schema, share links, gists, saved models, import and export, the operation descriptions, keyboard-only editing, phone width and both colour schemes. The harness builds the site and runs vite preview itself on a fixed port with --strictPort. Retries are off. pnpm test excludes e2e/ and stays browserless; pnpm typecheck and ESLint cover the new project. I broke the site five ways (Cancel, rename, a help sentence, the link's index, the retained model) and each failed only the tests that should.

The precedent is agent-comms, whose E2E job resolves the Playwright version, caches ~/.cache/ms-playwright on playwright-<os>-<version> and installs the browser on a miss. graphle, process-graph, talktrack and wire-mesh install Chromium on every run, uncached. I followed agent-comms and added the architecture to the key.

The job decides for itself whether anything it depends on changed (site/, src/, e2e/, the Playwright config, package.json, the lockfile) by diffing against the PR's base or the commit a push replaces. A workflow-level path filter would leave Required Checks missing on a PR that touches none of those, so instead the job always runs and passes at once when nothing relevant changed. Required Checks depends on it. The release job does not: the package is unaffected by a site regression. A base that cannot be fetched runs the tests.

Cost, in work: one job added (eleven steps; two run when nothing relevant changed, the rest are skipped). Downloads on a cache miss, for Linux x64: 125,797,539 bytes for Chromium's headless shell and 2,302,701 for ffmpeg, 128,100,240 in all (arm64: 127,748,574). --only-shell avoids the 200,345,244-byte full Chromium. On a hit nothing comes from Playwright's CDN. Before that, pnpm install adds @playwright/test, playwright and playwright-core, 18,718,670 bytes unpacked. A run is one site build and one server, 53 tests, no retries.

The job ran on the self-hosted fleet (linux/arm64). The operating system libraries were installed with playwright install-deps through the runner's passwordless sudo, which the step uses when it can and otherwise skips with a message. The first run caught a real defect, fixed in the last commit: vite preview listened on localhost, which resolved to the IPv6 loopback only, so the tests could not reach it; the server now listens on 127.0.0.1. A rerun of the job restored the browser from the cache and skipped the install step.

The path decision for a pull request that touches none of the paths is not exercised by this one, which touches all of them; I ran its pattern over a list of file names and only site/, src/, e2e/, the Playwright config, package.json and the lockfile select the tests.

Every commit is scoped site, which unreleasedScopes keeps off npm, and the existing release-rules test already covers every commit type in that scope, so it needed no extension.

@Mearman
Mearman marked this pull request as ready for review October 29, 2026 20:40
@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

…plorer

A dev dependency only, at an exact version, and not part of the published package. The browser
itself is not an npm dependency: Playwright downloads it on request, which CI does through a
cache keyed on this version.
The checks that were run by hand against the built site are now Playwright tests in e2e/, in
TypeScript under the repository's lint rules, with assertions in place of logging. The harness
builds the site and serves it with vite preview itself and stops it afterwards, on a fixed port
that fails if something already holds it. Retries are off, since a test that passes only on a
retry is a flake to fix.

The tests cover the operations and cancelling a count that never finishes, the form and the
JSON view as one model, every kind of node the schema defines, share links, gists, saved
models, import and export, the operation descriptions, keyboard-only editing, phone width and
the colour schemes. The unit run excludes e2e/, so `pnpm test` stays browserless, and
`pnpm typecheck` covers the new project.
The job decides for itself whether the site, the library source, the tests or the dependencies
changed, by diffing against the pull request's base or the commit a push replaces, and runs
the rest of its steps only when they did. A workflow-level path filter would leave a required
check missing on a pull request that touches none of those paths; this job reports passing at
once instead, so Required Checks can depend on it. A base that cannot be fetched runs the tests.

The browser binary is cached on Playwright's version, platform and architecture, only the
headless shell is installed, and the operating system libraries are installed when the runner
allows it. Traces of a failed run are kept for a week.
…t be set

On the self-hosted runner the preview server ran and the tests could not reach it: the server
listened on `localhost`, which resolved to the IPv6 loopback alone, while the tests ask for the
IPv4 one. The server now listens on 127.0.0.1, the address the tests use.

The port can be set with E2E_PORT for a machine where another process already holds the default,
and a port something holds still fails the run, since the server is started with --strictPort.
@Mearman
Mearman force-pushed the feat/site-browser-ci branch from 28db795 to 798ae87 Compare October 29, 2026 20:50
@Mearman

Mearman commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-10-29T20:51:33.989016Z
We couldn’t complete this review. Comment @codex security review to try again.
798ae87 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman enabled auto-merge (rebase) October 29, 2026 20:52
@Mearman
Mearman merged commit db3c5ad into main Oct 29, 2026
11 checks passed
@Mearman
Mearman deleted the feat/site-browser-ci branch October 29, 2026 20:59
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run the explorer's browser checks in CI

1 participant