Skip to content

Commit

Permalink
test: split tppwless tests into multiple files to help with paralleli…
Browse files Browse the repository at this point in the history
…zation (#742)

* test: split tppwless tests into multiple files to help with parallelization

* chore: bump patch version
  • Loading branch information
porcellus committed Sep 24, 2023
1 parent 2ff1031 commit 19fa8ab
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.35.2] - 2023-09-24

### Test changes

- Split some test suites into multiple files to help with test parallelization

## [0.35.1] - 2023-09-21

### Test changes
Expand Down
2 changes: 1 addition & 1 deletion lib/build/version.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
export const package_version = "0.35.1";
export const package_version = "0.35.2";
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-auth-react",
"version": "0.35.1",
"version": "0.35.2",
"description": "ReactJS SDK that provides login functionality with SuperTokens.",
"main": "./index.js",
"engines": {
Expand Down
63 changes: 63 additions & 0 deletions test/end-to-end/thirdpartypasswordless.pwless.test.js
Original file line number Diff line number Diff line change
@@ -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",
});
});
});
18 changes: 0 additions & 18 deletions test/end-to-end/thirdpartypasswordless.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
});
});
72 changes: 72 additions & 0 deletions test/end-to-end/thirdpartypasswordless.tp.test.js
Original file line number Diff line number Diff line change
@@ -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",
});
});
});
1 change: 1 addition & 0 deletions test/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ app.post("/beforeeach", async (req, res) => {

await killAllST();
await setupST();
initST();
res.send();
});

Expand Down

0 comments on commit 19fa8ab

Please sign in to comment.