Skip to content

Commit a0a6202

Browse files
deepjyoti30-stnamsnath
authored andcommitted
fix: factorChooser issues and tenant interactions race condition
1 parent 6029657 commit a0a6202

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

test/end-to-end/mfa.chooserscreen.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
256256
await chooseFactor(page, "otp-phone");
257257
await completeOTP(page);
258258

259-
await goToFactorChooser(page);
259+
await goToFactorChooser(page, true, false);
260260

261261
await waitForSTElement(page, "[data-supertokens~=backButton]");
262262
});

test/end-to-end/mfa.helpers.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,16 @@ export async function tryPasswordlessSignInUp(page, contactInfo, queryParams) {
191191
await submitForm(page);
192192
await new Promise((res) => setTimeout(res, 1000));
193193
}
194-
export async function goToFactorChooser(page, waitForList = true) {
194+
export async function goToFactorChooser(page, waitForList = true, waitForNetworkIdle = true) {
195195
const ele = await page.waitForSelector(".goToFactorChooser");
196-
await waitFor(100);
197-
await Promise.all([page.waitForNavigation({ waitUntil: "networkidle0" }), ele.click()]);
196+
await waitFor(waitForNetworkIdle ? 100 : 1000);
197+
const steps = [ele.click()];
198+
if (waitForNetworkIdle) {
199+
// Insert at the start of the array
200+
steps.unshift(page.waitForNavigation({ waitUntil: "networkidle0" }));
201+
}
202+
203+
await Promise.all(steps);
198204
if (waitForList) {
199205
await waitForSTElement(page, "[data-supertokens~=factorChooserList]");
200206
}

test/end-to-end/mfa.requirement_handling.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
124124

125125
await tryEmailPasswordSignUp(page, email);
126126
await waitForDashboard(page);
127-
await goToFactorChooser(page);
127+
await goToFactorChooser(page, true, false);
128128
await chooseFactor(page, "otp-email");
129129
await completeOTP(page);
130130
await setupOTP(page, "PHONE", phoneNumber);

test/end-to-end/multitenancy.tenant_interactions.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,11 @@ describe("SuperTokens Multitenancy tenant interactions", function () {
647647

648648
await removeTenant("customer1");
649649

650+
// We need to wait for a while so that the login_methods
651+
// endpoint doesn't crash. Essentially, it seems like the core
652+
// take a few seconds to update.
653+
await page.waitForTimeout(3000);
654+
650655
let getDynamicLoginMethodsCalled = false;
651656
await page.setRequestInterception(true);
652657
const requestHandler = (request) => {

0 commit comments

Comments
 (0)