@@ -207,14 +207,37 @@ test("Create passkey account and send ETH", async ({ page }) => {
207207 // Click Sign Up
208208 await popup . getByTestId ( "signup" ) . click ( ) ;
209209
210+ // Wait for account deployment to complete
211+ await page . waitForTimeout ( 3000 ) ;
212+
213+ // After deployment, session creation requires WebAuthn signing
214+ // We need to recreate the virtual authenticator with the same credential
215+ client = await popup . context ( ) . newCDPSession ( popup ) ;
216+ await client . send ( "WebAuthn.enable" ) ;
217+ const resultAuth1 = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
218+ options : {
219+ protocol : "ctap2" ,
220+ transport : "usb" ,
221+ hasResidentKey : true ,
222+ hasUserVerification : true ,
223+ isUserVerified : true ,
224+ automaticPresenceSimulation : true ,
225+ } ,
226+ } ) ;
227+ await expect ( newCredential ) . not . toBeNull ( ) ;
228+ await client . send ( "WebAuthn.addCredential" , {
229+ authenticatorId : resultAuth1 . authenticatorId ,
230+ credential : newCredential ! ,
231+ } ) ;
232+
210233 // Confirm access to your account
211234 await expect ( popup . getByText ( "Connect to ZKsync SSO Demo" ) ) . toBeVisible ( ) ;
212235 await expect ( popup . getByText ( "localhost:3004" ) ) . toBeVisible ( ) ;
213236 await expect ( popup . getByText ( "Let it see your address, balance and activity" ) ) . toBeVisible ( ) ;
214237 await popup . getByTestId ( "connect" ) . click ( ) ;
215238
216- // Waits for session to complete and popup to close
217- await page . waitForTimeout ( 2000 ) ;
239+ // Wait for session creation (WebAuthn signing) and popup to close
240+ await page . waitForTimeout ( 3000 ) ;
218241
219242 // Check address/balance is shown
220243 await expect ( page . getByText ( "Disconnect" ) ) . toBeVisible ( ) ;
@@ -309,14 +332,37 @@ test("Create passkey account and send ETH with paymaster", async ({ page }) => {
309332 // Click Sign Up
310333 await popup . getByTestId ( "signup" ) . click ( ) ;
311334
335+ // Wait for account deployment to complete
336+ await page . waitForTimeout ( 3000 ) ;
337+
338+ // After deployment, session creation requires WebAuthn signing
339+ // We need to recreate the virtual authenticator with the same credential
340+ client = await popup . context ( ) . newCDPSession ( popup ) ;
341+ await client . send ( "WebAuthn.enable" ) ;
342+ const resultAuth2 = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
343+ options : {
344+ protocol : "ctap2" ,
345+ transport : "usb" ,
346+ hasResidentKey : true ,
347+ hasUserVerification : true ,
348+ isUserVerified : true ,
349+ automaticPresenceSimulation : true ,
350+ } ,
351+ } ) ;
352+ await expect ( newCredential ) . not . toBeNull ( ) ;
353+ await client . send ( "WebAuthn.addCredential" , {
354+ authenticatorId : resultAuth2 . authenticatorId ,
355+ credential : newCredential ! ,
356+ } ) ;
357+
312358 // Confirm access to your account
313359 await expect ( popup . getByText ( "Connect to ZKsync SSO Demo" ) ) . toBeVisible ( ) ;
314360 await expect ( popup . getByText ( "localhost:3004" ) ) . toBeVisible ( ) ;
315361 await expect ( popup . getByText ( "Let it see your address, balance and activity" ) ) . toBeVisible ( ) ;
316362 await popup . getByTestId ( "connect" ) . click ( ) ;
317363
318- // Waits for session to complete and popup to close
319- await page . waitForTimeout ( 2000 ) ;
364+ // Wait for session creation (WebAuthn signing) and popup to close
365+ await page . waitForTimeout ( 3000 ) ;
320366
321367 // Check address/balance is shown
322368 await expect ( page . getByText ( "Disconnect" ) ) . toBeVisible ( ) ;
@@ -335,7 +381,7 @@ test("Create passkey account and send ETH with paymaster", async ({ page }) => {
335381 // We need to recreate the virtual authenticator to match the previous one
336382 client = await popup . context ( ) . newCDPSession ( popup ) ;
337383 await client . send ( "WebAuthn.enable" ) ;
338- const result = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
384+ const resultPaymaster = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
339385 options : {
340386 protocol : "ctap2" ,
341387 transport : "usb" ,
@@ -347,7 +393,7 @@ test("Create passkey account and send ETH with paymaster", async ({ page }) => {
347393 } ) ;
348394 await expect ( newCredential ) . not . toBeNull ( ) ;
349395 await client . send ( "WebAuthn.addCredential" , {
350- authenticatorId : result . authenticatorId ,
396+ authenticatorId : resultPaymaster . authenticatorId ,
351397 credential : newCredential ! ,
352398 } ) ;
353399
@@ -411,14 +457,37 @@ test("Create passkey account and sign typed data", async ({ page }) => {
411457 // Click Sign Up
412458 await popup . getByTestId ( "signup" ) . click ( ) ;
413459
460+ // Wait for account deployment to complete
461+ await page . waitForTimeout ( 3000 ) ;
462+
463+ // After deployment, session creation requires WebAuthn signing
464+ // We need to recreate the virtual authenticator with the same credential
465+ client = await popup . context ( ) . newCDPSession ( popup ) ;
466+ await client . send ( "WebAuthn.enable" ) ;
467+ const resultAuth3 = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
468+ options : {
469+ protocol : "ctap2" ,
470+ transport : "usb" ,
471+ hasResidentKey : true ,
472+ hasUserVerification : true ,
473+ isUserVerified : true ,
474+ automaticPresenceSimulation : true ,
475+ } ,
476+ } ) ;
477+ await expect ( newCredential ) . not . toBeNull ( ) ;
478+ await client . send ( "WebAuthn.addCredential" , {
479+ authenticatorId : resultAuth3 . authenticatorId ,
480+ credential : newCredential ! ,
481+ } ) ;
482+
414483 // Confirm access to your account
415484 await expect ( popup . getByText ( "Connect to ZKsync SSO Demo" ) ) . toBeVisible ( ) ;
416485 await expect ( popup . getByText ( "localhost:3004" ) ) . toBeVisible ( ) ;
417486 await expect ( popup . getByText ( "Let it see your address, balance and activity" ) ) . toBeVisible ( ) ;
418487 await popup . getByTestId ( "connect" ) . click ( ) ;
419488
420- // Waits for session to complete and popup to close
421- await page . waitForTimeout ( 2000 ) ;
489+ // Wait for session creation (WebAuthn signing) and popup to close
490+ await page . waitForTimeout ( 3000 ) ;
422491
423492 // Check address/balance is shown
424493 await expect ( page . getByText ( "Disconnect" ) ) . toBeVisible ( ) ;
@@ -438,7 +507,7 @@ test("Create passkey account and sign typed data", async ({ page }) => {
438507 // We need to recreate the virtual authenticator to match the previous one
439508 client = await popup . context ( ) . newCDPSession ( popup ) ;
440509 await client . send ( "WebAuthn.enable" ) ;
441- const result = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
510+ const resultTypedData = await client . send ( "WebAuthn.addVirtualAuthenticator" , {
442511 options : {
443512 protocol : "ctap2" ,
444513 transport : "usb" ,
@@ -450,7 +519,7 @@ test("Create passkey account and sign typed data", async ({ page }) => {
450519 } ) ;
451520 await expect ( newCredential ) . not . toBeNull ( ) ;
452521 await client . send ( "WebAuthn.addCredential" , {
453- authenticatorId : result . authenticatorId ,
522+ authenticatorId : resultTypedData . authenticatorId ,
454523 credential : newCredential ! ,
455524 } ) ;
456525
0 commit comments