9
9
getColor ,
10
10
isBuild ,
11
11
page ,
12
+ untilBrowserLogAfter ,
12
13
untilUpdated ,
13
14
viteServer
14
15
} from '~utils'
@@ -26,7 +27,8 @@ test('vuex can be import succeed by named import', async () => {
26
27
} )
27
28
28
29
test ( '/about' , async ( ) => {
29
- await page . goto ( url + 'about' )
30
+ await untilBrowserLogAfter ( ( ) => page . goto ( url + 'about' ) , 'hydrated' )
31
+
30
32
expect ( await page . textContent ( 'h1' ) ) . toMatch ( 'About' )
31
33
// should not have hydration mismatch
32
34
browserLogs . forEach ( ( msg ) => {
@@ -54,7 +56,8 @@ test('/about', async () => {
54
56
} )
55
57
56
58
test ( '/external' , async ( ) => {
57
- await page . goto ( url + 'external' )
59
+ await untilBrowserLogAfter ( ( ) => page . goto ( url + 'external' ) , 'hydrated' )
60
+
58
61
expect ( await page . textContent ( 'div' ) ) . toMatch (
59
62
'Example external component content'
60
63
)
@@ -81,7 +84,8 @@ test('/external', async () => {
81
84
} )
82
85
83
86
test ( '/' , async ( ) => {
84
- await page . goto ( url )
87
+ await untilBrowserLogAfter ( ( ) => page . goto ( url ) , 'hydrated' )
88
+
85
89
expect ( await page . textContent ( 'h1' ) ) . toMatch ( 'Home' )
86
90
// should not have hydration mismatch
87
91
browserLogs . forEach ( ( msg ) => {
@@ -155,7 +159,8 @@ test('nested virtual module', async () => {
155
159
} )
156
160
157
161
test ( 'hydration' , async ( ) => {
158
- await page . goto ( url )
162
+ await untilBrowserLogAfter ( ( ) => page . goto ( url ) , 'hydrated' )
163
+
159
164
expect ( await page . textContent ( 'button' ) ) . toMatch ( '0' )
160
165
await page . click ( 'button' )
161
166
expect ( await page . textContent ( 'button' ) ) . toMatch ( '1' )
@@ -175,7 +180,8 @@ test(
175
180
)
176
181
177
182
test ( 'client navigation' , async ( ) => {
178
- await page . goto ( url )
183
+ await untilBrowserLogAfter ( ( ) => page . goto ( url ) , 'hydrated' )
184
+
179
185
await untilUpdated ( ( ) => page . textContent ( 'a[href="/test/about"]' ) , 'About' )
180
186
await page . click ( 'a[href="/test/about"]' )
181
187
await untilUpdated ( ( ) => page . textContent ( 'h1' ) , 'About' )
0 commit comments