From 6a46e2dd570e086abea117acca8820194b8d831b Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Tue, 11 Mar 2025 13:29:19 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20chrome=20flags=20?= =?UTF-8?q?to=20keep=20from=20backgrounding=20(#2714)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was an issue in tests where events fired in Hds::FlyOut and Hds::Modal were not being dispatched. These close events were depended on by test waiters to know when the element was removed. In recent versions of chrome, when ran headless and on macos, these events were not firing. This meant the tests waited indefinitely on developers local machines, until the tests timed out. This issue was seen across multiple macbooks and even on the hds repo. This issue was *only* experienced in headless chrome on recent macos. It was **not** happening in: * macos chrome headed locally * linux chrome headless in CI This made the issue only impact people running tests locally, getting obscure timeouts. This issue is fixed by the addition of this flag: --disable-backgrounding-occluded-windows The other flags added in this commit are not required for the fix but should help keep a browser "active", which was loosely what researching this bug hinted at the cause of finding the issue fix. --- addons/api/testem.js | 6 ++++++ addons/auth/testem.js | 6 ++++++ addons/core/testem.js | 6 ++++++ addons/rose/testem.js | 6 ++++++ ui/admin/testem.js | 6 ++++++ ui/desktop/testem-electron.js | 6 ++++++ ui/desktop/testem.js | 6 ++++++ 7 files changed, 42 insertions(+) diff --git a/addons/api/testem.js b/addons/api/testem.js index fca63a5fe..25230d2b8 100644 --- a/addons/api/testem.js +++ b/addons/api/testem.js @@ -17,6 +17,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-gpu', //'--disable-software-rasterizer', diff --git a/addons/auth/testem.js b/addons/auth/testem.js index 7a9dd86c5..89e03073d 100644 --- a/addons/auth/testem.js +++ b/addons/auth/testem.js @@ -17,6 +17,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-gpu', //'--disable-software-rasterizer', diff --git a/addons/core/testem.js b/addons/core/testem.js index 9c05858ca..792cdd3dd 100644 --- a/addons/core/testem.js +++ b/addons/core/testem.js @@ -17,6 +17,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio', diff --git a/addons/rose/testem.js b/addons/rose/testem.js index fca63a5fe..25230d2b8 100644 --- a/addons/rose/testem.js +++ b/addons/rose/testem.js @@ -17,6 +17,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-gpu', //'--disable-software-rasterizer', diff --git a/ui/admin/testem.js b/ui/admin/testem.js index 00bf16832..3ac229155 100644 --- a/ui/admin/testem.js +++ b/ui/admin/testem.js @@ -15,6 +15,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-gpu', //'--disable-software-rasterizer', diff --git a/ui/desktop/testem-electron.js b/ui/desktop/testem-electron.js index baec24997..6738d7f32 100644 --- a/ui/desktop/testem-electron.js +++ b/ui/desktop/testem-electron.js @@ -19,6 +19,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio', diff --git a/ui/desktop/testem.js b/ui/desktop/testem.js index e913f40ce..d25c8bcaa 100644 --- a/ui/desktop/testem.js +++ b/ui/desktop/testem.js @@ -17,6 +17,12 @@ module.exports = { // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', + // Disable backgrounding renders for occluded windows + '--disable-backgrounding-occluded-windows', + // Disable renderer process backgrounding + '--disable-renderer-backgrounding', + // Disable task throttling of timer tasks from background pages + '--disable-background-timer-throttling', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio',