From 348e47dbd8068bb6899cc160f25f0f8395e67874 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 10:10:25 +1100 Subject: [PATCH 01/12] Add the Vitest and Playwright harness with the login E2E test. (#109) --- .gitea/workflows/tests.yml | 82 +++ .gitignore | 2 + README.md | 21 + package-lock.json | 1125 ++++++++++++++++++++++++++++++++- package.json | 7 +- playwright.config.mjs | 13 + tests/e2e/dev-server.mjs | 36 ++ tests/e2e/login.spec.mjs | 99 +++ tests/unit/api-server.test.js | 33 + vitest.config.mjs | 8 + 10 files changed, 1420 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/tests.yml create mode 100644 playwright.config.mjs create mode 100644 tests/e2e/dev-server.mjs create mode 100644 tests/e2e/login.spec.mjs create mode 100644 tests/unit/api-server.test.js create mode 100644 vitest.config.mjs diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml new file mode 100644 index 0000000..e13c135 --- /dev/null +++ b/.gitea/workflows/tests.yml @@ -0,0 +1,82 @@ +name: Tests + +on: + pull_request: + +jobs: + unit: + 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: + runs-on: ubuntu-latest + 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: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: false + + - name: Checkout submodules manually + run: | + set -euo pipefail + # Use the same host/scheme the runner already used for origin (not public HTTPS). + ORIGIN_URL=$(git remote get-url origin) + ORIGIN_URL=${ORIGIN_URL%/} + ORIGIN_URL=${ORIGIN_URL%.git} + BASE_URL=${ORIGIN_URL%/*} + CINNY_URL="${BASE_URL}/cinny.git" + echo "Rewriting submodule URL to ${CINNY_URL}" + git config submodule.cinny.url "${CINNY_URL}" + git submodule sync --recursive + git submodule update --init --recursive + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: | + package-lock.json + cinny/package-lock.json + + - 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 --prefer-offline + + - name: Ensure a display for Electron + run: command -v xvfb-run >/dev/null || sudo apt-get install -y xvfb + + - name: Run login E2E + run: xvfb-run -a npm run test:e2e + + - name: Upload test artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: e2e-artifacts + path: | + test-results + playwright-report diff --git a/.gitignore b/.gitignore index c1a4b2a..4806e5f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ devAssets .DS_Store dist-electron/ +playwright-report/ +test-results/ diff --git a/README.md b/README.md index 9d30c9a..2c20cfa 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,27 @@ To build the app locally, run: To start local dev server, run: * `npm run dev` +## Testing + +* `npm run test` - unit and E2E +* `npm run test:unit` - Vitest +* `npm run test:e2e` - Playwright driving Electron + +The E2E test drives the real Electron app against the vite dev server, so it needs the +cinny dependencies installed and an X display. On a headless machine run it under xvfb: +`xvfb-run -a npm run test:e2e`. + +The login test uses a dedicated test account, never a personal one: + +Variable | Default +---|--- +`E2E_HOMESERVER` | `ruv.wtf` +`E2E_USER` | `giteaci` +`E2E_PASSWORD` | required, read from the environment, never committed + +A failed E2E run attaches a screenshot and the main and renderer console logs to the +report. CI uploads `test-results/` and `playwright-report/` as artifacts. + ## Plugin System Paarrot includes a plugin system for extending and customising the app with JavaScript modules. diff --git a/package-lock.json b/package-lock.json index c9fa36a..eaa45e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "paarrot", - "version": "4.11.137", + "version": "4.11.221", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "paarrot", - "version": "4.11.137", + "version": "4.11.221", "license": "AGPL-3.0-only", "dependencies": { "adm-zip": "^0.5.18", @@ -20,6 +20,7 @@ "devDependencies": { "@actions/github": "9.1.1", "@electron/rebuild": "4.2.0", + "@playwright/test": "1.64.1", "concurrently": "10.0.3", "cross-env": "10.1.0", "electron": "43.1.0", @@ -27,6 +28,7 @@ "node-fetch": "3.3.2", "png2icons": "2.0.1", "sharp": "0.35.3", + "vitest": "5.1.0", "wait-on": "9.0.10" }, "engines": { @@ -1017,6 +1019,34 @@ "node": ">=18.0.0" } }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@malept/cross-spawn-promise": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz", @@ -1237,6 +1267,17 @@ "@octokit/openapi-types": "^27.0.0" } }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, "node_modules/@peculiar/asn1-schema": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.8.0.tgz", @@ -1289,6 +1330,318 @@ "node": ">=14.18.0" } }, + "node_modules/@playwright/test": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz", + "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz", + "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz", + "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz", + "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz", + "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz", + "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz", + "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz", + "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz", + "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz", + "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz", + "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz", + "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz", + "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz", + "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz", + "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz", + "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/@sindresorhus/is": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", @@ -1335,6 +1688,17 @@ "@types/responselike": "^1.0.0" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, "node_modules/@types/debug": { "version": "4.1.13", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", @@ -1345,6 +1709,20 @@ "@types/ms": "*" } }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -1399,6 +1777,44 @@ "@types/node": "*" } }, + "node_modules/@vitest/mocker": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz", + "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.1.0", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/spy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz", + "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/@xmldom/xmldom": { "version": "0.8.13", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.13.tgz", @@ -1707,6 +2123,16 @@ "node": ">=12.0.0" } }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -2070,6 +2496,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "5.6.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", @@ -3118,6 +3554,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", @@ -3184,6 +3627,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -3193,6 +3646,16 @@ "node": ">= 0.6" } }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/exponential-backoff": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", @@ -3481,6 +3944,22 @@ "dev": true, "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -4126,6 +4605,291 @@ "integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==", "license": "MIT" }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/lodash": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", @@ -4169,6 +4933,16 @@ "node": ">=10" } }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, "node_modules/matcher": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", @@ -4342,6 +5116,26 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/negotiator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", @@ -4543,6 +5337,20 @@ "node": ">= 0.4" } }, + "node_modules/obug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", + "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -4672,9 +5480,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -4715,6 +5523,35 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/playwright": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz", + "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz", + "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/plist": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", @@ -4740,6 +5577,36 @@ "png2icons": "png2icons-cli.js" } }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/postject": { "version": "1.0.0-alpha.6", "resolved": "https://registry.npmjs.org/postject/-/postject-1.0.0-alpha.6.tgz", @@ -5072,6 +5939,41 @@ "node": ">=8.0" } }, + "node_modules/rolldown": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz", + "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.16", + "@rolldown/binding-android-arm64": "1.2.16", + "@rolldown/binding-darwin-arm64": "1.2.16", + "@rolldown/binding-darwin-x64": "1.2.16", + "@rolldown/binding-freebsd-x64": "1.2.16", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", + "@rolldown/binding-linux-arm64-gnu": "1.2.16", + "@rolldown/binding-linux-arm64-musl": "1.2.16", + "@rolldown/binding-linux-ppc64-gnu": "1.2.16", + "@rolldown/binding-linux-s390x-gnu": "1.2.16", + "@rolldown/binding-linux-x64-gnu": "1.2.16", + "@rolldown/binding-linux-x64-musl": "1.2.16", + "@rolldown/binding-openharmony-arm64": "1.2.16", + "@rolldown/binding-win32-arm64-msvc": "1.2.16", + "@rolldown/binding-win32-x64-msvc": "1.2.16" + } + }, "node_modules/router": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", @@ -5445,6 +6347,17 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -5483,6 +6396,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -5653,6 +6573,26 @@ "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==", "license": "MIT" }, + "node_modules/tinybench": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", + "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -5888,6 +6828,168 @@ "node": ">= 0.8" } }, + "node_modules/vite": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", + "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.30", + "rolldown": "~1.2.14", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz", + "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.1.0", + "chai": "^6.3.0", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.4.3", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "std-env": "^4.3.0", + "tinybench": "^6.2.2", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.1.0", + "@vitest/browser-preview": "5.1.0", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.1.0", + "@vitest/coverage-v8": "5.1.0", + "@vitest/ui": "5.1.0", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, "node_modules/wait-on": { "version": "9.0.10", "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-9.0.10.tgz", @@ -5954,6 +7056,19 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", + "dev": true, + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=20.11" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 5ac1252..8f45856 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,10 @@ "build:linux": "npm run build -- --linux", "build:win": "npm run build -- --win", "postman:generate": "node scripts/generate-postman-collection.js", - "generate:update-manifest": "node scripts/generate-update-manifest.mjs" + "generate:update-manifest": "node scripts/generate-update-manifest.mjs", + "test": "npm run test:unit && npm run test:e2e", + "test:unit": "vitest run", + "test:e2e": "playwright test" }, "keywords": [], "author": { @@ -40,6 +43,7 @@ "devDependencies": { "@actions/github": "9.1.1", "@electron/rebuild": "4.2.0", + "@playwright/test": "1.64.1", "concurrently": "10.0.3", "cross-env": "10.1.0", "electron": "43.1.0", @@ -47,6 +51,7 @@ "node-fetch": "3.3.2", "png2icons": "2.0.1", "sharp": "0.35.3", + "vitest": "5.1.0", "wait-on": "9.0.10" }, "allowScripts": { diff --git a/playwright.config.mjs b/playwright.config.mjs new file mode 100644 index 0000000..5657ce1 --- /dev/null +++ b/playwright.config.mjs @@ -0,0 +1,13 @@ +import { defineConfig } from '@playwright/test'; + +export default defineConfig({ + testDir: './tests/e2e', + // Electron launch plus first paint is far slower than a page load. + timeout: 120_000, + // One Electron process at a time: the app takes a single-instance lock and + // every test shares the same vite dev server. + workers: 1, + outputDir: 'test-results', + reporter: [['list'], ['html', { open: false }]], + globalSetup: './tests/e2e/dev-server.mjs', +}); diff --git a/tests/e2e/dev-server.mjs b/tests/e2e/dev-server.mjs new file mode 100644 index 0000000..210a757 --- /dev/null +++ b/tests/e2e/dev-server.mjs @@ -0,0 +1,36 @@ +import { spawn } from 'node:child_process'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// electron/main.js loads this URL whenever the app is not packaged, so the E2E +// run needs the vite dev server up. It is the same server `npm run dev` uses. +export const DEV_URL = 'http://localhost:38347'; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); + +const reachable = async () => { + try { + const res = await fetch(DEV_URL, { signal: AbortSignal.timeout(3000) }); + return res.ok; + } catch { + return false; + } +}; + +export default async function globalSetup() { + // A dev server the developer already started is reused rather than restarted. + if (await reachable()) return () => {}; + + const child = spawn('npm', ['run', 'dev:vite'], { cwd: ROOT, detached: true, stdio: 'inherit' }); + + for (let attempt = 0; attempt < 60; attempt++) { + if (await reachable()) { + // detached puts npm and its sh -c child in their own process group. + return () => process.kill(-child.pid, 'SIGTERM'); + } + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + + process.kill(-child.pid, 'SIGTERM'); + throw new Error(`Vite dev server did not come up at ${DEV_URL}`); +} diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs new file mode 100644 index 0000000..dcf9ed0 --- /dev/null +++ b/tests/e2e/login.spec.mjs @@ -0,0 +1,99 @@ +import { test, expect, _electron } from '@playwright/test'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; + +const HOMESERVER = process.env.E2E_HOMESERVER ?? 'ruv.wtf'; +const USER = process.env.E2E_USER ?? 'giteaci'; +const PASSWORD = process.env.E2E_PASSWORD; + +let app; +let page; +let logs; + +const serverInput = () => page.locator('input').first(); +const usernameInput = () => page.locator('input[name="usernameInput"]'); +const passwordInput = () => page.locator('input[name="passwordInput"]'); + +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'); + await expect(usernameInput()).toBeVisible(); +} + +async function submitLogin(username, password) { + await usernameInput().fill(username); + await passwordInput().fill(password); + await page.locator('button[type="submit"]').click(); +} + +test.beforeEach(async () => { + if (!PASSWORD) { + throw new Error('E2E_PASSWORD is not set. Export it, or add it as the CI secret.'); + } + + logs = []; + + // Fresh profile per run. electron/main.js takes a single-instance lock keyed to + // the user data dir, so a shared profile collides with a running Paarrot. + const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'paarrot-e2e-')); + app = await _electron.launch({ args: ['.', `--user-data-dir=${profile}`] }); + + app.on('console', (msg) => logs.push(`[main] ${msg.type()}: ${msg.text()}`)); + + page = await app.firstWindow(); + page.on('console', (msg) => logs.push(`[renderer] ${msg.type()}: ${msg.text()}`)); + + await page.waitForSelector('input'); + await chooseServer(HOMESERVER); +}); + +test.afterEach(async ({}, testInfo) => { + if (testInfo.status !== testInfo.expectedStatus) { + if (page && !page.isClosed()) { + await testInfo.attach('failure.png', { body: await page.screenshot(), contentType: 'image/png' }); + } + await testInfo.attach('console.log', { body: logs.join('\n'), contentType: 'text/plain' }); + } + + await app + .close() + // main.js preventDefault()s window close to minimise to tray, so close can hang. + .catch(() => app.process().kill('SIGTERM')); +}); + +async function expectAuthenticated() { + // Login complete reloads into the client shell, which lands on the last active + // path or the inbox, so assert on the shell rather than one route. + await expect(page).not.toHaveURL(/#\/login\//, { timeout: 30_000 }); + + const session = await page.evaluate(() => ({ + userId: JSON.parse(localStorage.getItem('currentSessionUserId') ?? 'null'), + sessions: JSON.parse(localStorage.getItem('matrixSessions') ?? '[]'), + })); + + expect(session.userId).toBe(`@${USER}:${HOMESERVER}`); + expect(session.sessions[0].accessToken).toBeTruthy(); + + // The login form is gone, so the app is on the authenticated shell. + await expect(usernameInput()).toHaveCount(0); +} + +test('test account can log in and reaches the authenticated app', async () => { + await submitLogin(USER, PASSWORD); + await expectAuthenticated(); +}); + +test('failed login reports an error without crashing the app', async () => { + await submitLogin(USER, 'not-the-password'); + + await expect(page.getByText('Invalid Username or Password.')).toBeVisible({ timeout: 30_000 }); + + // The main process is still running and the form is still usable. + expect(app.process().exitCode).toBeNull(); + await expect(usernameInput()).toBeVisible(); + + await submitLogin(USER, PASSWORD); + await expectAuthenticated(); +}); diff --git a/tests/unit/api-server.test.js b/tests/unit/api-server.test.js new file mode 100644 index 0000000..f6c9135 --- /dev/null +++ b/tests/unit/api-server.test.js @@ -0,0 +1,33 @@ +import { afterAll, beforeAll, expect, test } from 'vitest'; + +import PaarrotAPIServer from '../../electron/api-server.js'; + +const api = new PaarrotAPIServer(null); +let base; + +beforeAll(async () => { + // Port 0 lets the OS pick a free port, so the test never collides with a running Paarrot. + await api.start(0); + base = `http://127.0.0.1:${api.server.address().port}`; +}); + +afterAll(async () => { + await api.stop(); +}); + +test('GET /health reports the API server is up', async () => { + const res = await fetch(`${base}/health`); + + expect(res.status).toBe(200); + expect(await res.json()).toEqual({ status: 'ok', app: 'Paarrot API', version: '1.0.0' }); +}); + +test('unknown endpoint answers 404 with the endpoint list', async () => { + const res = await fetch(`${base}/not-an-endpoint`); + + expect(res.status).toBe(404); + + const body = await res.json(); + expect(body.error).toBe('Endpoint not found'); + expect(body.availableEndpoints).toContain('GET /health'); +}); diff --git a/vitest.config.mjs b/vitest.config.mjs new file mode 100644 index 0000000..fbdc945 --- /dev/null +++ b/vitest.config.mjs @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + include: ['tests/unit/**/*.test.js'], + environment: 'node', + }, +}); -- 2.51.1 From fcbf1020e8ed3de1e4ae366a97e03ef9e308429b Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 11:03:49 +1100 Subject: [PATCH 02/12] Apply the #109 review panel: fork guard, loopback dev server, real authenticated assertions. 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. --- .gitea/workflows/tests.yml | 24 +++---------- README.md | 3 +- playwright.config.mjs | 15 ++++++-- tests/e2e/dev-server.mjs | 36 ------------------- tests/e2e/login.spec.mjs | 71 ++++++++++++++++++++++++++------------ vitest.config.mjs | 2 +- 6 files changed, 69 insertions(+), 82 deletions(-) delete mode 100644 tests/e2e/dev-server.mjs diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index e13c135..32e7f67 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -22,6 +22,9 @@ jobs: 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 env: # Dedicated test account on the homeserver, not a personal one. @@ -30,33 +33,16 @@ jobs: # 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: false - - - name: Checkout submodules manually - run: | - set -euo pipefail - # Use the same host/scheme the runner already used for origin (not public HTTPS). - ORIGIN_URL=$(git remote get-url origin) - ORIGIN_URL=${ORIGIN_URL%/} - ORIGIN_URL=${ORIGIN_URL%.git} - BASE_URL=${ORIGIN_URL%/*} - CINNY_URL="${BASE_URL}/cinny.git" - echo "Rewriting submodule URL to ${CINNY_URL}" - git config submodule.cinny.url "${CINNY_URL}" - git submodule sync --recursive - git submodule update --init --recursive + submodules: true - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' - cache: 'npm' - cache-dependency-path: | - package-lock.json - cinny/package-lock.json - name: Install dependencies run: npm ci diff --git a/README.md b/README.md index 2c20cfa..d484883 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ The E2E test drives the real Electron app against the vite dev server, so it nee cinny dependencies installed and an X display. On a headless machine run it under xvfb: `xvfb-run -a npm run test:e2e`. -The login test uses a dedicated test account, never a personal one: +The E2E test logs in to a live homeserver over the network, so it needs network access and a +working test account. It uses a dedicated account, never a personal one: Variable | Default ---|--- diff --git a/playwright.config.mjs b/playwright.config.mjs index 5657ce1..2300866 100644 --- a/playwright.config.mjs +++ b/playwright.config.mjs @@ -4,10 +4,19 @@ export default defineConfig({ testDir: './tests/e2e', // Electron launch plus first paint is far slower than a page load. timeout: 120_000, + expect: { timeout: 30_000 }, // One Electron process at a time: the app takes a single-instance lock and // every test shares the same vite dev server. workers: 1, - outputDir: 'test-results', - reporter: [['list'], ['html', { open: false }]], - globalSetup: './tests/e2e/dev-server.mjs', + // The suite logs in to a live homeserver, where Synapse login rate limiting is a real flake. + retries: process.env.CI ? 1 : 0, + reporter: [['list'], ['html']], + // cinny/vite.config.js binds 0.0.0.0 with fs.allow: ['..'], which is exposed on a shared + // CI runner, so pin the dev server to loopback. The flag has to reach vite itself: + // `npm run dev:vite -- --host` lands on sh's positional params, not on vite. + // localhost is also the URL electron/main.js loads, so the page keeps that origin. + webServer: { + command: 'sh -c "cd cinny && npm start -- --host localhost"', + url: 'http://localhost:38347', + }, }); diff --git a/tests/e2e/dev-server.mjs b/tests/e2e/dev-server.mjs deleted file mode 100644 index 210a757..0000000 --- a/tests/e2e/dev-server.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import { spawn } from 'node:child_process'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -// electron/main.js loads this URL whenever the app is not packaged, so the E2E -// run needs the vite dev server up. It is the same server `npm run dev` uses. -export const DEV_URL = 'http://localhost:38347'; - -const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); - -const reachable = async () => { - try { - const res = await fetch(DEV_URL, { signal: AbortSignal.timeout(3000) }); - return res.ok; - } catch { - return false; - } -}; - -export default async function globalSetup() { - // A dev server the developer already started is reused rather than restarted. - if (await reachable()) return () => {}; - - const child = spawn('npm', ['run', 'dev:vite'], { cwd: ROOT, detached: true, stdio: 'inherit' }); - - for (let attempt = 0; attempt < 60; attempt++) { - if (await reachable()) { - // detached puts npm and its sh -c child in their own process group. - return () => process.kill(-child.pid, 'SIGTERM'); - } - await new Promise((resolve) => setTimeout(resolve, 1000)); - } - - process.kill(-child.pid, 'SIGTERM'); - throw new Error(`Vite dev server did not come up at ${DEV_URL}`); -} diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs index dcf9ed0..0a1a296 100644 --- a/tests/e2e/login.spec.mjs +++ b/tests/e2e/login.spec.mjs @@ -9,47 +9,66 @@ const PASSWORD = process.env.E2E_PASSWORD; let app; let page; -let logs; +let logs = []; +let profile; +// ServerPicker gives its input no name or test id, so position is the only handle on it; +// this breaks if the form ever gains a field before the ones below. const serverInput = () => page.locator('input').first(); const usernameInput = () => page.locator('input[name="usernameInput"]'); const passwordInput = () => page.locator('input[name="passwordInput"]'); +const submitButton = () => page.locator('button[type="submit"]'); + +async function expectLoginForm() { + await expect(serverInput()).toBeVisible(); + await expect(usernameInput()).toBeVisible(); + await expect(passwordInput()).toBeVisible(); + await expect(submitButton()).toBeVisible(); +} 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'); - await expect(usernameInput()).toBeVisible(); + await expectLoginForm(); } async function submitLogin(username, password) { await usernameInput().fill(username); await passwordInput().fill(password); - await page.locator('button[type="submit"]').click(); + await submitButton().click(); } test.beforeEach(async () => { + logs = []; + if (!PASSWORD) { throw new Error('E2E_PASSWORD is not set. Export it, or add it as the CI secret.'); } - logs = []; - // Fresh profile per run. electron/main.js takes a single-instance lock keyed to // the user data dir, so a shared profile collides with a running Paarrot. - const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'paarrot-e2e-')); + profile = fs.mkdtempSync(path.join(os.tmpdir(), 'paarrot-e2e-')); app = await _electron.launch({ args: ['.', `--user-data-dir=${profile}`] }); app.on('console', (msg) => logs.push(`[main] ${msg.type()}: ${msg.text()}`)); page = await app.firstWindow(); + // main.js opens DevTools in dev mode, and that window can be the first one registered. + while (page.url().startsWith('devtools://')) { + page = app.windows().find((w) => !w.url().startsWith('devtools://')) + ?? await new Promise((resolve) => app.once('window', resolve)); + } page.on('console', (msg) => logs.push(`[renderer] ${msg.type()}: ${msg.text()}`)); - await page.waitForSelector('input'); 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. test.afterEach(async ({}, testInfo) => { + if (!app) return; + if (testInfo.status !== testInfo.expectedStatus) { if (page && !page.isClosed()) { await testInfo.attach('failure.png', { body: await page.screenshot(), contentType: 'image/png' }); @@ -61,20 +80,30 @@ test.afterEach(async ({}, testInfo) => { .close() // main.js preventDefault()s window close to minimise to tray, so close can hang. .catch(() => app.process().kill('SIGTERM')); + + fs.rmSync(profile, { recursive: true, force: true }); }); async function expectAuthenticated() { - // Login complete reloads into the client shell, which lands on the last active - // path or the inbox, so assert on the shell rather than one route. - await expect(page).not.toHaveURL(/#\/login\//, { timeout: 30_000 }); + // Login complete reloads into the client shell, which lands on the last active path + // (state/lastActivePath.ts) or the inbox, so assert a shell route rather than any URL. + await expect(page).toHaveURL(/#\/(inbox|home|room|space)/); - const session = await page.evaluate(() => ({ - userId: JSON.parse(localStorage.getItem('currentSessionUserId') ?? 'null'), - sessions: JSON.parse(localStorage.getItem('matrixSessions') ?? '[]'), - })); + await expect + .poll(() => page.evaluate(() => JSON.parse(localStorage.getItem('currentSessionUserId') ?? 'null'))) + .toBe(`@${USER}:${HOMESERVER}`); - expect(session.userId).toBe(`@${USER}:${HOMESERVER}`); - expect(session.sessions[0].accessToken).toBeTruthy(); + // A truthy accessToken only proves a string exists, so prove it authenticates. Only the + // status is asserted, so a failure cannot put a live token into the CI log or the report. + await expect + .poll(async () => { + const token = await page.evaluate(() => JSON.parse(localStorage.getItem('matrixSessions') ?? '[]')[0]?.accessToken); + if (!token) return 0; + // /versions and /account 404 on ruv.wtf; /capabilities exists and requires a valid token. + const res = await fetch(`https://${HOMESERVER}/_matrix/client/v3/capabilities`, { headers: { Authorization: `Bearer ${token}` } }); + return res.status; + }) + .toBe(200); // The login form is gone, so the app is on the authenticated shell. await expect(usernameInput()).toHaveCount(0); @@ -88,12 +117,10 @@ test('test account can log in and reaches the authenticated app', async () => { test('failed login reports an error without crashing the app', async () => { await submitLogin(USER, 'not-the-password'); - await expect(page.getByText('Invalid Username or Password.')).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText('Invalid Username or Password.')).toBeVisible(); - // The main process is still running and the form is still usable. - expect(app.process().exitCode).toBeNull(); + // 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(''); await expect(usernameInput()).toBeVisible(); - - await submitLogin(USER, PASSWORD); - await expectAuthenticated(); }); diff --git a/vitest.config.mjs b/vitest.config.mjs index fbdc945..7bb5cc8 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -2,7 +2,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { + // The default pattern would also pick up the Electron spec in tests/e2e. include: ['tests/unit/**/*.test.js'], - environment: 'node', }, }); -- 2.51.1 From f104999800ed91a81b3c54fe67095c33e798a6fe Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 11:11:46 +1100 Subject: [PATCH 03/12] Refresh apt lists before installing xvfb on the runner. --- .gitea/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 32e7f67..e0757ca 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -52,8 +52,9 @@ jobs: working-directory: ./cinny run: npm ci --prefer-offline + # 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 install -y xvfb + run: command -v xvfb-run >/dev/null || (sudo apt-get update && sudo apt-get install -y xvfb) - name: Run login E2E run: xvfb-run -a npm run test:e2e -- 2.51.1 From 4eff64b2513175013fc6080afa78fc1373900a0d Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 11:15:40 +1100 Subject: [PATCH 04/12] Install Electron's system libraries and use the v3 artifact protocol on the runner. upload-artifact@v4 rejects Gitea as GHES. Playwright's Electron launch failed on the runner before the test ran, so install-deps runs first. --- .gitea/workflows/tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index e0757ca..5506b8d 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -52,6 +52,10 @@ jobs: working-directory: ./cinny run: npm ci --prefer-offline + # Electron needs system libraries the runner image does not ship. + - name: Install system libraries for Electron + run: npx playwright install-deps + # 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) @@ -59,9 +63,10 @@ jobs: - 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@v4 + uses: actions/upload-artifact@v3 with: name: e2e-artifacts path: | -- 2.51.1 From f4fb8d2d28d3c6f1fe9d66033ce578de8eb2b30e Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 11:29:07 +1100 Subject: [PATCH 05/12] Fail fast when the runner cannot reach the homeserver. 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. --- .gitea/workflows/tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 5506b8d..7aa5179 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -60,6 +60,11 @@ jobs: - 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. + - 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" + - name: Run login E2E run: xvfb-run -a npm run test:e2e -- 2.51.1 From e58b87ed3abfba6ec7794b2a3530fe2de14258cc Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 12:16:17 +1100 Subject: [PATCH 06/12] Run the E2E job with host networking so the homeserver replies reach it. (#109) 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. --- .gitea/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 7aa5179..af48492 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -26,6 +26,12 @@ jobs: # PRs can be trusted with the E2E_PASSWORD secret. if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest + # ruv.wtf is a macvlan interface on a container on the runner host, so the reply to a + # bridge-networked job arrives on that container's bridge and Docker's inter-bridge + # isolation drops it. Host networking keeps the request and reply on one path. + container: + image: docker.io/gitea/runner-images:ubuntu-latest + options: --network=host env: # Dedicated test account on the homeserver, not a personal one. E2E_HOMESERVER: ruv.wtf -- 2.51.1 From 73990d092c32cad7c9480833652fb35dee93a695 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 12:25:13 +1100 Subject: [PATCH 07/12] Drop the host-network container option: act_runner ignores --network. (#109) 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. --- .gitea/workflows/tests.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index af48492..bfd81c4 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -26,12 +26,10 @@ jobs: # PRs can be trusted with the E2E_PASSWORD secret. if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest - # ruv.wtf is a macvlan interface on a container on the runner host, so the reply to a - # bridge-networked job arrives on that container's bridge and Docker's inter-bridge - # isolation drops it. Host networking keeps the request and reply on one path. - container: - image: docker.io/gitea/runner-images:ubuntu-latest - options: --network=host + # 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. env: # Dedicated test account on the homeserver, not a personal one. E2E_HOMESERVER: ruv.wtf -- 2.51.1 From 879a7155eb211ff0a225bf468cd83222b88d7e07 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 12:51:11 +1100 Subject: [PATCH 08/12] Apply the #109 re-review: fork guard on the unit job, gated reachability check, renderer liveness assertion. 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. --- .gitea/workflows/tests.yml | 18 ++++++++++++------ tests/e2e/login.spec.mjs | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) 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(); }); -- 2.51.1 From d12ce65ac578c481f28d8cd9ed890de2d599d33a Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 12:56:03 +1100 Subject: [PATCH 09/12] Revert the chromium-only install-deps: Electron needs the full dep set. (#109) --- .gitea/workflows/tests.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 8f7a2f7..12f7f07 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -60,10 +60,13 @@ jobs: working-directory: ./cinny run: npm ci --prefer-offline - # 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. + # 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. Run 930 failed with "Process failed to launch!" + # on the narrowed set. - name: Install system libraries for Electron - run: npx playwright install-deps chromium + run: npx playwright install-deps # The runner image has no xvfb and no fresh apt lists. - name: Ensure a display for Electron -- 2.51.1 From 347acd0ebd2b9221f5126e7b3944f1d25cface10 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 13:01:29 +1100 Subject: [PATCH 10/12] Drop the pageerror assertion: the failed login path produces one. (#109) --- tests/e2e/login.spec.mjs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs index 881bc4b..a1d4b4b 100644 --- a/tests/e2e/login.spec.mjs +++ b/tests/e2e/login.spec.mjs @@ -10,7 +10,6 @@ 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; @@ -44,7 +43,6 @@ 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.'); @@ -64,10 +62,7 @@ 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}`); - }); + page.on('pageerror', (err) => logs.push(`[renderer] pageerror: ${err}`)); await chooseServer(HOMESERVER); }); @@ -128,9 +123,9 @@ test('failed login reports an error without crashing the app', async () => { await expect(page.getByText('Invalid Username or Password.')).toBeVisible(); - // "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); + // "Without crashing" is proven by the form still rendering: a dead renderer cannot render it. + // Pageerrors go into the artifact but are not asserted — the failed login itself produces + // MatrixError, and dev mode produces a ServiceWorker registration error. No second login + // here: every run costs Synapse rc_login budget, and the re-login was the main flake source. await expect(usernameInput()).toBeVisible(); }); -- 2.51.1 From 1ddca424732e58da2f7fbed0ac543c7c6731e057 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 13:22:39 +1100 Subject: [PATCH 11/12] Apply the #109 re-review: crash assertion, artifact hook on launch failure, dropped redundant lines. (#109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .gitea/workflows/tests.yml | 10 +++++--- playwright.config.mjs | 4 +++ tests/e2e/login.spec.mjs | 52 +++++++++++++++++++++++--------------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 12f7f07..2fc634c 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -58,17 +58,19 @@ jobs: # 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 --prefer-offline + 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. Run 930 failed with "Process failed to launch!" - # on the narrowed set. + # 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 runner image has no xvfb and no fresh apt lists. + # 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) diff --git a/playwright.config.mjs b/playwright.config.mjs index 2300866..fa2bb37 100644 --- a/playwright.config.mjs +++ b/playwright.config.mjs @@ -10,7 +10,11 @@ export default defineConfig({ workers: 1, // The suite logs in to a live homeserver, where Synapse login rate limiting is a real flake. retries: process.env.CI ? 1 : 0, + // An explicit reporter replaces the default, so list stays for the CI log. reporter: [['list'], ['html']], + // A trace captures the login POST body, which contains the password. Pin it off rather than + // relying on the version default. + trace: 'off', // cinny/vite.config.js binds 0.0.0.0 with fs.allow: ['..'], which is exposed on a shared // CI runner, so pin the dev server to loopback. The flag has to reach vite itself: // `npm run dev:vite -- --host` lands on sh's positional params, not on vite. diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs index a1d4b4b..9e1141a 100644 --- a/tests/e2e/login.spec.mjs +++ b/tests/e2e/login.spec.mjs @@ -11,6 +11,7 @@ let app; let page; let logs = []; let profile; +let crashed = false; // ServerPicker gives its input no name or test id, so position is the only handle on it; // this breaks if the form ever gains a field before the ones below. @@ -43,6 +44,7 @@ async function submitLogin(username, password) { test.beforeEach(async () => { logs = []; + crashed = false; if (!PASSWORD) { throw new Error('E2E_PASSWORD is not set. Export it, or add it as the CI secret.'); @@ -63,29 +65,37 @@ test.beforeEach(async () => { } page.on('console', (msg) => logs.push(`[renderer] ${msg.type()}: ${msg.text()}`)); page.on('pageerror', (err) => logs.push(`[renderer] pageerror: ${err}`)); + // crash is render-process-gone, so it does not fire on the MatrixError or the ServiceWorker error. + page.on('crash', () => { + crashed = true; + }); await chooseServer(HOMESERVER); }); // 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. +// capture is not covered by config at all, so this hook stays manual. test.afterEach(async ({}, testInfo) => { - if (!app) return; - if (testInfo.status !== testInfo.expectedStatus) { - if (page && !page.isClosed()) { - await testInfo.attach('failure.png', { body: await page.screenshot(), contentType: 'image/png' }); - } + // Console first: a failed launch has no app and no page, so this is the only artifact that + // path can produce. await testInfo.attach('console.log', { body: logs.join('\n'), contentType: 'text/plain' }); + if (page && !page.isClosed()) { + // screenshot() throws on a crashed page, which would mask the original failure. + const shot = await page.screenshot().catch(() => null); + if (shot) await testInfo.attach('failure.png', { body: shot, contentType: 'image/png' }); + } } - await app - .close() - // main.js preventDefault()s window close to minimise to tray, so close can hang. - .catch(() => app.process().kill('SIGTERM')); + if (app) { + await app + .close() + // main.js preventDefault()s window close to minimise to tray, so close can hang. + .catch(() => app.process().kill('SIGTERM')); + } - fs.rmSync(profile, { recursive: true, force: true }); + // Reachable on launch failure, so the temp profile does not leak. + if (profile) fs.rmSync(profile, { recursive: true, force: true }); }); async function expectAuthenticated() { @@ -108,9 +118,6 @@ async function expectAuthenticated() { return res.status; }) .toBe(200); - - // The login form is gone, so the app is on the authenticated shell. - await expect(usernameInput()).toHaveCount(0); } test('test account can log in and reaches the authenticated app', async () => { @@ -118,14 +125,17 @@ test('test account can log in and reaches the authenticated app', async () => { await expectAuthenticated(); }); -test('failed login reports an error without crashing the app', async () => { +test('failed login reports an error and keeps the renderer alive', async () => { await submitLogin(USER, 'not-the-password'); - await expect(page.getByText('Invalid Username or Password.')).toBeVisible(); + // A rate-limited run renders LoginError.RateLimited instead of the wrong-password message, + // so accept both branches rather than asserting one exact string. + await expect(page.getByText(/Invalid Username or Password\.|rate-limited by server/)).toBeVisible(); - // "Without crashing" is proven by the form still rendering: a dead renderer cannot render it. - // Pageerrors go into the artifact but are not asserted — the failed login itself produces - // MatrixError, and dev mode produces a ServiceWorker registration error. No second login - // here: every run costs Synapse rc_login budget, and the re-login was the main flake source. + // A dead renderer cannot render the form. Pageerrors go into the artifact but are not + // asserted — the failed login itself produces MatrixError, and dev mode produces a + // ServiceWorker registration error. No second login here: every run costs Synapse rc_login + // budget, and the re-login was the main flake source. await expect(usernameInput()).toBeVisible(); + await expect(crashed).toBe(false); }); -- 2.51.1 From 87ba01fde9bffaba1679a45d136927bbe9140de7 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 13:42:15 +1100 Subject: [PATCH 12/12] Move the crash assertion ahead of the locator and name the crash path in the artifact. (#109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- tests/e2e/login.spec.mjs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/e2e/login.spec.mjs b/tests/e2e/login.spec.mjs index 9e1141a..346a28e 100644 --- a/tests/e2e/login.spec.mjs +++ b/tests/e2e/login.spec.mjs @@ -60,6 +60,8 @@ test.beforeEach(async () => { page = await app.firstWindow(); // main.js opens DevTools in dev mode, and that window can be the first one registered. while (page.url().startsWith('devtools://')) { + // Recorded so a hang here names which windows existed instead of reporting a bare timeout. + logs.push(`[window] ${page.url()}`); page = app.windows().find((w) => !w.url().startsWith('devtools://')) ?? await new Promise((resolve) => app.once('window', resolve)); } @@ -68,6 +70,7 @@ test.beforeEach(async () => { // crash is render-process-gone, so it does not fire on the MatrixError or the ServiceWorker error. page.on('crash', () => { crashed = true; + logs.push('[renderer] page crashed'); }); await chooseServer(HOMESERVER); @@ -78,7 +81,9 @@ test.beforeEach(async () => { test.afterEach(async ({}, testInfo) => { if (testInfo.status !== testInfo.expectedStatus) { // Console first: a failed launch has no app and no page, so this is the only artifact that - // path can produce. + // path can produce, and it is empty by construction because no handler is attached before + // launch — the failure message in the report is the diagnosis there. A crashed page produces + // no screenshot; the crash line in the console names it. await testInfo.attach('console.log', { body: logs.join('\n'), contentType: 'text/plain' }); if (page && !page.isClosed()) { // screenshot() throws on a crashed page, which would mask the original failure. @@ -132,10 +137,11 @@ test('failed login reports an error and keeps the renderer alive', async () => { // so accept both branches rather than asserting one exact string. await expect(page.getByText(/Invalid Username or Password\.|rate-limited by server/)).toBeVisible(); - // A dead renderer cannot render the form. Pageerrors go into the artifact but are not - // asserted — the failed login itself produces MatrixError, and dev mode produces a - // ServiceWorker registration error. No second login here: every run costs Synapse rc_login - // budget, and the re-login was the main flake source. - await expect(usernameInput()).toBeVisible(); + // Asserted before the form check: on a crashed page the locator throws TargetClosedError, + // which names the wrong thing. Pageerrors go into the artifact but are not asserted — the + // failed login itself produces MatrixError, and dev mode produces a ServiceWorker registration + // error. No second login here: every run costs Synapse rc_login budget, and the re-login was + // the main flake source. await expect(crashed).toBe(false); + await expect(usernameInput()).toBeVisible(); }); -- 2.51.1