Skip to content

Commit 8fe9623

Browse files
Add test for invalid options error showing an UI error in signin
1 parent 7e73653 commit 8fe9623

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,26 @@ describe("SuperTokens Webauthn SignIn", () => {
136136
localStorage.removeItem("webauthnErrorStatus");
137137
});
138138
});
139+
it("should show error if invalid options error is thrown", async () => {
140+
// Set the error to be thrown
141+
await page.evaluateOnNewDocument(() => {
142+
localStorage.setItem("webauthnErrorStatus", "INVALID_OPTIONS_ERROR");
143+
});
144+
await tryWebauthnSignIn(page);
145+
const errorTextContainer = await waitForSTElement(
146+
page,
147+
"[data-supertokens~='passkeyRecoverableErrorContainer']"
148+
);
149+
const errorText = await errorTextContainer.evaluate((el) => el.textContent);
150+
assert.strictEqual(
151+
errorText,
152+
"The request either timed out, was canceled or the device is already registered. Please try again or try using another device."
153+
);
154+
155+
await page.evaluateOnNewDocument(() => {
156+
localStorage.removeItem("webauthnErrorStatus");
157+
});
158+
});
139159
it("should show general error in the same view", async () => {
140160
// Set the error to be thrown
141161
await page.evaluateOnNewDocument(() => {

0 commit comments

Comments
 (0)