diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 896267ea06bae5..b3b8582d9a14e1 100644 --- a/playground/html/__tests__/html.spec.ts +++ b/playground/html/__tests__/html.spec.ts @@ -7,6 +7,7 @@ import { isBuild, isServe, page, + untilBrowserLogAfter, viteServer, viteTestUrl, withRetry, @@ -298,8 +299,11 @@ describe.runIf(isServe)('invalid', () => { }) test('should reload when fixed', async () => { - await page.goto(viteTestUrl + '/invalid.html') - await editFile('invalid.html', (content) => { + await untilBrowserLogAfter( + () => page.goto(viteTestUrl + '/invalid.html'), + /connected/, // wait for HMR connection + ) + editFile('invalid.html', (content) => { return content.replace('
Good') }) const content = await page.waitForSelector('text=Good HTML')