Skip to content

Commit 8a793e3

Browse files
alexbastubaclaude
andcommitted
Widen the shipped-UI flow's network tripwire and pin the kept event
Reviewer findings on chunk 11: the tripwire only watched the sample-data host, so a request to any other origin would have passed; it now records every request off the preview origin. The kept correction is also asserted as matched before the retune orphans it, so both states are pinned. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent f3ef67e commit 8a793e3

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

‎tests/browser/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ the same ZIP reader as the Vitest bundle tests (`tests/export/zip-entries.ts`) a
7272
the reload finds 0 cards. It skips only when `dist/` is missing. The axe scan covers every step
7373
that renders (Videos, Maze, Track) and fails on `serious`/`critical` only; `KNOWN_VIOLATIONS` is
7474
**empty** since chunk 10b fixed the maze step's scroll container, so any serious or critical
75-
finding fails the run. It makes no network request: the results-only path never fetches, and a
76-
`page.route` tripwire on `raw.githubusercontent.com` fails the flow if anything tries; the fetch
75+
finding fails the run. It makes no network request: the results-only path never fetches, every
76+
request off the preview origin is recorded and fails the flow, and `raw.githubusercontent.com` is
77+
refused outright; the fetch
7778
verifier is covered offline in `tests/demo/fetch-sample-clip.test.ts`, and the one live check
7879
there is opt-in through `BARNESTRACK_NET_TEST=1` (D2).
7980

‎tests/browser/app-smoke.spec.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,16 @@ test.describe('the whole demo flow through the shipped UI', () => {
438438
test.skip(!distBuilt, 'no dist/ — run `npm run build` first');
439439

440440
test('load, review, correct, retune, export, reload', async ({ page }) => {
441-
// The results-only path makes no request at all (D2, D33). The route is a
442-
// tripwire, not a stub: anything reaching the sample-data repository is
443-
// recorded and fails the run below.
441+
// The results-only path makes no request off the page's own origin (D2,
442+
// D33). Every other request is recorded and fails the run below; the
443+
// sample-data repository is also refused outright, so a regression cannot
444+
// download three clips before the assertion catches it.
444445
const networkRequests: string[] = [];
445-
await page.route('https://raw.githubusercontent.com/**', (route) => {
446-
networkRequests.push(route.request().url());
447-
return route.abort();
446+
page.on('request', (request) => {
447+
const url = request.url();
448+
if (!url.startsWith(PREVIEW_URL) && !/^(data|blob):/.test(url)) networkRequests.push(url);
448449
});
450+
await page.route('https://raw.githubusercontent.com/**', (route) => route.abort());
449451
await page.goto(PREVIEW_URL);
450452
await expect(page.getByRole('heading', { name: 'BarnesTrack' })).toBeVisible();
451453
await clearStoredSession(page);
@@ -494,6 +496,9 @@ test.describe('the whole demo flow through the shipped UI', () => {
494496
await page.keyboard.press('k');
495497
await expect(corrections).toHaveCount(correctionsBefore + 1);
496498
await expect(corrections.last()).toContainText('confirmed by the user, no change');
499+
// Matched to its automatic event under the parameters it was made with; the
500+
// retune below orphans it, and the reload check compares that state.
501+
await expect(corrections.last()).not.toContainText('no longer matches');
497502
const keptEvent = /Event (\S+) confirmed by the user/.exec((await corrections.last().textContent()) ?? '')?.[1];
498503
expect(keptEvent).toBeDefined();
499504
console.log(`shipped UI: kept ${keptEvent} with K; corrections ${correctionsBefore} → ${correctionsBefore + 1}`);

0 commit comments

Comments
 (0)