From 15bc3399bf36f1f8c0f7b3bf8e7c853c90f51026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Wed, 18 Dec 2024 13:03:49 +0100 Subject: [PATCH] fix: improve flaky example test --- templates/ts-playwright-test-runner/tests/first.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/ts-playwright-test-runner/tests/first.spec.ts b/templates/ts-playwright-test-runner/tests/first.spec.ts index eaa57f10..1e0960ce 100644 --- a/templates/ts-playwright-test-runner/tests/first.spec.ts +++ b/templates/ts-playwright-test-runner/tests/first.spec.ts @@ -4,7 +4,11 @@ test('has appropriate size', async ({ page }) => { let totalDownloaded = 0; await page.on('response', async (r) => { - totalDownloaded += await (await r.body()).byteLength; + r.body().then((b) => { + totalDownloaded += b.byteLength; + }).catch(() => { + // Ignore errors. + }); }); await page.goto('https://apify.com/about', { waitUntil: 'networkidle' });