Skip to content

feat: e2e testing#86

Merged
PetrIvan merged 6 commits into
mainfrom
feature/e2e-testing
Jun 15, 2026
Merged

feat: e2e testing#86
PetrIvan merged 6 commits into
mainfrom
feature/e2e-testing

Conversation

@PetrIvan

Copy link
Copy Markdown
Owner

Add a test suite (Vitest + Playwright) and run it in CI

The app had no automated tests. This adds Vitest for the pure logic, Playwright smokes for the core flow, and a CI workflow that runs both on every PR.

What's in it:

  • Tooling - adds vitest, jsdom, @playwright/test, serve, and the matching npm scripts.
  • Refactor - extracts the WAV/MP3 encoders into a Tone-free audio_encoders.ts (so they're testable without mocking Tone) and adds a canonical Chord type shared by the store, export path, and fixtures.
  • Unit tests - audio encoders, MIDI I/O, transposition map, and the Zustand store.
  • E2E smokes - 3 Chromium tests that boot the app and check the core pages render and the edit/export flow works. Run against next dev locally and the real static export in CI.
  • CI - a Tests workflow with separate unit and e2e jobs sharing a composite setup action; the e2e job builds the export first, caches the browser, and uploads the report.

All green locally: tsc, eslint, Vitest (30/30), Playwright (3/3), npm run build, npm audit clean.

PetrIvan added 5 commits June 15, 2026 19:34
Add the test harness this repo previously lacked: Vitest 4 (with v8
coverage, jsdom) for unit and integration tests, Playwright for e2e
smokes, and a serve dev dependency used to host the static export during
e2e runs. Wire up the test, test:watch, test:coverage, test:e2e and
serve:out npm scripts, and ignore the Playwright report and result dirs.
Split the WAV/MP3/PCM encoders out of audio_render.tsx into a
dependency-free audio_encoders module so they can be unit tested without
pulling in Tone or the offline render path, removing the need to widen
audio_render's public surface for tests. Introduce one canonical Chord
type in src/state/chord.ts and consume it from the store and the export
pipeline, replacing the shape that was duplicated inline.
Cover the logic-heavy, pure parts of the app: transposition map
invariants, chordsToNoteEvents, the WAV/MP3 encoders, MIDI import and
export round-trips, and the store editing actions (add, delete, replace,
clear, deep-equal skip, undo and redo). Tone is stubbed where a module
loads it eagerly, and shared chord builders live under src/test.
Boot the app and assert the landing page links into the editor, the
toolbar renders, and exporting a .chseq file triggers a download. Kept
small and resilient: overlays are seeded off via localStorage, and in CI
the suite runs against the real static export rather than the dev server.
Add a Tests workflow that runs the Vitest unit tests and the Playwright
smokes on push to main and on pull requests. A composite action holds the
shared Node 22, npm 11 pin and npm ci setup so the two jobs do not drift,
and the e2e job builds the static export, caches the Playwright browser,
and builds before installing the browser so failures surface sooner.
Comment thread .github/workflows/test.yml Fixed
Comment thread .github/workflows/test.yml Fixed
CodeQL flagged the workflow for not limiting GITHUB_TOKEN scope. The jobs
only check out the repo and run tests, so contents: read is sufficient.
@PetrIvan PetrIvan merged commit b66f809 into main Jun 15, 2026
5 checks passed
@PetrIvan PetrIvan deleted the feature/e2e-testing branch June 15, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants