Skip to content

Commit c866b67

Browse files
committed
docs: document stateful staging verification
1 parent 7031d4b commit c866b67

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎e2e/staging/README.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Stateful staging E2E
2+
3+
This directory is deliberately excluded from the ordinary `playwright.config.ts` suite and from `npm run verify`.
4+
5+
## Why it is separate
6+
7+
`auth.setup.ts` calls the deployed staging `demo-code-login` Edge Function. That operation is **stateful**:
8+
9+
- it reserves a use of the supplied demo code;
10+
- it can create the demo user;
11+
- it updates the demo user's role/settings;
12+
- the live Sparring canary consumes AI provider quota and writes normal usage telemetry.
13+
14+
Do not run this suite on pull-request code merely because credentials happen to be available.
15+
16+
## Required environment
17+
18+
Provide these values through the shell or an approved secret store. Never commit them to the repository or print them in logs.
19+
20+
```text
21+
E2E_STAGING_SUPABASE_URL
22+
E2E_STAGING_ANON_KEY
23+
E2E_STAGING_DEMO_CODE
24+
```
25+
26+
The anon key is a browser credential, but keep the harness configurable so the test cannot silently point at the wrong project. The demo code is reusable access material and must be treated as a secret.
27+
28+
Optional:
29+
30+
```text
31+
STAGING_PLAYWRIGHT_BASE_URL=http://localhost:8080
32+
```
33+
34+
The frontend process is forced to `VITE_FORCE_SUPABASE_ENV=staging` by `playwright.staging.config.ts`.
35+
36+
## Run
37+
38+
Only after remote staging mutation has been explicitly authorized:
39+
40+
```bash
41+
npx playwright install chromium
42+
npm run test:e2e:staging
43+
```
44+
45+
The setup exchanges the demo code for a real staging session and saves only the browser storage state under ignored `test-results/.auth/`. The authenticated project then verifies that the session survives reload and that one real Sparring opponent request can travel end to end.
46+
47+
## Pull-request safety
48+
49+
Do not add this config to ordinary pull-request CI with staging secrets. Pull-request code controls the test process and must not receive reusable staging credentials.

0 commit comments

Comments
 (0)