Skip to main content

Test coverage and evidence

This page is the living coverage register for snappycart.

It is intended for two audiences:

  • contributors, who need to understand what is already covered and where to add new tests
  • package users, who want confidence that the core cart contract and UI flows are already exercised by automated tests

This page is not a replacement for the test strategy, state transition matrix, or decision tables.

It answers a different question:

what is currently covered, by which framework, where is the test, and where is the execution evidence?

Why this page exists

snappycart uses multiple testing layers and multiple tools:

  • Vitest for unit and integration-style library tests
  • Cypress for component tests and demo-level browser tests
  • Playwright for component tests and end-to-end smoke tests

Some coverage is intentionally duplicated across Cypress and Playwright.

That duplication is acceptable when it improves confidence at different layers or validates the same behaviour through different test runners.

How to use this page

Each row in the tables below represents a coverage entry.

Contributors should update this page when they:

  • add a new automated test
  • replace one framework with another
  • add a new browser-level flow
  • upload a new video walkthrough for an existing automated test

Required fields for each coverage entry

Every coverage row should include:

  • Status
  • Area
  • Level
  • Framework
  • What is covered
  • GitHub test link
  • Video evidence link
  • Notes

Status legend

StatusMeaning
ConfirmedTest exists in the repository and is linked below
PartialCoverage exists, but the flow is only partially validated
PlannedIntended coverage, but no committed automated test yet
DeprecatedHistorical entry kept for reference but no longer current

Coverage model

The tables are grouped by testing level:

  • unit
  • integration
  • component
  • end-to-end

Frameworks are listed separately even when they overlap.

That is intentional.

The point of this page is not to hide duplication. The point is to make duplication visible and understandable.


Unit and integration coverage

These tests validate core cart behaviour inside the package itself.

Vitest coverage

For the canonical Vitest inventory and test IDs, read Vitest Testing.

Vitest unit coverage

Test IDStatusAreaLevelFrameworkWhat is coveredGitHub test linkMatrix referenceNotes
VT-01ConfirmedCart reducerUnitVitestadd new itemcartReducer.test.tsVT-01Confirms a new cart line is inserted with the expected quantity and values
VT-02ConfirmedCart reducerUnitVitestadd existing item and merge quantitycartReducer.test.tsVT-02Confirms duplicate adds increase quantity instead of creating a second line
VT-03ConfirmedCart reducerUnitVitestadd item with invalid quantity and normalise itcartReducer.test.tsVT-03Confirms invalid quantity input is normalised to a safe stored value
VT-04ConfirmedCart reducerUnitVitestadd item with decimal quantity and floor itcartReducer.test.tsVT-04Confirms decimal quantity is normalised before storage
VT-05ConfirmedCart reducerUnitVitestremove itemcartReducer.test.tsVT-05Confirms the matching reducer line is removed
VT-06ConfirmedCart reducerUnitVitestincrement itemcartReducer.test.tsVT-06Confirms quantity increases by one
VT-07ConfirmedCart reducerUnitVitestdecrement item above onecartReducer.test.tsVT-07Confirms quantity decreases without removing the line
VT-08ConfirmedCart reducerUnitVitestdecrement item from one and remove the linecartReducer.test.tsVT-08Confirms the item is removed when decrement reaches the removal boundary
VT-09ConfirmedCart reducerUnitVitestset positive quantitycartReducer.test.tsVT-09Confirms quantity updates directly to the requested value
VT-10ConfirmedCart reducerUnitVitestset decimal quantity and floor itcartReducer.test.tsVT-10Confirms decimal quantity is normalised before storage
VT-11ConfirmedCart reducerUnitVitestset quantity to zero and remove the linecartReducer.test.tsVT-11Confirms zero quantity removes the line from state
VT-12ConfirmedCart reducerUnitVitestset negative quantity and remove the linecartReducer.test.tsVT-12Confirms invalid negative quantity does not remain in state
VT-13ConfirmedCart reducerUnitVitestclear cartcartReducer.test.tsVT-13Confirms reducer state resets to an empty cart
VT-14ConfirmedCart reducerUnitVitestcalculate total itemscartReducer.test.tsVT-14Confirms derived total item count is correct
VT-15ConfirmedCart reducerUnitVitestcalculate subtotalcartReducer.test.tsVT-15Confirms derived subtotal is correct

Vitest integration coverage

Test IDStatusAreaLevelFrameworkWhat is coveredGitHub test linkMatrix referenceNotes
VT-16ConfirmedCart provider and hook contractIntegrationVitestthrows outside providerCartProvider.test.tsxVT-16Confirms useCart throws when used outside CartProvider
VT-17ConfirmedCart provider and hook contractIntegrationVitestexposes empty initial stateCartProvider.test.tsxVT-17Confirms the default empty cart contract on first render
VT-18ConfirmedCart provider and hook contractIntegrationVitestadd item updates items, totalItems, and subtotalCartProvider.test.tsxVT-18Validates provider state update through hook usage
VT-19ConfirmedCart provider and hook contractIntegrationVitestremove item updates derived valuesCartProvider.test.tsxVT-19Confirms line removal updates totals correctly
VT-20ConfirmedCart provider and hook contractIntegrationVitestincrement and decrement update derived valuesCartProvider.test.tsxVT-20Covers quantity mutation path and keeps derived values in sync
VT-21ConfirmedCart provider and hook contractIntegrationVitestclear resets stateCartProvider.test.tsxVT-21Confirms full cart reset
VT-22ConfirmedCart provider and hook contractIntegrationVitestadd item with explicit quantityCartProvider.test.tsxVT-22Additional integration scenario covering explicit quantity input

Guidance for contributors

Use this section for:

  • cart reducer logic
  • provider and hook behaviour
  • derived totals
  • safe handling of cart mutations inside the library

If the change is purely internal and does not require a browser, this is usually the cheapest layer.

Component coverage

These tests validate library components in an interactive browser-like environment.

Cypress component coverage

Cypress component testing video evidence

Shared execution video for the full Cypress Component Testing run covering CT-01 to CT-24.

Cypress component coverage table

StatusAreaLevelFrameworkWhat is coveredGitHub test linkVideo evidence linkMatrix referenceWhat this test confirms
ConfirmedCartDrawerComponentCypressdrawer does not render when closedCartDrawer.cy.tsxCT-1 videoCT-01Confirms that the drawer stays absent from the DOM when mounted in the closed state
ConfirmedCartDrawerComponentCypressempty state renders when open with no itemsCartDrawer.cy.tsxCT-2 videoCT-02Validates the empty drawer output when the drawer is opened with no cart items
ConfirmedCartDrawerComponentCypressclose button receives focus on openCartDrawer.cy.tsxCT-03 videoCT-03Confirms initial focus placement on the close button for accessibility and keyboard usability
ConfirmedCartDrawerComponentCypressEscape triggers onCloseCartDrawer.cy.tsxCT-04 videoCT-04Confirms that pressing Escape requests the drawer to close
ConfirmedCartDrawerComponentCypressoverlay click triggers onCloseCartDrawer.cy.tsxCT-05 videoCT-05Confirms that clicking the overlay requests the drawer to close
ConfirmedCartIconComponentCypressempty badge behaviour matches the current cart stateCartIcon.cy.tsxCT-06 videoCT-06Validates the empty cart badge state without relying on CSS selectors
ConfirmedCartIconComponentCypressbadge updates to 1 when the cart has one itemCartIcon.cy.tsxCT-07 videoCT-07Confirms the single-item badge transition
ConfirmedCartIconComponentCypressbadge reflects the total item count when the cart has multiple itemsCartIcon.cy.tsxCT-08 videoCT-08Confirms total quantity rendering rather than distinct line count
ConfirmedCartIcon + CartDrawer integrationComponentCypressclicking the cart icon opens the empty drawer stateCartIntegration.cy.tsxCT-09 videoCT-09Confirms that clicking the cart entry point opens the drawer in its empty state
ConfirmedCartIcon + CartDrawer + CartProviderComponentCypressadding the first item updates the badge and drawer title countCartIntegration.cy.tsxCT-10 videoCT-10Confirms that the first seeded item transitions the cart from empty to non-empty and updates both the badge and drawer count
ConfirmedCartDrawer + CartProviderComponentCypresspopulated row is shown after seeding the first itemCartDrawer.cy.tsxCT-11 videoCT-11Confirms that the first seeded item is rendered as a visible cart row with quantity 1
ConfirmedCartDrawer + CartProviderComponentCypressincrementing quantity from 1 to 2 updates the subtotalCartDrawer.cy.tsxCT-12 videoCT-12Confirms quantity growth and immediate subtotal recalculation after increment
ConfirmedCartDrawer + CartProviderComponentCypressdecrementing quantity from 2 to 1 updates the subtotalCartDrawer.cy.tsxCT-13 videoCT-13Confirms quantity reduction and immediate subtotal recalculation after decrement
ConfirmedCartDrawer + CartProviderComponentCypressdecrementing at quantity 1 removes the item and returns the cart to the empty stateCartDrawer.cy.tsxCT-14 videoCT-14Confirms the single-item decrement-to-empty transition
ConfirmedCartDrawer + CartProviderComponentCypressclicking remove deletes the item and returns the cart to the empty stateCartDrawer.cy.tsxCT-15 videoCT-15Confirms explicit item removal and empty-state rendering
ConfirmedCartDrawer + CartProviderComponentCypressmultiple distinct items render as separate rows and subtotal matches their combined valueCartDrawer.cy.tsxCT-16 videoCT-16Confirms multi-item row rendering and subtotal aggregation
ConfirmedCartDrawer + CartProviderComponentCypressremoving one item leaves the remaining item visible and recalculates subtotalCartDrawer.cy.tsxCT-17 videoCT-17Confirms partial removal without losing the rest of the cart state
ConfirmedCartDrawer + CartProviderComponentCypressremoving the last remaining item returns the cart to the empty stateCartDrawer.cy.tsxCT-18 videoCT-18Confirms the final-item removal transition back to an empty cart
ConfirmedCartDrawer + CartProviderComponentCypressclicking clear empties the cart and removes all rendered rowsCartDrawer.cy.tsxCT-19 videoCT-19Confirms the bulk clear action resets the drawer to its empty state
ConfirmedCartDrawer + CartProviderComponentCypresssubtotal recalculates immediately after increment and decrement actionsCartDrawer.cy.tsxCT-20 videoCT-20Confirms subtotal consistency across rapid quantity changes
ConfirmedCartDrawer + CartProviderComponentCypressclosing and reopening the drawer preserves the same items, quantities, and subtotalCartDrawer.cy.tsxCT-21 videoCT-21Confirms drawer visibility changes do not reset cart state
ConfirmedCartIcon + CartDrawer + CartProviderComponentCypressclosing the drawer preserves the current cart stateCartIntegration.cy.tsxCT-22 videoCT-22Confirms that the drawer can close without clearing the cart and that the badge still reflects the current item count
ConfirmedCartDrawer + CartProviderComponentCypressvisible product metadata renders correctly for a representative productCartDrawer.cy.tsxCT-23 videoCT-23Confirms that a seeded product is rendered with visible metadata in the drawer, including its product name
ConfirmedCartDrawer + CartProviderComponentCypressthe UI stays in sync across increment, decrement, and remove actionsCartDrawer.cy.tsxCT-24 videoCT-24Confirms that repeated cart interactions keep rows, quantities, and subtotal consistent after each transition

Playwright component coverage

StatusAreaLevelFrameworkWhat is coveredGitHub test linkVideo evidence linkNotes
ConfirmedCartDrawerComponentPlaywright CTclicking Close triggers onCloseCartDrawer.pw.spec.tsxAdd Drive or YouTube linkConfirms callback wiring in Playwright component runner

Guidance for contributors

Use this section for:

  • component visibility
  • focus behaviour
  • keyboard handling
  • overlay behaviour
  • callback wiring
  • visual browser-level interactions that do not require full app navigation

If the same component rule is covered in both Cypress and Playwright, keep both rows.

That overlap should be visible, not hidden.


End-to-end coverage

These tests validate demo-level user flows through the running application.

Cypress end-to-end coverage

Cypress E2E testing video evidence

Shared execution video for the Cypress end-to-end test run.

Cypress end-to-end coverage table

StatusAreaLevelFrameworkWhat is coveredGitHub test linkVideo evidence linkNotes
ConfirmedDemo cart smokeE2ECypressadd item from demo and show it in drawerdemo-cart.cy.tsAdd Drive or YouTube linkDemo-level add-to-cart smoke
ConfirmedDemo cart smokeE2ECypressincrement and decrement quantity from drawerdemo-cart.cy.tsAdd Drive or YouTube linkQuantity mutation flow
ConfirmedDemo cart smokeE2ECypressremove item from drawerdemo-cart.cy.tsAdd Drive or YouTube linkRemove line flow
ConfirmedDemo cart smokeE2ECypressclear cart after starter setdemo-cart.cy.tsAdd Drive or YouTube linkBulk reset flow

Playwright end-to-end coverage

StatusAreaLevelFrameworkWhat is coveredGitHub test linkVideo evidence linkNotes
ConfirmedDemo cart smokeE2EPlaywrightadd item to cart and verify it appears in drawercart-add-item.spec.tsAdd Drive or YouTube linkAdd item, badge update, drawer visibility
ConfirmedDrawer smokeE2EPlaywrightdrawer opens and closes in the democart-drawer-open-close.spec.tsAdd Drive or YouTube linkFocused drawer visibility flow

Guidance for contributors

Use this section for:

  • smoke flows through the demo app
  • top-level user actions
  • browser behaviour that depends on real navigation and mounted UI

Cypress and Playwright may overlap here.

That is acceptable when:

  • one runner acts as the main regression smoke
  • the second runner validates the same flow from another browser toolchain
  • the project is comparing or migrating runners over time

Duplicate coverage policy

Overlap between Cypress and Playwright is allowed when it is intentional.

Typical valid reasons include:

  • validating the same critical flow in two different browser runners
  • comparing reliability during framework migration
  • keeping one smoke path in each tool while broader coverage is still evolving

Overlap becomes a problem only when it creates maintenance cost without adding confidence.

Contributors should avoid blind duplication.

When adding a new row, ask:

  • does this duplicate an existing flow exactly
  • does the second runner add confidence that the first does not
  • is this duplication temporary, strategic, or accidental

If the duplication is intentional, say so in the Notes column.


Video evidence policy

Each browser-level test entry should ideally include a short execution video.

Recommended workflow:

  1. contributor records the automated test execution
  2. contributor uploads the video to the agreed shared drive
  3. maintainer publishes or mirrors the final version to YouTube if needed
  4. this table is updated with a stable video link

Preferred video format

  • short and focused
  • one test flow per video where possible
  • no unnecessary narration required
  • stable viewport
  • clear visible assertions
  • either Drive or YouTube link is acceptable

Where video evidence is most useful

Video evidence is most valuable for:

  • component tests with visible interaction
  • end-to-end flows
  • UI regressions
  • onboarding new contributors to expected behaviour

Video evidence is optional for pure library-level unit tests, unless a maintainer specifically wants a visual walkthrough.


How contributors should update this page

When you add a new automated test:

  1. add the test file to the repository
  2. commit and push the test normally
  3. add a new row to the correct table in this page
  4. link the exact GitHub test file
  5. add a Drive or YouTube link if video evidence exists
  6. describe the covered behaviour in one short sentence
  7. mark overlap clearly if the same flow already exists in another framework

How package users should read this page

Package users do not need to read every test file.

This page gives a high-level confidence map:

  • what the package already tests
  • which framework covers each area
  • where the source test lives
  • where to find visual evidence of the flow

It should be read together with:

  • the cart testing plan
  • the cart state transition matrix
  • the cart decision tables

The current coverage register can be expanded over time with:

  • broader component coverage for CartIcon and CartDrawer integration flows
  • more unit coverage for reducer-only logic
  • CI report artifact links
  • coverage percentage badges
  • links to generated HTML reports if the project publishes them

Summary

snappycart uses multiple testing layers and multiple frameworks.

This page exists to make that coverage visible.

It is a living register of:

  • what is covered
  • how it is covered
  • where the test lives
  • where the execution evidence can be inspected