Last active
November 24, 2018 03:44
-
-
Save prescottprue/58f98d5b08d0a8ed97192ee9b0de00cb to your computer and use it in GitHub Desktop.
Cypress test to confirm a Firebase app correctly routes authed/unauthed users.
This file contains 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('Projects Page', () => { | |
describe('when not authenticated', () => { | |
before(() => { | |
// Attempt to go to /projects (requires user to be logged in) | |
cy.visit('/projects') | |
}) | |
it('Redirects to Home (/)', () => { | |
cy.url().should('equal', '/') | |
}); | |
}) | |
describe('when authenticated', () => { | |
before(() => { | |
// Login using custom token | |
cy.login() | |
// Go to /projects (which requires user to be logged in) | |
cy.visit('/projects') | |
}) | |
it('Does not redirect', () => { | |
cy.url().should('equal', '/projects') | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment