This repository contains the end-to-end tests for the DCS (Digital Case System) using Playwright.
- Getting Started
- Usage
- Project Structure
- Configuration
- Fixtures
- Page Object Model
- Visual Testing
- CI/CD
- Contributing
- License
-
Clone the repository:
git clone https://github.com/hmcts/dcs-e2e-tests.git cd dcs-e2e-tests -
Install dependencies:
yarn install
-
Install Playwright browsers:
yarn setup
The following scripts are available to run the tests:
- Run all tests (except a11y, performance, and visual) in Chrome:
yarn test:chrome
- Run all tests (except a11y, performance, and visual) in Firefox:
yarn test:firefox
- Run all tests (except a11y, performance, and visual) in WebKit:
yarn test:webkit
- Run all tests (except a11y, performance, and visual) in Edge:
yarn test:edge
- Run all tests (except a11y, performance, and visual) in Tablet Chrome:
yarn test:tabletchrome
- Run all tests (except a11y, performance, and visual) in Tablet WebKit:
yarn test:tabletwebkit
- Run accessibility tests:
yarn test:a11y
- Run visual tests:
yarn test:visual
To update the visual snapshots, run:
yarn test:update-snapshotsdcs-e2e-tests/
├── playwright-e2e/
│ ├── fixtures.ts
│ ├── global.setup.ts
│ ├── global.teardown.ts
│ ├── page-objects/
│ ├── snapshots/
│ ├── tests/
│ └── utils/
├── playwright.config.ts
├── package.json
└── README.md
playwright-e2e/: Contains all the Playwright test-related files.fixtures.ts: Global fixtures for the tests.global.setup.ts: Global setup for the tests.global.teardown.ts: Global teardown for the tests.page-objects/: Contains the Page Object Model files.snapshots/: Stores the visual regression snapshots.tests/: Contains the test files.utils/: Contains utility functions.
playwright.config.ts: Playwright configuration file.package.json: Project dependencies and scripts.README.md: This file.
The main configuration for Playwright is in playwright.config.ts. This file extends the common configuration from @hmcts/playwright-common.
Environment-specific variables are managed through .env files. An example can be found in .env.example.
This project uses Playwright fixtures to set up and tear down the test environment. The global fixtures are defined in playwright-e2e/fixtures.ts.
The project follows the Page Object Model (POM) design pattern. The page objects are located in the playwright-e2e/page-objects/ directory.
Visual regression testing is set up to catch unintended UI changes. The tests are tagged with @visual and can be run with yarn test:visual.
Snapshots are stored in the playwright-e2e/snapshots/ directory.
The project uses Jenkins for Continuous Integration and Continuous Delivery. The Jenkinsfiles (Jenkinsfile_CNP, Jenkinsfile_nightly, Jenkinsfile_nightly_parallel) are located in the root of the repository.
Please refer to the CODEOWNERS file for information on who to contact for reviews.
This project is licensed under the MIT License. See the LICENSE file for details.