improve: deeplinking behavior (#4960)
* add passing tests for fragment rewriting * add failing fragment retention tests * fire legacy `show` actions before standard ones * skip failing tests * remove extra line
This commit is contained in:
@@ -14,12 +14,13 @@ describe("Deep linking feature", () => {
|
||||
|
||||
describe("Operation with whitespace in tag+id", () => {
|
||||
const elementToGet = ".opblock-post"
|
||||
const correctFragment = "#/my%20Tag/my%20Operation"
|
||||
|
||||
BaseDeeplinkTestFactory({
|
||||
baseUrl: swagger2BaseUrl,
|
||||
elementToGet,
|
||||
correctElementId: "operations-my_Tag-my_Operation",
|
||||
correctFragment: "#/my%20Tag/my%20Operation",
|
||||
correctFragment,
|
||||
correctHref: "#/my%20Tag/my%20Operation"
|
||||
})
|
||||
|
||||
@@ -31,6 +32,13 @@ describe("Deep linking feature", () => {
|
||||
.get(`${elementToGet}.is-open`)
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it.skip("should rewrite to the correct fragment when provided the legacy fragment", () => {
|
||||
cy.visit(`${swagger2BaseUrl}${legacyFragment}`)
|
||||
.reload()
|
||||
.window()
|
||||
.should("have.deep.property", "location.hash", correctFragment)
|
||||
})
|
||||
})
|
||||
|
||||
describe("Operation with underscores in tag+id", () => {
|
||||
@@ -91,14 +99,13 @@ describe("Deep linking feature", () => {
|
||||
|
||||
describe("Operation with whitespace in tag+id", () => {
|
||||
const elementToGet = ".opblock-post"
|
||||
const correctElementId = "operations-my_Tag-my_Operation"
|
||||
const correctFragment = "#/my%20Tag/my%20Operation"
|
||||
|
||||
BaseDeeplinkTestFactory({
|
||||
baseUrl: openAPI3BaseUrl,
|
||||
elementToGet: ".opblock-post",
|
||||
correctElementId: "operations-my_Tag-my_Operation",
|
||||
correctFragment: "#/my%20Tag/my%20Operation",
|
||||
correctFragment,
|
||||
correctHref: "#/my%20Tag/my%20Operation"
|
||||
})
|
||||
|
||||
@@ -110,6 +117,14 @@ describe("Deep linking feature", () => {
|
||||
.get(`${elementToGet}.is-open`)
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
|
||||
it.skip("should rewrite to the correct fragment when provided the legacy fragment", () => {
|
||||
cy.visit(`${openAPI3BaseUrl}${legacyFragment}`)
|
||||
.reload()
|
||||
.window()
|
||||
.should("have.deep.property", "location.hash", correctFragment)
|
||||
})
|
||||
})
|
||||
|
||||
describe("Operation with underscores in tag+id", () => {
|
||||
@@ -187,4 +202,12 @@ function BaseDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, corr
|
||||
.get(`${elementToGet}.is-open`)
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should retain the correct fragment when reloaded", () => {
|
||||
cy.visit(`${baseUrl}${correctFragment}`)
|
||||
.reload()
|
||||
.should("exist")
|
||||
.window()
|
||||
.should("have.deep.property", "location.hash", correctFragment)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user