Skip to content

Commit 2fb1622

Browse files
Add fixes for tests to make them run
1 parent 7406edc commit 2fb1622

File tree

8 files changed

+265
-159
lines changed

8 files changed

+265
-159
lines changed

package-lock.json

Lines changed: 34 additions & 4 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
@@ -64,6 +64,8 @@ let page;
6464
let consoleLogs;
6565

6666
describe("General error rendering", function () {
67+
let coreUrl;
68+
let enabledRecipes = undefined;
6769
before(async function () {
6870
const _isGeneralErrorSupported = await isGeneralErrorSupported();
6971
if (!_isGeneralErrorSupported) {
@@ -76,8 +78,8 @@ describe("General error rendering", function () {
7678

7779
beforeEach(async function () {
7880
await backendHook("beforeEach");
79-
const coreUrl = await setupCoreApp();
80-
await setupST({ coreUrl });
81+
coreUrl = await setupCoreApp();
82+
await setupST({ coreUrl, enabledRecipes });
8183
page = await browser.newPage();
8284

8385
consoleLogs = [];
@@ -212,11 +214,18 @@ describe("General error rendering", function () {
212214
});
213215

214216
describe("ThirdPartyEmailPassword", function () {
217+
before(async function () {
218+
enabledRecipes = ["thirdpartyemailpassword", "session"];
219+
});
220+
215221
getEmailPasswordTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
216222
getThirdPartyTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
217223
});
218224

219225
describe("ThirdPartyPasswordless", function () {
226+
before(async function () {
227+
enabledRecipes = ["thirdpartypasswordless", "session"];
228+
});
220229
getThirdPartyTests("thirdpartypasswordless", "THIRD_PARTY_PASSWORDLESS");
221230
});
222231

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/passwordless.test.js

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

539539
function getTestCases(contactMethod, inputName, contactInfo) {
540-
let contactInfoSubmitLogs =
541-
authRecipe === "all" && inputName == "email"
542-
? contactInfoSubmitLogsWithEmailChecks
543-
: contactInfoSubmitLogsWithoutEmailChecks;
544-
545540
let accountLinkingSupported;
546541
let coreUrl;
547542
const appId = randomUUID();

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

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

365365
after(async function () {
366-
await browser.close();
366+
await browser?.close();
367367
await backendHook("after");
368368
});
369369

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
setupCoreApp,
4141
setupST,
4242
screenshotOnFailure,
43+
isReact16,
4344
} from "../helpers";
4445
import { TEST_CLIENT_BASE_URL, SIGN_IN_UP_API, GET_AUTH_URL_API } from "../constants";
4546

0 commit comments

Comments
 (0)