From 6cca5213a6174e8fa3dfb2c704a2841c6babb2a5 Mon Sep 17 00:00:00 2001 From: Timo Gasda Date: Wed, 24 May 2023 12:40:41 +0200 Subject: [PATCH 1/2] chore: Update Chrome to use new headless mode See https://developer.chrome.com/articles/new-headless/ --- src/browsers/capabilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browsers/capabilities.ts b/src/browsers/capabilities.ts index 27f5105..27faef2 100644 --- a/src/browsers/capabilities.ts +++ b/src/browsers/capabilities.ts @@ -53,7 +53,7 @@ const defaultCapabilities: Record = { '--prerender-from-omnibox=disabled', '--no-sandbox', '--disable-gpu', - '--headless', + '--headless=new', ], }, }, From a91aef2d2231052265a71f1c3bbe4c9d4cde0910 Mon Sep 17 00:00:00 2001 From: Timo Gasda Date: Wed, 24 May 2023 13:06:33 +0200 Subject: [PATCH 2/2] skip favicon errors --- src/use-browser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/use-browser.ts b/src/use-browser.ts index ecabaf3..8cb651d 100644 --- a/src/use-browser.ts +++ b/src/use-browser.ts @@ -40,8 +40,8 @@ function useBrowser(...args: [Partial, TestFunction] | [TestFu await testFn(browser); // This method does not exist in w3c protocol if (!options.skipConsoleErrorsCheck && 'getLogs' in browser) { - const logs = (await browser.getLogs('browser')) as Array<{ level: string }>; - const errors = logs.filter(entry => entry.level === 'SEVERE'); + const logs = (await browser.getLogs('browser')) as Array<{ level: string; message: string }>; + const errors = logs.filter(entry => entry.level === 'SEVERE' && !entry.message.includes('/favicon.ico')); if (errors.length > 0) { throw new Error('Unexpected errors in browser console:\n' + JSON.stringify(errors, null, 2)); }