diff --git a/test/end-to-end/thirdpartypasswordless.pwless.test.js b/test/end-to-end/thirdpartypasswordless.pwless.test.js new file mode 100644 index 000000000..6e881a36d --- /dev/null +++ b/test/end-to-end/thirdpartypasswordless.pwless.test.js @@ -0,0 +1,63 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/* + * Imports + */ + +import assert from "assert"; +import puppeteer from "puppeteer"; +import { + clearBrowserCookiesWithoutAffectingConsole, + clickOnProviderButton, + getUserIdWithFetch, + getLogoutButton, + loginWithAuth0, + setInputValues, + submitForm, + waitForSTElement, + getPasswordlessDevice, + setPasswordlessFlowType, + getFeatureFlags, + isReact16, + assertProviders, + setEnabledRecipes, + clickOnProviderButtonWithoutWaiting, + getGeneralError, + backendBeforeEach, +} from "../helpers"; +import { TEST_CLIENT_BASE_URL, TEST_SERVER_BASE_URL, SIGN_IN_UP_API, GET_AUTH_URL_API } from "../constants"; +import { getThirdPartyTestCases } from "./thirdparty.test"; +import { getPasswordlessTestCases } from "./passwordless.test"; + +/* + * Tests. + */ +describe("SuperTokens Third Party Passwordless", function () { + before(async function () { + const features = await getFeatureFlags(); + if (!features.includes("thirdpartypasswordless")) { + this.skip(); + } + }); + + describe("Passwordless specific", function () { + getPasswordlessTestCases({ + authRecipe: "thirdpartypasswordless", + logId: "THIRDPARTYPASSWORDLESS", + generalErrorRecipeName: "THIRD_PARTY_PASSWORDLESS", + }); + }); +}); diff --git a/test/end-to-end/thirdpartypasswordless.test.js b/test/end-to-end/thirdpartypasswordless.test.js index cb7ac0bd2..ab45c5d8e 100644 --- a/test/end-to-end/thirdpartypasswordless.test.js +++ b/test/end-to-end/thirdpartypasswordless.test.js @@ -225,22 +225,4 @@ describe("SuperTokens Third Party Passwordless", function () { assert.strictEqual(await getGeneralError(page), "Something went wrong. Please try again."); }); }); - - describe("Third Party specific", function () { - getThirdPartyTestCases({ - authRecipe: "thirdpartypasswordless", - rid: "thirdpartypasswordless", - logId: "THIRDPARTYPASSWORDLESS", - signInUpPageLoadLogs, - thirdPartySignInUpLog: "THIRD_PARTY_SIGN_IN_AND_UP", - }); - }); - - describe("Passwordless specific", function () { - getPasswordlessTestCases({ - authRecipe: "thirdpartypasswordless", - logId: "THIRDPARTYPASSWORDLESS", - generalErrorRecipeName: "THIRD_PARTY_PASSWORDLESS", - }); - }); }); diff --git a/test/end-to-end/thirdpartypasswordless.tp.test.js b/test/end-to-end/thirdpartypasswordless.tp.test.js new file mode 100644 index 000000000..71943298f --- /dev/null +++ b/test/end-to-end/thirdpartypasswordless.tp.test.js @@ -0,0 +1,72 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/* + * Imports + */ + +import assert from "assert"; +import puppeteer from "puppeteer"; +import { + clearBrowserCookiesWithoutAffectingConsole, + clickOnProviderButton, + getUserIdWithFetch, + getLogoutButton, + loginWithAuth0, + setInputValues, + submitForm, + waitForSTElement, + getPasswordlessDevice, + setPasswordlessFlowType, + getFeatureFlags, + isReact16, + assertProviders, + setEnabledRecipes, + clickOnProviderButtonWithoutWaiting, + getGeneralError, + backendBeforeEach, +} from "../helpers"; +import { TEST_CLIENT_BASE_URL, TEST_SERVER_BASE_URL, SIGN_IN_UP_API, GET_AUTH_URL_API } from "../constants"; +import { getThirdPartyTestCases } from "./thirdparty.test"; +import { getPasswordlessTestCases } from "./passwordless.test"; + +/* + * Tests. + */ +describe("SuperTokens Third Party Passwordless", function () { + const signInUpPageLoadLogs = isReact16() + ? ["ST_LOGS THIRDPARTYPASSWORDLESS OVERRIDE GET_LOGIN_ATTEMPT_INFO"] + : [ + "ST_LOGS THIRDPARTYPASSWORDLESS OVERRIDE GET_LOGIN_ATTEMPT_INFO", + "ST_LOGS THIRDPARTYPASSWORDLESS OVERRIDE GET_LOGIN_ATTEMPT_INFO", + ]; + + before(async function () { + const features = await getFeatureFlags(); + if (!features.includes("thirdpartypasswordless")) { + this.skip(); + } + }); + + describe("Third Party specific", function () { + getThirdPartyTestCases({ + authRecipe: "thirdpartypasswordless", + rid: "thirdpartypasswordless", + logId: "THIRDPARTYPASSWORDLESS", + signInUpPageLoadLogs, + thirdPartySignInUpLog: "THIRD_PARTY_SIGN_IN_AND_UP", + }); + }); +}); diff --git a/test/server/index.js b/test/server/index.js index e05e753d1..f001d7fdb 100644 --- a/test/server/index.js +++ b/test/server/index.js @@ -268,6 +268,7 @@ app.post("/beforeeach", async (req, res) => { await killAllST(); await setupST(); + initST(); res.send(); });