@@ -116,6 +116,10 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
116
116
obj . result . data . cloudViewer . organizations . nodes = [ ]
117
117
}
118
118
119
+ if ( obj . result . data ?. cloudViewer ?. firstOrganization ?. nodes ) {
120
+ obj . result . data . cloudViewer . firstOrganization . nodes = [ ]
121
+ }
122
+
119
123
return obj . result
120
124
} )
121
125
@@ -150,8 +154,14 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
150
154
cy . startAppServer ( 'component' )
151
155
152
156
cy . remoteGraphQLIntercept ( async ( obj ) => {
153
- if ( obj ?. result ?. data ?. cloudViewer ?. organizations ?. nodes ) {
154
- obj . result . data . cloudViewer . organizations . nodes = [ ]
157
+ if ( ( obj . operationName !== 'CreateCloudOrgModal_CloudOrganizationsCheck_refreshOrganizations_cloudViewer' ) ) {
158
+ if ( obj . result . data ?. cloudViewer ?. organizations ?. nodes ) {
159
+ obj . result . data . cloudViewer . organizations . nodes = [ ]
160
+ }
161
+
162
+ if ( obj . result . data ?. cloudViewer ?. firstOrganization ?. nodes ) {
163
+ obj . result . data . cloudViewer . firstOrganization . nodes = [ ]
164
+ }
155
165
}
156
166
157
167
return obj . result
@@ -181,7 +191,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
181
191
cy . startAppServer ( 'component' )
182
192
183
193
cy . remoteGraphQLIntercept ( async ( obj , testState ) => {
184
- if ( obj . operationName === 'CloudConnectModals_RefreshCloudViewer_refreshCloudViewer_cloudViewer ' ) {
194
+ if ( obj . operationName === 'LoginConnectModals_LoginConnectModalsQuery_cloudViewer ' ) {
185
195
testState . refetchCalled = true
186
196
}
187
197
@@ -312,7 +322,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
312
322
313
323
moveToRunsPage ( )
314
324
cy . findByText ( defaultMessages . runs . connect . buttonProject ) . click ( )
315
- cy . get ( 'button' ) . contains ( defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
325
+ cy . contains ( 'button' , defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
316
326
cy . findByText ( defaultMessages . runs . connectSuccessAlert . title ) . should ( 'be.visible' )
317
327
318
328
cy . withCtx ( async ( ctx ) => {
@@ -351,7 +361,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
351
361
352
362
cy . get ( '[href="#/runs"]' ) . click ( )
353
363
cy . findByText ( defaultMessages . runs . connect . buttonProject ) . click ( )
354
- cy . get ( 'button' ) . contains ( defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
364
+ cy . contains ( 'button' , defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
355
365
356
366
cy . get ( '[data-cy="alert"]' ) . within ( ( ) => {
357
367
cy . contains ( defaultMessages . runs . connect . errors . baseError . title )
@@ -386,7 +396,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
386
396
387
397
cy . get ( '[href="#/runs"]' ) . click ( )
388
398
cy . findByText ( defaultMessages . runs . connect . buttonProject ) . click ( )
389
- cy . get ( 'button' ) . contains ( defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
399
+ cy . contains ( 'button' , defaultMessages . runs . connect . modal . selectProject . createProject ) . click ( )
390
400
391
401
cy . get ( '[data-cy="alert"]' ) . within ( ( ) => {
392
402
cy . contains ( defaultMessages . runs . connect . errors . internalServerError . title )
@@ -417,7 +427,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
417
427
}
418
428
419
429
if ( obj . result . data ?. cloudViewer ?. organizations ?. nodes ) {
420
- const projectNodes = obj . result . data ? .cloudViewer . organizations . nodes [ 0 ] . projects . nodes
430
+ const projectNodes = obj . result . data . cloudViewer . organizations . nodes [ 0 ] . projects . nodes
421
431
422
432
projectNodes . push ( {
423
433
__typename : 'CloudProject' ,
@@ -440,9 +450,10 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
440
450
} )
441
451
442
452
it ( 'opens Connect Project modal after clicking Reconnect Project button' , ( ) => {
443
- cy . findByText ( defaultMessages . runs . errors . notFound . button ) . should ( 'be.visible' ) . click ( )
453
+ cy . findByText ( defaultMessages . runs . errors . notFound . button ) . click ( )
454
+
444
455
cy . get ( '[aria-modal="true"]' ) . should ( 'exist' )
445
- cy . get ( '[data-cy="selectProject"] button' ) . should ( 'have.text ', 'Mock Project' )
456
+ cy . contains ( '[data-cy="selectProject"] button' , 'Mock Project' )
446
457
cy . get ( '[data-cy="connect-project"]' ) . click ( )
447
458
cy . get ( '[data-cy="runs"]' , { timeout : 7500 } )
448
459
} )
@@ -510,12 +521,13 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
510
521
511
522
it ( 'updates the button text when the request access button is clicked' , ( ) => {
512
523
cy . remoteGraphQLIntercept ( async ( obj , testState ) => {
513
- if ( obj . operationName === 'Runs_currentProject_cloudProject_cloudProjectBySlug' ) {
524
+ if ( obj . operationName ?. includes ( 'cloudProject_cloudProjectBySlug' ) ) {
514
525
const proj = obj ! . result ! . data ! . cloudProjectBySlug
515
526
516
527
proj . __typename = 'CloudProjectUnauthorized'
517
528
proj . message = 'Cloud Project Unauthorized'
518
529
proj . hasRequestedAccess = false
530
+
519
531
testState . project = proj
520
532
} else if ( obj . operationName === 'RunsErrorRenderer_RequestAccess_cloudProjectRequestAccess' ) {
521
533
obj ! . result ! . data ! . cloudProjectRequestAccess = {
@@ -696,7 +708,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
696
708
697
709
cy . loginUser ( )
698
710
cy . remoteGraphQLIntercept ( ( obj ) => {
699
- if ( obj . operationName === 'Runs_currentProject_cloudProject_cloudProjectBySlug' ) {
711
+ if ( obj . operationName ?. includes ( 'cloudProject_cloudProjectBySlug' ) ) {
700
712
cloudData = obj . result
701
713
obj . result = { }
702
714
@@ -714,7 +726,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
714
726
// cy.percySnapshot() // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435
715
727
716
728
cy . remoteGraphQLIntercept ( ( obj ) => {
717
- if ( obj . operationName === 'Runs_currentProject_cloudProject_cloudProjectBySlug' ) {
729
+ if ( obj . operationName ?. includes ( 'cloudProject_cloudProjectBySlug' ) ) {
718
730
return cloudData
719
731
}
720
732
@@ -732,10 +744,6 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
732
744
cy . startAppServer ( 'component' )
733
745
} )
734
746
735
- afterEach ( ( ) => {
736
- cy . goOnline ( )
737
- } )
738
-
739
747
it ( 'shows alert warning if runs have been returned already' , ( ) => {
740
748
cy . loginUser ( )
741
749
cy . visitApp ( )
@@ -773,11 +781,15 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
773
781
cy . openProject ( 'component-tests' , [ '--config-file' , 'cypressWithoutProjectId.config.js' ] )
774
782
cy . startAppServer ( 'component' )
775
783
776
- cy . remoteGraphQLIntercept ( async ( obj ) => {
784
+ cy . remoteGraphQLIntercept ( ( obj ) => {
777
785
if ( obj . result . data ?. cloudViewer ?. organizations ?. nodes ) {
778
786
obj . result . data . cloudViewer . organizations . nodes = [ ]
779
787
}
780
788
789
+ if ( obj . result . data ?. cloudViewer ?. firstOrganization ?. nodes ) {
790
+ obj . result . data . cloudViewer . firstOrganization . nodes = [ ]
791
+ }
792
+
781
793
return obj . result
782
794
} )
783
795
@@ -845,7 +857,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
845
857
cy . openProject ( 'component-tests' )
846
858
cy . startAppServer ( 'component' )
847
859
cy . loginUser ( )
848
- cy . remoteGraphQLIntercept ( ( obj , testState ) => {
860
+ cy . remoteGraphQLIntercept ( ( obj ) => {
849
861
if ( obj . result . data ?. cloudProjectBySlug ?. runs ?. nodes . length ) {
850
862
obj . result . data . cloudProjectBySlug . runs . nodes . map ( ( run ) => {
851
863
run . status = 'RUNNING'
0 commit comments