04c7f6e68a
Tests · UI / test (push) Failing after 7m31s
Native SvelteKit service worker (src/service-worker.ts): a version-keyed cache precaches the app shell + build artefacts (incl. core.wasm) + static files; activate purges old caches; the gateway is never intercepted; navigations fall back to the cached shell offline. Adds static/manifest.webmanifest, a generated placeholder icon set (scripts/gen-pwa-icons.mjs — dependency-free pure-Node PNG encoder), and manifest / theme-color / apple-touch tags in app.html. Gated by Playwright against a production preview (playwright.pwa.config.ts + tests/pwa/pwa.spec.ts via `pnpm test:pwa`, wired into ui-test): manifest + installable icons, SW registration + a single version-keyed cache, and offline shell load. Lighthouse is not used — its PWA category was removed in v12. Docs: ui/docs/pwa-strategy.md (+ index); F5 marked done. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
122 lines
3.9 KiB
YAML
122 lines
3.9 KiB
YAML
name: Tests · UI
|
|
|
|
# UI-side unit and end-to-end tests (Vitest + Playwright). The Go side
|
|
# of the workspace is tested in `go-unit.yaml`. Both workflows can run
|
|
# in parallel for a push that touches Go and UI together.
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'ui/**'
|
|
- '.gitea/workflows/ui-test.yaml'
|
|
- '!**/*.md'
|
|
pull_request:
|
|
paths:
|
|
- 'ui/**'
|
|
- '.gitea/workflows/ui-test.yaml'
|
|
- '!**/*.md'
|
|
|
|
# Playwright launches its own `pnpm dev` on :5173, and in host-mode
|
|
# the runner shares the host's port namespace with every other job,
|
|
# so two parallel ui-test runs collide on EADDRINUSE. Serialise via a
|
|
# singleton concurrency group with queueing — new runs wait their
|
|
# turn instead of cancelling the in-progress one. cancel-in-progress
|
|
# is explicitly false because Gitea has shown spurious self-cancel
|
|
# behaviour under cancel-in-progress: true even when no other run
|
|
# shares the group.
|
|
concurrency:
|
|
group: ui-test-singleton
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 11.0.7
|
|
# Install pnpm into a per-job directory so concurrent jobs on
|
|
# the shared host runner do not race on the default
|
|
# `~/setup-pnpm` (the self-installer otherwise fails with
|
|
# `ENOTEMPTY` while cleaning a sibling job's install).
|
|
dest: ${{ runner.temp }}/setup-pnpm
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: ui/pnpm-lock.yaml
|
|
|
|
- name: Install npm dependencies
|
|
working-directory: ui
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.work
|
|
cache: true
|
|
|
|
- name: Build core.wasm
|
|
uses: ./.gitea/actions/build-wasm
|
|
|
|
- name: Install Playwright browsers
|
|
# `--with-deps` would shell out to `sudo apt-get install` for
|
|
# the system .so libraries, which the host-mode runner cannot
|
|
# run non-interactively. The host has the deps installed once,
|
|
# globally; we only need to fetch the browser binaries here.
|
|
# If a future run fails with missing libraries, install them
|
|
# on the host via `pnpm exec playwright install-deps` (one
|
|
# shot, requires sudo).
|
|
working-directory: ui/frontend
|
|
run: pnpm exec playwright install
|
|
|
|
- name: Run Vitest
|
|
working-directory: ui/frontend
|
|
run: pnpm test
|
|
|
|
- name: Clear stale Vite from :5173
|
|
# Defence in depth in case a previous job's webServer survived
|
|
# the concurrency-cancel — `pkill` does not fail when there is
|
|
# nothing to kill, and `fuser -k` cleans up anything else
|
|
# holding the port.
|
|
run: |
|
|
pkill -f 'vite dev' || true
|
|
fuser -k 5173/tcp 2>/dev/null || true
|
|
|
|
- name: Run Playwright
|
|
working-directory: ui/frontend
|
|
run: pnpm exec playwright test
|
|
|
|
- name: Run PWA tests
|
|
# Builds + previews the production bundle (the service worker only
|
|
# precaches a real build) and checks manifest / SW / offline.
|
|
working-directory: ui/frontend
|
|
run: pnpm test:pwa
|
|
|
|
- name: Upload Playwright report on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: ui/frontend/playwright-report/
|
|
retention-days: 14
|
|
|
|
- name: Upload Playwright traces on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-traces
|
|
path: ui/frontend/test-results/
|
|
retention-days: 14
|