Skip to content

Testing and CI

github-actions[bot] edited this page Nov 27, 2026 · 6 revisions

Testing and CI

How Omnisnap is tested, what each test level needs, and what every workflow in .github/workflows does.

Test levels

Level Run with Needs What it covers
Unit go test ./... nothing every package, on fixtures: fake sessions, recorded driver transcripts, golden captures, schema examples, a fake Firefox for install
Golden parity part of go test ./... nothing the Go port reproduces the spike's results on testdata/golden/planted: alignment (layoutdiff), triage (triage), ink, model and feature parity
Ground-truth gates go test -tags e2e ./test/e2e/... -run Planted nothing (golden captures) TestPlantedGates: planted recall, control pages, KB fixtures, budgets (Ground truth and the model). The same -run also captures with the runner's Chrome and Firefox: the planted audit and appearance pages, and TestPlantedSelectors, which pastes every cause's selector into the live baseline page and checks it selects the element with the cause's box (Layout diff, "Selectors")
Wiki go test ./test/internals/ (part of go test ./...) nothing the pages in docs/internals/ against the repository (below)
Browsers go test -tags browsers ./internal/... installed browsers discovery on the real machine, launch and cleanup cycles, driver conformance, viewport, the viewer in Chrome, branded warming
End to end go test -tags e2e ./test/e2e/... browsers geometry parity of live captures, the audit and appearance planted pages; with Chrome, Firefox and WebKitGTK installed, TestProgressStreamWithinTheCap checks that a job within --max-browsers emits the progress stream recorded before the cap (testdata/progress)
Network go test -tags network ./internal/install/... the internet installing Mozilla's real Firefox ESR

Build tags: browsers (needs installed browsers), e2e (end to end), network (downloads), plus the OS tags for per-platform code. Environment switches used by tests: OMNISNAP_EXPECT_BROWSERS and OMNISNAP_EXPECT_ENGINES (CI lists what the runner image has, so a missing browser fails instead of skipping), OMNISNAP_COST=1 (lane timing), OMNISNAP_NO_SANDBOX=1 (restricted hosts), OMNISNAP_WEBKIT=wpe|gtk, and WEBKIT_HEADLESS=0 (show WebKitGTK windows).

Lint: .golangci.yml. The in-page scripts are pinned by SHA256SUMS and checked by inject_test.go.

Workflows

Workflow Trigger Jobs and what they check
ci.yml push to main, every pull request test (Linux, Windows, macOS): build, omnisnap version, go test ./..., the planted fixtures match the spike (export-planted.mjs --check), lint. planted-gates: the e2e gates. conformance (three OSes): discovery with the runner's browsers, driver conformance, the viewer in Chrome, process cleanup (including TerminateProcess on Windows), the Linux out-of-memory score on real browsers (it fails under CI when a browser is missing), the Windows install fixture and each extractor alone (verbose), branded. packages (three OSes): the npm and PyPI wrappers' tests, then the packages as published in a fresh project and venv, run() on the planted suite, and the planted gates on its summary.
walkthrough.yml push to main, pull requests, manual the README walkthrough on every OS
e2e-action.yml manual (optional tag), and called by every release run (release.yml, job e2e-action) the composite action, built and checked out at the tag (or the ref the run started from), on the planted suite on three OSes; Windows injects a failure; the merged comment must name the planted finding; a capture its browser left unpainted fails it (B17). Artifacts selftest-action-<os> and selftest-action-merged, so they never mix with the website demo's in a release run (GitHub Action)
e2e-report.yml manual (optional tag), pull requests touching report.yml or action/, and called by every release run (release.yml, job e2e-report, after the release's assets are up) calls report.yml the way a consumer does, then asserts on the result. The binary is the given tag's (a release without SHA256SUMS fails in pick), otherwise the newest release with SHA256SUMS. It passes artifact-prefix: selftest-report, so its artifacts are selftest-report-*; a capture its browser left unpainted fails it (B17)
install.yml weekly (Mondays 04:17 UTC), manual, and pull requests that touch internal/install/, internal/discovery/ or the workflow the network install test on Linux and Windows: Mozilla's real ESR installed, discovered, launched and removed, with its unpacked size logged (Install)
safari-smoke.yml manual only does Safari run unattended on a hosted macOS runner (hosted macOS is billed at about 10×)
release.yml a pushed v* tag, manual the unit tests, the five binaries (refused if the packages were not bumped), the GitHub release, a check that the assets download, then npm and PyPI by trusted publishing and the website deploy (Release process)
deploy.yml called by release.yml after the assets are verified; manual (optional tag, else the newest release) captures the demo through report.yml, builds the website from the tag and deploys the Worker to omnisnap.org
wiki.yml push to main touching docs/internals/, scripts/publish-wiki.sh or itself; manual publishes this wiki (below)
report.yml workflow_call the reusable workflow consumers call; not a test
report-comment.yml workflow_call the fork-safe comment; not a test

The wiki's own check

This wiki's pages are in docs/internals/. test/internals/internals_test.go checks them on every go test ./..., so CI's test job runs it on all three OSes:

Test Fails when
TestEveryPageListsItsSourceFiles a page other than Home, Glossary, _Sidebar and _Footer has no final ## Source files section, or the section lists something other than repository links
TestEveryRepositoryLinkExistsOnMain a code link names a path that does not exist, points at a ref other than main, carries a line anchor (#L…), or uses blob/ for a directory or tree/ for a file
TestEverySourceFileIsNamed a non-test Go file under cmd/, internal/, tools/ or assets/ is named in no page's "Source files", or a top-level item of .github/workflows/, action/, packages/, schema/, scripts/, test/ or tools/ has nothing under it named
TestWikiLinksResolve a link between pages, or to a heading on one, does not resolve (GitHub's anchor rule, with -1, -2 on repeated headings)
TestSidebarLinksEveryPage a page is missing from _Sidebar.md

Each test lists every offending page and item at once. Links inside code (fenced or inline) are not checked. The test cannot tell whether a page still says what the code does; the rule in CONTRIBUTING.md covers that.

Publishing: wiki.yml runs on every push to main that changes the pages, the script or itself, and by hand. It clones Omnisnap.wiki.git with the workflow's token (contents: write), runs scripts/publish-wiki.sh, and pushes. The script removes every file in the clone, copies docs/internals/*.md in, and commits "Publish docs/internals from " only when something changed, so the wiki holds exactly the pages of that commit. A newer run cancels an older one. If the clone fails, the wiki has no first page yet: create one in the Wiki tab, then run the workflow again.

Fixtures

Directory Holds
testdata/golden the spike's captures and findings for the planted suite (README: Chrome 155, Firefox 153.6 ESR, WebKitGTK 2.50.4, Linux, 1280×800). Real-site goldens are local only.
testdata/planted the planted pages and expectations.json
testdata/drivers/transcripts recorded CDP, BiDi and Classic sessions
testdata/discovery reg query dumps and Info.plist files
testdata/schema valid and invalid examples per schema
testdata/install a fake Firefox, signed sums, the test key
testdata/model/parity.json 30 rows scored by LightGBM, for the Go evaluator
testdata/viewer summaries for the viewer, single and merged
testdata/branded/trackers.html a page with tracker requests, for the branded checks

Source files

Clone this wiki locally