fix(cypress): deep-linking tests should use cy.location (#6309)

This commit is contained in:
Tim Lai
2020-08-17 14:55:17 -07:00
committed by GitHub
parent 471c24dfcb
commit 02e0515b97

View File

@@ -201,8 +201,9 @@ function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId,
cy.visit(baseUrl) cy.visit(baseUrl)
.get(elementToGet) .get(elementToGet)
.click() .click()
.window() cy.location().should((loc) => {
.should("have.deep.property", "location.hash", correctFragment) expect(loc.hash).to.eq(correctFragment)
})
}) })
it("should provide an anchor link that has the correct fragment as href", () => { it("should provide an anchor link that has the correct fragment as href", () => {
@@ -211,8 +212,9 @@ function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId,
.find("a") .find("a")
.should("have.attr", "href", correctHref) .should("have.attr", "href", correctHref)
.click() .click()
.window() cy.location().should((loc) => {
.should("have.deep.property", "location.hash", correctFragment) expect(loc.hash).to.eq(correctFragment)
})
}) })
it("should expand the operation when reloaded", () => { it("should expand the operation when reloaded", () => {
@@ -225,8 +227,9 @@ function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId,
cy.visit(`${baseUrl}${correctFragment}`) cy.visit(`${baseUrl}${correctFragment}`)
.reload() .reload()
.should("exist") .should("exist")
.window() cy.location().should((loc) => {
.should("have.deep.property", "location.hash", correctFragment) expect(loc.hash).to.eq(correctFragment)
})
}) })
it("should expand a tag with docExpansion disabled", () => { it("should expand a tag with docExpansion disabled", () => {
@@ -254,8 +257,9 @@ function TagDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, corre
.get(elementToGet) .get(elementToGet)
.click() .click()
.click() // tags need two clicks because they're expanded by default .click() // tags need two clicks because they're expanded by default
.window() cy.location().should((loc) => {
.should("have.deep.property", "location.hash", correctFragment) expect(loc.hash).to.eq(correctFragment)
})
}) })
it("should provide an anchor link that has the correct fragment as href", () => { it("should provide an anchor link that has the correct fragment as href", () => {
@@ -275,8 +279,9 @@ function TagDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, corre
cy.visit(`${baseUrl}${correctFragment}`) cy.visit(`${baseUrl}${correctFragment}`)
.reload() .reload()
.should("exist") .should("exist")
.window() cy.location().should((loc) => {
.should("have.deep.property", "location.hash", correctFragment) expect(loc.hash).to.eq(correctFragment)
})
}) })
it("should expand a tag with docExpansion disabled", () => { it("should expand a tag with docExpansion disabled", () => {