Skip to content

Commit

Permalink
Merge pull request #2122 from ChainSafe/mnt/add-sign-out-test-storage…
Browse files Browse the repository at this point in the history
…-2121

[Storage] Add sign out test
  • Loading branch information
juans-chainsafe authored May 10, 2022
2 parents 82741b1 + e074f00 commit 58cdd65
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const navigationMenu = {
spaceUsedLabel: () => cy.get("[data-cy=label-space-used]"),
spaceUsedProgressBar: () => cy.get("[data-cy=progress-bar-space-used]"),
// mobile view only
signOutButton: () => cy.get("[data-cy=container-signout-nav]")
signOutButton: () => cy.get("[data-cy=button-sign-out]")
}
29 changes: 24 additions & 5 deletions packages/storage-ui/cypress/tests/main-navigation-spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
import { navigationMenu } from "../support/page-objects/navigationMenu"
import { cidsPage } from "../support/page-objects/cidsPage"
import { authenticationPage } from "../support/page-objects/authenticationPage"

describe("Main Navigation", () => {

context("desktop", () => {
before(() => {
beforeEach(() => {
cy.web3Login()
})

it("can navigate to the cids page", () => {
navigationMenu.cidsNavButton().click()
cy.url().should("include", "/cids")
})
})

context("mobile", () => {
before(() => {
cy.web3Login()
it("can sign out from the navigation bar", () => {
navigationMenu.signOutDropdown().click()
navigationMenu.signOutMenuOption()
.should("be.visible")
.click()
authenticationPage.web3Button().should("be.visible")
cy.url().should("not.include", "/drive")
cy.url().should("not.include", "/bin")
cy.url().should("not.include", "/settings")
})
})

context("mobile", () => {
beforeEach(() => {
cy.web3Login()
cy.viewport("iphone-6")
cidsPage.hamburgerMenuButton().click()
})
Expand All @@ -28,5 +37,15 @@ describe("Main Navigation", () => {
navigationMenu.cidsNavButton().click()
cy.url().should("include", "/cids")
})

it("can sign out from the navigation bar", () => {
navigationMenu.signOutButton()
.should("be.visible")
.click()
authenticationPage.web3Button().should("be.visible")
cy.url().should("not.include", "/drive")
cy.url().should("not.include", "/bin")
cy.url().should("not.include", "/settings")
})
})
})
1 change: 1 addition & 0 deletions packages/storage-ui/src/Components/Layouts/AppNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ const AppNav: React.FC<IAppNav> = ({ navOpen, setNavOpen }: IAppNav) => {

<div style={{ display: "flex" }}>
<Button
data-cy="button-sign-out"
variant='secondary'
onClick={() => {
handleOnClick()
Expand Down

0 comments on commit 58cdd65

Please sign in to comment.