From 85d97b0cc7ca0070b73de80b6c1d7edb76646697 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 7 Feb 2024 10:10:31 +0100 Subject: [PATCH] test: make debug info test less flaky (#11861) --- test/src/debugInfo.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/src/debugInfo.spec.ts b/test/src/debugInfo.spec.ts index 079107cab7c..4ff5960e516 100644 --- a/test/src/debugInfo.spec.ts +++ b/test/src/debugInfo.spec.ts @@ -15,6 +15,21 @@ describe('DebugInfo', function () { it('should work', async () => { const {page, browser} = await getTestState(); + for (let i = 0; i < 5; i++) { + if (!browser.debugInfo.pendingProtocolErrors.length) { + break; + } + await new Promise(resolve => { + return setTimeout(resolve, 200); + }); + } + + if (browser.debugInfo.pendingProtocolErrors.length) { + throw new Error( + 'browser.debugInfo.pendingProtocolErrors is not empty before the test' + ); + } + const promise = page.evaluate(() => { return new Promise(resolve => { // @ts-expect-error another context