Skip to content

Latest commit

 

History

History
55 lines (29 loc) · 2.13 KB

Testing.md

File metadata and controls

55 lines (29 loc) · 2.13 KB

Testing

Unit

Testing makes use of Vitest which is a test runner much like Jest but integrates with the Vite tranformation pipeline and configuration. It provides a compatible api with Jest making it a drop in raplacement but runs significantly faster than Jest.

Run test

Initiating test runs and watching for changes is excuted using

pnpm test

However, you can bring up a visual console for testing using

pnpm test:ui

Test dashboard

The console can be accessed from the http://localhost They are also published to github pages at Coverage

Coverage Reports

Coverage reports are also generated and can be access from from within the testing console above. They are also published to Coverage Reports

API Mocking

MockServiceWorker or mswjs, is used to intercept API request and serve responses directly. This is utilised in a node testing environment (unit testing environment) using a node interceptor and in browser testing environment (end to end testing environment) using a service worker.

The mock data that was generated using Orval from the example field of the OpenAPI spec, is used to provision an instance of mswjs specifically used for unit testing.

Component

Storybook interactions is utilised to run a visual test on managed components. They are also published to StoryBook Reports

Smoke /E2E

Run test

End to end testing uses PlayWright

The primary reason for using this tool, is its ability to codegen tests which makes for far more efficient process for authoring end to end testing.

Initiating test runs and watching for changes is excuted using

pnpm e2e

However, you can bring up a visual console for testing using

pnpm e2e:ui

Visual reporting can be run using

pnpm e2e:report