test(audio): Playwright E2E (3 tests, skip-if-no-browser) + client robustness

E2E asserts in a real headless Chromium: white_noise loads the noise asset,
soundtrack loads the current scale's asset, and Visual=off fades video while
audio keeps playing. Driving it out surfaced + fixed three client issues:
- fadeVolume uses setInterval (rAF stalls when the tab is backgrounded)
- start gesture drops srcless priming (a click grants Chrome autoplay
  document-wide; priming empty <audio> only hung the handler / polluted state)
- applyAudio doesn't await play() (awaiting a srcless/buffering play can hang)
pyproject: [e2e] optional dep (pytest-playwright). Full suite 288 passed, 2 skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BenStullsBets
2026-06-26 08:00:44 -07:00
parent fd0aad6610
commit c07067492b
3 changed files with 120 additions and 12 deletions
+6
View File
@@ -24,3 +24,9 @@ sim = [
"uvicorn[standard]>=0.29",
"httpx>=0.27",
]
# Playwright E2E browser tests (audio spec §9). Install with the browser binary:
# pip install -e '.[e2e]' && python -m playwright install chromium
# The E2E suite skips cleanly when Playwright/Chromium is absent (headless box).
e2e = [
"pytest-playwright>=0.4",
]