@@ -125,6 +125,9 @@ function addSchedule() {
125
125
. should ( 'be.enabled' ) // Checks if Save button is enabled once all required fields are filled
126
126
. click ( ) ,
127
127
} ) ;
128
+ return cy . then ( ( ) => {
129
+ return INITIAL_SCHEDULE_NAME ;
130
+ } ) ;
128
131
}
129
132
130
133
function clickScheduleItem ( scheduleName ) {
@@ -489,12 +492,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
489
492
490
493
it ( 'Checking whether add, edit & delete schedule works' , ( ) => {
491
494
/* ===== Adding a schedule ===== */
492
- addSchedule ( ) ;
493
- cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
495
+ addSchedule ( ) . then ( ( createdScheduleName ) => {
496
+ // createdScheduleName value will be "Test-name"
497
+ // Assert schedule saved flash message
498
+ cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
499
+ // Selecting the schedule and intercepting the API call to get schedule details
500
+ clickScheduleItem ( createdScheduleName ) ;
501
+ } ) ;
494
502
495
503
/* ===== Editing a schedule ===== */
496
- // Selecting the schedule and intercepting the API call to get schedule details
497
- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
498
504
// Open edit schedule form
499
505
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
500
506
// Editing name and description
@@ -511,11 +517,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
511
517
512
518
it ( 'Checking whether Cancel & Reset buttons work fine in the Edit form' , ( ) => {
513
519
/* ===== Adding a schedule ===== */
514
- addSchedule ( ) ;
520
+ addSchedule ( ) . then ( ( createdScheduleName ) => {
521
+ // createdScheduleName value will be "Test-name"
522
+ // Selecting the schedule and intercepting the API call to get schedule details
523
+ clickScheduleItem ( createdScheduleName ) ;
524
+ } ) ;
515
525
516
526
/* ===== Checking whether Reset button works ===== */
517
- // Selecting the schedule and intercepting the API call to get schedule details
518
- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
519
527
// Open edit schedule form
520
528
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
521
529
// Editing description and start date
0 commit comments