@@ -143,6 +143,9 @@ function addSchedule() {
143143 . should ( 'be.enabled' ) // Checks if Save button is enabled once all required fields are filled
144144 . click ( ) ,
145145 } ) ;
146+ return cy . then ( ( ) => {
147+ return INITIAL_SCHEDULE_NAME ;
148+ } ) ;
146149}
147150
148151function clickScheduleItem ( scheduleName ) {
@@ -545,12 +548,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
545548
546549 it ( 'Checking whether add, edit & delete schedule works' , ( ) => {
547550 /* ===== Adding a schedule ===== */
548- addSchedule ( ) ;
549- cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
551+ addSchedule ( ) . then ( ( createdScheduleName ) => {
552+ // createdScheduleName value will be "Test-name"
553+ // Assert schedule saved flash message
554+ cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
555+ // Selecting the schedule and intercepting the API call to get schedule details
556+ clickScheduleItem ( createdScheduleName ) ;
557+ } ) ;
550558
551559 /* ===== Editing a schedule ===== */
552- // Selecting the schedule and intercepting the API call to get schedule details
553- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
554560 // Open edit schedule form
555561 selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
556562 // Editing name and description
@@ -574,11 +580,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
574580
575581 it ( 'Checking whether Cancel & Reset buttons work fine in the Edit form' , ( ) => {
576582 /* ===== Adding a schedule ===== */
577- addSchedule ( ) ;
583+ addSchedule ( ) . then ( ( createdScheduleName ) => {
584+ // createdScheduleName value will be "Test-name"
585+ // Selecting the schedule and intercepting the API call to get schedule details
586+ clickScheduleItem ( createdScheduleName ) ;
587+ } ) ;
578588
579589 /* ===== Checking whether Reset button works ===== */
580- // Selecting the schedule and intercepting the API call to get schedule details
581- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
582590 // Open edit schedule form
583591 selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
584592 // Editing description and start date
0 commit comments