Skip to content

Commit adda845

Browse files
fix: failing auth-react tests [0.34] (#898)
* update: remove `enabledRecipes` config * Skip thirdpartyemailpassword if not enabled in backend * fix: `after` hook page close failures --------- Co-authored-by: Deepjyoti Barman <[email protected]>
1 parent 961d257 commit adda845

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
@@ -65,7 +65,6 @@ let consoleLogs;
6565

6666
describe("General error rendering", function () {
6767
let coreUrl;
68-
let enabledRecipes = undefined;
6968
before(async function () {
7069
const _isGeneralErrorSupported = await isGeneralErrorSupported();
7170
if (!_isGeneralErrorSupported) {
@@ -79,7 +78,7 @@ describe("General error rendering", function () {
7978
beforeEach(async function () {
8079
await backendHook("beforeEach");
8180
coreUrl = await setupCoreApp();
82-
await setupST({ coreUrl, enabledRecipes });
81+
await setupST({ coreUrl });
8382
page = await browser.newPage();
8483

8584
consoleLogs = [];
@@ -214,18 +213,11 @@ describe("General error rendering", function () {
214213
});
215214

216215
describe("ThirdPartyEmailPassword", function () {
217-
before(async function () {
218-
enabledRecipes = ["thirdpartyemailpassword", "session"];
219-
});
220-
221216
getEmailPasswordTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
222217
getThirdPartyTests("thirdpartyemailpassword", "THIRD_PARTY_EMAIL_PASSWORD");
223218
});
224219

225220
describe("ThirdPartyPasswordless", function () {
226-
before(async function () {
227-
enabledRecipes = ["thirdpartypasswordless", "session"];
228-
});
229221
getThirdPartyTests("thirdpartypasswordless", "THIRD_PARTY_PASSWORDLESS");
230222
});
231223

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 });
@@ -304,6 +313,7 @@ describe("getRedirectionURL Tests", function () {
304313

305314
describe("Passwordless recipe", function () {
306315
const exampleEmail = "[email protected]";
316+
let page;
307317

308318
before(async function () {
309319
let _isPasswordlessSupported = await isPasswordlessSupported();
@@ -345,6 +355,7 @@ describe("getRedirectionURL Tests", function () {
345355

346356
describe("ThirdPartyPasswordless recipe: Magic Link", function () {
347357
const exampleEmail = "[email protected]";
358+
let page;
348359

349360
before(async function () {
350361
let _isThirdPartyPasswordlessSupported = await isThirdPartyPasswordlessSupported();
@@ -386,6 +397,7 @@ describe("getRedirectionURL Tests", function () {
386397
});
387398

388399
describe("ThirdParty Recipe", function () {
400+
let page;
389401
before(async function () {
390402
const coreUrl = await setupCoreApp();
391403
await setupST({ coreUrl });

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
backendHook,
5252
setupCoreApp,
5353
setupST,
54+
isThirdPartyEmailPasswordSupported,
5455
} from "../helpers";
5556
import {
5657
TEST_CLIENT_BASE_URL,
@@ -76,6 +77,10 @@ describe("SuperTokens Third Party Email Password", function () {
7677
const appConfig = {};
7778

7879
before(async function () {
80+
if (!(await isThirdPartyEmailPasswordSupported())) {
81+
this.skip();
82+
}
83+
7984
await backendHook("before");
8085
const coreUrl = await setupCoreApp();
8186
appConfig.coreUrl = coreUrl;

test/helpers.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,15 @@ export async function isThirdPartyPasswordlessSupported() {
956956
return false;
957957
}
958958

959+
export async function isThirdPartyEmailPasswordSupported() {
960+
const features = await getFeatureFlags();
961+
if (features.includes("thirdpartyemailpassword")) {
962+
return true;
963+
}
964+
965+
return false;
966+
}
967+
959968
export async function isUserRolesSupported() {
960969
const features = await getFeatureFlags();
961970
if (!features.includes("userroles")) {

0 commit comments

Comments
 (0)