11import { expect } from '@playwright/test'
22import { test } from '@tanstack/router-e2e-utils'
3+ import { waitForHydration } from './hydration'
34
45test . describe ( 'RSC Component Slot Tests - Passing components as props' , ( ) => {
56 test ( 'Renders server product card with client component slots' , async ( {
67 page,
78 } ) => {
89 await page . goto ( '/rsc-component-slot' )
910 await page . waitForURL ( '/rsc-component-slot' )
10- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
11+ await waitForHydration ( page )
1112
1213 // Verify server-rendered product card
1314 await expect ( page . getByTestId ( 'rsc-product-card' ) ) . toBeVisible ( )
@@ -27,7 +28,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
2728 test ( 'Changing quantity does not reload RSC' , async ( { page } ) => {
2829 await page . goto ( '/rsc-component-slot' )
2930 await page . waitForURL ( '/rsc-component-slot' )
30- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
31+ await waitForHydration ( page )
3132
3233 // Get initial RSC timestamp
3334 const initialTimestamp = await page
@@ -64,7 +65,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
6465 test ( 'Toggling badge details does not reload RSC' , async ( { page } ) => {
6566 await page . goto ( '/rsc-component-slot' )
6667 await page . waitForURL ( '/rsc-component-slot' )
67- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
68+ await waitForHydration ( page )
6869
6970 // Get initial RSC timestamp
7071 const initialTimestamp = await page
@@ -94,7 +95,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
9495 test ( 'Add to cart interaction does not reload RSC' , async ( { page } ) => {
9596 await page . goto ( '/rsc-component-slot' )
9697 await page . waitForURL ( '/rsc-component-slot' )
97- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
98+ await waitForHydration ( page )
9899
99100 // Get initial RSC timestamp
100101 const initialTimestamp = await page
@@ -129,7 +130,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
129130 } ) => {
130131 await page . goto ( '/rsc-component-slot' )
131132 await page . waitForURL ( '/rsc-component-slot' )
132- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
133+ await waitForHydration ( page )
133134
134135 // Get initial RSC timestamp
135136 const initialTimestamp = await page
@@ -159,7 +160,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
159160 test ( 'Reset quantity works without reloading RSC' , async ( { page } ) => {
160161 await page . goto ( '/rsc-component-slot' )
161162 await page . waitForURL ( '/rsc-component-slot' )
162- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
163+ await waitForHydration ( page )
163164
164165 // Get initial RSC timestamp
165166 const initialTimestamp = await page
@@ -191,7 +192,7 @@ test.describe('RSC Component Slot Tests - Passing components as props', () => {
191192 } ) => {
192193 await page . goto ( '/rsc-component-slot' )
193194 await page . waitForURL ( '/rsc-component-slot' )
194- await expect ( page . getByTestId ( 'app-hydrated' ) ) . toHaveText ( 'hydrated' )
195+ await waitForHydration ( page )
195196
196197 // Verify server-provided data is passed to client components
197198 // Product ID comes from server and is displayed in client component
0 commit comments