@@ -358,34 +358,52 @@ describe('Settings', () => {
358358 } )
359359
360360 describe ( 'project id panel' , ( ) => {
361- beforeEach ( function ( ) {
362- this . openProject . resolve ( this . config )
363- this . projectStatuses [ 0 ] . id = this . config . projectId
364- this . getProjectStatus . resolve ( this . projectStatuses [ 0 ] )
361+ context ( 'with json file' , ( ) => {
362+ beforeEach ( function ( ) {
363+ this . openProject . resolve ( this . config )
364+ this . projectStatuses [ 0 ] . id = this . config . projectId
365+ this . getProjectStatus . resolve ( this . projectStatuses [ 0 ] )
365366
366- this . goToSettings ( )
367- cy . contains ( 'Project ID' ) . click ( )
368- } )
367+ this . goToSettings ( )
368+ cy . contains ( 'Project ID' ) . click ( )
369+ } )
369370
370- it ( 'displays project id section' , function ( ) {
371- cy . contains ( this . config . projectId )
372- cy . percySnapshot ( )
373- } )
371+ it ( 'displays project id section' , function ( ) {
372+ cy . contains ( this . config . projectId )
373+ cy . percySnapshot ( )
374+ } )
375+
376+ it ( 'shows tooltip on hover of copy to clipboard' , ( ) => {
377+ cy . get ( '.action-copy' ) . trigger ( 'mouseover' )
378+ cy . get ( '.cy-tooltip' ) . should ( 'contain' , 'Copy to clipboard' )
379+ } )
374380
375- it ( 'shows tooltip on hover of copy to clipboard' , ( ) => {
376- cy . get ( '.action-copy' ) . trigger ( 'mouseover' )
377- cy . get ( '.cy-tooltip' ) . should ( 'contain' , 'Copy to clipboard' )
381+ it ( 'copies project id config to clipboard' , function ( ) {
382+ cy . get ( '.action-copy' ) . click ( )
383+ . then ( ( ) => {
384+ const expectedJsonConfig = {
385+ projectId : this . config . projectId ,
386+ }
387+ const expectedCopyCommand = JSON . stringify ( expectedJsonConfig , null , 2 )
388+
389+ expect ( this . ipc . setClipboardText ) . to . be . calledWith ( expectedCopyCommand )
390+ } )
391+ } )
378392 } )
379393
380- it ( 'copies project id config to clipboard' , function ( ) {
381- cy . get ( '.action-copy' ) . click ( )
382- . then ( ( ) => {
383- const expectedJsonConfig = {
384- projectId : this . config . projectId ,
385- }
386- const expectedCopyCommand = JSON . stringify ( expectedJsonConfig , null , 2 )
394+ context ( 'with js file' , ( ) => {
395+ beforeEach ( function ( ) {
396+ this . openProject . resolve ( { ...this . config , configFile : 'custom.cypress.js' } )
397+ this . projectStatuses [ 0 ] . id = this . config . projectId
398+ this . getProjectStatus . resolve ( this . projectStatuses [ 0 ] )
399+
400+ this . goToSettings ( )
401+ cy . contains ( 'Project ID' ) . click ( )
402+ } )
387403
388- expect ( this . ipc . setClipboardText ) . to . be . calledWith ( expectedCopyCommand )
404+ it ( 'displays project id section' , function ( ) {
405+ cy . get ( '[data-cy="project-id"] pre' ) . contains ( 'module.exports = {' )
406+ cy . percySnapshot ( )
389407 } )
390408 } )
391409 } )
@@ -586,6 +604,17 @@ describe('Settings', () => {
586604 . should ( 'contain' , systemNodeVersion )
587605 . should ( 'not.contain' , bundledNodeVersion )
588606 } )
607+
608+ it ( 'should display an additional line when configFile is not JSON' , function ( ) {
609+ const configFile = 'notjson.js'
610+
611+ this . navigateWithConfig ( {
612+ configFile,
613+ } )
614+
615+ cy . contains ( `Node.js Version (${ bundledNodeVersion } )` ) . click ( )
616+ cy . get ( '.node-version li' ) . should ( 'contain' , configFile )
617+ } )
589618 } )
590619
591620 describe ( 'proxy settings panel' , ( ) => {
0 commit comments