Skip to content

Commit 5a3a26c

Browse files
committed
Add docs-driven playground e2e coverage
1 parent bfbed21 commit 5a3a26c

37 files changed

+5594
-63
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Playground E2E
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
pull_request:
8+
paths:
9+
- "examples/playground/testing.md"
10+
- "examples/playground/scripts/**"
11+
- "examples/playground/e2e/**"
12+
- "examples/playground/src/**"
13+
- "examples/playground/package.json"
14+
- ".github/workflows/playground-e2e.yml"
15+
- "package-lock.json"
16+
- "package.json"
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
sync-check:
24+
name: Testing.md sync check
25+
runs-on: ubuntu-24.04
26+
timeout-minutes: 10
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 1
31+
32+
- uses: actions/setup-node@v6
33+
with:
34+
node-version: 24
35+
cache: npm
36+
37+
- run: npm ci
38+
- run: npm run check:playground-testing-sync
39+
40+
e2e:
41+
name: Playground browser tests
42+
runs-on: ubuntu-24.04
43+
timeout-minutes: 20
44+
needs: sync-check
45+
steps:
46+
- uses: actions/checkout@v6
47+
with:
48+
fetch-depth: 1
49+
50+
- uses: actions/setup-node@v6
51+
with:
52+
node-version: 24
53+
cache: npm
54+
55+
- run: npm ci
56+
57+
- name: Get Playwright version
58+
id: playwright-version
59+
run: echo "version=$(jq -r '.packages[\"node_modules/playwright\"].version' package-lock.json)" >> $GITHUB_OUTPUT
60+
61+
- name: Cache Playwright browsers
62+
uses: actions/cache@v5
63+
id: playwright-cache
64+
with:
65+
path: ~/.cache/ms-playwright
66+
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
67+
68+
- name: Install Playwright browsers
69+
if: steps.playwright-cache.outputs.cache-hit != 'true'
70+
run: npx playwright install --with-deps chromium
71+
72+
- name: Run playground e2e tests
73+
run: npm run test:playground:e2e
74+
75+
- name: Upload Playwright report
76+
if: always()
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: playground-playwright-report
80+
path: |
81+
playwright-report
82+
examples/playground/playwright-report
83+
test-results
84+
examples/playground/test-results
85+
if-no-files-found: ignore

examples/playground/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,29 @@ playground/
9999

100100
## Testing
101101

102-
See [testing.md](./testing.md) for a comprehensive guide on manually testing every feature.
102+
See [testing.md](./testing.md) for the source-of-truth test plan. The browser test suite is generated from it.
103+
104+
```bash
105+
# Regenerate the manifest + generated Playwright stubs after editing testing.md
106+
npm run sync:testing
107+
108+
# Verify generated artifacts are up to date
109+
npm run check:testing-sync
110+
111+
# Run the browser suite locally
112+
npm run test:e2e
113+
```
114+
115+
Generated files:
116+
117+
- `e2e/testing.manifest.json` — machine-readable scenario manifest parsed from `testing.md`
118+
- `e2e/generated/testing.generated.spec.ts` — auto-generated `test.fixme()` stubs for every documented scenario
119+
- `e2e/testing.coverage.json` / `e2e/testing.coverage.md` — implemented-vs-uncovered coverage reports
120+
- `e2e/manual/*.spec.ts` — hand-authored Playwright coverage for the most important flows
121+
122+
The browser test command also uses a smart dependency prepare step: it only rebuilds `agents`, `@cloudflare/ai-chat`, `@cloudflare/codemode`, and `@cloudflare/voice` when their source is newer than their built `dist/` output.
123+
124+
GitHub Actions runs the playground browser suite nightly, on manual dispatch, and on relevant pull requests.
103125

104126
## Configuration
105127

0 commit comments

Comments
 (0)