Created
May 26, 2020 03:11
-
-
Save sir-dunxalot/5c3b1b1c20d56629ec1b4d9d81f5268a to your computer and use it in GitHub Desktop.
cypress-nextjs-auth0__helper--login-with-multiple-users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cypress.Commands.add('login', (credentials?: Credentials = {}) => { | |
const { username, password } = credentials; | |
const credentials = { | |
username: username || Cypress.env('auth0Username'), | |
password: password || Cypress.env('auth0Password'), | |
}; | |
/* ... */ | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context('Logging in', () => { | |
it('should successfully log in', () => { | |
cy.login({ | |
username: Cypress.env('auth0UsernameAlt'), | |
password: Cypress.env('auth0PasswordAlt'), | |
}).then(() => { | |
cy.visit('/'); | |
cy.request('/api/me').then(({ body: user }) => { | |
expect(user).to.exist; | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment