cypress-keycloak-commands
a keycloak commands list to use in cypress e2e tests
Installation
npm i @digital-wafa/cypress-keycloak-commands -D
Usage
Add the following environment variables to your cypress.json
file
{
"env": {
"KEYCLOAK_BASE_URL" : "your keycloak base url",
"KEYCLOAK_REALM" : "your realm",
"KEYCLOAK_CLIENT" : "your client id",
"KEYCLOAK_REDIRECT_URI" : "your redirect uri",
"KEYCLOAK_IDP_HINT" : "your idp hint"
}
}
Import the commands in your cypress/support/commands.js
file
require("@digital-wafa/cypress-keycloak-commands");
Finaly inside your cypress tests files
cy.login(username, password)
cy.logout()
Acknowledgement
this library is based on this blog post.