Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
18163e7
update: makes test utils/server use applications
namsnath Feb 26, 2025
6ec5b6d
feat: setup mochawesome
namsnath Feb 26, 2025
a6417a0
update: `emailverification` tests use core apps
namsnath Feb 26, 2025
fd624eb
update: `embed` tests use core apps
namsnath Mar 3, 2025
77cdb86
update: `generalerror` tests use core apps
namsnath Mar 3, 2025
e36f2b1
update: `getRedirectionURL` tests use core apps
namsnath Mar 4, 2025
fe872b1
update: remove assertion on creating new apps
namsnath Mar 4, 2025
7ddf577
update: `mfa.chooserscreen` tests use core apps
namsnath Mar 4, 2025
41a3fd1
feat: adds mocha envs to test config
namsnath Mar 4, 2025
a46fb7b
lint: format code
namsnath Mar 4, 2025
d65eaf4
update: `accountlinking` tests use core apps
namsnath Mar 4, 2025
d55fda8
update: `mfa.default_reqs` tests use core apps
namsnath Mar 4, 2025
d71e74a
refactor: split app creation and ST setup utils
namsnath Mar 7, 2025
c11dae0
update: `mfa.factorscreen.otp` tests use core apps
namsnath Mar 7, 2025
b6e5bb1
refactor: split app creation and ST setup utils
namsnath Mar 7, 2025
2041010
update: `mfa.factorscreen.totp` tests use core apps
namsnath Mar 7, 2025
b5a04ba
update: add missing backend hooks
namsnath Mar 11, 2025
b5a1b76
update: `mfa.firstFactors` tests use core apps
namsnath Mar 11, 2025
646f0d4
update: `mfa.requirement_handling` tests use core apps
namsnath Mar 11, 2025
87f778c
update: `mfa.signin` tests use core apps
namsnath Mar 11, 2025
d9f3daf
update: `multitenancy.tenant_interactions` tests use core apps
namsnath Mar 11, 2025
23dadd6
update: `oauth2provider` tests use core apps
namsnath Mar 11, 2025
d7a55f1
update: `resetpasswordusingtoken` tests use core apps
namsnath Mar 12, 2025
c37e670
update: `signin-rrdv5/6` tests use core apps
namsnath Mar 12, 2025
d1c7f48
update: few `thirdparty` tests use core apps
namsnath Mar 12, 2025
88e5ecf
update: removes `visual` tests
namsnath Mar 12, 2025
f54f19e
removes usages of old helper functions
namsnath Mar 12, 2025
eef281a
update: `userContext`/`userroles` tests use core apps
namsnath Mar 12, 2025
3da8a6c
fix: broken tests, update configs
namsnath Mar 14, 2025
10ef8d0
update: remove log
namsnath Mar 14, 2025
a965aac
fix: correct setup ST url
namsnath Mar 19, 2025
5e586a0
test: only run few tests
namsnath Mar 19, 2025
46d7103
revert: test: only run few tests
namsnath Mar 20, 2025
5bbad1f
Fix package-lock issues
deepjyoti30-st Mar 25, 2025
aa04571
Add some fixes for userContext and test server
deepjyoti30-st Mar 25, 2025
67c72c5
update: remove spec config in mocha
namsnath Mar 25, 2025
c9e289e
Add fixes for some failing updates
deepjyoti30-st Apr 2, 2025
3c77a8c
Add workflow and docker compose file for runs
deepjyoti30-st Apr 2, 2025
d0e0bb4
Modify the workflow to run in a separate workflow for test
deepjyoti30-st Apr 4, 2025
b8032dd
Fix FDI versions and branch ref
deepjyoti30-st Apr 4, 2025
ab28870
Update .github/workflows/auth-react-test-1.yml
deepjyoti30-st Apr 7, 2025
165daa3
Update workflow to make it ready for merge
deepjyoti30-st Apr 7, 2025
7e5c70f
Add unit test workflow
deepjyoti30-st Apr 11, 2025
2c8d6ec
Get rid of using random UUID for appId
deepjyoti30-st Apr 15, 2025
32c6cef
Rename Core test to Core Functionality
deepjyoti30-st Apr 15, 2025
fbbcb06
Get rid of a TODO
deepjyoti30-st Apr 15, 2025
ecad24b
Get rid of using timeout in tests
deepjyoti30-st Apr 16, 2025
f215d04
Get rid of setting appId from tests directly
deepjyoti30-st Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Auth-React Unit Tests

on:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install
- run: npm run test-unit
19 changes: 6 additions & 13 deletions test/end-to-end/accountlinking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
screenshotOnFailure,
} from "../helpers";
import { TEST_CLIENT_BASE_URL, RESET_PASSWORD_API } from "../constants";
import { randomUUID } from "node:crypto";

/*
* Tests.
Expand Down Expand Up @@ -322,8 +321,7 @@ describe("SuperTokens Account linking", function () {

it("should not allow sign in w/ an unverified emailpassword user in case of conflict", async function () {
// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down Expand Up @@ -491,8 +489,7 @@ describe("SuperTokens Account linking", function () {

it("should not allow sign in w/ an unverified thirdparty user in case of conflict", async function () {
// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down Expand Up @@ -561,8 +558,7 @@ describe("SuperTokens Account linking", function () {
const email = `test-user+${Date.now()}@supertokens.com`;

// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down Expand Up @@ -611,8 +607,7 @@ describe("SuperTokens Account linking", function () {
it("should not allow sign up w/ passwordless if it conflicts with an unverified user", async function () {
const email = `test-user+${Date.now()}@supertokens.com`;
// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down Expand Up @@ -663,8 +658,7 @@ describe("SuperTokens Account linking", function () {
const email2 = `test-user2+${Date.now()}@supertokens.com`;

// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down Expand Up @@ -739,8 +733,7 @@ describe("SuperTokens Account linking", function () {
await page.evaluate(() => window.localStorage.setItem("mode", "REQUIRED"));

// Use a common appId over the test to allow re-inits
const appId = randomUUID();
const coreUrl = await setupCoreApp({ appId });
const coreUrl = await setupCoreApp({ appId: "test-app-id" });
await setupST({
coreUrl,
passwordlessFlowType,
Expand Down
15 changes: 7 additions & 8 deletions test/end-to-end/emailverification.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe("Email Verification", () => {
await backendHook("after");
});

describe("Core", function () {
describe("Core Functionality", function () {
describe("Email verification screen", function () {
it("Should redirect to auth from email verification protected page if the user is deleted", async function () {
await toggleSignInSignUp(page);
Expand Down Expand Up @@ -168,7 +168,6 @@ describe("Email Verification", () => {
rid: "emailpassword",
}),
});
await new Promise((r) => setTimeout(r, 11000));

consoleLogs = [];
await page.reload({ waitUntil: ["networkidle0"] });
Expand Down Expand Up @@ -349,7 +348,7 @@ describe("Email Verification", () => {
await toggleSignInSignUp(page);
await defaultSignUp(page);
await logoutFromEmailVerification(page);
await new Promise((r) => setTimeout(r, 1000));
await waitForUrl(page, "/auth/");
consoleLogs = [];

await Promise.all([
Expand All @@ -361,8 +360,9 @@ describe("Email Verification", () => {
{ name: "password", value: "Str0ngP@ssw0rd" },
]);
await Promise.all([submitForm(page), page.waitForNavigation({ waitUntil: "networkidle0" })]);
await new Promise((r) => setTimeout(r, 2000));
await waitForUrl(page, "/auth/verify-email");
await waitForSTElement(page, "[data-supertokens~='sendVerifyEmailResend']");

// Click on resend email should show "Email Resent" success message
await sendVerifyEmail(page);
await page.waitForResponse(
Expand Down Expand Up @@ -393,10 +393,10 @@ describe("Email Verification", () => {
"ST_LOGS SESSION OVERRIDE GET_USER_ID",
"ST_LOGS EMAIL_VERIFICATION OVERRIDE SEND_VERIFICATION_EMAIL",
"ST_LOGS EMAIL_VERIFICATION PRE_API_HOOKS SEND_VERIFY_EMAIL",
"ST_LOGS EMAIL_VERIFICATION ON_HANDLE_EVENT VERIFY_EMAIL_SENT",
"ST_LOGS EMAIL_VERIFICATION OVERRIDE SEND_VERIFICATION_EMAIL",
"ST_LOGS EMAIL_VERIFICATION PRE_API_HOOKS SEND_VERIFY_EMAIL",
"ST_LOGS EMAIL_VERIFICATION ON_HANDLE_EVENT VERIFY_EMAIL_SENT",
"ST_LOGS EMAIL_VERIFICATION ON_HANDLE_EVENT VERIFY_EMAIL_SENT",
"ST_LOGS SESSION OVERRIDE SIGN_OUT",
"ST_LOGS SESSION PRE_API_HOOKS SIGN_OUT",
"ST_LOGS SESSION ON_HANDLE_EVENT SIGN_OUT",
Expand All @@ -408,7 +408,7 @@ describe("Email Verification", () => {
await toggleSignInSignUp(page);
await defaultSignUp(page);
await logoutFromEmailVerification(page);
await new Promise((r) => setTimeout(r, 1000));
await waitForUrl(page, "/auth/");
consoleLogs = [];

await Promise.all([
Expand Down Expand Up @@ -484,7 +484,7 @@ describe("Email Verification", () => {
const { fieldValues, postValues } = getDefaultSignUpFieldValues();
await signUp(page, fieldValues, postValues, "emailpassword");
await logoutFromEmailVerification(page);
await new Promise((r) => setTimeout(r, 100));
await waitForUrl(page, "/auth/");
consoleLogs = [];

// Attempt verification without a session
Expand Down Expand Up @@ -646,7 +646,6 @@ describe("Email Verification", () => {

describe("Server errors", function () {
describe("Verify Email with token screen", function () {
// TODO: Debug and Fix
it('Should show "Something went wrong" screen when API failure', async function () {
await page.setRequestInterception(true);
page.on("request", (request) => {
Expand Down
7 changes: 2 additions & 5 deletions test/end-to-end/passwordless.test_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {

import { TEST_CLIENT_BASE_URL, SOMETHING_WENT_WRONG_ERROR } from "../constants";
import { tryEmailPasswordSignUp, tryPasswordlessSignInUp } from "./mfa.helpers";
import { randomUUID } from "crypto";

const examplePhoneNumber = "+36701231212";
const exampleEmail = "[email protected]";
Expand Down Expand Up @@ -129,9 +128,8 @@ export function getPasswordlessTestCases({ authRecipe, logId, generalErrorRecipe
const contactMethod = "EMAIL_OR_PHONE";

before(async function () {
const appId = randomUUID();
const coreUrl = await setupCoreApp({
appId,
appId: "test-app-id",
coreConfig: {
passwordless_code_lifetime: 4000,
passwordless_max_code_input_attempts: 3,
Expand Down Expand Up @@ -338,15 +336,14 @@ export function getPasswordlessTestCases({ authRecipe, logId, generalErrorRecipe

let accountLinkingSupported;
let coreUrl;
const appId = randomUUID();
const coreConfig = {
passwordless_code_lifetime: 4000,
passwordless_max_code_input_attempts: 3,
};

before(async function () {
coreUrl = await setupCoreApp({
appId,
appId: "test-app-id",
coreConfig,
});
});
Expand Down
Loading