Skip to content

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

test: retry page-leak object count checks (#32794)

Max Schmittdd91afa736dc
diff --git a/tests/page/page-leaks.spec.ts b/tests/page/page-leaks.spec.ts
index b33ce8e1d4..ce356f1e12 100644
--- a/tests/page/page-leaks.spec.ts
+++ b/tests/page/page-leaks.spec.ts
@@ -83,9 +83,11 @@ test('click should not leak', async ({ page, browserName, toImpl }) => {
expect(leakedJSHandles()).toBeFalsy();
if (browserName === 'chromium') {
- const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
- expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
- expect(counts.main + counts.utility).toBeLessThan(25);
+ await expect(async () => {
+ const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
+ expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
+ expect(counts.main + counts.utility).toBeLessThan(25);
+ }).toPass();
}
});
@@ -114,9 +116,11 @@ test('fill should not leak', async ({ page, mode, browserName, toImpl }) => {
expect(leakedJSHandles()).toBeFalsy();
if (browserName === 'chromium') {
- const counts = await objectCounts(toImpl(page), 'HTMLInputElement');
- expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
- expect(counts.main + counts.utility).toBeLessThan(25);
+ await expect(async () => {
+ const counts = await objectCounts(toImpl(page), 'HTMLInputElement');
+ expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
+ expect(counts.main + counts.utility).toBeLessThan(25);
+ }).toPass();
}
});
@@ -144,9 +148,11 @@ test('expect should not leak', async ({ page, mode, browserName, toImpl }) => {
expect(leakedJSHandles()).toBeFalsy();
if (browserName === 'chromium') {
- const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
- expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
- expect(counts.main + counts.utility).toBeLessThan(25);
+ await expect(async () => {
+ const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
+ expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
+ expect(counts.main + counts.utility).toBeLessThan(25);
+ }).toPass();
}
});
@@ -174,8 +180,10 @@ test('waitFor should not leak', async ({ page, mode, browserName, toImpl }) => {
expect(leakedJSHandles()).toBeFalsy();
if (browserName === 'chromium') {
- const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
- expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
- expect(counts.main + counts.utility).toBeLessThan(25);
+ await expect(async () => {
+ const counts = await objectCounts(toImpl(page), 'HTMLButtonElement');
+ expect(counts.main + counts.utility).toBeGreaterThanOrEqual(2);
+ expect(counts.main + counts.utility).toBeLessThan(25);
+ }).toPass();
}
});