Last active
December 1, 2018 09:57
-
-
Save prescottprue/62063229114fb3eb6c09443a199b35a2 to your computer and use it in GitHub Desktop.
Cypress test of Firebase app route that requires auth
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
const TEST_PROJECT_PATH = 'projects/123abc' | |
const fakeProject = { | |
name: 'My Project' | |
} | |
describe('Project Detail Page', () => { | |
beforeEach(() => { | |
// Login using custom token | |
cy.login() | |
// Go to projects page | |
cy.visit('/projects') | |
// Settings to add createdBy and createdAt | |
const settings = { withMeta: true } | |
// Seed database with fake project that contains createdAt and createdBy (meta) | |
cy.callRtdb('set', TEST_PROJECT_PATH , fakeProject, settings) | |
}) | |
afterEach(() => { | |
// Reset the displayName in the user's profile to "Test User" | |
cy.callRtdb('remove', TEST_PROJECT_PATH) | |
}) | |
it('User can visit the detail page of a project they own', () => { | |
// Go to transaction detail page | |
cy.url().visit(TEST_PROJECT_PATH) | |
// Confirm that user was not redirected (still on project detail page) | |
cy.url().should('equal', TEST_PROJECT_PATH) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment