-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,6 +608,36 @@ describe("SuperTokens SignIn with react router dom v6", function () { | |
]); | ||
}); | ||
|
||
it("Should redirect to onFailureRedirections result if it's a relative path", async function () { | ||
await Promise.all([ | ||
page.goto( | ||
`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=${encodeURIComponent("/dashboard?test=value#asdf")}` | ||
), | ||
page.waitForNavigation({ waitUntil: "networkidle0" }), | ||
]); | ||
|
||
// Set correct values. | ||
await setInputValues(page, [ | ||
{ name: "email", value: "[email protected]" }, | ||
{ name: "password", value: "Str0ngP@ssw0rd" }, | ||
]); | ||
await Promise.all([ | ||
submitFormReturnRequestAndResponse(page, SIGN_IN_API), | ||
page.waitForNavigation({ waitUntil: "networkidle0" }), | ||
]); | ||
|
||
await page.evaluate(() => { | ||
const validator = window.UserRoleClaim.validators.includes("admin"); | ||
validator.onFailureRedirection = () => "second-factor"; | ||
window.setClaimValidators([validator]); | ||
}); | ||
|
||
await page.waitForNavigation({ waitUntil: "networkidle0" }); | ||
|
||
let href = await page.evaluate(() => window.location.pathname); | ||
assert.strictEqual(href, "/dashboard/second-factor"); | ||
}); | ||
|
||
it("Should redirect to onFailureRedirections result if it's on another domain", async function () { | ||
await Promise.all([ | ||
page.goto(`${TEST_CLIENT_BASE_URL}/auth`), | ||
|