Add automated testing infrastructure (Vitest + Playwright E2E) #110

Merged
litruv merged 12 commits from issue-109-automated-testing into main 2026-11-03 13:51:15 +11:00
12 Commits
Author SHA1 Message Date
litruv 87ba01fde9 Move the crash assertion ahead of the locator and name the crash path in the artifact. (#109)
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Successful in 2m57s
- The `crash` assertion now runs before the form check, because on a crashed page the locator throws TargetClosedError and names the wrong thing.
- The `crash` handler logs the crash, so the failure artifact is not empty on that path.
- The DevTools window loop records the window URLs, so a hang there names which windows existed instead of reporting a bare timeout.
- Comment states that a launch failure produces an empty console artifact by construction, so the report's failure message is the diagnosis there.

Checks: `node --check` on the file, `npm run test:unit` — 2 passed. E2E cannot be run locally (no `E2E_PASSWORD` in this session); CI is the check.
2026-11-03 13:42:15 +11:00
litruv 1ddca42473 Apply the #109 re-review: crash assertion, artifact hook on launch failure, dropped redundant lines. (#109)
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Successful in 4m10s
tests/e2e/login.spec.mjs: assert the render process is alive with the `crash`
event instead of counting pageerrors; the failed-login test now accepts the
rate-limited message as well as the wrong-password one; the failure hook
attaches the console before the app guard so a launch failure still produces an
artifact, wraps `screenshot()` because it throws on a crashed page, and reaches
`fs.rmSync` on launch failure; dropped the duplicate login-form assertion.

playwright.config.mjs: pin `trace: 'off'` explicitly rather than relying on the
version default, since a trace captures the login POST body.

.gitea/workflows/tests.yml: dropped `--prefer-offline`; corrected the xvfb
comment (the guard is live for the host runner, which already has xvfb); dropped
an unresolvable CI run-number citation.

Checks: `node --check` on both JS files, `npm run test:unit` — 2 passed. E2E
cannot be run locally (no `E2E_PASSWORD` in this session); CI is the check.
2026-11-03 13:22:39 +11:00
litruv 347acd0ebd Drop the pageerror assertion: the failed login path produces one. (#109)
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Successful in 3m53s
2026-11-03 13:01:29 +11:00
litruv d12ce65ac5 Revert the chromium-only install-deps: Electron needs the full dep set. (#109)
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 3m6s
2026-11-03 12:56:03 +11:00
litruv 879a7155eb Apply the #109 re-review: fork guard on the unit job, gated reachability check, renderer liveness assertion.
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 1m50s
act_runner mounts /var/run/docker.sock into every container job, so the fork guard
has to cover the unit job too. The e2e comment now states the blast radius of the
host DOCKER-USER exception instead of the removed container.options. Playwright deps
are narrowed to chromium, which is what Electron uses, and the homeserver reachability
curl gates with -f so a non-2xx fails the job.

The login test claimed "without crashing the app" but asserted only that the body had
text, which is true for an error page. It now asserts no uncaught renderer pageerror,
and toHaveValue after the homeserver commit proves fill() actually stuck.
2026-11-03 12:51:11 +11:00
litruv 73990d092c Drop the host-network container option: act_runner ignores --network. (#109)
Tests / unit (pull_request) Successful in 18s
Tests / e2e (pull_request) Successful in 2m56s
Run 928 logged "--network and --net in the options will be ignored", so
NetworkMode stayed the per-job bridge. The fix is a DOCKER-USER exception on
the runner host (pizzabox), which accepts RELATED/ESTABLISHED traffic from
br-f192811a98b7; verified 200 from a bridge container after adding it.
2026-11-03 12:25:13 +11:00
litruv e58b87ed3a Run the E2E job with host networking so the homeserver replies reach it. (#109)
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 2m41s
The homeserver ruv.wtf (192.168.10.4) is a macvlan interface on the caddy-caddy-1 container on the runner host pizzabox. Replies to a bridge-networked job arrive on br-f192811a98b7 and DOCKER-ISOLATION-STAGE-2 drops them, so the login E2E times out. Host networking keeps request and reply on one path.
2026-11-03 12:16:17 +11:00
litruv f4fb8d2d28 Fail fast when the runner cannot reach the homeserver.
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 2m41s
The login form only renders after the auth-flows request succeeds. On the runner the form never appeared within the expect timeout, so the login request to ruv.wtf (192.168.10.4) is not reachable from the runner network. The check turns a 30s locator timeout into a clear message.
2026-11-03 11:29:07 +11:00
litruv 4eff64b251 Install Electron's system libraries and use the v3 artifact protocol on the runner.
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 5m15s
upload-artifact@v4 rejects Gitea as GHES. Playwright's Electron launch failed on the runner before the test ran, so install-deps runs first.
2026-11-03 11:15:40 +11:00
litruv f104999800 Refresh apt lists before installing xvfb on the runner.
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 1m40s
2026-11-03 11:11:46 +11:00
litruv fcbf1020e8 Apply the #109 review panel: fork guard, loopback dev server, real authenticated assertions.
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Failing after 1m1s
Playwright's webServer replaces the custom globalSetup. The e2e job is gated to same-repo PRs because a fork PR controls both the test files and the workflow steps while the E2E_PASSWORD secret is in the environment. The dev server is pinned to loopback, the login screen is asserted before filling, the authenticated state is proven by a token-authenticated request, the token value is never printed, the failed-login test no longer asserts a tautological exitCode, and the DevTools window is no longer mistaken for the app window.
2026-11-03 11:04:18 +11:00
litruv 348e47dbd8 Add the Vitest and Playwright harness with the login E2E test. (#109) 2026-11-03 10:10:25 +11:00