@@ -15,7 +15,6 @@ import { type Client as WebDriverClient, default as webdriver } from 'webdriver'
15
15
import { EventEmitter } from 'stream'
16
16
17
17
const path = require ( 'path' )
18
- const _ = require ( 'lodash' )
19
18
const mockfs = require ( 'mock-fs' )
20
19
const FirefoxProfile = require ( 'firefox-profile' )
21
20
const utils = require ( '../../../lib/browsers/utils' )
@@ -119,12 +118,12 @@ describe('lib/browsers/firefox', () => {
119
118
sinon . spy ( FirefoxProfile . prototype , 'setPreference' )
120
119
sinon . spy ( FirefoxProfile . prototype , 'shouldDeleteOnExit' )
121
120
sinon . spy ( FirefoxProfile . prototype , 'path' )
122
- sinon . stub ( FirefoxProfile . prototype , 'encoded' ) . callsFake ( ( cb ) => {
121
+ sinon . stub ( FirefoxProfile . prototype , 'encoded' ) . callsFake ( ( cb : Function ) => {
123
122
cb ( undefined , 'abcdef' )
124
123
} )
125
124
126
125
sinon . stub ( fsExtra , 'writeJSON' ) . resolves ( undefined )
127
- sinon . stub ( fsExtra , 'writeFile' ) . resolves ( undefined )
126
+ sinon . stub ( fsExtra , 'writeFile' ) . returns ( undefined )
128
127
browserCriClient = sinon . createStubInstance ( BrowserCriClient )
129
128
130
129
browserCriClient . attachToTargetUrl = sinon . stub ( ) . resolves ( { } )
@@ -393,11 +392,6 @@ describe('lib/browsers/firefox', () => {
393
392
} )
394
393
395
394
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
-
401
395
mockfs ( {
402
396
[ path . resolve ( `${ __dirname } ../../../../../extension/dist/v2` ) ] : {
403
397
'background.js' : mockfs . file ( {
@@ -418,16 +412,16 @@ describe('lib/browsers/firefox', () => {
418
412
} )
419
413
420
414
utils . writeExtension . restore ( )
415
+ // @ts -expect-error
416
+ fsExtra . writeFile . restore ( )
417
+ sinon . spy ( fsExtra , 'chmod' )
421
418
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
427
421
428
422
await firefox . open ( this . browser , 'http://' , this . options , this . automation )
429
423
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 ( / C y p r e s s E x t e n s i o n \ /b a c k g r o u n d \ .j s / ) , 0o644 )
431
425
} )
432
426
433
427
it ( 'sets proxy-related preferences if specified' , async function ( ) {
0 commit comments