NJ Municipality Lookup
Codebase

Tests

End-to-end (E2E) tests using Playwright for browser-based acceptance testing.

Tests Directory

End-to-end (E2E) tests using Playwright for browser-based acceptance testing.

What This Directory Contains

This directory contains integration and E2E tests that run against the full application in a browser environment. These tests verify that features work correctly from a user's perspective.

Why Tests Are Organized This Way

The test suite is split across two locations for different purposes:

LocationTest TypePurpose
src/**/*.test.tsUnit testsCo-located with source, test individual functions
src/__tests__/Test utilitiesHelpers, fixtures, code quality checks
tests/e2e/E2E testsBrowser-based acceptance tests

Directory Structure

tests/
└── e2e/
    β”œβ”€β”€ acceptance.spec.ts      # Core user flow tests
    β”œβ”€β”€ accessibility.spec.ts   # WCAG compliance tests
    β”œβ”€β”€ edge-cases.spec.ts      # Error handling and edge cases
    β”œβ”€β”€ theme-toggle.spec.ts    # Dark mode functionality
    β”œβ”€β”€ global-setup.ts         # Playwright setup
    β”œβ”€β”€ fixtures/               # Test fixtures and mocks
    β”‚   └── api-mocks.ts        # API response mocks
    └── helpers/                # Test helper utilities
        └── form-interaction.ts # Form interaction helpers

How to Run Tests

All Tests

# Run unit + integration tests
bun test

# Run E2E tests
bun test:e2e

# Run everything
bun test && bun test:e2e

E2E Tests Only

# Run all E2E tests
bun test:e2e

# Run specific test file
bun test:e2e tests/e2e/acceptance.spec.ts

# Run in headed mode (see the browser)
bun test:e2e --headed

# Run with Playwright UI
bun test:e2e --ui

# Run specific browser
bun test:e2e --project=chromium
bun test:e2e --project=firefox
bun test:e2e --project=webkit

Unit Tests Only

# Run all unit tests
bun test

# Run domain tests
bun test src/domain

# Run adapter tests
bun test src/adapters

# Run with coverage
bun test:coverage

# Watch mode
bun test --watch

Test Coverage

The project maintains high test coverage:

LayerLine CoverageTarget
Domain100%100%
Adapters99.5%90%
Lib100%100%
Overall99.97%95%

Run coverage report:

bun test:coverage

On this page