Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Development and E2E Testing #7350

Open
Tracked by #7932
hifabienne opened this issue Feb 7, 2024 · 3 comments
Open
Tracked by #7932

Local Development and E2E Testing #7350

hifabienne opened this issue Feb 7, 2024 · 3 comments
Labels
devops docs Improvements or additions to documentation

Comments

@hifabienne
Copy link
Member

hifabienne commented Feb 7, 2024

What is the recommended approach for setting up and testing the authentication system in local development environments and during end-to-end testing?

  1. 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)
  1. 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
  2. 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.

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

@hifabienne hifabienne added docs Improvements or additions to documentation devops labels Feb 7, 2024
@mffap
Copy link
Member

mffap commented Feb 7, 2024

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.

Optimally, we explain it with one of our examples (eg, https://github.com/zitadel/example-quote-generator-app).

@hifabienne
Copy link
Member Author

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.

Optimally, we explain it with one of our examples (eg, https://github.com/zitadel/example-quote-generator-app).

@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.

@stebenz
Copy link
Collaborator

stebenz commented Feb 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops docs Improvements or additions to documentation
Projects
Status: 🧐 Investigating
Development

No branches or pull requests

3 participants