Skip to content

Commit

Permalink
test: always use www.example.org as return_to URL in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Sep 11, 2024
1 parent 0ed2ed1 commit 03c127c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ context("Testing logout flows", () => {

cy.visit(settings, {
qs: {
return_to: "https://www.ory.sh",
return_to: "https://www.example.org",
},
})

cy.get("a[href*='logout']").click()
cy.location("host").should("eq", "www.ory.sh")
cy.location("host").should("eq", "www.example.org")
})

it("should be able to sign out on welcome page", () => {
Expand All @@ -94,12 +94,12 @@ context("Testing logout flows", () => {

cy.visit(welcome, {
qs: {
return_to: "https://www.ory.sh",
return_to: "https://www.example.org",
},
})

cy.get("a[href*='logout']").click()
cy.location("host").should("eq", "www.ory.sh")
cy.location("host").should("eq", "www.example.org")
})

it("should be able to sign out at 2fa page", () => {
Expand All @@ -122,7 +122,7 @@ context("Testing logout flows", () => {
cy.logout()
cy.visit(route, {
qs: {
return_to: "https://www.ory.sh",
return_to: "https://www.example.org",
},
})

Expand All @@ -135,7 +135,7 @@ context("Testing logout flows", () => {

cy.get("a[href*='logout']").click()

cy.location("host").should("eq", "www.ory.sh")
cy.location("host").should("eq", "www.example.org")
cy.useLookupSecrets(false)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ context("Social Sign Up Successes", () => {
app,
email,
website,
route: registration + "?return_to=https://www.ory.sh/",
route: registration + "?return_to=https://www.example.org/",
})
cy.location("href").should("eq", "https://www.ory.sh/")
cy.location("href").should("eq", "https://www.example.org/")
cy.logout()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ context("Account Recovery With Code Success", () => {

const identity = gen.identityWithWebsite()
cy.registerApi(identity)
cy.visit(express.recovery + "?return_to=https://www.ory.sh/")
cy.visit(express.recovery + "?return_to=https://www.example.org/")
cy.get("input[name='email']").type(identity.email)
cy.get("button[value='code']").click()
cy.get('[data-testid="ui/message/1060003"]').should(
Expand All @@ -196,6 +196,6 @@ context("Account Recovery With Code Success", () => {

cy.get('input[name="password"]').clear().type(gen.password())
cy.get('button[value="password"]').click()
cy.url().should("eq", "https://www.ory.sh/")
cy.url().should("eq", "https://www.example.org/")
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ context("Account Recovery Success", () => {
const identity = gen.identityWithWebsite()
cy.registerApi(identity)

cy.recoverApi({ email: identity.email, returnTo: "https://www.ory.sh/" })
cy.recoverApi({
email: identity.email,
returnTo: "https://www.example.org/",
})

cy.recoverEmail({ expect: identity })

Expand All @@ -120,7 +123,7 @@ context("Account Recovery Success", () => {
.clear()
.type(gen.password())
cy.get('button[value="password"]').click()
cy.url().should("eq", "https://www.ory.sh/")
cy.url().should("eq", "https://www.example.org/")
})

it("should recover even if already logged into another account", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ context("Recovery with `return_to`", () => {
}

it("should return to the `return_to` url after successful account recovery and settings update", () => {
cy.visit(recovery + "?return_to=https://www.ory.sh/")
cy.visit(recovery + "?return_to=https://www.example.org/")
doRecovery()

cy.get('[data-testid="ui/message/1060001"]', { timeout: 30000 }).should(
Expand All @@ -80,7 +80,7 @@ context("Recovery with `return_to`", () => {
.type(newPassword)
cy.get('button[value="password"]').click()

cy.location("hostname").should("eq", "www.ory.sh")
cy.location("hostname").should("eq", "www.example.org")
})

it("should return to the `return_to` url even with mfa enabled after successful account recovery and settings update", () => {
Expand Down Expand Up @@ -108,7 +108,7 @@ context("Recovery with `return_to`", () => {
cy.logout()
cy.clearAllCookies()

cy.visit(recovery + "?return_to=https://www.ory.sh/")
cy.visit(recovery + "?return_to=https://www.example.org/")
doRecovery()

cy.shouldShow2FAScreen()
Expand All @@ -122,7 +122,7 @@ context("Recovery with `return_to`", () => {
.clear()
.type(newPassword)
cy.get('button[value="password"]').click()
cy.location("hostname").should("eq", "www.ory.sh")
cy.location("hostname").should("eq", "www.example.org")
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ context("Social Sign Up Successes", () => {
app,
email,
website,
route: registration + "?return_to=https://www.ory.sh/",
route: registration + "?return_to=https://www.example.org/",
})
cy.location("href").should("eq", "https://www.ory.sh/")
cy.location("href").should("eq", "https://www.example.org/")
cy.logout()
})

Expand Down

0 comments on commit 03c127c

Please sign in to comment.