1.0.1 • Published 4 years ago

@digital-wafa/cypress-keycloak-commands v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

cypress-keycloak-commands npm version

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

// to login
cy.login(username, password)

// to logout
cy.logout()

Acknowledgement

this library is based on this blog post.