jam-cloud/jam-ui/cypress/integration/layout/navigation.spec.js

43 lines
928 B
JavaScript

/// <reference types="cypress" />
import { before } from "lodash";
describe("Top Navigation", () => {
const showSubscribeToUpdates = () => {
cy.contains('Keep JamKazam Improving').should('exist')
cy.contains('Subscribe')
}
describe("when user has not logged in", () => {
beforeEach(() => {
cy.stubUnauthenticate()
cy.visit('/')
});
it("does not show user dropdown", () => {
showSubscribeToUpdates()
cy.get('[data-testid=navbarTopProfileDropdown]').should('not.exist')
});
})
describe("when user has logged in", () => {
beforeEach(() => {
cy.stubAuthenticate()
cy.visit('/')
});
it("shows user dropdown", () => {
showSubscribeToUpdates()
cy.get('[data-testid=navbarTopProfileDropdown]').should('exist')
cy.contains("Peter Pan")
cy.contains("My Profile")
cy.contains("Sign out")
})
})
});