@@ -18,8 +18,8 @@ import {
1818 setInputValues ,
1919 setAccountLinkingConfig ,
2020 getPasswordlessDevice ,
21- clickOnWebAuthnButton ,
2221} from "../helpers" ;
22+ import { tryWebauthnSignUp } from "./webauthn.helpers" ;
2323import assert from "assert" ;
2424
2525/*
@@ -110,15 +110,7 @@ describe("SuperTokens WebAuthn Account Linking", function () {
110110 await page . waitForTimeout ( 2000 ) ;
111111
112112 // We want to parse the text inside the session-context-userId div
113- const userId = await page . evaluate ( ( ) => document . querySelector ( ".session-context-userId" ) . textContent ) ;
114- console . log ( userId ) ;
115- assert . strictEqual ( userId , "undefined" ) ;
116-
117- userId1 = userId ;
118-
119- // Extract userId from console logs
120- const userIdLog = consoleLogs . find ( ( log ) => log . includes ( "ST_LOGS SESSION" ) ) ;
121- userId1 = userIdLog . split ( "ST_LOGS SESSION" ) [ 1 ] . trim ( ) ;
113+ const userId1 = await page . evaluate ( ( ) => document . querySelector ( ".session-context-userId" ) . textContent ) ;
122114
123115 // Find the div with classname logoutButton and click it using normal
124116 // puppeteer selector
@@ -130,26 +122,16 @@ describe("SuperTokens WebAuthn Account Linking", function () {
130122
131123 // We should be in the confirmation page now.
132124 await submitForm ( page ) ;
133-
134- await page . waitForTimeout ( 5000 ) ;
135-
136- // Wait for successful registration and login
137- await page . waitForNavigation ( { waitUntil : "networkidle0" } ) ;
125+ await page . waitForTimeout ( 1000 ) ;
138126
139127 // Extract second userId from console logs
140- const userIdLog2 = consoleLogs . find ( ( log ) => log . includes ( "ST_LOGS SESSION" ) ) ;
141- userId2 = userIdLog2 . split ( "ST_LOGS SESSION" ) [ 1 ] . trim ( ) ;
128+ const userId2 = await page . evaluate ( ( ) => document . querySelector ( ".session-context-userId" ) . textContent ) ;
142129
143130 // Verify that two different users were created
144131 assert . notStrictEqual (
145132 userId1 ,
146133 userId2 ,
147134 "Different auth methods with same email should create separate users when account linking is disabled"
148135 ) ;
149-
150- // Verify that the second user has an unverified email
151- // This would require checking the API or console logs for email verification status
152- const emailVerificationLog = consoleLogs . find ( ( log ) => log . includes ( "isEmailVerified" ) ) ;
153- assert ( emailVerificationLog . includes ( "false" ) , "The WebAuthn user should have an unverified email" ) ;
154136 } ) ;
155137} ) ;
0 commit comments