Skip to content

Commit 2ee063c

Browse files
committed
test: switch most thirdparty test to use mock provider
1 parent bfe9f61 commit 2ee063c

9 files changed

+81
-58
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
assertProviders,
3838
clickOnProviderButton,
3939
clickOnProviderButtonWithoutWaiting,
40-
loginWithAuth0,
40+
loginWithMockProvider,
4141
isGeneralErrorSupported,
4242
setGeneralErrorToLocalStorage,
4343
backendBeforeEach,
@@ -403,7 +403,7 @@ function getThirdPartyTests(rid, ridForStorage) {
403403
await assertProviders(page);
404404

405405
let [_, response1] = await Promise.all([
406-
clickOnProviderButtonWithoutWaiting(page, "Auth0"),
406+
clickOnProviderButtonWithoutWaiting(page, "Mock Provider"),
407407
page.waitForResponse(
408408
(response) =>
409409
response.url().includes(GET_AUTH_URL_API) &&
@@ -428,10 +428,10 @@ function getThirdPartyTests(rid, ridForStorage) {
428428

429429
await page.goto(`${TEST_CLIENT_BASE_URL}/auth`);
430430
await assertProviders(page);
431-
await clickOnProviderButton(page, "Auth0");
431+
await clickOnProviderButton(page, "Mock Provider");
432432

433433
let [_, response1] = await Promise.all([
434-
loginWithAuth0(page),
434+
loginWithMockProvider(page),
435435
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
436436
]);
437437

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
screenshotOnFailure,
88
assertProviders,
99
clickOnProviderButton,
10-
loginWithAuth0,
10+
loginWithMockProvider,
1111
setPasswordlessFlowType,
1212
waitForSTElement,
1313
getPasswordlessDevice,
@@ -114,9 +114,9 @@ describe("getRedirectionURL Tests", function () {
114114
page.waitForNavigation({ waitUntil: "networkidle0" }),
115115
]);
116116
await assertProviders(page);
117-
await clickOnProviderButton(page, "Auth0");
117+
await clickOnProviderButton(page, "Mock Provider");
118118
await Promise.all([
119-
loginWithAuth0(page),
119+
loginWithMockProvider(page),
120120
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
121121
]);
122122
const newUserCheck = await page.evaluate(() => localStorage.getItem("isNewUserCheck"));
@@ -170,9 +170,9 @@ describe("getRedirectionURL Tests", function () {
170170

171171
it("Test that isNewRecipeUser works correctly when signing up with auth 0", async function () {
172172
await assertProviders(page);
173-
await clickOnProviderButton(page, "Auth0");
173+
await clickOnProviderButton(page, "Mock Provider");
174174
await Promise.all([
175-
loginWithAuth0(page),
175+
loginWithMockProvider(page),
176176
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
177177
]);
178178
const newUserCheck = await page.evaluate(() => localStorage.getItem("isNewUserCheck"));
@@ -354,9 +354,9 @@ describe("getRedirectionURL Tests", function () {
354354
page.waitForNavigation({ waitUntil: "networkidle0" }),
355355
]);
356356
await assertProviders(page);
357-
await clickOnProviderButton(page, "Auth0");
357+
await clickOnProviderButton(page, "Mock Provider");
358358
await Promise.all([
359-
loginWithAuth0(page),
359+
loginWithMockProvider(page),
360360
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
361361
]);
362362
const newUserCheck = await page.evaluate(() => localStorage.getItem("isNewUserCheck"));
@@ -642,10 +642,10 @@ describe("getRedirectionURL Tests", function () {
642642
]);
643643

644644
await assertProviders(page);
645-
await clickOnProviderButton(page, "Auth0");
645+
await clickOnProviderButton(page, "Mock Provider");
646646

647647
await Promise.all([
648-
loginWithAuth0(page),
648+
loginWithMockProvider(page),
649649
page.waitForResponse(
650650
(response) => response.url() === SIGN_IN_UP_API && response.status() === 200
651651
),
@@ -654,7 +654,7 @@ describe("getRedirectionURL Tests", function () {
654654
const urlAfterSignUp = await page.url();
655655
const newUserCheck = await page.evaluate(() => localStorage.getItem("isNewUserCheck"));
656656
assert.equal(newUserCheck, "thirdparty-true");
657-
assert(urlAfterSignUp.includes("/auth/callback/auth0"));
657+
assert(urlAfterSignUp.includes("/auth/callback/mock-provider"));
658658
});
659659
});
660660
});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ import {
3434
loginWithGoogle,
3535
clearBrowserCookiesWithoutAffectingConsole,
3636
clickOnProviderButton,
37-
loginWithAuth0,
37+
loginWithMockProvider,
3838
isMultitenancySupported,
3939
isMultitenancyManagementEndpointsSupported,
4040
setupTenant,
4141
backendBeforeEach,
4242
getTextByDataSupertokens,
4343
setupBrowser,
44+
loginWithAuth0,
4445
} from "../helpers";
4546
import {
4647
TEST_CLIENT_BASE_URL,

test/end-to-end/thirdparty.test.js

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ import {
2626
assertNoSTComponents,
2727
generateState,
2828
clickOnProviderButton,
29-
loginWithAuth0,
29+
loginWithMockProvider,
3030
getGeneralError,
3131
waitFor,
3232
screenshotOnFailure,
3333
clickOnProviderButtonWithoutWaiting,
3434
backendBeforeEach,
3535
waitForUrl,
3636
setupBrowser,
37+
loginWithAuth0,
3738
} from "../helpers";
3839

3940
import { TEST_CLIENT_BASE_URL, TEST_SERVER_BASE_URL, SIGN_IN_UP_API, GET_AUTH_URL_API } from "../constants";
@@ -137,37 +138,37 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
137138
]);
138139
});
139140

140-
it("Successful sign in with Auth0 with redirectToPath (w/ leading slash) keeping query params", async function () {
141+
it("Successful sign in with redirectToPath (w/ leading slash) keeping query params", async function () {
141142
await Promise.all([
142143
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=%2Fredirect-here%3Ffoo%3Dbar`),
143144
page.waitForNavigation({ waitUntil: "networkidle0" }),
144145
]);
145146
await assertProviders(page);
146-
await clickOnProviderButton(page, "Auth0");
147+
await clickOnProviderButton(page, "Mock Provider");
147148
await Promise.all([
148-
loginWithAuth0(page),
149+
loginWithMockProvider(page),
149150
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
150151
]);
151152
const { pathname, search } = await page.evaluate(() => window.location);
152153
assert.deepStrictEqual(pathname + search, "/redirect-here?foo=bar");
153154
});
154155

155-
it("Successful sign in with Auth0 with redirectToPath (w/o leading slash) keeping query params", async function () {
156+
it("Successful sign in with SSO with redirectToPath (w/o leading slash) keeping query params", async function () {
156157
await Promise.all([
157158
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=%3Ffoo%3Dbar`),
158159
page.waitForNavigation({ waitUntil: "networkidle0" }),
159160
]);
160161
await assertProviders(page);
161-
await clickOnProviderButton(page, "Auth0");
162+
await clickOnProviderButton(page, "Mock Provider");
162163
await Promise.all([
163-
loginWithAuth0(page),
164+
loginWithMockProvider(page),
164165
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
165166
]);
166167
const { pathname, search } = await page.evaluate(() => window.location);
167168
assert.deepStrictEqual(pathname + search, "/?foo=bar");
168169
});
169170

170-
it("Successful sign in with Auth0 with redirectToPath (query params + fragment)", async function () {
171+
it("Successful sign in with SSO with redirectToPath (query params + fragment)", async function () {
171172
await Promise.all([
172173
page.goto(
173174
`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=${encodeURIComponent(
@@ -177,39 +178,39 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
177178
page.waitForNavigation({ waitUntil: "networkidle0" }),
178179
]);
179180
await assertProviders(page);
180-
await clickOnProviderButton(page, "Auth0");
181+
await clickOnProviderButton(page, "Mock Provider");
181182
await Promise.all([
182-
loginWithAuth0(page),
183+
loginWithMockProvider(page),
183184
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
184185
]);
185186
const { pathname, search, hash } = await page.evaluate(() => window.location);
186187
assert.deepStrictEqual(pathname + search + hash, "/redirect-here?foo=bar#cell=4,1-6,2");
187188
});
188189

189-
it("Successful sign in with Auth0 with redirectToPath (only fragment)", async function () {
190+
it("Successful sign in with SSO with redirectToPath (only fragment)", async function () {
190191
await Promise.all([
191192
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=${encodeURIComponent("#cell=4,1-6,2")}`),
192193
page.waitForNavigation({ waitUntil: "networkidle0" }),
193194
]);
194195
await assertProviders(page);
195-
await clickOnProviderButton(page, "Auth0");
196+
await clickOnProviderButton(page, "Mock Provider");
196197
await Promise.all([
197-
loginWithAuth0(page),
198+
loginWithMockProvider(page),
198199
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
199200
]);
200201
const { pathname, search, hash } = await page.evaluate(() => window.location);
201202
assert.deepStrictEqual(pathname + search + hash, "/#cell=4,1-6,2");
202203
});
203204

204-
it("Successful signin with Auth0 and email verification", async function () {
205+
it("Successful signin with SSO and email verification", async function () {
205206
await Promise.all([
206207
page.goto(`${TEST_CLIENT_BASE_URL}/auth?mode=REQUIRED`),
207208
page.waitForNavigation({ waitUntil: "networkidle0" }),
208209
]);
209210
await assertProviders(page);
210-
await clickOnProviderButton(page, "Auth0");
211+
await clickOnProviderButton(page, "Mock Provider");
211212
await Promise.all([
212-
loginWithAuth0(page),
213+
loginWithMockProvider(page),
213214
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
214215
]);
215216
await page.waitForSelector(".sessionInfo-user-id");
@@ -241,48 +242,51 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
241242
]);
242243
});
243244

244-
it("Successful signin with auth0 and redirectToPath", async function () {
245+
it("Successful signin with SSO and redirectToPath", async function () {
245246
await Promise.all([
246247
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=/hello`),
247248
page.waitForNavigation({ waitUntil: "networkidle0" }),
248249
]);
249250
await assertProviders(page);
250-
await clickOnProviderButton(page, "Auth0");
251+
await clickOnProviderButton(page, "Mock Provider");
251252
await Promise.all([
252-
loginWithAuth0(page),
253+
loginWithMockProvider(page),
253254
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
254255
]);
255256
await waitForUrl(page, "/hello");
256257
});
257258

258-
it("Successful signin with auth0 and redirectToPath case sensitive", async function () {
259+
it("Successful signin with SSO and redirectToPath case sensitive", async function () {
259260
await Promise.all([
260261
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=%2FCasE%2FCase-SensItive1-PAth`),
261262
page.waitForNavigation({ waitUntil: "networkidle0" }),
262263
]);
263264
await assertProviders(page);
264-
await clickOnProviderButton(page, "Auth0");
265+
await clickOnProviderButton(page, "Mock Provider");
265266
await Promise.all([
266-
loginWithAuth0(page),
267+
loginWithMockProvider(page),
267268
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
268269
]);
269270
await waitForUrl(page, "/CasE/Case-SensItive1-PAth");
270271
});
271272

272273
it("should work with custom getRedirectUrl", async function () {
273274
await page.evaluate((TEST_CLIENT_BASE_URL) => {
274-
localStorage.setItem("thirdPartyRedirectURL", `${TEST_CLIENT_BASE_URL}/auth/auth0-custom-redirect`);
275+
localStorage.setItem(
276+
"thirdPartyRedirectURL",
277+
`${TEST_CLIENT_BASE_URL}/auth/mock-provider-custom-redirect`
278+
);
275279
}, TEST_CLIENT_BASE_URL);
276280

277281
await Promise.all([
278282
page.goto(`${TEST_CLIENT_BASE_URL}/auth?redirectToPath=/hello`),
279283
page.waitForNavigation({ waitUntil: "networkidle0" }),
280284
]);
281285
await assertProviders(page);
282-
await clickOnProviderButton(page, "Auth0");
283-
await loginWithAuth0(page);
286+
await clickOnProviderButton(page, "Mock Provider");
287+
await loginWithMockProvider(page);
284288

285-
await waitForUrl(page, "/auth/auth0-custom-redirect");
289+
await waitForUrl(page, "/auth/mock-provider-custom-redirect");
286290
});
287291

288292
// it("Successful signin with facebook", async function () {
@@ -354,8 +358,8 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
354358
}
355359
};
356360
page.on("request", requestHandler);
357-
await clickOnProviderButton(page, "Auth0");
358-
await loginWithAuth0(page);
361+
await clickOnProviderButton(page, "Mock Provider");
362+
await loginWithMockProvider(page);
359363
const error = await getGeneralError(page);
360364
assert.deepStrictEqual(error, "TOS");
361365
});
@@ -390,8 +394,8 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
390394
};
391395
page.on("request", requestHandler);
392396

393-
await clickOnProviderButton(page, "Auth0");
394-
await loginWithAuth0(page);
397+
await clickOnProviderButton(page, "Mock Provider");
398+
await loginWithMockProvider(page);
395399

396400
const error = await getGeneralError(page);
397401
assert.deepStrictEqual(error, "Test message!!!!");

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
getLogoutButton,
3030
signUp,
3131
toggleSignInSignUp,
32-
loginWithAuth0,
32+
loginWithMockProvider,
3333
getLoginWithRedirectToSignIn,
3434
getLoginWithRedirectToSignUp,
3535
getAuthPageHeaderText,
@@ -284,11 +284,11 @@ describe("SuperTokens Third Party Email Password", function () {
284284
await waitForSTElement(page, "[data-supertokens~=generalError]", true);
285285
});
286286

287-
it("Successful signin/up with auth0", async function () {
287+
it("Successful signin/up", async function () {
288288
await assertProviders(page);
289-
await clickOnProviderButton(page, "Auth0");
289+
await clickOnProviderButton(page, "Mock Provider");
290290
await Promise.all([
291-
loginWithAuth0(page),
291+
loginWithMockProvider(page),
292292
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
293293
]);
294294
await page.waitForSelector(".sessionInfo-user-id");
@@ -339,10 +339,10 @@ describe("SuperTokens Third Party Email Password", function () {
339339
await Promise.all([await logoutButton.click(), page.waitForNavigation({ waitUntil: "networkidle0" })]);
340340

341341
await waitForUrl(page, "/auth");
342-
// 2. Sign in with auth0 with same address.
343-
await clickOnProviderButton(page, "Auth0");
342+
// 2. Sign in with SSO with same address.
343+
await clickOnProviderButton(page, "Mock Provider");
344344
await Promise.all([
345-
loginWithAuth0(page),
345+
loginWithMockProvider(page),
346346
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
347347
]);
348348
await waitForUrl(page, "/dashboard");

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
clickOnProviderButton,
2525
getUserIdWithFetch,
2626
getLogoutButton,
27-
loginWithAuth0,
27+
loginWithMockProvider,
2828
setInputValues,
2929
submitForm,
3030
waitForSTElement,
@@ -139,10 +139,10 @@ describe("SuperTokens Third Party Passwordless", function () {
139139

140140
await waitForSTElement(page, `input[name=email]`);
141141

142-
// 3. Sign in with auth0 with same address.
143-
await clickOnProviderButton(page, "Auth0");
142+
// 3. Sign in with SSO with same address.
143+
await clickOnProviderButton(page, "Mock Provider");
144144
await Promise.all([
145-
loginWithAuth0(page),
145+
loginWithMockProvider(page),
146146
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
147147
]);
148148
await Promise.all([page.waitForSelector(".sessionInfo-user-id"), page.waitForNetworkIdle()]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
clickOnProviderButton,
2525
getUserIdWithFetch,
2626
getLogoutButton,
27-
loginWithAuth0,
27+
loginWithMockProvider,
2828
setInputValues,
2929
submitForm,
3030
waitForSTElement,

test/end-to-end/userContext.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import {
2323
submitFormReturnRequestAndResponse,
2424
assertProviders,
2525
clickOnProviderButton,
26-
loginWithAuth0,
26+
loginWithMockProvider,
2727
backendBeforeEach,
2828
waitForUrl,
2929
setupBrowser,
30+
loginWithAuth0,
3031
} from "../helpers";
3132
import {
3233
TEST_CLIENT_BASE_URL,

0 commit comments

Comments
 (0)