This project has the tests using cypress for app frontend that is running locally.
These instructions will get you run the integration tests on altinn-app-frontend.
This is only needed the first time, or when dependencies are updated:
yarn --immutable
Please refer to Linux Prerequisites to run Cypress on Linux/Wsl.
- Start your local development server for
app-frontend-react
:
yarn start
- Run the tests against a remote environment:
npx cypress run --env environment=tt02 -s 'test/e2e/integration/*/*.ts'
-
Clone app-localtest and follow the instructions in the README to start the local environment.
-
Clone one or more of the apps we've made automatic tests for:
- ttd/frontend-test
- ttd/anonymous-stateless-app
- ttd/stateless-app
- ttd/signing-test
- ttd/expression-validation-test
- ttd/payment-test
- ttd/component-library
- Start the app you want to test:
cd <app-folder>/App
dotnet run
- Start the tests for a given app:
If you ran app-localtest with Docker:
npx cypress run --env environment=docker -s 'test/e2e/integration/frontend-test/*.ts'
If you ran app-localtest with podman:
npx cypress run --env environment=podman -s 'test/e2e/integration/frontend-test/*.ts'
- Stop the running app (using
Ctrl+C
in the terminal where it's running) and repeat step 3 and 4 for the next app you want to test.
To run a single test case, open the Cypress runner using:
npx cypress open --env environment=<environment>
Then click on the test you want to run.
Tip: Most test files contain multiple test cases. You can run a single test case
by adding .only
to the it
function in the test file. Be sure not to commit
this change.
- it('should do something', () => {
+ it.only('should do something', () => {