diff --git a/tests/playwright-test/playwright.expect.misc.spec.ts b/tests/playwright-test/playwright.expect.misc.spec.ts
index f6d8408c50..faf3a0df6f 100644
--- a/tests/playwright-test/playwright.expect.misc.spec.ts
+++ b/tests/playwright-test/playwright.expect.misc.spec.ts
@@ -23,9 +23,15 @@ test('should support toHaveCount', async ({ runInlineTest }) => {
const { test } = pwt;
test('pass', async ({ page }) => {
- await page.setContent('');
+ await page.setContent('');
const locator = page.locator('option');
- await expect(locator).toHaveCount(2);
+ let done = false;
+ const promise = expect(locator).toHaveCount(2).then(() => { done = true; });
+ await page.waitForTimeout(1000);
+ expect(done).toBe(false);
+ await page.setContent('');
+ await promise;
+ expect(done).toBe(true);
});
`,
}, { workers: 1 });