-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for resetPassword email field
- Loading branch information
1 parent
be4c00a
commit 363b575
Showing
3 changed files
with
29 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -740,6 +740,17 @@ function getSignInFormFields() { | |
return {}; | ||
} | ||
|
||
function emailFormForResetPassword() { | ||
let showDefaultFields = localStorage.getItem("SHOW_DEFAULT_EMAIL_FOR_RESET_PASSWORD"); | ||
if (showDefaultFields === "YES") { | ||
return { | ||
getDefaultValue: () => "[email protected]", | ||
style: theme, | ||
}; | ||
} | ||
return { style: theme }; | ||
} | ||
|
||
function getEmailPasswordConfigs({ disableDefaultUI }) { | ||
return EmailPassword.init({ | ||
style: ` | ||
|
@@ -808,9 +819,7 @@ function getEmailPasswordConfigs({ disableDefaultUI }) { | |
useShadowDom, | ||
resetPasswordUsingTokenFeature: { | ||
disableDefaultUI, | ||
enterEmailForm: { | ||
style: theme, | ||
}, | ||
enterEmailForm: emailFormForResetPassword(), | ||
submitNewPasswordForm: { | ||
style: theme, | ||
}, | ||
|
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 |
---|---|---|
|
@@ -48,11 +48,11 @@ import { | |
toggleSignInSignUp, | ||
defaultSignUp, | ||
screenshotOnFailure, | ||
getAuthPageHeaderText, | ||
getResetPasswordFormBackButton, | ||
waitForSTElement, | ||
getResetPasswordSuccessBackToSignInButton, | ||
backendBeforeEach, | ||
getInputField, | ||
} from "../helpers"; | ||
|
||
/* | ||
|
@@ -232,6 +232,21 @@ describe("SuperTokens Reset password", function () { | |
const buttonLabel = await getSubmitFormButtonLabel(page); | ||
assert.deepStrictEqual(buttonLabel, "SIGN IN"); | ||
}); | ||
|
||
it("Should show default values for email field", async function () { | ||
await page.evaluate(() => window.localStorage.setItem("SHOW_DEFAULT_EMAIL_FOR_RESET_PASSWORD", "YES")); | ||
|
||
await page.reload({ | ||
waitUntil: "domcontentloaded", | ||
}); | ||
|
||
const expectedDefaultEmail = "[email protected]"; | ||
|
||
const emailInput = await getInputField(page, "email"); | ||
const defaultEmail = await emailInput.evaluate((f) => f.value); | ||
|
||
assert.strictEqual(defaultEmail, expectedDefaultEmail); | ||
}); | ||
}); | ||
|
||
describe("Reset password new password form test", function () { | ||
|
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 |
---|---|---|
|
@@ -330,6 +330,7 @@ function getEmailPasswordConfigs() { | |
return EmailPassword.init({ | ||
resetPasswordUsingTokenFeature: { | ||
enterEmailForm: { | ||
getDefaultValue: () => "[email protected]", | ||
style: theme.style, | ||
}, | ||
submitNewPasswordForm: { | ||
|