Skip to content

Instantly share code, notes, and snippets.

@danlourenco
Created November 13, 2018 19:30
Show Gist options
  • Save danlourenco/7fd970ac8c0f9599608c1588828edae9 to your computer and use it in GitHub Desktop.
Save danlourenco/7fd970ac8c0f9599608c1588828edae9 to your computer and use it in GitHub Desktop.
Using Cypress commands
Cypress.Commands.add('login', (overrides = {}) => {
Cypress.log({
name: 'loginViaAuth0',
});
const options = {
method: 'POST',
url: Cypress.env('auth_url'),
body: {
grant_type: 'password',
username: Cypress.env('auth_username'),
password: Cypress.env('auth_password'),
audience: Cypress.env('auth_audience'),
scope: 'openid profile email',
client_id: Cypress.env('auth_client_id'),
client_secret: Cypress.env('auth_client_secret'),
},
};
cy.request(options);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment