Skip to content

Cypress commands for Keycloak

License

Notifications You must be signed in to change notification settings

sezane/cypress-keycloak

 
 

Repository files navigation

cypress-keycloak

Cypress commands for Keycloak


Installation

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');

Usage

Two cy commands have been added:

  • cy.logout({ ... }):
    • root: string
    • realm: string
    • redirect_uri: string
  • cy.login({ ... }):
    • root: string
    • realm: string
    • username: string
    • password: string
    • client_id: string
    • redirect_uri: string
    • path_prefix?: string = "auth"

Example:

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/',
    });
  });
});

Credits

cypress-keycloak is built and maintained by babangsund.
@blog.
@github.
@twitter.

About

Cypress commands for Keycloak

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 51.1%
  • TypeScript 48.9%