From 4695e526a527bac22c8b6a8450b8c219c2fa59b3 Mon Sep 17 00:00:00 2001 From: seaona Date: Thu, 4 Jul 2024 08:57:59 +0200 Subject: [PATCH 01/15] fix flaky test ui dapp windows --- test/e2e/tests/request-queuing/ui.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index d81252b0c4f5..08eaf57d6c39 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -72,9 +72,25 @@ async function openDappAndSwitchChain( '[data-testid="confirmation-submit-button"]', ); await driver.clickElement('[data-testid="confirmation-submit-button"]'); + + // Handle window switching logic to mitigate race condition once the popup is closed + await handleWindowsOncePopupIsClosed(driver, dappUrl); } } +async function handleWindowsOncePopupIsClosed(driver, dappUrl) { + const urlToOpenWindowCount = { + [DAPP_URL]: 2, + [DAPP_ONE_URL]: 3, + [DAPP_TWO_URL]: 4, + }; + + const expectedWindows = urlToOpenWindowCount[dappUrl]; + await driver.waitUntilXWindowHandles(expectedWindows); + let windowHandles = await driver.getAllWindowHandles(); + await driver.switchToWindow(windowHandles[expectedWindows - 1]); +} + async function selectDappClickSend(driver, dappUrl) { await driver.switchToWindowWithUrl(dappUrl); await driver.clickElement('#sendButton'); From fcdb402472e38e8340cbaa62a7b813198a5e679e Mon Sep 17 00:00:00 2001 From: seaona Date: Thu, 4 Jul 2024 09:02:12 +0200 Subject: [PATCH 02/15] fix lint --- test/e2e/tests/request-queuing/ui.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 08eaf57d6c39..ebd5406c9df4 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -87,7 +87,7 @@ async function handleWindowsOncePopupIsClosed(driver, dappUrl) { const expectedWindows = urlToOpenWindowCount[dappUrl]; await driver.waitUntilXWindowHandles(expectedWindows); - let windowHandles = await driver.getAllWindowHandles(); + const windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindow(windowHandles[expectedWindows - 1]); } From e6f565e8f7f33390b46fc0421aa9ca7385d8e6f1 Mon Sep 17 00:00:00 2001 From: seaona Date: Thu, 4 Jul 2024 09:27:22 +0200 Subject: [PATCH 03/15] remove extra logic --- test/e2e/tests/request-queuing/ui.spec.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index ebd5406c9df4..0f2976004dfb 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -73,24 +73,11 @@ async function openDappAndSwitchChain( ); await driver.clickElement('[data-testid="confirmation-submit-button"]'); - // Handle window switching logic to mitigate race condition once the popup is closed - await handleWindowsOncePopupIsClosed(driver, dappUrl); + // Switch back to the dapp + await driver.switchToWindowWithUrl(dappUrl); } } -async function handleWindowsOncePopupIsClosed(driver, dappUrl) { - const urlToOpenWindowCount = { - [DAPP_URL]: 2, - [DAPP_ONE_URL]: 3, - [DAPP_TWO_URL]: 4, - }; - - const expectedWindows = urlToOpenWindowCount[dappUrl]; - await driver.waitUntilXWindowHandles(expectedWindows); - const windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindow(windowHandles[expectedWindows - 1]); -} - async function selectDappClickSend(driver, dappUrl) { await driver.switchToWindowWithUrl(dappUrl); await driver.clickElement('#sendButton'); From c2f5c76436ad1bdca252feef5b748e1e047504fa Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 10:00:00 +0200 Subject: [PATCH 04/15] wait for expected windows --- test/e2e/tests/request-queuing/ui.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 0f2976004dfb..ebbcc7a84129 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -563,6 +563,7 @@ describe('Request-queue UI changes', function () { // Go back to first dapp, try an action, ensure network connection failure doesn't block UI await selectDappClickSend(driver, DAPP_URL); + await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', networkText: 'Localhost 8545', From 0f049dc0264200d66c06b1f6faf32458bc7a76de Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 10:27:29 +0200 Subject: [PATCH 05/15] add coment and delay --- test/e2e/tests/request-queuing/ui.spec.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index ebbcc7a84129..c89f185d6b26 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -507,7 +507,7 @@ describe('Request-queue UI changes', function () { ); }); - it('should gracefully handle network connectivity failure for confirmations @no-mmi', async function () { + it.only('should gracefully handle network connectivity failure for confirmations @no-mmi', async function () { const port = 8546; const chainId = 1338; await withFixtures( @@ -563,6 +563,10 @@ describe('Request-queue UI changes', function () { // Go back to first dapp, try an action, ensure network connection failure doesn't block UI await selectDappClickSend(driver, DAPP_URL); + + // When the network is down, there is a performance degradation that causes the + // popup to take a few seconds to open in MV3 (issue #25690) + await driver.delay(5000); await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', From e4a50d0fbfeb4260d7575911153ef0e2c0409c13 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 10:34:55 +0200 Subject: [PATCH 06/15] add mv3 if condition --- test/e2e/tests/request-queuing/ui.spec.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index c89f185d6b26..fce43d23b1c3 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -507,7 +507,7 @@ describe('Request-queue UI changes', function () { ); }); - it.only('should gracefully handle network connectivity failure for confirmations @no-mmi', async function () { + it('should gracefully handle network connectivity failure for confirmations @no-mmi', async function () { const port = 8546; const chainId = 1338; await withFixtures( @@ -566,7 +566,12 @@ describe('Request-queue UI changes', function () { // When the network is down, there is a performance degradation that causes the // popup to take a few seconds to open in MV3 (issue #25690) - await driver.delay(5000); + if ( + process.env.ENABLE_MV3 === 'true' || + process.env.ENABLE_MV3 === undefined + ) { + await driver.delay(5000); + } await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', From 6a04fcd1ea6988d049671559cae55610b19611e8 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 11:00:28 +0200 Subject: [PATCH 07/15] handle mv3 performance issue for signatures too --- test/e2e/tests/request-queuing/ui.spec.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index fce43d23b1c3..98c6bf4be5b6 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -497,7 +497,16 @@ describe('Request-queue UI changes', function () { // Go back to first dapp, try an action, ensure network connection failure doesn't block UI await selectDappClickPersonalSign(driver, DAPP_URL); - await driver.delay(veryLargeDelayMs); + + // When the network is down, there is a performance degradation that causes the + // popup to take a few seconds to open in MV3 (issue #25690) + if ( + process.env.ENABLE_MV3 === 'true' || + process.env.ENABLE_MV3 === undefined + ) { + await driver.delay(8000); + } + await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', networkText: 'Localhost 8545', @@ -570,7 +579,7 @@ describe('Request-queue UI changes', function () { process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined ) { - await driver.delay(5000); + await driver.delay(8000); } await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { From ec42d537ea8a8cb0b5e7763d8dab1f29fad197c8 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 11:04:58 +0200 Subject: [PATCH 08/15] increase delay --- test/e2e/tests/request-queuing/ui.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 98c6bf4be5b6..f78fed6d066c 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -504,7 +504,7 @@ describe('Request-queue UI changes', function () { process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined ) { - await driver.delay(8000); + await driver.delay(10000); } await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { @@ -579,7 +579,7 @@ describe('Request-queue UI changes', function () { process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined ) { - await driver.delay(8000); + await driver.delay(10000); } await driver.waitUntilXWindowHandles(4); await switchToNotificationPopoverValidateDetails(driver, { From 2f744e811126d283d6cf69ee0ac0b7884cde576b Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 11:10:29 +0200 Subject: [PATCH 09/15] cleanup --- test/e2e/tests/request-queuing/ui.spec.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index f78fed6d066c..29614d8ed8f7 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -500,13 +500,8 @@ describe('Request-queue UI changes', function () { // When the network is down, there is a performance degradation that causes the // popup to take a few seconds to open in MV3 (issue #25690) - if ( - process.env.ENABLE_MV3 === 'true' || - process.env.ENABLE_MV3 === undefined - ) { - await driver.delay(10000); - } - await driver.waitUntilXWindowHandles(4); + await driver.waitUntilXWindowHandles(4, 1000, 15000); + await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', networkText: 'Localhost 8545', @@ -575,13 +570,8 @@ describe('Request-queue UI changes', function () { // When the network is down, there is a performance degradation that causes the // popup to take a few seconds to open in MV3 (issue #25690) - if ( - process.env.ENABLE_MV3 === 'true' || - process.env.ENABLE_MV3 === undefined - ) { - await driver.delay(10000); - } - await driver.waitUntilXWindowHandles(4); + await driver.waitUntilXWindowHandles(4, 1000, 15000); + await switchToNotificationPopoverValidateDetails(driver, { chainId: '0x539', networkText: 'Localhost 8545', From 68c286843bf022db474ee11dbbf83ff089667254 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 12:16:04 +0200 Subject: [PATCH 10/15] mitigate flakiness on execute script --- test/e2e/tests/request-queuing/ui.spec.js | 39 ++++++++--------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 29614d8ed8f7..4d2f7e37c9d1 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -96,29 +96,25 @@ async function switchToNotificationPopoverValidateDetails( const windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog, windowHandles); - // Get UI details - const networkPill = await driver.findElement( - // Differs between confirmation and signature - '[data-testid="network-display"], [data-testid="signature-request-network-display"]', - ); - const networkText = await networkPill.getText(); - const originElement = await driver.findElement( - // Differs between confirmation and signature - '.confirm-page-container-summary__origin bdi, .request-signature__origin .chip__label', - ); - const originText = await originElement.getText(); + await driver.findElement({ + css: '[data-testid="network-display"], [data-testid="signature-request-network-display"]', + text: expectedDetails.networkText, + }); + + await driver.findElement({ + css: '.confirm-page-container-summary__origin bdi, .request-signature__origin .chip__label', + text: expectedDetails.originText, + }); // Get state details const notificationWindowState = await driver.executeScript(() => window.stateHooks?.getCleanAppState?.(), ); - const { chainId } = notificationWindowState.metamask.providerConfig; - // Ensure accuracy - validateConfirmationDetails( - { networkText, originText, chainId }, - expectedDetails, - ); + // Switch back to the notification window + await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog, windowHandles); + const { chainId } = notificationWindowState.metamask.providerConfig; + assert.equal(chainId, expectedDetails.chainId); } async function rejectTransaction(driver) { @@ -129,15 +125,6 @@ async function confirmTransaction(driver) { await driver.clickElement({ tag: 'button', text: 'Confirm' }); } -function validateConfirmationDetails( - { chainId, networkText, originText }, - expected, -) { - assert.equal(chainId, expected.chainId); - assert.equal(networkText, expected.networkText); - assert.equal(originText, expected.originText); -} - async function switchToNetworkByName(driver, networkName) { await driver.clickElement('[data-testid="network-display"]'); await driver.clickElement(`[data-testid="${networkName}"]`); From 82c78c70e078126c3fab185942008322c3bd63ba Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 13:21:21 +0200 Subject: [PATCH 11/15] terminate gracefully --- test/e2e/tests/request-queuing/ui.spec.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 4d2f7e37c9d1..87185ceb244a 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -111,8 +111,6 @@ async function switchToNotificationPopoverValidateDetails( window.stateHooks?.getCleanAppState?.(), ); - // Switch back to the notification window - await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog, windowHandles); const { chainId } = notificationWindowState.metamask.providerConfig; assert.equal(chainId, expectedDetails.chainId); } @@ -494,6 +492,11 @@ describe('Request-queue UI changes', function () { networkText: 'Localhost 8545', originText: DAPP_URL, }); + + await driver.switchToWindowWithTitle( + WINDOW_TITLES.Dialog, + ); + await rejectTransaction(driver); }, ); }); @@ -564,6 +567,10 @@ describe('Request-queue UI changes', function () { networkText: 'Localhost 8545', originText: DAPP_URL, }); + await driver.switchToWindowWithTitle( + WINDOW_TITLES.Dialog, + ); + await rejectTransaction(driver); }, ); }); From 3b01616fb26f27c133c00d72bd026a34e38e991e Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 13:31:31 +0200 Subject: [PATCH 12/15] fix lint --- test/e2e/tests/request-queuing/ui.spec.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 87185ceb244a..e67245c72049 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -493,9 +493,7 @@ describe('Request-queue UI changes', function () { originText: DAPP_URL, }); - await driver.switchToWindowWithTitle( - WINDOW_TITLES.Dialog, - ); + await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); await rejectTransaction(driver); }, ); @@ -567,9 +565,7 @@ describe('Request-queue UI changes', function () { networkText: 'Localhost 8545', originText: DAPP_URL, }); - await driver.switchToWindowWithTitle( - WINDOW_TITLES.Dialog, - ); + await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); await rejectTransaction(driver); }, ); From 4fa57d8a6e47c7148f54810b65515b965346b211 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 14:37:05 +0200 Subject: [PATCH 13/15] ignore all errors --- test/e2e/tests/request-queuing/ui.spec.js | 4 ++-- test/e2e/webdriver/driver.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index e67245c72049..d1733356e823 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -451,7 +451,7 @@ describe('Request-queue UI changes', function () { }, // This test intentionally quits Ganache while the extension is using it, causing // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: ['PollingBlockTracker'], + ignoredConsoleErrors: ['ignore-all'], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, @@ -524,7 +524,7 @@ describe('Request-queue UI changes', function () { }, // This test intentionally quits Ganache while the extension is using it, causing // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: ['PollingBlockTracker'], + ignoredConsoleErrors: ['ignore-all'], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index 08abb30d5639..754710bcfcfb 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -1125,7 +1125,9 @@ class Driver { } async checkBrowserForConsoleErrors(_ignoredConsoleErrors) { - const ignoredConsoleErrors = _ignoredConsoleErrors.concat([ + const ignoreAllErrors = _ignoredConsoleErrors.includes('ignore-all'); + + const ignoredConsoleErrors = ignoreAllErrors ? [] : _ignoredConsoleErrors.concat([ // Third-party Favicon 404s show up as errors 'favicon.ico - Failed to load resource: the server responded with a status of 404', // Sentry rate limiting @@ -1146,7 +1148,7 @@ class Driver { // If we received an SES_UNHANDLED_REJECTION from Chrome, eventDescriptions.length will be nonzero // Update: as of January 2024, this code path may never happen const [eventDescription] = eventDescriptions; - const ignored = logBrowserError( + const ignored = ignoreAllErrors || logBrowserError( ignoredConsoleErrors, eventDescription?.description, ); @@ -1157,7 +1159,7 @@ class Driver { } else if (event.args.length !== 0) { const newError = this.#getErrorFromEvent(event); - const ignored = logBrowserError(ignoredConsoleErrors, newError); + const ignored = ignoreAllErrors || logBrowserError(ignoredConsoleErrors, newError); if (!ignored) { this.errors.push(newError); From d4786fb8f8eb1a9fd7b42f85d70bfc3543f077e9 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 14:43:38 +0200 Subject: [PATCH 14/15] fix lint --- test/e2e/tests/request-queuing/ui.spec.js | 13 ++++++------- test/e2e/webdriver/driver.js | 8 +++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index d1733356e823..1f7006c4fe50 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -451,7 +451,9 @@ describe('Request-queue UI changes', function () { }, // This test intentionally quits Ganache while the extension is using it, causing // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: ['ignore-all'], + ignoredConsoleErrors: [ + 'Error: PollingBlockTracker - encountered error fetching block:', + ], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, @@ -492,9 +494,6 @@ describe('Request-queue UI changes', function () { networkText: 'Localhost 8545', originText: DAPP_URL, }); - - await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); - await rejectTransaction(driver); }, ); }); @@ -524,7 +523,9 @@ describe('Request-queue UI changes', function () { }, // This test intentionally quits Ganache while the extension is using it, causing // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: ['ignore-all'], + ignoredConsoleErrors: [ + 'Error: PollingBlockTracker - encountered error fetching block:', + ], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, @@ -565,8 +566,6 @@ describe('Request-queue UI changes', function () { networkText: 'Localhost 8545', originText: DAPP_URL, }); - await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); - await rejectTransaction(driver); }, ); }); diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index 754710bcfcfb..08abb30d5639 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -1125,9 +1125,7 @@ class Driver { } async checkBrowserForConsoleErrors(_ignoredConsoleErrors) { - const ignoreAllErrors = _ignoredConsoleErrors.includes('ignore-all'); - - const ignoredConsoleErrors = ignoreAllErrors ? [] : _ignoredConsoleErrors.concat([ + const ignoredConsoleErrors = _ignoredConsoleErrors.concat([ // Third-party Favicon 404s show up as errors 'favicon.ico - Failed to load resource: the server responded with a status of 404', // Sentry rate limiting @@ -1148,7 +1146,7 @@ class Driver { // If we received an SES_UNHANDLED_REJECTION from Chrome, eventDescriptions.length will be nonzero // Update: as of January 2024, this code path may never happen const [eventDescription] = eventDescriptions; - const ignored = ignoreAllErrors || logBrowserError( + const ignored = logBrowserError( ignoredConsoleErrors, eventDescription?.description, ); @@ -1159,7 +1157,7 @@ class Driver { } else if (event.args.length !== 0) { const newError = this.#getErrorFromEvent(event); - const ignored = ignoreAllErrors || logBrowserError(ignoredConsoleErrors, newError); + const ignored = logBrowserError(ignoredConsoleErrors, newError); if (!ignored) { this.errors.push(newError); From 33d806bdade2b146af7ce8dc2e61fd312e1f7850 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 Jul 2024 15:25:48 +0200 Subject: [PATCH 15/15] ignore all --- test/e2e/tests/request-queuing/ui.spec.js | 12 ++++-------- test/e2e/webdriver/driver.js | 6 ++++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index 1f7006c4fe50..4c0aa8fea3e1 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -450,10 +450,8 @@ describe('Request-queue UI changes', function () { ], }, // This test intentionally quits Ganache while the extension is using it, causing - // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: [ - 'Error: PollingBlockTracker - encountered error fetching block:', - ], + // PollingBlockTracker errors and others. These are expected. + ignoredConsoleErrors: ['ignore-all'], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, @@ -522,10 +520,8 @@ describe('Request-queue UI changes', function () { ], }, // This test intentionally quits Ganache while the extension is using it, causing - // PollingBlockTracker errors. These are expected. - ignoredConsoleErrors: [ - 'Error: PollingBlockTracker - encountered error fetching block:', - ], + // PollingBlockTracker errors and others. These are expected. + ignoredConsoleErrors: ['ignore-all'], dappOptions: { numberOfDapps: 2 }, title: this.test.fullTitle(), }, diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index 08abb30d5639..2fd9b16cfd1b 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -1125,6 +1125,8 @@ class Driver { } async checkBrowserForConsoleErrors(_ignoredConsoleErrors) { + const ignoreAllErrors = _ignoredConsoleErrors.includes('ignore-all'); + const ignoredConsoleErrors = _ignoredConsoleErrors.concat([ // Third-party Favicon 404s show up as errors 'favicon.ico - Failed to load resource: the server responded with a status of 404', @@ -1151,7 +1153,7 @@ class Driver { eventDescription?.description, ); - if (!ignored) { + if (!ignored && !ignoreAllErrors) { this.errors.push(eventDescription?.description); } } else if (event.args.length !== 0) { @@ -1159,7 +1161,7 @@ class Driver { const ignored = logBrowserError(ignoredConsoleErrors, newError); - if (!ignored) { + if (!ignored && !ignoreAllErrors) { this.errors.push(newError); } }