Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(gatsby): Trailing slash client only splat #34538

Merged
merged 9 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions e2e-tests/trailing-slash/cypress/integration/always.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ describe(`always`, () => {
cy.getTestElement(`fs-api-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/`)
})
it(`fs-api client only splat without slash`, () => {
cy.getTestElement(`fs-api-client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without/`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`fs-api client only splat with slash`, () => {
cy.getTestElement(`fs-api-client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/with/`)
Expand Down Expand Up @@ -62,25 +72,25 @@ describe(`always`, () => {
cy.getTestElement(`query-param-hash`).click()
cy.waitForRouteChange().assertRoute(`/page-2/?query_param=hello#anchor`)
})
it(`client-only-simple without slash`, () => {
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only/without/`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`client-only-simple with slash`, () => {
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without/`)
cy.getTestElement(`title`).should(`have.text`, `without`)
it(`client-only-splat without slash`, () => {
cy.getTestElement(`client-only-splat-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/without/without/`)
cy.getTestElement(`title`).should(`have.text`, `without/without`)
})
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
it(`client-only-splat with slash`, () => {
cy.getTestElement(`client-only-splat-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with/with`)
})
})

Expand Down Expand Up @@ -111,25 +121,35 @@ describe(`always (direct visits)`, () => {
.waitForRouteChange()
.assertRoute(`/fs-api-simple/without/`)
})
it(`client-only-simple with`, () => {
it(`fs-api client only splat with`, () => {
cy.visit(`/fs-api/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
})
it(`fs-api client only splat without`, () => {
cy.visit(`/fs-api/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without/`)
})
it(`client-only with`, () => {
cy.visit(`/client-only/with/`)
.waitForRouteChange()
.assertRoute(`/client-only/with/`)
})
it(`client-only-simple without`, () => {
it(`client-only without`, () => {
cy.visit(`/client-only/without`)
.waitForRouteChange()
.assertRoute(`/client-only/without/`)
})
it(`client-only with`, () => {
cy.visit(`/fs-api/with/with/`)
it(`client-only-splat with`, () => {
cy.visit(`/client-only-splat/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
.assertRoute(`/client-only-splat/with/with/`)
})
it(`client-only without`, () => {
cy.visit(`/fs-api/without/without`)
it(`client-only-splat without`, () => {
cy.visit(`/client-only-splat/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without/`)
.assertRoute(`/client-only-splat/without/without/`)
})
it(`query-param-hash with`, () => {
cy.visit(`/page-2/?query_param=hello#anchor`)
Expand Down
68 changes: 54 additions & 14 deletions e2e-tests/trailing-slash/cypress/integration/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ describe(`ignore`, () => {
cy.getTestElement(`create-page-without`).click()
cy.waitForRouteChange().assertRoute(`/create-page/without`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/with/`)
it(`fs-api with slash`, () => {
cy.getTestElement(`fs-api-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/`)
})
it(`fs-api-simple without slash`, () => {
cy.getTestElement(`fs-api-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/without`)
it(`fs-api without slash`, () => {
cy.getTestElement(`fs-api-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without`)
})
it(`fs-api client only splat without slash`, () => {
cy.getTestElement(`fs-api-client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`fs-api client only splat with slash`, () => {
cy.getTestElement(`fs-api-client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
Expand Down Expand Up @@ -62,6 +72,26 @@ describe(`ignore`, () => {
cy.getTestElement(`query-param-hash`).click()
cy.waitForRouteChange().assertRoute(`/page-2?query_param=hello#anchor`)
})
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`client-only-splat without slash`, () => {
cy.getTestElement(`client-only-splat-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without/without`)
})
it(`client-only-splat with slash`, () => {
cy.getTestElement(`client-only-splat-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with/with`)
})
})

const IS_BUILD = Cypress.env(`IS_BUILD`)
Expand Down Expand Up @@ -96,25 +126,35 @@ describe(`ignore (direct visits)`, () => {
.waitForRouteChange()
.assertRoute(`/fs-api-simple/without`)
})
it(`client-only-simple with`, () => {
it(`fs-api client only splat with`, () => {
cy.visit(`/fs-api/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
})
it(`fs-api client only splat without`, () => {
cy.visit(`/fs-api/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
})
it(`client-only with`, () => {
cy.visit(`/client-only/with/`)
.waitForRouteChange()
.assertRoute(`/client-only/with/`)
})
it(`client-only-simple without`, () => {
it(`client-only without`, () => {
cy.visit(`/client-only/without`)
.waitForRouteChange()
.assertRoute(`/client-only/without`)
})
it(`client-only with`, () => {
cy.visit(`/fs-api/with/with/`)
it(`client-only-splat with`, () => {
cy.visit(`/client-only-splat/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
.assertRoute(`/client-only-splat/with/with/`)
})
it(`client-only without`, () => {
cy.visit(`/fs-api/without/without`)
it(`client-only-splat without`, () => {
cy.visit(`/client-only-splat/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
.assertRoute(`/client-only-splat/without/without`)
})
it(`query-param-hash with`, () => {
cy.visit(`/page-2/?query_param=hello#anchor`)
Expand Down
68 changes: 54 additions & 14 deletions e2e-tests/trailing-slash/cypress/integration/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ describe(`legacy`, () => {
cy.getTestElement(`create-page-without`).click()
cy.waitForRouteChange().assertRoute(`/create-page/without`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/with/`)
it(`fs-api with slash`, () => {
cy.getTestElement(`fs-api-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/`)
})
it(`fs-api-simple without slash`, () => {
cy.getTestElement(`fs-api-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/without`)
it(`fs-api without slash`, () => {
cy.getTestElement(`fs-api-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without`)
})
it(`fs-api client only splat without slash`, () => {
cy.getTestElement(`fs-api-client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`fs-api client only splat with slash`, () => {
cy.getTestElement(`fs-api-client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
Expand Down Expand Up @@ -62,6 +72,26 @@ describe(`legacy`, () => {
cy.getTestElement(`query-param-hash`).click()
cy.waitForRouteChange().assertRoute(`/page-2?query_param=hello#anchor`)
})
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only/with/`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`client-only-splat without slash`, () => {
cy.getTestElement(`client-only-splat-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without/without`)
})
it(`client-only-splat with slash`, () => {
cy.getTestElement(`client-only-splat-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/with/with/`)
cy.getTestElement(`title`).should(`have.text`, `with/with`)
})
})

const IS_BUILD = Cypress.env(`IS_BUILD`)
Expand Down Expand Up @@ -97,25 +127,35 @@ describe(`legacy (direct visits)`, () => {
IS_BUILD ? `/fs-api-simple/without/` : `/fs-api-simple/without`
)
})
it(`client-only-simple with`, () => {
it(`fs-api client only splat with`, () => {
cy.visit(`/fs-api/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
})
it(`fs-api client only splat without`, () => {
cy.visit(`/fs-api/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
})
it(`client-only with`, () => {
cy.visit(`/client-only/with/`)
.waitForRouteChange()
.assertRoute(`/client-only/with/`)
})
it(`client-only-simple without`, () => {
it(`client-only without`, () => {
cy.visit(`/client-only/without`)
.waitForRouteChange()
.assertRoute(`/client-only/without`)
})
it(`client-only with`, () => {
cy.visit(`/fs-api/with/with/`)
it(`client-only-splat with`, () => {
cy.visit(`/client-only-splat/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with/`)
.assertRoute(`/client-only-splat/with/with/`)
})
it(`client-only without`, () => {
cy.visit(`/fs-api/without/without`)
it(`client-only-splat without`, () => {
cy.visit(`/client-only-splat/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
.assertRoute(`/client-only-splat/without/without`)
})
it(`query-param-hash with`, () => {
cy.visit(`/page-2/?query_param=hello#anchor`)
Expand Down
56 changes: 38 additions & 18 deletions e2e-tests/trailing-slash/cypress/integration/never.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ describe(`never`, () => {
cy.getTestElement(`fs-api-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without`)
})
it(`fs-api client only splat without slash`, () => {
cy.getTestElement(`fs-api-client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`fs-api client only splat with slash`, () => {
cy.getTestElement(`fs-api-client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`fs-api-simple with slash`, () => {
cy.getTestElement(`fs-api-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api-simple/with`)
Expand Down Expand Up @@ -62,25 +72,25 @@ describe(`never`, () => {
cy.getTestElement(`query-param-hash`).click()
cy.waitForRouteChange().assertRoute(`/page-2?query_param=hello#anchor`)
})
it(`client-only-simple without slash`, () => {
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-simple-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
})
it(`client-only-simple with slash`, () => {
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-simple-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only/with`)
cy.getTestElement(`title`).should(`have.text`, `with`)
})
it(`client-only without slash`, () => {
cy.getTestElement(`client-only-without`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without`)
it(`client-only-splat without slash`, () => {
cy.getTestElement(`client-only-splat-without`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/without/without`)
cy.getTestElement(`title`).should(`have.text`, `without/without`)
})
it(`client-only with slash`, () => {
cy.getTestElement(`client-only-with`).click()
cy.waitForRouteChange().assertRoute(`/fs-api/with/with`)
cy.getTestElement(`title`).should(`have.text`, `with`)
it(`client-only-splat with slash`, () => {
cy.getTestElement(`client-only-splat-with`).click()
cy.waitForRouteChange().assertRoute(`/client-only-splat/with/with`)
cy.getTestElement(`title`).should(`have.text`, `with/with`)
})
})

Expand Down Expand Up @@ -114,25 +124,35 @@ describe(`never (direct visits)`, () => {
.waitForRouteChange()
.assertRoute(`/fs-api-simple/without`)
})
it(`client-only-simple with`, () => {
it(`fs-api client only splat with`, () => {
cy.visit(`/fs-api/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with`)
})
it(`fs-api client only splat without`, () => {
cy.visit(`/fs-api/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
})
it(`client-only with`, () => {
cy.visit(`/client-only/with/`)
.waitForRouteChange()
.assertRoute(`/client-only/with`)
})
it(`client-only-simple without`, () => {
it(`client-only without`, () => {
cy.visit(`/client-only/without`)
.waitForRouteChange()
.assertRoute(`/client-only/without`)
})
it(`client-only with`, () => {
cy.visit(`/fs-api/with/with/`)
it(`client-only-splat with`, () => {
cy.visit(`/client-only-splat/with/with/`)
.waitForRouteChange()
.assertRoute(`/fs-api/with/with`)
.assertRoute(`/client-only-splat/with/with`)
})
it(`client-only without`, () => {
cy.visit(`/fs-api/without/without`)
it(`client-only-splat without`, () => {
cy.visit(`/client-only-splat/without/without`)
.waitForRouteChange()
.assertRoute(`/fs-api/without/without`)
.assertRoute(`/client-only-splat/without/without`)
})
it(`query-param-hash with`, () => {
cy.visit(`/page-2/?query_param=hello#anchor`)
Expand Down
Loading