SPB Git

Repository Public

TESTING.md 7.7 KB 58 lines markdown

1# Testing23Results of the last full run are recorded in `IMPLEMENTATION_STATUS.md`. This file explains what each layer covers.45## Commands67```bash8pnpm typecheck        # tsc --noEmit, strict + noUncheckedIndexedAccess9pnpm lint             # eslint10pnpm test             # vitest — tests/*.test.ts (the media tests need ffmpeg and say so when they skip)11pnpm build            # production build12pnpm media:test-capsule && pnpm build:preview13pnpm leak-check       # unpublished content: scans both builds, then starts each and crawls it; client bundle scan14pnpm test:e2e         # Playwright, headless: public (8841), dev preview (8842), studio on a throw-away database (8843) + a real worker15pnpm secret-scan16pnpm clean-check      # no ignored/untracked source file; a `git archive HEAD` export type-checks on its own17pnpm audit            # dependencies18pnpm test:all         # everything above except the audit, in order19pnpm screenshots      # public pages → docs/screenshots/ ; studio captures are written by the studio spec to e2e/.tmp/studio/shots/20```2122Playwright starts and stops its three servers; the global setup starts the media worker and the teardown stops it by PID. Nothing opens a window. Media used by the tests are generated by ffmpeg at run time and never committed.2324## Unit and integration tests (`tests/`)2526| File | Covers |27|---|---|28| `publication.test.ts`, `importer.test.ts`, `urls.test.ts`, `quiz.test.ts`, `progress.test.ts`, `search.test.ts`, `diagrams.test.ts`, `paths.test.ts`, `brand.test.ts` | Phases 1–3 (unchanged, except one fixture in `publication.test.ts`: media permission now follows the files a capsule names) |29| `studio-auth.test.ts` | migrations from an empty database (idempotent, forward-only, atomic, mismatch refused); roles; enrolment tokens (hashed, single live token, expiry); registration ceremony bound to the browser; sessions (hashing, expiry, idle, rotation, revocation, disabled editor); last-owner protection; challenge replay; lock-out surviving a restart; origin check; rate limiter; log redaction |30| `studio-publication.test.ts` | seeded studio = same public view as the snapshot; database never created by a public read; workflow and confirmation; drafts and private items unreachable (view, search index, sitemap, structured data); edits invisible until republished; private preview view; scheduling by time, cancellation; history, rollback, withdrawal, archive; media permission before/after publication; publication blockers; slug change → redirect; stale edits; public plan |31| `studio-sync.test.ts` | import diff (update, conflict, addition, removal), default keeps local, decisions, idempotence, never publishes, new sessions as drafts, tolerance of half-written sessions, solutions and symlinks never read, unreadable source |32| `studio-media.test.ts` | ladder (never upscales); chunk assembly in any order, per-piece and whole-file checksums, altered or misplaced pieces, on-disk damage, resume, duplicate detection, validation before sending, disguised files, sweep; resource versions; **with real ffmpeg**: toolchain detection and clear failure when missing, ffprobe validation, upload → queue → worker → HLS + MP4 + poster + thumbnails with the master untouched, silent source, captions, transcript, chapters, re-encode never rewriting published files |33| `studio-archive.test.ts` | zip and tar.gz forged in the test: traversal names, links and devices, bombs (ratio, sizes, entry count), lying headers, duplicates, encryption, pax long names |34| `studio-captions.test.ts` | WebVTT validation (12 refusal cases, warnings), language tags, transcript import, file-type detection, safe file names |35| `studio-jobs.test.ts` | queue state machine, atomic claim, back-off, permanent errors, cancellation, manual retry, recovery of dead workers, heartbeat; worker loop with bounded concurrency, cancel while running, graceful stop |36| `studio-ops.test.ts` | backup → restore drill into an empty directory (same public view, audit and history), full backup, tamper detection, existing database protected, newer backup refused, retention; export without credentials; health states; storage; link and integrity checker |37| `studio-slides.test.ts` | deck structure from sources (labels, kinds, notes skipped), page text cleaning, page → slide mapping incl. the « never guess identifiers » fallback; local resume state; **with poppler**, on hand-made PDFs: build of both themes, determinism, skipped sessions, pack import and tampered packs, slides-only publication (state, counts, search, deep links), refusal to publish more, unpublish, deck replacement; speaker notes absent everywhere; **with the real repository when present**: S01 has one slide per PDF page, every content frame identified, no note phrase in the deck |38| `markdown.test.ts` | XSS probes, KaTeX, highlighting, tables, heading offset |3940## End-to-end (`e2e/`)4142| Spec | Projects | Covers |43|---|---|---|44| `journey`, `player`, `production`, `features`, `a11y`, `mobile` | chromium, webkit, firefox, mobile | Phases 2–3, unchanged except: `/admin` now redirects to the sign-in page (asserted) and the 404 page is tested on another address |45| `slides.spec.ts` | chromium, webkit, mobile | a fourth server (8844) with decks built by the global setup through the operator commands: honest states and counts; keyboard, « aller à », outline, overview, text version, copy link, presentation mode; deep links and local resume, cleared by « Effacer mes données locales »; theme following the site and toggled, images really rendered in Chromium and WebKit; search hit → slide; leaks (unpublished deck 404 by every address, absent from search and sitemap, no speaker note served); axe in both themes; 375 px: no overflow, 44 px targets, swipe |46| `studio.spec.ts` | studio (Chromium, virtual WebAuthn authenticator via CDP) | 25 serial tests: closed studio; invalid link; enrolment, cookie scope; sign-out, replay of a closed session, sign-in, foreign authenticator refused; dashboard health; import with a conflict, a new session, incomplete sessions, then the same source as an archive (no change); editing (fiche, Markdown with XSS probes, quiz with preview, glossary); upload of a disguised file (refused), of a synthetic video, encode by the worker, duplicate reuse; invalid then valid captions, timing preview, chapters; resource checks and replacement; private preview vs anonymous; publish → anonymous checks (page, video, captions, transcript search hit, sitemap, structured data, no cookie); licence + plan; edit → republish → rollback → withdraw with anonymous checks at each step; scheduling; tools and journal; author role; disabling an editor; negative security (anonymous, foreign origin, CSRF, replay, traversal, altered piece, rate limit); health details; axe on 14 screens + editors + a dialog in both themes; screenshots at 1440 px and 834 px with an overflow check |4748## What the tests do not prove4950- Real passkeys (Touch ID, iPhone, synced keys), real browsers other than headless Chromium for the studio.51- The production gateway: TLS, forwarded headers, body limits, caching, resumable uploads over a real unstable link.52- Real lecture-length or 4K video, encode times, storage and bandwidth figures.53- Real devices for playback of studio-produced streams (iPhone/iPad Safari).54- Concurrency of several editors on the same session beyond the revision check; several workers at once (the claim is atomic and unit-tested, never run with two processes).55- Screen readers (axe is automated rules only); performance; load.56- A scheduled publication actually reaching its due time on a running server (the time logic is unit-tested with explicit dates; e2e checks invisibility before the date and cancellation).57- The CI workflow (never executed) and the deployment.58
Files main
Menu

Theme