The user full name was not the same, it would induce flaky test, while the user name is updated at user login from the KC data.
1.8 KiB
1.8 KiB
E2E tests
Run E2E tests
# you need the dockers to be up and running
make bootstrap
# you will need to have few accounts in the database
make demo FLUSH_ARGS='--no-input'
# run the tests
cd src/frontend/apps/e2e
yarn test:ui --workers=1
A new browser window will open and you will be able to run the tests.
Available accounts
The make demo command creates the following accounts:
e2e.team-<role>@example.comwhere<role>is one ofadministrator,member,owner: this account only belong to a team with the specified role.e2e.mail-<role>@example.comwhere<role>is one ofadministrator,member,owner: this account only have a mailbox with the specified role access.e2e.team-<team_role>-mail-<domain_role>@example.comwith a combination of roles as for the previous accounts.
For each account, the password is password-e2e.<role>, for instance password-e2e.team-member.
In the E2E tests you can use these accounts to benefit from there accesses,
using the keyCloakSignIn(page, browserName, <account_name>). The account name is the
username without the prefix e2e..
await keyCloakSignIn(page, browserName, 'mail-owner');
The keyCloakSignIn function will sign in the user on Keycloak using the proper username and password.
.. note:: This only works because the OIDC setting is set to fallback on user email.
Add a new account
In case you need to add a new account for specific tests you need:
- to create a new user with the same format in the backend database:
update
[create_demo.py](../src/backend/demo/management/commands/create_demo.py) - to create a new account in Keycloak: update realm.json
- if the keycloak was running locally, you need to destroy its database and restart the database and the keycloak containers.