mardi 9 février 2021

Is it possible to use Cypress for E2E testing when keycloak protectes the site

I am using Cypress for E2E testing. I also use Keycloak to provide Authentication.

Keycloak uses an external website login form, however, this is not supported by Cypress when it is on a different domain to that being tested.

I know in most cases you would avoid testing the login functionality of 3rd party provider, but in my case, I use the functions built to the Keycloak-js library such as checking for role permissions to validate if a user can access a page.

Without being able to login through the keycloak-js adapter, Cypress can not test any of my site.

I am able to login to keycloak via the API using grant_type = password via fetch. This provides me with a token, refresh token and session id. Is there a way I might init the keycloak-js adapter with these tokens?

Aucun commentaire:

Enregistrer un commentaire