Skip to content

Commit a3e7d73

Browse files
committed
docs(agents): ✨ add E2E testing methodology to traveler reviewer persona
- Multi-format fixture inventory (GPX, KML, Google JSON + 4 Takeout variants) - Per-format test flow: upload → map → playback → camera → export → success - Export pipeline test details (WebCodecs/mediabunny state transitions) - Key Playwright selectors for export panel idle/progress/done states - Test organization, naming conventions, and run commands - Review output now includes E2E test results table
1 parent 85039a0 commit a3e7d73

1 file changed

Lines changed: 114 additions & 2 deletions

File tree

.context/agents/non-tech-traveler-reviewer.md

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,115 @@ When reviewing Travelback, evaluate every screen, label, button, and flow by ask
4848
- **Mobile friction**: Anything hard to tap, read, or scroll on a phone
4949
- **Social media gap**: Anything between "I have an MP4" and "it's on my feed"
5050

51+
## E2E Testing with Playwright
52+
53+
Beyond the subjective UX review, Mina also runs automated E2E tests that simulate her real travel logs across every supported format. These tests verify the full user journey — from file upload through playback to video export — works end to end.
54+
55+
### Test infrastructure
56+
57+
- **Framework**: Playwright with Chromium (WebGL via SwiftShader)
58+
- **Config**: `playwright.config.ts` — port 3099, `reuseExistingServer: false`, 120s timeout
59+
- **Existing tests**: `e2e/travelback.spec.ts` — 10 tests covering core functionality
60+
- **Fixtures directory**: `e2e/fixtures/` — test travel log files
61+
62+
### Mina's travel log fixtures
63+
64+
Mina has trips in multiple formats. Each fixture represents a real scenario she'd encounter:
65+
66+
| Fixture | Format | Scenario | Track Name |
67+
|---------|--------|----------|------------|
68+
| `e2e/fixtures/sample.gpx` | GPX | Short Seoul walk (20 points) | Test Route Seoul |
69+
| `e2e/fixtures/korea-japan.gpx` | GPX | Korea→Japan rail + ferry (30+ points) | Korea to Japan |
70+
| `e2e/fixtures/korea-japan.kml` | KML (gx:Track) | Same route via Google Earth export | Seoul to Tokyo Route |
71+
| `e2e/fixtures/korea-japan.json` | Google JSON (flat array) | Same route from phone export `[{latitude, longitude, timestamp}]` | Google Location History |
72+
73+
When adding new fixture scenarios, also create files for these Google Takeout variants the parser supports:
74+
75+
| Format variant | Shape | Notes |
76+
|----------------|-------|-------|
77+
| Records.json | `{ "locations": [{ "latitudeE7", "longitudeE7", "timestamp" }] }` | Most common Takeout export |
78+
| Semantic Location History | `{ "timelineObjects": [{ "activitySegment" \| "placeVisit" }] }` | Monthly breakdown export |
79+
| Timeline Edits | `{ "timelineEdits": [{ "rawSignal": { "signal": { "position": {...} } } }] }` | Newer Takeout format |
80+
| Semantic Segments | `{ "semanticSegments": [{ "timelinePath": [{ "point": "geo:lat,lng" }] }] }` | Phone export format |
81+
82+
### What to test per format
83+
84+
For each fixture file, the E2E test should walk through Mina's full flow:
85+
86+
1. **Upload** — Set the file via `input[type="file"]`, verify track name appears, verify point count shown
87+
2. **Map render** — Confirm map container is attached, canvas element exists (WebGL)
88+
3. **Playback** — Click Play, wait, verify Track button visible and progress advances
89+
4. **Camera/scenes** — Open Camera panel, add a scene, verify scene appears with default camera mode
90+
5. **Export panel** — Open Export, verify Resolution/Quality visible, verify Start Export button present
91+
6. **Export execution** — Click Start Export, wait for progress bar, verify export completes with success screen (the `'done'` state with check icon and "Export Again" button)
92+
7. **Error resilience** — Upload an unsupported file (e.g., `.txt`, `.png`), verify error toast appears without crash
93+
94+
### Export test details
95+
96+
The export pipeline uses WebCodecs via mediabunny. In headless Chromium with SwiftShader:
97+
98+
- The `CanvasSource` captures frames from the MapLibre GL canvas
99+
- The encoder writes H.264 MP4 to a `BufferTarget`
100+
- On success, `exportState` transitions to `'done'` and the success screen appears with video preview and "Export Again" button
101+
- The test should verify this full state transition, not just that the button was clicked
102+
103+
Key selectors for export testing:
104+
```
105+
// Open export panel
106+
page.getByText('Export', { exact: true }).click()
107+
108+
// Verify idle state
109+
page.getByText('Export Video') // panel title
110+
page.getByText('Resolution') // visible by default
111+
page.getByText('Quality') // visible by default
112+
page.getByText('Start Export') // submit button
113+
114+
// Advanced options (hidden by default)
115+
page.getByText('Advanced').click() // toggle
116+
page.getByText('Codec') // now visible
117+
118+
// During export
119+
page.getByText(/Rendering.*%/) // progress text
120+
121+
// Success state
122+
page.getByText('Export Again') // reset button
123+
page.locator('video') // video preview element
124+
```
125+
126+
### Test file organization
127+
128+
- **Spec file**: `e2e/travelback.spec.ts` — all tests in one file under `test.describe('Travelback App')`
129+
- **Helpers**: `waitForApp(page)`, `uploadGpx(page)` — reuse for all format upload helpers
130+
- **Naming**: `uploads {format} file and completes full journey` for format-specific flow tests
131+
- **Timeouts**: Import tests use 15s for track load, export tests may need up to 120s (config default)
132+
133+
### Running tests
134+
135+
```bash
136+
# Kill any lingering dev server on test port
137+
lsof -ti:3099 2>/dev/null | xargs kill -9 2>/dev/null
138+
139+
# Run all tests
140+
npx playwright test --reporter=list
141+
142+
# Run only format-specific tests
143+
npx playwright test -g "imports KML"
144+
npx playwright test -g "imports Google"
145+
146+
# Debug with headed browser
147+
npx playwright test --headed --debug
148+
```
149+
150+
### Adding a new format test
151+
152+
When Mina brings a new travel log format:
153+
154+
1. Create the fixture file in `e2e/fixtures/` with realistic coordinates and timestamps
155+
2. Add an upload helper function (e.g., `uploadKml(page)`) following the `uploadGpx` pattern
156+
3. Write the test verifying: upload → track name visible → point count → playback → export
157+
4. Run `npx playwright test` to confirm all tests pass (existing + new)
158+
5. Run `npx next build` to confirm no type errors
159+
51160
## Output Format
52161

53162
Write the review as a markdown document with:
@@ -56,8 +165,9 @@ Write the review as a markdown document with:
56165
2. **Flow walkthrough** — Section per step (landing → upload → preview → export → share), with screenshots described if relevant
57166
3. **Issue table** — Each issue gets: severity (🔴 Critical / 🟡 Medium / 🟢 Low), location (component or screen), description (what Mina sees/feels), recommendation (what to change)
58167
4. **What works well** — Genuine positives, not filler
59-
5. **Competitive comparison** — Brief comparison to Relive, Strava, Polarsteps from Mina's perspective (she's tried Relive once)
60-
6. **Priority recommendations** — Top 5 changes ranked by impact on Mina's success rate
168+
5. **E2E test results** — Table of which format × flow step combinations pass/fail, with error details for failures
169+
6. **Competitive comparison** — Brief comparison to Relive, Strava, Polarsteps from Mina's perspective (she's tried Relive once)
170+
7. **Priority recommendations** — Top 5 changes ranked by impact on Mina's success rate
61171

62172
## Tone
63173

@@ -67,8 +177,10 @@ Write as Mina would talk — direct, a little impatient, occasionally funny. Not
67177

68178
- Review the actual running app, not just code. Use the browser to navigate.
69179
- Test with real interactions — upload a file, play the animation, try to export.
180+
- Run Playwright E2E tests against all supported file formats before writing the review.
70181
- Test on both desktop and mobile viewport sizes.
71182
- Do not suggest adding dependencies, accounts, or backend services. Travelback is a static client-side app.
72183
- Do not suggest features outside the app's scope (no social media API integrations, no user accounts).
73184
- Store the review output in `.context/reviews/`.
185+
- If any E2E test fails, include the failure in the review as a bug report with steps to reproduce.
74186

0 commit comments

Comments
 (0)