Skip to content

Commit 80ac0f9

Browse files
fix: failing auth-react tests [0.38] (#897)
* update: remove `enabledRecipes` config * Skip thirdpartyemailpassword if not enabled in backend * fix: `after` hook page close failures * update: moves variable to correct block --------- Co-authored-by: Deepjyoti Barman <[email protected]>
1 parent da9ddcb commit 80ac0f9

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ let consoleLogs;
6363

6464
describe("General error rendering", function () {
6565
let coreUrl;
66-
let enabledRecipes = undefined;
6766
before(async function () {
6867
const _isGeneralErrorSupported = await isGeneralErrorSupported();
6968
if (!_isGeneralErrorSupported) {
@@ -77,7 +76,7 @@ describe("General error rendering", function () {
7776
beforeEach(async function () {
7877
await backendHook("beforeEach");
7978
coreUrl = await setupCoreApp();
80-
await setupST({ coreUrl, enabledRecipes });
79+
await setupST({ coreUrl });
8180
page = await browser.newPage();
8281

8382
consoleLogs = [];
@@ -212,18 +211,11 @@ describe("General error rendering", function () {
212211
});
213212

214213
describe("ThirdPartyEmailPassword", function () {
215-
before(async function () {
216-
enabledRecipes = ["thirdpartyemailpassword", "session"];
217-
});
218-
219214
getEmailPasswordTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
220215
getThirdPartyTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
221216
});
222217

223218
describe("ThirdPartyPasswordless", function () {
224-
before(async function () {
225-
enabledRecipes = ["thirdpartypasswordless", "session"];
226-
});
227219
getThirdPartyTests("thirdpartypasswordless", "THIRD_PARTY_PASSWORDLESS");
228220
});
229221

test/end-to-end/getRedirectionURL.test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { TEST_CLIENT_BASE_URL, SIGN_IN_UP_API } from "../constants";
2323

2424
describe("getRedirectionURL Tests", function () {
2525
let browser;
26-
let page;
2726

2827
before(async function () {
2928
await backendHook("before");
@@ -46,6 +45,8 @@ describe("getRedirectionURL Tests", function () {
4645

4746
describe("Test that isNewRecipeUser is passed correctly", function () {
4847
describe("Email Password Recipe", function () {
48+
let page;
49+
4950
beforeEach(async function () {
5051
page = await browser.newPage();
5152
const coreUrl = await setupCoreApp();
@@ -72,6 +73,8 @@ describe("getRedirectionURL Tests", function () {
7273
});
7374

7475
describe("Third party recipe", function () {
76+
let page;
77+
7578
before(async function () {
7679
const coreUrl = await setupCoreApp();
7780
await setupST({ coreUrl });
@@ -105,6 +108,8 @@ describe("getRedirectionURL Tests", function () {
105108
});
106109

107110
describe("Thirdpartyemailpassword recipe", function () {
111+
let page;
112+
108113
before(async function () {
109114
const coreUrl = await setupCoreApp();
110115
await setupST({ coreUrl });
@@ -145,6 +150,7 @@ describe("getRedirectionURL Tests", function () {
145150

146151
describe("Passwordless recipe", function () {
147152
const exampleEmail = "[email protected]";
153+
let page;
148154

149155
before(async function () {
150156
let _isPasswordlessSupported = await isPasswordlessSupported();
@@ -207,6 +213,7 @@ describe("getRedirectionURL Tests", function () {
207213

208214
describe("ThirdPartyPasswordless recipe", function () {
209215
const exampleEmail = "[email protected]";
216+
let page;
210217

211218
before(async function () {
212219
let _isThirdPartyPasswordlessSupported = await isThirdPartyPasswordlessSupported();
@@ -283,6 +290,8 @@ describe("getRedirectionURL Tests", function () {
283290

284291
describe("No Redirection", function () {
285292
describe("Email Password Recipe", function () {
293+
let page;
294+
286295
before(async function () {
287296
const coreUrl = await setupCoreApp();
288297
await setupST({ coreUrl });
@@ -320,6 +329,7 @@ describe("getRedirectionURL Tests", function () {
320329

321330
describe("Passwordless recipe", function () {
322331
const exampleEmail = "[email protected]";
332+
let page;
323333

324334
before(async function () {
325335
let _isPasswordlessSupported = await isPasswordlessSupported();
@@ -387,6 +397,7 @@ describe("getRedirectionURL Tests", function () {
387397

388398
describe("ThirdPartyPasswordless recipe: Magic Link", function () {
389399
const exampleEmail = "[email protected]";
400+
let page;
390401

391402
before(async function () {
392403
let _isThirdPartyPasswordlessSupported = await isThirdPartyPasswordlessSupported();
@@ -453,6 +464,7 @@ describe("getRedirectionURL Tests", function () {
453464
});
454465

455466
describe("ThirdParty Recipe", function () {
467+
let page;
456468
before(async function () {
457469
const coreUrl = await setupCoreApp();
458470
await setupST({ coreUrl });

test/end-to-end/thirdpartyemailpassword.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import {
4949
backendHook,
5050
setupCoreApp,
5151
setupST,
52+
isThirdPartyEmailPasswordSupported,
5253
} from "../helpers";
5354
import {
5455
TEST_CLIENT_BASE_URL,
@@ -71,6 +72,10 @@ describe("SuperTokens Third Party Email Password", function () {
7172
const appConfig = {};
7273

7374
before(async function () {
75+
if (!(await isThirdPartyEmailPasswordSupported())) {
76+
this.skip();
77+
}
78+
7479
await backendHook("before");
7580
const coreUrl = await setupCoreApp();
7681
appConfig.coreUrl = coreUrl;

test/helpers.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,15 @@ export async function isThirdPartyPasswordlessSupported() {
961961
return false;
962962
}
963963

964+
export async function isThirdPartyEmailPasswordSupported() {
965+
const features = await getFeatureFlags();
966+
if (features.includes("thirdpartyemailpassword")) {
967+
return true;
968+
}
969+
970+
return false;
971+
}
972+
964973
export async function isUserRolesSupported() {
965974
const features = await getFeatureFlags();
966975
if (!features.includes("userroles")) {

0 commit comments

Comments
 (0)