Testing
Parallax Designer uses layered tests to protect behavior that is easy to break and hard to catch manually.
Why These Tests Exist
The test strategy is intentionally risk-driven:
- keep core logic regressions out of production (
schema, presets, export formatting) - protect cross-module behavior that manual QA misses (
useProjectIO,useLayerAssets, state mutation flows) - validate only critical end-user browser journeys with E2E (not exhaustive UI permutations)
This avoids shallow “test for coverage only” suites and keeps maintenance cost proportional to risk.
Current Test Layers
Unit
Unit tests focus on pure logic with no Vue runtime mounting.
Current unit scope:
schemavalidation and normalization- project defaults and preset application behavior
- export payload generation
- numeric constraint clamping
- background CSS composition
- local asset reference parsing
Integration (Phase One)
Integration tests focus on composable boundaries and local persistence behavior:
useProjectStatelayer mutation and ordering invariantsuseProjectIOimport/preset flowsuseLayerAssetsupload/delete/resolve behavior with IndexedDB
E2E (Phase Two)
Playwright covers critical browser-level journeys only:
- panel toggle via keyboard shortcut (
H) - layer lifecycle smoke (add, duplicate, visibility, delete)
- preset apply confirmation and undo action flow
- JSON import modal (invalid + valid paste path)
- export guard when layer count is below minimum
- clear local data confirmation and starter reset flow
These are the minimum browser-level checks that exercise real user-critical outcomes.
Testing Philosophy
Tests should validate behavior and invariants, not just implementation details.
A useful unit test in this project should:
- assert a real product rule (for example, layer trimming at max layer count)
- fail if behavior regresses in production
- avoid brittle assertions tied to incidental formatting or ordering
Run Tests
Unit tests:
npm run test:unitUnit watch mode:
npm run test:unit:watchIntegration tests:
npm run test:integrationIntegration watch mode:
npm run test:integration:watchE2E tests:
npm run test:e2eE2E in headed mode:
npm run test:e2e:headedDefault test alias (currently unit only):
npm testCI Status
Current GitHub Pages deploy workflow runs npm run check (i18n + docs sync + type-check), then builds app + docs.
Test commands are available and documented, but merge/deploy gating for tests is still pending CI policy decisions.
Test Layout
Tests are stored under:
tests/Current layout:
tests/unit/core/
tests/integration/
tests/e2e/Coverage Goals (Practical)
Coverage percentage alone is not the goal. Prioritize tests that lock down:
- schema compatibility and normalization safety
- preset behavior across
replaceandkeepstrategies - export correctness for JSON/runtime HTML outputs
- deterministic helper behavior used across the app
- composable + persistence boundaries that span multiple modules
Add a New Unit Test
- Identify a user-visible rule or invariant.
- Write a test that fails without the intended behavior.
- Keep fixtures small and explicit.
- Assert outcomes, not internal implementation noise.
Related Commands
npm run check:i18nvalidates translation key parity.npm run typecheckruns TypeScript + Vue SFC type checks.npm run buildbuilds the app bundle.npm run check:docs-syncvalidates documentation/source synchronization checks.npm run checkruns i18n + docs-sync + type-check validation.npm run verifyrunscheck+ unit/integration tests + app/docs builds.