This directory contains E2E tests for the Hanko project using Playwright.
To run the tests you need to have the following software installed:
Furthermore, you need running instances of:
- the Hanko backend
- a running frontend application (e.g. our quickstart) using the web component provided by hanko-elements
- Mailslurper as an SMTP server (used to test passcodes through mail retrieval via its API)
The tests distinguish between password-based and passwordless scenarios. Each of these requires the proper backend configuration, i.e. it must be configured to run with either passwords enabled or disabled.
To get everything up and running, you can use the existing Docker Compose quickstart in
the deploy/docker-compose
directory. From the root project directory, execute:
Passwords disabled:
# compose v1
docker-compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-nopw" up --build
# compose v2
docker compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-nopw" up --build
Passwords enabled:
# compose v1
PASSWORD_ENABLED=true docker-compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-pw" up --build
# compose v2
PASSWORD_ENABLED=true docker compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-pw" up --build
or add the following to the deploy/docker-compose/config.yaml
password:
enabled: true
and then run
# compose v1
docker-compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-pw" up --build
# compose v2
docker compose -f deploy/docker-compose/quickstart.yaml -p "hanko-quickstart-pw" up --build
Once the services are up and running, install dependencies from inside the e2e
directory:
npm install
npx playwright install chromium
Then execute the tests using:
Passwords disabled:
npm run test:nopw
Passwords enabled:
npm run test:pw
Note: If VSCode is your IDE of choice, you can use the Playwright extension to run a test or a group of tests with a single click.
For more information on how to customize npm scripts to run tests using the Playwright CLI please view the official documentation.