Skip to main content

Overview

Blueprint uses Vitest for unit, integration tests and Playwright for end-to-end (E2E) tests.

Identifying Test Files

Test files in Blueprint are identified by the .spec.ts or .spec.tsx file extensions.

Test Suite Structure

The Blueprint test suites consist of the following:

  • End-to-end (E2E) tests
  • Unit tests
  • Integration tests

End-to-End Tests

End-to-end testing differs from unit testing, as it focuses on testing the entire application workflow from start to finish to ensure that it behaves as expected. Blueprint uses Playwright to run E2E tests. It supports all modern rendering engines including Chromium, WebKit, and Firefox. For more details on Playwright configurations, refer to the Playwright documentation. These tests are located in the /src/test/playwright folder.

Running End-to-End Tests

You can run the E2E tests using the following commands inside any of the Blueprint apps. Make sure you're testing against the latest build of the app, then run all E2E tests. For example: apps/gb-energy-consumer-site:

Build the app and run all E2E tests:

# Option 1: Build and test in one step
pnpm test:e2e:with-build

or

# Option 2: Build and test in two steps
pnpm build
# Starts the server and run the tests
pnpm test:e2e
  • Run E2E tests in Chromium only:

    pnpm build
    pnpm test:e2e:chromium

    or

    pnpm test:e2e:chromium:with-build

Debugging End-to-End Tests

To debug the E2E tests, add the --debug flag to the run command. For example:

pnpm test:e2e --debug

Unit and Integration Tests

Unit and integration tests are located in the /src/tests folder. These test files have the .spec.ts or .spec.tsx extensions.

Running Unit and Integration Tests

You can run all unit and integration tests (excluding Playwright tests) using the following command inside any of the Blueprint apps. For example: apps/gb-energy-consumer-site:

pnpm test