Skip to content

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

test: fix flaky interception test (#1508)

Dmitry Gozman4f89e4031c5d
diff --git a/test/interception.spec.js b/test/interception.spec.js
index 8cf190892e..6f35754bf3 100644
--- a/test/interception.spec.js
+++ b/test/interception.spec.js
@@ -254,11 +254,9 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
spinner ? route.abort() : route.continue();
spinner = !spinner;
});
- const results = await page.evaluate(() => Promise.all([
- fetch('/zzz').then(response => response.text()).catch(e => 'FAILED'),
- fetch('/zzz').then(response => response.text()).catch(e => 'FAILED'),
- fetch('/zzz').then(response => response.text()).catch(e => 'FAILED'),
- ]));
+ const results = [];
+ for (let i = 0; i < 3; i++)
+ results.push(await page.evaluate(() => fetch('/zzz').then(response => response.text()).catch(e => 'FAILED')));
expect(results).toEqual(['11', 'FAILED', '22']);
});
it('should navigate to dataURL and not fire dataURL requests', async({page, server}) => {