Testing
Blueprint uses Vitest for unit, integration tests and Playwright for end-to-end (E2E) tests.
Blueprint provides the @krakentech/blueprint-playwright package with utilities and helpers for writing Playwright tests. See the API reference for available functions.
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 the Foundation app. Make sure you're testing against the latest build of the app, then run all E2E tests. For example from the repo root with --filter=foundation, or from apps/foundation:
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:chromiumor
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 the Foundation app. For example: apps/foundation:
pnpm test