Skip to content

Testing

Erin Hoops edited this page Jul 12, 2024 · 5 revisions

E2E tests

We are using playwright for end to end testing.

To run all e2e tests

cd packages/data-portal
pnpm run e2e

To run e2e tests in a specific file

cd packages/data-portal
npx playwright test e2e/metadataDrawer.test.ts

Test file structure

- newFeature.test.ts
- page-objects
  - newFeature
    - new-feature-page.ts
    - new-feature-aggregators.ts (optional)
    - types.ts
    - utils.ts

newFeature.test.ts - this is where the test cases live. Each test should be easy to read.

page-objects - this directory contains all of the helpers related to each set of tests.

new-feature-page.ts - this is a page object that contains all of the steps of a test that interact with the page.

new-feature-aggregators.ts (optional) - this file contains helper functions that have multiple steps. Adding this layer allows the tests to stay readable. It removes duplication that is not relevant for someone reading the test file.

types.ts - test-specific types

utils.ts - contains helpers that are not specific to interacting with the page. For example, for fetching data.

Clone this wiki locally