Skip to content

Commit

Permalink
fix: add remote.active-protocols argument and set it to 2 to enable CDP
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Jun 20, 2024
1 parent c153d6e commit 247403b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

_Released 7/2/2024 (PENDING)_

**Bugfixes:**

- Fixed an issue where Firefox 129 (Firefox Nightly) would not launch with Cypress. Fixes [#29713](https://github.com/cypress-io/cypress/issues/29713). Fixed in [#29720](https://github.com/cypress-io/cypress/pull/29720).

**Dependency Updates:**

- Updated `ws` from `5.2.3` to `5.2.4`. Addressed in [#29698](https://github.com/cypress-io/cypress/pull/29698).
Expand Down
6 changes: 6 additions & 0 deletions packages/server/lib/browsers/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ const defaultPreferences = {

'privacy.trackingprotection.enabled': false,

// CDP is deprecated in Firefox 129 and up.
// In order to enable CDP, we need to set
// remote.active-protocol=2
// @see https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/
// @see https://github.com/cypress-io/cypress/issues/29713
'remote.active-protocols': 2,
// Enable Remote Agent
// https://bugzilla.mozilla.org/show_bug.cgi?id=1544393
'remote.enabled': true,
Expand Down
17 changes: 17 additions & 0 deletions packages/server/test/unit/browsers/firefox_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,23 @@ describe('lib/browsers/firefox', () => {
})
})

// CDP is deprecated in Firefox 129 and up.
// In order to enable CDP, we need to set
// remote.active-protocol=2
// @see https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/
// @see https://github.com/cypress-io/cypress/issues/29713
it('sets "remote.active-protocols"=2 to keep CDP enabled for firefox versions 129 and up', function () {
const executeBeforeBrowserLaunchSpy = sinon.spy(utils, 'executeBeforeBrowserLaunch')

return firefox.open(this.browser, 'http://', this.options, this.automation).then(() => {
expect(executeBeforeBrowserLaunchSpy).to.have.been.calledWith(this.browser, sinon.match({
preferences: {
'remote.active-protocols': 2,
},
}), this.options)
})
})

it('updates the preferences', function () {
return firefox.open(this.browser, 'http://', this.options, this.automation).then(() => {
expect(FirefoxProfile.prototype.updatePreferences).to.be.called
Expand Down

0 comments on commit 247403b

Please sign in to comment.