mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-09-03 07:24:52 +08:00
The demo now fabricates most of what it shows — geo lookups, upstream and site probes, connection counters, DNS records, a synthetic access log — and refuses a set of routes outright. Nothing verified that any of it actually reaches the screen, so a provider could silently stop being installed and every page would still look plausible. Eleven Playwright specs, split into per-module data assertions and the cross-cutting guardrails: /api/pty returns the typed demo refusal rather than a 404 or a successful upgrade, the simulated shell answers `help` and `nginx -t` without opening a WebSocket, and the destructive routes return code 40300. Kept as its own top-level package rather than joining the app/ Bun workspace, so the frontend build is untouched. Not wired into CI yet: it needs a running container, and the job shape is worth deciding separately. Also hides the Preference > Terminal tab in demo mode, which the terminal work had specified but never implemented — the tab was still reachable and led to a panel with nothing behind it. The tab renders only once the demo flag has resolved, so a normal installation is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
Public demo end-to-end tests
This directory is an isolated Playwright package for the Cloudflare Containers public demo. It does not participate in the app/ Bun workspace or change the frontend build.
Prerequisites
- Bun
- Docker with Linux/amd64 emulation available
- The repository frontend already built in
app/dist, or network access socloudflare/build-binary.shcan build it
Install the isolated dependencies and Chromium once:
cd e2e
bun install
bun run install:browser
Start the local demo target
From the repository root:
sh cloudflare/build-binary.sh
docker build --platform linux/amd64 -f demo.Dockerfile -t nginxui-demo-e2e:local \
--build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 .
docker run -d --name nginxui-e2e --platform linux/amd64 --cap-drop=ALL \
-p 18110:8080 nginxui-demo-e2e:local
until curl --fail --silent http://127.0.0.1:18110/healthz >/dev/null; do sleep 2; done
--cap-drop=ALL is required because it reproduces the Cloudflare Containers capability set.
Run the suite
The complete suite runs with one command from the repository root:
bun run --cwd e2e test
The default target is http://127.0.0.1:18110 with admin / admin. Override it when needed:
E2E_BASE_URL=https://demo.example.test E2E_USERNAME=admin E2E_PASSWORD=admin \
bun run --cwd e2e test
Failure traces, videos, and screenshots are retained under e2e/test-results/. The HTML report is written to e2e/playwright-report/.
Stop and remove the local target when finished:
docker rm -f nginxui-e2e