Skip to content

Commit 896bcf1

Browse files
Add fixes for tests to make them run
1 parent e597545 commit 896bcf1

11 files changed

+197
-19729
lines changed

package-lock.json

Lines changed: 1 addition & 19264 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/end-to-end/generalerror.test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ let page;
6262
let consoleLogs;
6363

6464
describe("General error rendering", function () {
65+
let coreUrl;
66+
let enabledRecipes = undefined;
6567
before(async function () {
6668
const _isGeneralErrorSupported = await isGeneralErrorSupported();
6769
if (!_isGeneralErrorSupported) {
@@ -74,8 +76,8 @@ describe("General error rendering", function () {
7476

7577
beforeEach(async function () {
7678
await backendHook("beforeEach");
77-
const coreUrl = await setupCoreApp();
78-
await setupST({ coreUrl });
79+
coreUrl = await setupCoreApp();
80+
await setupST({ coreUrl, enabledRecipes });
7981
page = await browser.newPage();
8082

8183
consoleLogs = [];
@@ -208,11 +210,18 @@ describe("General error rendering", function () {
208210
});
209211

210212
describe("ThirdPartyEmailPassword", function () {
213+
before(async function () {
214+
enabledRecipes = ["thirdpartyemailpassword", "session"];
215+
});
216+
211217
getEmailPasswordTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
212218
getThirdPartyTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
213219
});
214220

215221
describe("ThirdPartyPasswordless", function () {
222+
before(async function () {
223+
enabledRecipes = ["thirdpartypasswordless", "session"];
224+
});
216225
getThirdPartyTests("thirdpartypasswordless", "THIRD_PARTY_PASSWORDLESS");
217226
});
218227

test/end-to-end/mfa.factorscreen.otp.test.js

Lines changed: 3 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -323,95 +323,6 @@ describe("SuperTokens SignIn w/ MFA", function () {
323323
}
324324
});
325325

326-
it("should handle consumeCode restart flow error", async () => {
327-
await setupST({
328-
...appConfig,
329-
mfaInfo: {
330-
requirements: [factorId],
331-
alreadySetup: [factorId],
332-
allowedToSetup: [factorId],
333-
},
334-
});
335-
336-
await page.setRequestInterception(true);
337-
const requestHandler = (request) => {
338-
if (request.url() === CONSUME_CODE_API && request.method() === "POST") {
339-
return request.respond({
340-
status: 200,
341-
headers: {
342-
"access-control-allow-origin": TEST_CLIENT_BASE_URL,
343-
"access-control-allow-credentials": "true",
344-
},
345-
body: JSON.stringify({
346-
status: "RESTART_FLOW_ERROR",
347-
}),
348-
});
349-
}
350-
351-
return request.continue();
352-
};
353-
page.on("request", requestHandler);
354-
try {
355-
await tryEmailPasswordSignIn(page, email);
356-
357-
await completeOTP(page);
358-
359-
await waitForAccessDenied(page);
360-
} finally {
361-
page.off("request", requestHandler);
362-
await page.setRequestInterception(false);
363-
}
364-
});
365-
366-
it("should handle consumeCode restart flow error when setting up factor", async () => {
367-
await setupST({
368-
...appConfig,
369-
mfaInfo: {
370-
requirements: [factorId],
371-
alreadySetup: [],
372-
allowedToSetup: [factorId],
373-
noContacts: true,
374-
},
375-
});
376-
377-
await page.setRequestInterception(true);
378-
const requestHandler = (request) => {
379-
if (request.url() === CONSUME_CODE_API && request.method() === "POST") {
380-
return request.respond({
381-
status: 200,
382-
headers: {
383-
"access-control-allow-origin": TEST_CLIENT_BASE_URL,
384-
"access-control-allow-credentials": "true",
385-
},
386-
body: JSON.stringify({
387-
status: "RESTART_FLOW_ERROR",
388-
}),
389-
});
390-
}
391-
392-
return request.continue();
393-
};
394-
page.on("request", requestHandler);
395-
try {
396-
await tryEmailPasswordSignIn(page, email);
397-
398-
await setInputValues(page, [
399-
contactMethod === "PHONE"
400-
? { name: "phoneNumber_text", value: getTestPhoneNumber() }
401-
: { name: "email", value: await getTestEmail() },
402-
]);
403-
await submitForm(page);
404-
405-
await completeOTP(page);
406-
407-
const error = await getGeneralError(page);
408-
assert.strictEqual("Login unsuccessful. Please try again.", error);
409-
} finally {
410-
page.off("request", requestHandler);
411-
await page.setRequestInterception(false);
412-
}
413-
});
414-
415326
it("should enable you to change the contact info during setup (w/ contact form)", async () => {
416327
await setupST({
417328
...appConfig,
@@ -447,7 +358,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
447358
await completeOTP(page);
448359
});
449360

450-
it("should show a link redirecting back if visited after sign in without stepUp param", async () => {
361+
it("should show a link redirecting back if visited after sign in - setup", async () => {
451362
await setupST({
452363
...appConfig,
453364
mfaInfo: {
@@ -456,37 +367,17 @@ describe("SuperTokens SignIn w/ MFA", function () {
456367
allowedToSetup: [],
457368
},
458369
});
459-
460370
await tryEmailPasswordSignIn(page, email);
461371

462372
await Promise.all([
463373
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}`),
464374
page.waitForNavigation({ waitUntil: "networkidle0" }),
465375
]);
466-
await waitForDashboard(page);
467-
});
468-
469-
it("should show a link redirecting back if visited after sign in - force setup", async () => {
470-
await setupST({
471-
...appConfig,
472-
mfaInfo: {
473-
requirements: [],
474-
alreadySetup: [factorId],
475-
allowedToSetup: [factorId],
476-
},
477-
});
478-
479-
await tryEmailPasswordSignIn(page, email);
480-
481-
await Promise.all([
482-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?setup=true`),
483-
page.waitForNavigation({ waitUntil: "networkidle0" }),
484-
]);
485376
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");
486377
await backBtn.click();
487378
await waitForDashboard(page);
488379
});
489-
it("should show a link redirecting back if visited after sign in - setup in stepUp", async () => {
380+
it("should show a link redirecting back if visited after sign in - verification", async () => {
490381
await setupST({
491382
...appConfig,
492383
mfaInfo: {
@@ -499,28 +390,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
499390
await tryEmailPasswordSignIn(page, email);
500391

501392
await Promise.all([
502-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?stepUp=true`),
503-
page.waitForNavigation({ waitUntil: "networkidle0" }),
504-
]);
505-
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");
506-
await backBtn.click();
507-
await waitForDashboard(page);
508-
});
509-
510-
it("should show a link redirecting back if visited after sign in - verification in stepUp", async () => {
511-
await setupST({
512-
...appConfig,
513-
mfaInfo: {
514-
requirements: [],
515-
alreadySetup: [factorId],
516-
allowedToSetup: [],
517-
},
518-
});
519-
520-
await tryEmailPasswordSignIn(page, email);
521-
522-
await Promise.all([
523-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?stepUp=true`),
393+
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}`),
524394
page.waitForNavigation({ waitUntil: "networkidle0" }),
525395
]);
526396
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");

test/end-to-end/mfa.factorscreen.totp.test.js

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
334334
}
335335
});
336336

337-
it("should redirect back if visited after sign in without stepUp param", async () => {
337+
it("should show a link redirecting back if visited after sign in - setup", async () => {
338338
await setupST({
339339
...appConfig,
340340
mfaInfo: {
@@ -350,31 +350,12 @@ describe("SuperTokens SignIn w/ MFA", function () {
350350
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}`),
351351
page.waitForNavigation({ waitUntil: "networkidle0" }),
352352
]);
353-
await waitForDashboard(page);
354-
});
355-
356-
it("should show a link redirecting back if visited after sign in - force setup", async () => {
357-
await setupST({
358-
...appConfig,
359-
mfaInfo: {
360-
requirements: [],
361-
alreadySetup: [factorId],
362-
allowedToSetup: [factorId],
363-
},
364-
});
365-
366-
await tryEmailPasswordSignIn(page, email);
367-
368-
await Promise.all([
369-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?setup=true`),
370-
page.waitForNavigation({ waitUntil: "networkidle0" }),
371-
]);
372353
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");
373354
await backBtn.click();
374355
await waitForDashboard(page);
375356
});
376357

377-
it("should show a link redirecting back if visited after sign in - setup in stepUp", async () => {
358+
it("should show a link redirecting back if visited after sign in - verification", async () => {
378359
await setupST({
379360
...appConfig,
380361
mfaInfo: {
@@ -387,28 +368,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
387368
await tryEmailPasswordSignIn(page, email);
388369

389370
await Promise.all([
390-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?stepUp=true`),
391-
page.waitForNavigation({ waitUntil: "networkidle0" }),
392-
]);
393-
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");
394-
await backBtn.click();
395-
await waitForDashboard(page);
396-
});
397-
398-
it("should show a link redirecting back if visited after sign in - verification in stepUp", async () => {
399-
await setupST({
400-
...appConfig,
401-
mfaInfo: {
402-
requirements: [],
403-
alreadySetup: [factorId],
404-
allowedToSetup: [],
405-
},
406-
});
407-
408-
await tryEmailPasswordSignIn(page, email);
409-
410-
await Promise.all([
411-
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}?stepUp=true`),
371+
page.goto(`${TEST_CLIENT_BASE_URL}/auth/mfa/${factorId}`),
412372
page.waitForNavigation({ waitUntil: "networkidle0" }),
413373
]);
414374
const backBtn = await waitForSTElement(page, "[data-supertokens~=backButton]");

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

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

260260
it("should throw error if there are no valid next options", async () => {
261-
setupST({
261+
await setupST({
262262
...appConfig,
263263
mfaInfo: {
264264
requirements: ["unknown"],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { TEST_CLIENT_BASE_URL, DEFAULT_WEBSITE_BASE_PATH, ST_ROOT_SELECTOR } fro
3838
/*
3939
* Tests.
4040
*/
41-
describe.skip("SuperTokens Multitenancy w/ mocked login methods", function () {
41+
describe("SuperTokens Multitenancy w/ mocked login methods", function () {
4242
let browser;
4343
let page;
4444
let pageCrashed;

test/end-to-end/passwordless.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,6 @@ export function getPasswordlessTestCases({ authRecipe, logId, generalErrorRecipe
545545
});
546546

547547
function getTestCases(contactMethod, inputName, contactInfo) {
548-
let contactInfoSubmitLogs =
549-
authRecipe === "all" && inputName == "email"
550-
? contactInfoSubmitLogsWithEmailChecks
551-
: contactInfoSubmitLogsWithoutEmailChecks;
552-
553548
let accountLinkingSupported;
554549
let coreUrl;
555550
const appId = randomUUID();

test/end-to-end/signup.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ describe("SuperTokens SignUp => Server Error", function () {
890890
});
891891

892892
after(async function () {
893-
await browser.close();
893+
await browser?.close();
894894
await backendHook("after");
895895
});
896896

test/end-to-end/thirdpartypasswordless.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
setupCoreApp,
3939
setupST,
4040
screenshotOnFailure,
41+
isReact16,
4142
} from "../helpers";
4243
import { TEST_CLIENT_BASE_URL, SIGN_IN_UP_API, GET_AUTH_URL_API } from "../constants";
4344

test/end-to-end/thirdpartypasswordless.tp.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* Imports
1818
*/
1919

20-
import { getFeatureFlags } from "../helpers";
20+
import { getFeatureFlags, isReact16 } from "../helpers";
2121
import { getThirdPartyTestCases } from "./thirdparty.test";
22-
import { getPasswordlessTestCases } from "./passwordless.test";
2322

2423
/*
2524
* Tests.

0 commit comments

Comments
 (0)