As a pre-requisite for running end-to-end tests, we assume you have the application fully up and running on your system. If not, please follow the documentation links in the README.md in the root of this repository.
The e2e tests are structured into 3 groups of tests:
Tests to make sure that views look the same as before. They must not change state which allows us to run the in parallel. They are also run with multiple browsers and viewports to make sure we didn't change something accidentally.
Tests to make sure that something works in all browsers. That can be a hack that we needed for a certain browser (this doesn't happen that often anymore, but it happens) or very important behavior we want to be sure it works on all browsers. We try to not modify state in this category as long as possible that we can keep them parallelized, but they might need to change state at some point.
Tests that we don't have to run in multiple browsers and viewports because they mostly test the interaction between the frontend and other services. They must not rely on a certain database state and cannot be run in parallel as they might influence the state of other tests.
# Only necessary on Mac OS: install xhost. Restart your Mac after this.
brew cask install xquartz# Only necessary on Mac OS and Linux, and only once per computer restart:
# Allow the Cypress Docker container to open a window on the host
xhost local:rootdocker compose --profile e2e run --rm e2e npm cidocker compose --profile e2e run --rm e2e npm updateor
docker compose --profile e2e run --rm e2e "npm update <dependency>"This switches off HMR and starts the frontend using a production build, like on CI. Please note that in this mode, when changing things in the frontend e.g. to fix a broken e2e test, you will have to run this command again every time (takes roughly 10 seconds).
CI=true docker compose up -d --force-recreate frontenddocker compose --profile e2e run --rm e2e npx playwright testdocker compose --profile e2e run --rm e2e npx playwright test tests/5-cross-browser-tests/login.spec.tsSupported browsers: chromium, firefox, webkit
docker compose --profile e2e run --rm e2e npx playwright test --project firefoxdocker compose --profile e2e run --rm e2e npm run test:uiopen playwright-report/index.htmldocker compose --profile e2e run --rm e2e npx playwright show-trace <your-trace-zip-file>You can skip this in case you didn't do the optional CI=true setup step above.
docker compose up -d --force-recreate frontendIf a branch switch leads to a different playwright version, the local playwright version might be outdated. To update the local playwright version, run npm ci:
npm install
npx playwright installdocker compose up -d
npm testdocker compose up -d
npm run test:uidocker compose --profile e2e run --rm e2e npm run lintdocker compose up -d --waitdocker compose -f ../docker-compose.yml build apidocker compose -f ../docker-compose.yml up --wait -d api