diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index bfd81c4..8f7a2f7 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -5,6 +5,9 @@ on: jobs: unit: + # act_runner mounts /var/run/docker.sock into every container job, so a fork PR reaches + # the Docker daemon on the runner host. Both jobs need the same guard. + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Checkout repository @@ -28,8 +31,9 @@ jobs: runs-on: ubuntu-latest # Needs the DOCKER-USER exception on the runner host: ruv.wtf is a macvlan interface on a # container there, so the reply to a bridge-networked job arrives on that container's bridge - # and Docker's inter-bridge isolation drops it. act_runner ignores --network in - # container.options, so the exception lives on the host. + # and Docker's inter-bridge isolation drops it. The exception is host-wide, so it also covers + # fork PR jobs, and the bridge name is Docker-generated: recreating the caddy container + # renames it and the test fails closed. env: # Dedicated test account on the homeserver, not a personal one. E2E_HOMESERVER: ruv.wtf @@ -56,18 +60,20 @@ jobs: working-directory: ./cinny run: npm ci --prefer-offline - # Electron needs system libraries the runner image does not ship. + # Electron needs system libraries the runner image does not ship. Chromium only: + # Electron uses the Chromium codebase, so firefox and webkit deps are not needed. - name: Install system libraries for Electron - run: npx playwright install-deps + run: npx playwright install-deps chromium # The runner image has no xvfb and no fresh apt lists. - name: Ensure a display for Electron run: command -v xvfb-run >/dev/null || (sudo apt-get update && sudo apt-get install -y xvfb) # The login form only renders after the auth-flows request succeeds, so an - # unreachable homeserver shows up as a 30s locator timeout. Fail fast instead. + # unreachable homeserver shows up as a 30s locator timeout. Fail fast instead, on + # connect failure or a non-2xx status. - name: Homeserver reachable from the runner - run: curl -sS --max-time 20 -o /dev/null -w '%{http_code}\n' "https://$E2E_HOMESERVER/.well-known/matrix/client" + run: curl -sSf --max-time 20 -o /dev/null -w '%{http_code}\n' "https://$E2E_HOMESERVER/.well-known/matrix/client" - name: Run login E2E run: xvfb-run -a npm run test:e2e diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs index 0a1a296..881bc4b 100644 --- a/tests/e2e/login.spec.mjs +++ b/tests/e2e/login.spec.mjs @@ -10,6 +10,7 @@ const PASSWORD = process.env.E2E_PASSWORD; let app; let page; let logs = []; +let pageErrors = []; let profile; // ServerPicker gives its input no name or test id, so position is the only handle on it; @@ -30,6 +31,8 @@ async function chooseServer(server) { await serverInput().fill(server); // The server field commits on Enter, which re-runs discovery and reloads the auth flows. await serverInput().press('Enter'); + // fill() does not prove the value stuck; a cancelled debounce would keep matrix.org. + await expect(serverInput()).toHaveValue(server); await expectLoginForm(); } @@ -41,6 +44,7 @@ async function submitLogin(username, password) { test.beforeEach(async () => { logs = []; + pageErrors = []; if (!PASSWORD) { throw new Error('E2E_PASSWORD is not set. Export it, or add it as the CI secret.'); @@ -60,12 +64,17 @@ test.beforeEach(async () => { ?? await new Promise((resolve) => app.once('window', resolve)); } page.on('console', (msg) => logs.push(`[renderer] ${msg.type()}: ${msg.text()}`)); + page.on('pageerror', (err) => { + pageErrors.push(String(err)); + logs.push(`[renderer] pageerror: ${err}`); + }); await chooseServer(HOMESERVER); }); -// Config-based screenshots and traces do not fire for a page taken from app.firstWindow(), -// and console capture is not covered by config at all, so this hook stays manual. +// Config-based screenshots do not fire for a page taken from app.firstWindow(), and console +// capture is not covered by config at all, so this hook stays manual. Traces stay off because a +// trace captures the login POST body. test.afterEach(async ({}, testInfo) => { if (!app) return; @@ -119,8 +128,9 @@ test('failed login reports an error without crashing the app', async () => { await expect(page.getByText('Invalid Username or Password.')).toBeVisible(); - // The renderer is still alive and the form is still usable. No second login here: every - // run costs Synapse rc_login budget, and the re-login was the main source of flakes. - await expect(page.evaluate(() => document.body.innerText.trim())).not.toBe(''); + // "Without crashing" needs a liveness signal: no uncaught renderer error, form still usable. + // No second login here: every run costs Synapse rc_login budget, and the re-login was the + // main source of flakes. + await expect(pageErrors).toHaveLength(0); await expect(usernameInput()).toBeVisible(); });