Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: unflake a few selectors-react tests (#38352)

Dmitry Gozman16ddf81f4018
diff --git a/tests/page/selectors-react.spec.ts b/tests/page/selectors-react.spec.ts
index e31e44fdca..d9e998fb7b 100644
--- a/tests/page/selectors-react.spec.ts
+++ b/tests/page/selectors-react.spec.ts
@@ -144,7 +144,9 @@ for (const [name, url] of Object.entries(reacts)) {
// @ts-ignore
mountNestedApp();
});
- await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ await expect(async () => {
+ await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ }).toPass();
});
it('should work with react memo', async ({ page }) => {
@@ -162,7 +164,9 @@ for (const [name, url] of Object.entries(reacts)) {
// @ts-ignore
window.mountApp(anotherRoot);
});
- await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ await expect(async () => {
+ await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ }).toPass();
});
await it.step('add a new book to second root', async () => {
@@ -182,7 +186,9 @@ for (const [name, url] of Object.entries(reacts)) {
// @ts-ignore
window.mountApp(shadowRoot);
});
- await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ await expect(async () => {
+ await expect(page.locator(`_react=BookItem`)).toHaveCountError(6);
+ }).toPass();
});
it('should work with multiroot react after unmount', async ({ page }) => {