File tree Expand file tree Collapse file tree 1 file changed +24
-10
lines changed
cypress/e2e/ui/Settings/Application-Settings Expand file tree Collapse file tree 1 file changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ function deleteSchedule(scheduleName = 'Test name') {
47
47
) ;
48
48
}
49
49
50
+ function invokeCleanupDeletion ( ) {
51
+ // Iterate and clean up any leftover schedules created during the test
52
+ cy . get ( 'li.list-group-item' ) . each ( ( $el ) => {
53
+ const text = $el ?. text ( ) ?. trim ( ) ;
54
+ if ( text === 'Test name' ) {
55
+ deleteSchedule ( ) ;
56
+ return false ;
57
+ }
58
+ if ( text === 'Dummy name' ) {
59
+ deleteSchedule ( 'Dummy name' ) ;
60
+ return false ;
61
+ }
62
+ return true ;
63
+ } ) ;
64
+ }
65
+
50
66
describe ( 'Automate Schedule form operations: Settings > Application Settings > Settings > Schedules > Configuration > Add a new schedule' , ( ) => {
51
67
beforeEach ( ( ) => {
52
68
cy . login ( ) ;
@@ -307,17 +323,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
307
323
} ) ;
308
324
309
325
afterEach ( ( ) => {
310
- cy . get ( 'li.list-group-item' ) . each ( ( $el ) => {
311
- const text = $el ?. text ( ) ?. trim ( ) ;
312
- if ( text === 'Test name' ) {
313
- deleteSchedule ( ) ;
314
- return false ;
315
- }
316
- if ( text === 'Dummy name' ) {
317
- deleteSchedule ( 'Dummy name' ) ;
318
- return false ;
326
+ cy ?. url ( ) ?. then ( ( url ) => {
327
+ // Ensures navigation to Settings -> Application-Settings in the UI
328
+ if ( url ?. includes ( '/ops/explorer' ) ) {
329
+ invokeCleanupDeletion ( ) ;
330
+ } else {
331
+ // Navigate to Settings -> Application-Settings before looking out for Schedules created during test
332
+ cy . menu ( 'Settings' , 'Application Settings' ) ;
333
+ invokeCleanupDeletion ( ) ;
319
334
}
320
- return true ;
321
335
} ) ;
322
336
} ) ;
323
337
} ) ;
You can’t perform that action at this time.
0 commit comments