Skip to content

Commit

Permalink
fix: add missing param
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Dec 14, 2023
1 parent d9f812a commit f75c9b3
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/for-tests-react-16/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
<a
className="goToFactorChooser"
onClick={() => {
return MultiFactorAuth.redirectToFactorChooser(true, props.history);
return MultiFactorAuth.redirectToFactorChooser(true, undefined, props.history);
}}>
MFA chooser
</a>
Expand Down
2 changes: 1 addition & 1 deletion examples/for-tests/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
<a
className="goToFactorChooser"
onClick={() => {
return MultiFactorAuth.redirectToFactorChooser(true, props.history);
return MultiFactorAuth.redirectToFactorChooser(true, undefined, props.history);
}}>
MFA chooser
</a>
Expand Down
1 change: 1 addition & 0 deletions lib/build/multifactorauthprebuiltui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion lib/build/passwordless-shared4.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion lib/build/totpprebuiltui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const FactorChooser: React.FC<Prop> = (props) => {
return MultiFactorAuth.getInstanceOrThrow().redirectToFactor(
availableFactors[0].id,
false,
false,
props.history
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export function useChildProps(
return history(-1);
},
onFactorChooserButtonClicked: () => {
return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, history);
return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, undefined, history);
},
recipeImplementation: recipeImplementation,
config: recipe.config,
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/totp/components/features/mfa/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export function useChildProps(
await redirectToAuth({ redirectBack: false, history: history });
},
onFactorChooserButtonClicked: () => {
return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, history);
return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, undefined, history);
},
onSuccess: () => {
const redirectToPath = getRedirectToPathFromURL();
Expand Down
13 changes: 9 additions & 4 deletions test/exampleTestHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ function getTestPhoneNumber() {
}

async function getSignInOrSignUpSwitchLink(page) {
return waitForSTElement(
page,
"div > div > [data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']"
);
return waitForSTElement(page, "div > div > [data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");
}

async function toggleSignInSignUp(page) {
Expand All @@ -137,6 +134,13 @@ async function toggleSignInSignUp(page) {
await signUpLink.click();
}

async function chooseFactor(page, id) {
const ele = await waitForSTElement(page, `[data-supertokens~=factorChooserOption][data-supertokens~=${id}]`);
await new Promise((res) => setTimeout(res, 100));
await Promise.all([page.waitForNavigation({ waitUntil: "networkidle0" }), ele.click()]);
await waitForSTElement(page);
}

module.exports = {
waitForSTElement,
getSubmitFormButton,
Expand All @@ -149,4 +153,5 @@ module.exports = {
getTestPhoneNumber,
getSignInOrSignUpSwitchLink,
toggleSignInSignUp,
chooseFactor,
};
5 changes: 1 addition & 4 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ export async function getLogoutButton(page) {
}

export async function getSignInOrSignUpSwitchLink(page) {
return waitForSTElement(
page,
"div > div > [data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']"
);
return waitForSTElement(page, "div > div > [data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");
}

export async function getForgotPasswordLink(page) {
Expand Down
8 changes: 4 additions & 4 deletions test/visual/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("Visual testing", function () {
]);
await page.waitForSelector("[data-supertokens~='headerSubtitle']");
// Switch to sign up
await page.click("[data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']");
await page.click("[data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");
await snapshot(page, "empty");

await setInputValue(page, { name: "email", value: "[email protected]" });
Expand Down Expand Up @@ -170,7 +170,7 @@ describe("Visual testing", function () {
]);
await page.waitForSelector("[data-supertokens~='headerSubtitle']");
// Switch to sign up
await page.click("[data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']");
await page.click("[data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");

await setInputValue(page, { name: "email", value: "[email protected]" });
await setInputValue(page, { name: "password", value: "weak" });
Expand Down Expand Up @@ -622,7 +622,7 @@ describe("Visual testing", function () {
]);
await page.waitForSelector("[data-supertokens~='headerSubtitle']");
// Switch to sign up
await page.click("[data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']");
await page.click("[data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");
await snapshot(page, "empty");

await setInputValue(page, { name: "email", value: "[email protected]" });
Expand Down Expand Up @@ -659,7 +659,7 @@ describe("Visual testing", function () {
]);
await page.waitForSelector("[data-supertokens~='headerSubtitle']");
// Switch to sign up
await page.click("[data-supertokens~='headerSubtitle'] > div > [data-supertokens~='link']");
await page.click("[data-supertokens~='headerSubtitle'] > [data-supertokens~='link']");

await setInputValue(page, { name: "email", value: "[email protected]" });
await setInputValue(page, { name: "password", value: "weak" });
Expand Down

0 comments on commit f75c9b3

Please sign in to comment.