mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 17:49:07 -05:00
Verifies the 68f2ca466 restructure actually works in a browser.
Previously committed without runtime validation; this closes that gap.
Smoke test coverage (tests/practice-smoke.spec.ts):
1. Layout landmarks render without console/pageerror — sticky
Your-task callout, scenario prose, textarea in LEFT column,
Reveal button directly below, Stuck-nudge, Tools panel header.
2. Submit-gradient safeguard fires on low-effort reveal
(<50 chars typed, clicked immediately). Verifies the
Think-longer? modal appears with Keep-thinking + Reveal-anyway
buttons, and that Keep-thinking returns to pre-reveal.
3. Substantive answer (>80 chars) bypasses the guard and
transitions straight to post-reveal with Model Answer visible
and self-assessment buttons ready.
Runtime fix:
- analytics.ts: add 'think_guard_triggered' to AnalyticsEvent union.
The restructure commit fired this event but the type union didn't
carry it, so tsc --noEmit failed. No behavior change beyond the
compile fix — existing consumers (Cloudflare analytics worker)
ignore unknown types gracefully.
Build hygiene:
- staffml/.gitignore: ignore test-results/ and playwright-report/
(per-run artifacts — screenshots, videos, traces on failure).
The tests/ directory itself IS committed.
- playwright.config.ts: baseURL http://localhost:3000, single-worker
serial execution, no retries, traces/screenshots/video on failure.
How to run:
npx next dev & # dev server in one shell
npx playwright test tests/practice-smoke # tests in another
All three tests pass against the dev server (chromium, 4.7s total).
30 lines
791 B
TypeScript
30 lines
791 B
TypeScript
import { defineConfig } from "@playwright/test";
|
|
|
|
/**
|
|
* Playwright config for StaffML smoke tests.
|
|
*
|
|
* The Next.js dev server is started out-of-band so we control its
|
|
* lifecycle and don't pay the dev-server boot cost on every test
|
|
* run. Invoke:
|
|
*
|
|
* npx next dev & # in one terminal
|
|
* npx playwright test tests/practice-smoke # in another
|
|
*
|
|
* For CI / one-shot runs, pass --webServer on the command line to
|
|
* launch the dev server inline.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: "./tests",
|
|
timeout: 30_000,
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
retries: 0,
|
|
reporter: [["list"]],
|
|
use: {
|
|
baseURL: "http://localhost:3000",
|
|
trace: "retain-on-failure",
|
|
screenshot: "only-on-failure",
|
|
video: "retain-on-failure",
|
|
},
|
|
});
|