Skip to content

Commit d29dba7

Browse files
Add test for checking back button not shown if only one recipe is enabled
1 parent 48a7aac commit d29dba7

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

test/end-to-end/webauthn.signup.test.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import {
1010
waitForSTElement,
1111
submitForm,
1212
setEnabledRecipes,
13+
setInputValues,
1314
} from "../helpers";
14-
import { tryWebauthnSignUp } from "./webauthn.helpers";
15+
import { tryWebauthnSignUp, openWebauthnSignUp } from "./webauthn.helpers";
1516
import assert from "assert";
1617

1718
describe("SuperTokens Webauthn SignUp", () => {
@@ -60,6 +61,34 @@ describe("SuperTokens Webauthn SignUp", () => {
6061
});
6162

6263
describe("SignUp test", () => {
64+
it("should not show the back button and continue without passkey button if there is only one recipe", async () => {
65+
await setEnabledRecipes(["webauthn"]);
66+
await openWebauthnSignUp(page);
67+
68+
// Use puppeteer to check if the back button is not shown
69+
const backBtn = await page.$("[data-supertokens~='backButton']");
70+
assert.strictEqual(backBtn, null);
71+
72+
// Make sure the continue without passkey button is not shown
73+
const continueWithoutPasskeyBtn = await page.$("[data-supertokens~='continueWithoutPasskey']");
74+
assert.strictEqual(continueWithoutPasskeyBtn, null);
75+
76+
// Should not show the back button after the form is submitted as well.
77+
const email = await getTestEmail();
78+
await setInputValues(page, [{ name: "email", value: email }]);
79+
await submitForm(page);
80+
await new Promise((res) => setTimeout(res, 1000));
81+
82+
const backBtnAfterSubmit = await page.$("[data-supertokens~='backButton']");
83+
assert.strictEqual(backBtnAfterSubmit, null);
84+
85+
// Make sure the continue without passkey button is not shown
86+
const continueWithoutPasskeyBtnAfterSubmit = await page.$("[data-supertokens~='continueWithoutPasskey']");
87+
assert.strictEqual(continueWithoutPasskeyBtnAfterSubmit, null);
88+
89+
// Reset the recipes after test is done
90+
await setEnabledRecipes(["webauthn", "emailpassword", "session", "dashboard", "userroles"]);
91+
});
6392
it("should show the create a passkey successfully", async () => {
6493
const email = await getTestEmail();
6594
await tryWebauthnSignUp(page, email);

0 commit comments

Comments
 (0)