From c20bb9860dd95c61a9607f050314db5fd363d52a Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Mon, 9 Dec 2024 08:34:26 -0700 Subject: [PATCH] fix: update userChrome.css to correctly hide the toolbox --- cli/CHANGELOG.md | 8 ++++++++ packages/server/lib/browsers/firefox.ts | 10 +++++++--- .../server/test/unit/browsers/firefox_spec.ts | 4 ++-- system-tests/lib/normalizeStdout.ts | 19 ------------------- system-tests/lib/pluginUtils.js | 7 +------ 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index b12efca21790..3517e9002fc9 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,4 +1,12 @@ +## 13.16.2 + +_Released 12/17/2024 (PENDING)_ + +**Bugfixes:** + +- Updated Firefox `userChrome.css` file to correctly hide the toolbox during headless mode. Addresses [#30721](https://github.com/cypress-io/cypress/issues/30721). + ## 13.16.1 _Released 12/03/2024_ diff --git a/packages/server/lib/browsers/firefox.ts b/packages/server/lib/browsers/firefox.ts index d6215f7e488b..816db8d2ee36 100644 --- a/packages/server/lib/browsers/firefox.ts +++ b/packages/server/lib/browsers/firefox.ts @@ -370,7 +370,12 @@ toolbar { overflow: hidden !important; display: none; } - +toolbox { + height: 0px !important; + min-height: 0px !important; + overflow: hidden !important; + border: none !important; +} ` let browserCriClient: BrowserCriClient | undefined @@ -560,11 +565,10 @@ export async function open (browser: Browser, url: string, options: BrowserLaunc } // resolution of exactly 1280x720 - // (height must account for firefox url bar, which we can only shrink to 2px) const BROWSER_ENVS = { MOZ_REMOTE_SETTINGS_DEVTOOLS: '1', MOZ_HEADLESS_WIDTH: '1280', - MOZ_HEADLESS_HEIGHT: '722', + MOZ_HEADLESS_HEIGHT: '720', ...launchOptions.env, } diff --git a/packages/server/test/unit/browsers/firefox_spec.ts b/packages/server/test/unit/browsers/firefox_spec.ts index 18f0cb538c7b..6eb543a66e68 100644 --- a/packages/server/test/unit/browsers/firefox_spec.ts +++ b/packages/server/test/unit/browsers/firefox_spec.ts @@ -274,7 +274,7 @@ describe('lib/browsers/firefox', () => { env: { MOZ_REMOTE_SETTINGS_DEVTOOLS: '1', MOZ_HEADLESS_WIDTH: '1280', - MOZ_HEADLESS_HEIGHT: '722', + MOZ_HEADLESS_HEIGHT: '720', }, }), jsdebugger: false, @@ -339,7 +339,7 @@ describe('lib/browsers/firefox', () => { env: { MOZ_REMOTE_SETTINGS_DEVTOOLS: '1', MOZ_HEADLESS_WIDTH: '1280', - MOZ_HEADLESS_HEIGHT: '722', + MOZ_HEADLESS_HEIGHT: '720', }, }), jsdebugger: true, diff --git a/system-tests/lib/normalizeStdout.ts b/system-tests/lib/normalizeStdout.ts index ea3cc016f9c6..77d960b57c35 100644 --- a/system-tests/lib/normalizeStdout.ts +++ b/system-tests/lib/normalizeStdout.ts @@ -180,25 +180,6 @@ export const normalizeStdout = function (str: string, options: any = {}) { str = str.split('\n').filter((line) => !line.includes(wdsFailedMsg)).join('\n') } - // in Firefox 130, height dimensions are off by 1 pixel in CI, so we need to fix the offset to match common snapshots - if (options.browser === 'firefox' && process.env.CI) { - const dimensionRegex = new RegExp(/(\((?\d+)x(?\d+)\))/g) - - const matches = dimensionRegex.exec(str) - - if (matches?.groups?.height && matches?.groups?.width) { - const height = parseInt(matches?.groups?.height) - - // only happens on default height for whatever reason in firefox 130... - if (height === 719) { - const expectedHeight = height + 1 - const expectedWidth = matches?.groups?.width - - str = str.replaceAll(`(${expectedWidth}x${height})`, `(${expectedWidth}x${expectedHeight})`) - } - } - } - if (options.sanitizeScreenshotDimensions) { // screenshot dimensions str = str.replace(/(\(\d+x\d+\))/g, replaceScreenshotDims) diff --git a/system-tests/lib/pluginUtils.js b/system-tests/lib/pluginUtils.js index 0ffdd3f6a5da..dafc2e418cd1 100644 --- a/system-tests/lib/pluginUtils.js +++ b/system-tests/lib/pluginUtils.js @@ -3,12 +3,7 @@ module.exports = { if (config.env['NO_RESIZE']) return if (browser.family === 'firefox') { - // this is needed to ensure correct error screenshot / video recording - // resolution of exactly 1280x720 - // (height must account for firefox url bar, which we can only shrink to 2px) - options.args.push( - '-width', '1280', '-height', '722', - ) + options.args.push('-width', '1280', '-height', '720') } else if (browser.name === 'electron') { options.preferences.width = 1280 options.preferences.height = 720