Skip to content

Commit 8ce8683

Browse files
authored
test: fix flaky "should reload" test (#17961)
1 parent cfb621e commit 8ce8683

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

playground/html/__tests__/html.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
isBuild,
88
isServe,
99
page,
10+
untilBrowserLogAfter,
1011
viteServer,
1112
viteTestUrl,
1213
withRetry,
@@ -298,8 +299,11 @@ describe.runIf(isServe)('invalid', () => {
298299
})
299300

300301
test('should reload when fixed', async () => {
301-
await page.goto(viteTestUrl + '/invalid.html')
302-
await editFile('invalid.html', (content) => {
302+
await untilBrowserLogAfter(
303+
() => page.goto(viteTestUrl + '/invalid.html'),
304+
/connected/, // wait for HMR connection
305+
)
306+
editFile('invalid.html', (content) => {
303307
return content.replace('<div Bad', '<div> Good')
304308
})
305309
const content = await page.waitForSelector('text=Good HTML')

0 commit comments

Comments
 (0)