fix(webkit): do not update console counter on unhandled rejections (#22890)
Fixes https://github.com/microsoft/playwright/issues/22886
This commit is contained in:
parent
1f209204cd
commit
5fb426e7db
|
|
@ -550,6 +550,7 @@ export class WKPage implements PageDelegate {
|
|||
stack = '';
|
||||
}
|
||||
|
||||
this._lastConsoleMessage = null;
|
||||
const error = new Error(message);
|
||||
error.stack = stack;
|
||||
error.name = name;
|
||||
|
|
|
|||
|
|
@ -145,3 +145,21 @@ it('should check the box using setChecked', async ({ page }) => {
|
|||
await page.setChecked('input', false);
|
||||
expect(await page.evaluate(() => window['checkbox'].checked)).toBe(false);
|
||||
});
|
||||
|
||||
it('do not update console count on unhandled rejections', async ({ page }) => {
|
||||
const messages: string[] = [];
|
||||
const consoleEventListener = m => messages.push(m.text());
|
||||
page.addListener('console', consoleEventListener);
|
||||
|
||||
await page.evaluate(() => {
|
||||
const fail = async () => Promise.reject(new Error('error'));
|
||||
console.log('begin');
|
||||
fail();
|
||||
fail();
|
||||
fail().catch(() => {
|
||||
console.log('end');
|
||||
});
|
||||
});
|
||||
|
||||
await expect.poll(() => messages).toEqual(['begin', 'end']);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue