@@ -86,6 +86,19 @@ const {
86
86
startTime,
87
87
deleteScheduleConfigOption,
88
88
schedulesAccordionItem,
89
+ flashTypeSuccess,
90
+ flashTypeWarning,
91
+ flashTypeError,
92
+ flashTypeInfo,
93
+ flashMessageScheduleQueued,
94
+ flashMessageOperationCanceled,
95
+ flashMessageScheduleDisabled,
96
+ flashMessageScheduleEnabled,
97
+ flashMessageScheduleSaved,
98
+ flashMessageResetSchedule,
99
+ flashMessageScheduleDeleted,
100
+ flashMessageFailedToAddSchedule,
101
+ browserAlertDeleteConfirmText,
89
102
} = textConstants ;
90
103
91
104
function selectConfigMenu ( configuration = addScheduleConfigOption ) {
@@ -137,8 +150,9 @@ function deleteSchedule(scheduleName = initialScheduleName) {
137
150
// Listening for the browser confirm alert and confirming deletion
138
151
cy . expect_browser_confirm_with_text ( {
139
152
confirmTriggerFn : ( ) => selectConfigMenu ( deleteScheduleConfigOption ) ,
153
+ containsText : browserAlertDeleteConfirmText ,
140
154
} ) ;
141
- cy . expect_flash ( 'success' ) ;
155
+ cy . expect_flash ( flashTypeSuccess , flashMessageScheduleDeleted ) ;
142
156
}
143
157
144
158
function invokeCleanupDeletion ( ) {
@@ -323,13 +337,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
323
337
)
324
338
. should ( 'be.enabled' )
325
339
. click ( ) ;
326
- cy . expect_flash ( 'success' ) ;
340
+ cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
327
341
} ) ;
328
342
329
343
it ( 'Checking whether add, edit & delete schedule works' , ( ) => {
330
344
/* ===== Adding a schedule ===== */
331
345
addSchedule ( ) ;
332
- cy . expect_flash ( 'success' ) ;
346
+ cy . expect_flash ( flashTypeSuccess , flashMessageScheduleSaved ) ;
333
347
334
348
/* ===== Editing a schedule ===== */
335
349
// Selecting the created schedule
@@ -342,7 +356,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
342
356
cy . contains ( '#main-content .bx--btn-set button[type="submit"]' , saveButton )
343
357
. should ( 'be.enabled' )
344
358
. click ( ) ;
345
- cy . expect_flash ( 'success' ) ;
359
+ cy . expect_flash ( flashTypeSuccess , flashMessageScheduleSaved ) ;
346
360
347
361
/* ===== Delete is already handled from afterEach hook ===== */
348
362
} ) ;
@@ -361,7 +375,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
361
375
)
362
376
. should ( 'be.enabled' )
363
377
. click ( ) ;
364
- cy . expect_flash ( 'success' ) ;
378
+ cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
365
379
366
380
/* ===== Checking whether Reset button works ===== */
367
381
// Selecting the created schedule
@@ -373,7 +387,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
373
387
cy . contains ( '#main-content .bx--btn-set button[type="button"]' , resetButton )
374
388
. should ( 'be.enabled' )
375
389
. click ( ) ;
376
- cy . expect_flash ( 'warning' ) ;
390
+ cy . expect_flash ( flashTypeWarning , flashMessageResetSchedule ) ;
377
391
// Confirming the edited fields contain the old values after resetting
378
392
cy . get ( 'input#description' ) . should ( 'have.value' , initialDescription ) ;
379
393
cy . get ( 'input#start_date' ) . should ( 'have.value' , initialStartDate ) ;
@@ -388,7 +402,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
388
402
389
403
/* ===== Trying to add the same schedule again ===== */
390
404
addSchedule ( ) ;
391
- cy . expect_flash ( 'error' ) ;
405
+ cy . expect_flash ( flashTypeError , flashMessageFailedToAddSchedule ) ;
392
406
} ) ;
393
407
394
408
it ( 'Checking whether Disabling, Enabling & Queueing up the schedule works' , ( ) => {
@@ -399,15 +413,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
399
413
400
414
/* ===== Disabling the schedule ===== */
401
415
selectConfigMenu ( disableScheduleConfigOption ) ;
402
- cy . expect_flash ( 'info' ) ;
416
+ cy . expect_flash ( flashTypeInfo , flashMessageScheduleDisabled ) ;
403
417
404
418
/* ===== Enabling the schedule ===== */
405
419
selectConfigMenu ( enableScheduleConfigOption ) ;
406
- cy . expect_flash ( 'info' ) ;
420
+ cy . expect_flash ( flashTypeInfo , flashMessageScheduleEnabled ) ;
407
421
408
422
/* ===== Queueing-up the schedule ===== */
409
423
selectConfigMenu ( queueScheduleConfigOption ) ;
410
- cy . expect_flash ( 'success' ) ;
424
+ cy . expect_flash ( flashTypeSuccess , flashMessageScheduleQueued ) ;
411
425
} ) ;
412
426
413
427
afterEach ( ( ) => {
0 commit comments