Files
cinny-desktop/.gitea/workflows/tests.yml
T
litruv 1ddca42473
Tests / unit (pull_request) Successful in 17s
Tests / e2e (pull_request) Successful in 4m10s
Apply the #109 re-review: crash assertion, artifact hook on launch failure, dropped redundant lines. (#109)
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

95 lines
3.6 KiB
YAML

name: Tests
on:
pull_request:
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
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test:unit
e2e:
# A fork PR controls both the test files and these steps, so only same-repository
# PRs can be trusted with the E2E_PASSWORD secret.
if: github.event.pull_request.head.repo.full_name == github.repository
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. 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
E2E_USER: giteaci
# Repo secret: E2E_PASSWORD. The test fails with a clear message when it is missing.
E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }}
steps:
# .gitmodules uses a relative URL, so the runner resolves it against origin.
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
# The E2E run drives the vite dev server, so cinny's dependencies are needed too.
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm ci
# Electron needs system libraries the runner image does not ship. Do not narrow this to
# chromium: Playwright's chromium dep set covers its own bundled browser, not Electron,
# and drops libgtk-3-0t64, libegl1, libegl-mesa0, libgles2, libsecret-1-0, libxtst6 and
# libxss1, which Electron needs to launch. Narrowing it fails with "Process failed to
# launch!".
- name: Install system libraries for Electron
run: npx playwright install-deps
# The container runner image has no xvfb and no fresh apt lists. The host runner already
# has xvfb, so the guard skips the install there; both share the ubuntu-latest label, so
# which one runs is not fixed.
- 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, on
# connect failure or a non-2xx status.
- name: Homeserver reachable from the runner
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
# Gitea implements the v3 artifact protocol; v4 rejects it as GHES.
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: e2e-artifacts
path: |
test-results
playwright-report