@@ -511,4 +511,34 @@ testAgainstRunningApps({ withPattern: ['astro.node.withCustomRoles'] })('basic f
511511 // await expect(u.page.getByText('Loading')).toBeHidden();
512512 await expect ( u . page . getByText ( "I'm an admin" ) ) . toBeVisible ( ) ;
513513 } ) ;
514+
515+ test ( 'prerendered page with control components works correctly' , async ( { page, context } ) => {
516+ const u = createTestUtils ( { app, page, context } ) ;
517+
518+ // Test while signed out
519+ await u . page . goToRelative ( '/prerendered' ) ;
520+ await u . page . waitForClerkJsLoaded ( ) ;
521+ await u . po . expect . toBeSignedOut ( ) ;
522+
523+ // Verify SignedOut content is visible and SignedIn is hidden
524+ await expect ( u . page . locator ( '#signed-out-content' ) ) . toBeVisible ( ) ;
525+ await expect ( u . page . locator ( '#signed-in-content' ) ) . toBeHidden ( ) ;
526+
527+ // Sign in
528+ await u . page . goToRelative ( '/sign-in' ) ;
529+ await u . po . signIn . waitForMounted ( ) ;
530+ await u . po . signIn . signInWithEmailAndInstantPassword ( {
531+ email : fakeAdmin . email ,
532+ password : fakeAdmin . password ,
533+ } ) ;
534+ await u . po . expect . toBeSignedIn ( ) ;
535+
536+ // Visit prerendered page again while signed in
537+ await u . page . goToRelative ( '/prerendered' ) ;
538+ await u . page . waitForClerkJsLoaded ( ) ;
539+
540+ // Verify SignedIn content is visible and SignedOut is hidden
541+ await expect ( u . page . locator ( '#signed-in-content' ) ) . toBeVisible ( ) ;
542+ await expect ( u . page . locator ( '#signed-out-content' ) ) . toBeHidden ( ) ;
543+ } ) ;
514544} ) ;
0 commit comments