Cypress commands for Keycloak
Using npm:
$ npm install cypress-keycloak -D
Using yarn:
$ yarn add cypress-keycloak -D
Then with a module bundler like webpack, add the following line to cypress/support/index.js
:
// Using ES6
import 'cypress-keycloak';
// using CommonJS
require('cypress-keycloak');
Two cy
commands have been added:
cy.logout({ ... })
:root
: stringrealm
: stringredirect_uri
: string
cy.login({ ... })
:root
: stringrealm
: stringusername
: stringpassword
: stringclient_id
: stringredirect_uri
: stringpath_prefix
?: string = "auth"
describe('thing', () => {
beforeEach(() => {
cy.login({
root: 'https://keycloak.babangsund.com',
realm: 'stage',
username: 'babangsund',
password: 'bacon',
client_id: 'frontend',
redirect_uri: 'https://babangsund.com/',
});
});
afterEach(() => {
cy.logout({
root: 'https://keycloak.babangsund.com',
realm: 'stage',
redirect_uri: 'https://babangsund.com/',
});
});
});
cypress-keycloak is built and maintained by babangsund.
@blog.
@github.
@twitter.