From 8ce86833f2eccb8a845f87e2fba20abf5dfecd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 28 Aug 2024 16:50:03 +0900 Subject: [PATCH] test: fix flaky "should reload" test (#17961) --- playground/html/__tests__/html.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 85ceea961752ee..9a5d31ce4edb1f 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')