Created
April 21, 2021 16:36
-
-
Save domenicozinzidea/090299c45780da0e590469f1c88b1de1 to your computer and use it in GitHub Desktop.
Cypress.io example of login in conduit project
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
describe('Logs in ', () => { | |
beforeEach(() => { | |
cy.visit('https://demo.productionready.io/#/register') | |
// we are not logged in | |
}) | |
it('logs in', () => { | |
cy.contains('a.nav-link', 'Sign in').click() | |
const dateToken ="20210421163022"; | |
const email = 'visit'+dateToken+'@email.com' | |
const password = 'visiting' | |
const user = Cypress.env('user') | |
cy.get('input[type="email"]').type(email) | |
cy.get('input[type="password"]').type(password) | |
cy.get('button[type="submit"]').click() | |
// when we are logged in, there should be two feeds | |
cy.contains('a.nav-link', 'Your Feed').should('have.class', 'active') | |
cy.contains('a.nav-link', 'Global Feed').should('not.have.class', 'active') | |
// url is / | |
cy.url().should('not.contain', '/login') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment