test: make debug info test less flaky (#11861)

This commit is contained in:
Alex Rudenko 2024-02-07 10:10:31 +01:00 committed by GitHub
parent bfa435a57e
commit 85d97b0cc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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