Skip to content

This repository contains playwright end to end tests for the LAA Crime Forms suite of applications.

License

Notifications You must be signed in to change notification settings

ministryofjustice/nsm-e2e-test

Repository files navigation

NSM End-to-End Tests

repo standards badge

This repository contains end-to-end tests to cover the LAA crime forms project, using Playwright. The LAA crimes forms cover, at time of writing, the old CRM4 (prior authority applications) and CRM7 (Non-standard magistrates fee claims) forms from e-Forms. The tests perform end-to-end testing from the provider-side submission application to the, intermediate data repository (application store) and the caseworker-side assessment application.

Prerequisites

  • Node.js
  • Playwright

Installation

First, clone the repository:

git clone https://github.com/username/nsm-e2e.git

Then, navigate to the project directory and install the dependencies:

cd nsm-e2e
npx playwright install
npm install

Running the tests

You can run the tests using the following command:

npm run e2e-test

To run the tests with UI, use:

npm run e2e-test:ui

Record a test

To record a new test for a caseworker, use:

npm run e2e-test-record:caseworker

This will open the dev env for caseworker app and you will able to record a test.

To record a new test for a provider, use:

npm run e2e-test-record:provider

This will open the dev env for provider app and you will able to record a test.

Running in docker containers

It is not possible to pull from the ecr repos if working locally. While docker-compose.yml is set up to pull images from ECR, docker-compose.local.yml is set up to override it to pull the source of each app from GitHub. If you experience error messages about not being able to access ECR, you may have an out-of-date docker engine. Docker desktop should be on at least version 4.28.

If you have difficulties on a mac M1 then you can set the platform being used before building the applications.

export LOCAL_PLATFORM=linux/amd64

To run the tests locally just run this script:

./run_test_local.sh

To run the tests inside a docker container

If you want a more manual approach you can build and shell into the test runner container and run them from there

# build locally on macos intel chipset
DOCKER_BUILDKIT=0 docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d --build

# build locally on macos apple silicon chipset (tested on M1)
DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d --build

# shell into e2e test container
docker-compose run --entrypoint sh laa-crime-forms-end-to-end-tests

# run tests, inside container (with trace, optional)
npx playwright test --trace on

Alternatively, this local build has been wrapped up in a script which you can use as follows:

# build and shell into container
./build_test_local.sh

# run the tests in the container
npx playwright test --trace on

You can extract the trace file from the container if neccessary and upload it to trace.playwright.dev to step through the test output.

Running tests as part of other CI pipeline

The purpose of the end-to-end tests is to identify breaking changes in the LAA crime form app repositories. To achieve a simple, reusable integration an orb has therefore been published.

License

This project is licensed under the MIT License.

About

This repository contains playwright end to end tests for the LAA Crime Forms suite of applications.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published