@@ -107,6 +107,9 @@ function addSchedule() {
107
107
. should ( 'be.enabled' ) // Checks if Save button is enabled once all required fields are filled
108
108
. click ( ) ,
109
109
} ) ;
110
+ return cy . then ( ( ) => {
111
+ return INITIAL_SCHEDULE_NAME ;
112
+ } ) ;
110
113
}
111
114
112
115
function clickScheduleItem ( scheduleName ) {
@@ -333,12 +336,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
333
336
334
337
it ( 'Checking whether add, edit & delete schedule works' , ( ) => {
335
338
/* ===== Adding a schedule ===== */
336
- addSchedule ( ) ;
337
- cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
339
+ addSchedule ( ) . then ( ( createdScheduleName ) => {
340
+ // createdScheduleName value will be "Test-name"
341
+ // Assert schedule saved flash message
342
+ cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
343
+ // Selecting the schedule and intercepting the API call to get schedule details
344
+ clickScheduleItem ( createdScheduleName ) ;
345
+ } ) ;
338
346
339
347
/* ===== Editing a schedule ===== */
340
- // Selecting the schedule and intercepting the API call to get schedule details
341
- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
342
348
// Open edit schedule form
343
349
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
344
350
// Editing name and description
@@ -355,11 +361,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
355
361
356
362
it ( 'Checking whether Cancel & Reset buttons work fine in the Edit form' , ( ) => {
357
363
/* ===== Adding a schedule ===== */
358
- addSchedule ( ) ;
364
+ addSchedule ( ) . then ( ( createdScheduleName ) => {
365
+ // createdScheduleName value will be "Test-name"
366
+ // Selecting the schedule and intercepting the API call to get schedule details
367
+ clickScheduleItem ( createdScheduleName ) ;
368
+ } ) ;
359
369
360
370
/* ===== Checking whether Reset button works ===== */
361
- // Selecting the schedule and intercepting the API call to get schedule details
362
- clickScheduleItem ( INITIAL_SCHEDULE_NAME ) ;
363
371
// Open edit schedule form
364
372
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
365
373
// Editing description and start date
0 commit comments