@@ -44,10 +44,61 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes], withPattern:
4444
4545 // Sign in first
4646 await u . po . signIn . goTo ( ) ;
47+
48+ // Diagnostic: check for duplicate DOM elements (Activity component issue)
49+ const identifierInputs = await page . locator ( 'input[name=identifier]' ) . count ( ) ;
50+ console . log ( `[DIAG] identifier inputs in DOM: ${ identifierInputs } ` ) ;
51+ console . log ( `[DIAG] URL after goTo sign-in: ${ page . url ( ) } ` ) ;
52+
4753 await u . po . signIn . signInWithEmailAndInstantPassword ( {
4854 email : fakeUser . email ,
4955 password : fakeUser . password ,
56+ waitForSession : false ,
5057 } ) ;
58+
59+ // Diagnostic: capture state after clicking Continue but before waiting for session
60+ const diagAfterSubmit = await page . evaluate ( ( ) => {
61+ return {
62+ url : window . location . href ,
63+ clerkDefined : typeof window . Clerk !== 'undefined' ,
64+ clerkLoaded : ! ! ( window as any ) . Clerk ?. loaded ,
65+ clerkVersion : ( window as any ) . Clerk ?. version ,
66+ hasSession : ! ! ( window as any ) . Clerk ?. session ,
67+ hasUser : ! ! ( window as any ) . Clerk ?. user ,
68+ sessionId : ( window as any ) . Clerk ?. session ?. id ?? null ,
69+ cookies : document . cookie ,
70+ identifierInputCount : document . querySelectorAll ( 'input[name=identifier]' ) . length ,
71+ signInRootCount : document . querySelectorAll ( '.cl-signIn-root' ) . length ,
72+ activityElements : document . querySelectorAll ( '[data-activity]' ) . length ,
73+ hiddenElements : document . querySelectorAll ( '[hidden]' ) . length ,
74+ } ;
75+ } ) ;
76+ console . log ( '[DIAG] State after submit:' , JSON . stringify ( diagAfterSubmit , null , 2 ) ) ;
77+
78+ // Now wait for session with extended timeout and more diagnostics
79+ try {
80+ await page . waitForFunction (
81+ ( ) => ! ! window . Clerk ?. session ,
82+ { timeout : 15_000 } ,
83+ ) ;
84+ } catch {
85+ // Capture state at timeout for debugging
86+ const diagAtTimeout = await page . evaluate ( ( ) => {
87+ return {
88+ url : window . location . href ,
89+ clerkDefined : typeof window . Clerk !== 'undefined' ,
90+ clerkLoaded : ! ! ( window as any ) . Clerk ?. loaded ,
91+ hasSession : ! ! ( window as any ) . Clerk ?. session ,
92+ hasUser : ! ! ( window as any ) . Clerk ?. user ,
93+ clerkStatus : ( window as any ) . Clerk ?. status ,
94+ cookies : document . cookie ,
95+ bodyHTML : document . body . innerHTML . substring ( 0 , 2000 ) ,
96+ } ;
97+ } ) ;
98+ console . log ( '[DIAG] State at TIMEOUT:' , JSON . stringify ( diagAtTimeout , null , 2 ) ) ;
99+ throw new Error ( `waitForSession timed out. Diagnostics logged above.` ) ;
100+ }
101+
51102 await u . po . expect . toBeSignedIn ( ) ;
52103
53104 // Navigate to server component page
0 commit comments