You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the recommended approach for setting up and testing the authentication system in local development environments and during end-to-end testing?
Create a test user in your ZITADEL instance
Depending on the isolation grade you want to achieve you can create the test user in the following environements.
Use a local ZITADEL instance (if you need control over the ZITADEL version)
Use a dedicated ZITADEL test instance in the cloud (If you do want to have dedicated systems for test and prod)
Use the productive ZITADEL instance in the cloud (For tests against your productive applications)
Give the needed user grants / permission to your user, depending on your use case
If you do need to test with different roles/permissions we recommend using different users for each use case
Authenticate the user in your test framework:
The standard way to authenticate a user is by giving the domain, username and password, and select the next/login button. The test framework then automatically authenticates the user and gets a token.
The broad strokes are there, but it lacks imo a bit of meat on the bone. When I want to integrate my app with ZITADEL e2e, we need also to explain how to setup org, project, client(s). Since things like client-id will be dynamically created, we need to explain how to solve this when deploying zitadel in a way that the configuration can be (re)-used.
The broad strokes are there, but it lacks imo a bit of meat on the bone. When I want to integrate my app with ZITADEL e2e, we need also to explain how to setup org, project, client(s). Since things like client-id will be dynamically created, we need to explain how to solve this when deploying zitadel in a way that the configuration can be (re)-used.
@eliobischof@stebenz any input on this?
I think we could describe the general path first and then setup an example application and show how it works with that.
I mean, yes, we can do an example for the e2e testing with ZITADEL, but is there interest in such an example?
If so, it should not require much effort as we should have all the relevant parts already.
But I'm not quite sure if that fits into our current examples.
What is the recommended approach for setting up and testing the authentication system in local development environments and during end-to-end testing?
Depending on the isolation grade you want to achieve you can create the test user in the following environements.
If you do need to test with different roles/permissions we recommend using different users for each use case
The standard way to authenticate a user is by giving the domain, username and password, and select the next/login button. The test framework then automatically authenticates the user and gets a token.
Authenticate the pre created user in ZITADEL
https://docs.cypress.io/api/commands/origin#SSO-login-custom-command
Authenticate the pre created user in ZITADEL
https://playwright.dev/docs/auth
Additional Information
Cypress authentication example:
https://github.com/zitadel/zitadel/blob/b099a26a1600be6661d9358c2ffbea034e47b51c/e2e/cypress/support/login/authenticate.ts
Cypress is not out of the box able to handle domain changes within the e2e tests. In that case you need to handle the context. An example on how we do it is included here. The relevant part is cy.origin():
https://github.com/zitadel/zitadel/blob/b099a26a1600be6661d9358c2ffbea034e47b51c/e2e/cypress/support/login/users.ts
The text was updated successfully, but these errors were encountered: