Skip to content

test: integration test for capture → compare pipeline #35

@tom-bot-for-rana

Description

@tom-bot-for-rana

Problem

capture-routes.test.js mocks Playwright entirely and only tests the capture module in isolation. There are zero tests that run the full capture → compare → stage pipeline, even with a tiny synthetic fixture. Interface mismatches between modules (e.g. a field rename in the results JSON) would not be caught by unit tests.

Proposed fix

Add one integration test that exercises the full data flow using pre-built PNG fixtures (no live browser needed):

  1. Write a minimal snapdrift.json config with 1–2 routes
  2. Place small pre-built PNG files in the expected screenshots/ location (bypassing Playwright entirely)
  3. Run generateDriftReport() directly against the fixture screenshots
  4. Assert that the output visual-diff-summary.json has the correct shape and values
  5. Optionally stage the bundle and verify the artifact structure

This tests the compare-resultsstage-artifacts interface without needing a running browser.

Scope

  • New tests/integration/capture-compare-pipeline.test.js
  • Small PNG fixture files in tests/fixtures/

Effort

Medium — requires PNG fixture generation and careful test setup, but no new lib code needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions