Skip to content

Commit a2b40a6

Browse files
committed
see if this fixes extension test [run ci]
1 parent e204aab commit a2b40a6

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

packages/server/test/unit/browsers/firefox_spec.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { type Client as WebDriverClient, default as webdriver } from 'webdriver'
1515
import { EventEmitter } from 'stream'
1616

1717
const path = require('path')
18-
const _ = require('lodash')
1918
const mockfs = require('mock-fs')
2019
const FirefoxProfile = require('firefox-profile')
2120
const utils = require('../../../lib/browsers/utils')
@@ -119,12 +118,12 @@ describe('lib/browsers/firefox', () => {
119118
sinon.spy(FirefoxProfile.prototype, 'setPreference')
120119
sinon.spy(FirefoxProfile.prototype, 'shouldDeleteOnExit')
121120
sinon.spy(FirefoxProfile.prototype, 'path')
122-
sinon.stub(FirefoxProfile.prototype, 'encoded').callsFake((cb) => {
121+
sinon.stub(FirefoxProfile.prototype, 'encoded').callsFake((cb: Function) => {
123122
cb(undefined, 'abcdef')
124123
})
125124

126125
sinon.stub(fsExtra, 'writeJSON').resolves(undefined)
127-
sinon.stub(fsExtra, 'writeFile').resolves(undefined)
126+
sinon.stub(fsExtra, 'writeFile').returns(undefined)
128127
browserCriClient = sinon.createStubInstance(BrowserCriClient)
129128

130129
browserCriClient.attachToTargetUrl = sinon.stub().resolves({})
@@ -393,11 +392,6 @@ describe('lib/browsers/firefox', () => {
393392
})
394393

395394
it('writes extension and ensure write access', async function () {
396-
// TODO: Test is failing locally, figure out why??
397-
if (!process.env.CI) {
398-
return
399-
}
400-
401395
mockfs({
402396
[path.resolve(`${__dirname }../../../../../extension/dist/v2`)]: {
403397
'background.js': mockfs.file({
@@ -418,16 +412,16 @@ describe('lib/browsers/firefox', () => {
418412
})
419413

420414
utils.writeExtension.restore()
415+
// @ts-expect-error
416+
fsExtra.writeFile.restore()
417+
sinon.spy(fsExtra, 'chmod')
421418

422-
const getFile = function (path) {
423-
return _.reduce(_.compact(_.split(path, '/')), (acc, item) => {
424-
return acc.getItem(item)
425-
}, mockfs.getMockRoot())
426-
}
419+
// bypass the extension clearing that happens in open mode, which is tested at the system test level
420+
this.options.isTextTerminal = true
427421

428422
await firefox.open(this.browser, 'http://', this.options, this.automation)
429423

430-
expect(getFile(`${process.env.HOME }/.config/Cypress/cy/test/browsers/firefox-stable/interactive/CypressExtension/background.js`).getMode()).to.be.equals(0o644)
424+
expect(fsExtra.chmod).to.have.been.calledWith(sinon.match(/CypressExtension\/background\.js/), 0o644)
431425
})
432426

433427
it('sets proxy-related preferences if specified', async function () {

0 commit comments

Comments
 (0)