File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,16 @@ export const testNoJs = test.extend({
44 javaScriptEnabled : ( { } , use ) => use ( false ) ,
55} )
66
7- export async function waitForHydration ( page : Page ) {
7+ export async function waitForHydration ( page : Page , locator : string = 'body' ) {
88 await expect
99 . poll (
1010 ( ) =>
1111 page
12- . locator ( 'body > *' )
13- . evaluateAll ( ( elements ) =>
14- elements . some ( ( el ) =>
12+ . locator ( locator )
13+ . evaluate (
14+ ( el ) =>
15+ el &&
1516 Object . keys ( el ) . some ( ( key ) => key . startsWith ( '__reactFiber' ) ) ,
16- ) ,
1717 ) ,
1818 { timeout : 3000 } ,
1919 )
Original file line number Diff line number Diff line change 11import { expect , test } from '@playwright/test'
22import { type Fixture , useFixture } from './fixture'
3- import { expectNoReload , testNoJs , waitForHydration } from './helper'
3+ import {
4+ expectNoReload ,
5+ testNoJs ,
6+ waitForHydration as waitForHydration_ ,
7+ } from './helper'
48import path from 'node:path'
59import fs from 'node:fs'
610
@@ -39,6 +43,9 @@ test.describe('build-no-ssr', () => {
3943} )
4044
4145function defineTest ( f : Fixture , variant ?: 'no-ssr' ) {
46+ const waitForHydration : typeof waitForHydration_ = ( page ) =>
47+ waitForHydration_ ( page , variant === 'no-ssr' ? '#root' : 'body' )
48+
4249 test ( 'basic' , async ( { page } ) => {
4350 await page . goto ( f . url ( ) )
4451 await waitForHydration ( page )
You can’t perform that action at this time.
0 commit comments