Skip to content

Instantly share code, notes, and snippets.

@yagudaev
Created January 21, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yagudaev/8cdac81749f16ba28e2745f0925c43f9 to your computer and use it in GitHub Desktop.
Save yagudaev/8cdac81749f16ba28e2745f0925c43f9 to your computer and use it in GitHub Desktop.
Testing Your Frontend with Cypress.io Framework
// cypress/support/commands.js
Cypress.Commands.add('login', (email, password) => {
cy.request({
method: 'POST',
url: 'http://localhost:300/api/v1/users/login',
body: {
user: {
email,
password
}
}
})
.then((res) => {
window.localStorage.setItem('jwt', res.body.user.token)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment