@cypress/core-desktop-gui
Version:
Desktop GUI for managing Cypress projects.
78 lines (65 loc) • 2.52 kB
text/coffeescript
describe "Navigation", ->
beforeEach ->
cy
.visit("/")
.window().then (win) ->
{, } = win
= cy.agents()
.spy(, "ipc")
.handle("get:options", null, {})
context "links", ->
beforeEach ->
cy
.fixture("user").then () ->
.handle("get:current:user", null, )
.handle("get:project:paths", null, [])
it "displays link to docs", ->
cy.get("nav").contains("Docs")
it "opens link to docs on click", ->
cy
.get("nav").contains("Docs").click().then ->
expect(.ipc).to.be.calledWith("external:open", "https://on.cypress.io")
it "displays link to chat", ->
cy.get("nav").contains("Chat")
it "opens link to chat on click", ->
cy
.get("nav").contains("Chat").click().then ->
expect(.ipc).to.be.calledWith("external:open", "https://gitter.im/cypress-io/cypress")
context "with a current user", ->
describe "username in header", ->
it "displays user name", ->
cy
.fixture("user").then () ->
.handle("get:current:user", null, )
.handle("get:project:paths", null, [])
.get("nav a").should ($a) ->
expect($a).to.contain(.name)
it "displays email instead of name", ->
cy
.fixture("user").then () ->
.name = null
.handle("get:current:user", null, )
.handle("get:project:paths", null, [])
.get("nav a").should ($a) ->
expect($a).to.contain(.email)
describe "logout of user", ->
beforeEach ->
cy
.fixture("user").then () ->
.handle("get:current:user", null, )
.handle("get:project:paths", null, [])
it "shows dropdown on click of user name", ->
cy.contains("Jane Lane").click()
cy.screenshot()
cy.contains("Log Out").should("be.visible")
it "triggers logout on click of logout", ->
cy.contains("Jane Lane").click()
cy.screenshot()
cy.contains("a", "Log Out").click().then ->
expect(.ipc).to.be.calledWith("log:out")
it "displays login screen on logout", ->
.handle("log:out", null, {})
cy.contains("Jane Lane").click()
cy.contains("a", "Log Out").click()
cy.screenshot()
cy.contains(".btn", "Log In with GitHub")