@@ -203,20 +203,24 @@ function addSchedule() {
203
203
force : true ,
204
204
} ) ;
205
205
// Select Action type option: 'VM Analysis'
206
- cy . get ( 'select#action_typ' ) . select ( actionTypeVmAnalysis ) ;
206
+ cy . getFormSelectFieldById ( actionTypeSelectFieldId ) . select (
207
+ actionTypeVmAnalysis
208
+ ) ;
207
209
// Select Filter type option: 'A Single VM'
208
- cy . get ( 'select#filter_typ' ) . select ( actionTypeVmAnalysis ) ;
210
+ cy . getFormSelectFieldById ( filterTypeSelectFieldId ) . select (
211
+ actionTypeVmAnalysis
212
+ ) ;
209
213
// Select Run option: 'Hours'
210
- cy . get ( 'select#timer_typ' ) . select ( timerTypeHourly ) ;
214
+ cy . getFormSelectFieldById ( timerTypeSelectFieldId ) . select ( timerTypeHourly ) ;
211
215
// Select Every option: '1 Hour'
212
- cy . get ( 'select#timer_value' ) . select ( frequencyTypeHour ) ;
216
+ cy . getFormSelectFieldById ( timerValueSelectFieldId ) . select ( frequencyTypeHour ) ;
213
217
// Select Time zone option: '(GMT-10:00) Hawaii'
214
- cy . get ( 'input[role="combobox"]#time_zone' ) . click ( ) ;
218
+ cy . getFormInputFieldById ( timeZoneInputFieldId ) . click ( ) ;
215
219
cy . contains ( '[role="option"]' , timezoneTypeHawaii )
216
220
. should ( 'be.visible' )
217
221
. click ( ) ;
218
- cy . get ( 'input#start_date' ) . type ( initialStartDate ) ;
219
- cy . get ( 'input#start_time' ) . type ( startTime ) ;
222
+ cy . getFormInputFieldById ( startDateInputFieldId ) . type ( initialStartDate ) ;
223
+ cy . getFormInputFieldById ( startTimeInputFieldId ) . type ( startTime ) ;
220
224
// Intercepting the API call for adding a new schedule
221
225
cy . intercept ( 'POST' , '/ops/schedule_edit/new?button=save' ) . as (
222
226
'addScheduleApi'
@@ -287,33 +291,33 @@ function invokeCleanupDeletion() {
287
291
}
288
292
289
293
function selectAndAssertDropdownValue ( id , value ) {
290
- cy . get ( `select# ${ id } ` ) . select ( value ) ;
291
- cy . get ( `select# ${ id } ` ) . should ( 'have.value' , value ) ;
294
+ cy . getFormSelectFieldById ( id ) . select ( value ) ;
295
+ cy . getFormSelectFieldById ( id ) . should ( 'have.value' , value ) ;
292
296
}
293
297
294
298
function assertSelectFieldWithLabel ( id ) {
295
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
296
- cy . get ( `select# ${ id } ` ) . should ( 'exist' ) ;
299
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
300
+ cy . getFormSelectFieldById ( id ) . should ( 'exist' ) ;
297
301
}
298
302
299
303
function selectActionTypeAndAssertFilterTypeDropdown ( value ) {
300
- selectAndAssertDropdownValue ( 'action_typ' , value ) ;
301
- assertSelectFieldWithLabel ( 'filter_typ' ) ;
304
+ selectAndAssertDropdownValue ( actionTypeSelectFieldId , value ) ;
305
+ assertSelectFieldWithLabel ( filterTypeSelectFieldId ) ;
302
306
}
303
307
304
308
function selectTimerTypeAndAssertTimerDropdown ( value ) {
305
- selectAndAssertDropdownValue ( 'timer_typ' , value ) ;
306
- assertSelectFieldWithLabel ( 'timer_value' ) ;
309
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , value ) ;
310
+ assertSelectFieldWithLabel ( timerValueSelectFieldId ) ;
307
311
}
308
312
309
313
function assertComboboxWithLabel ( id ) {
310
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
311
- cy . get ( `input[role="combobox"]# ${ id } ` ) . should ( 'exist' ) ;
314
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
315
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
312
316
}
313
317
314
318
function assertInputFieldWithLabel ( id ) {
315
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
316
- cy . get ( `input# ${ id } ` ) . should ( 'exist' ) ;
319
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
320
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
317
321
}
318
322
319
323
describe ( 'Automate Schedule form operations: Settings > Application Settings > Settings > Schedules > Configuration > Add a new schedule' , ( ) => {
@@ -362,46 +366,49 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
362
366
363
367
/* ===== Selecting "Automation Tasks" option from "Action" dropdown shows Zone, Object details & Object fields ===== */
364
368
365
- selectAndAssertDropdownValue ( 'action_typ' , actionTypeAutomationTasks ) ;
369
+ selectAndAssertDropdownValue (
370
+ actionTypeSelectFieldId ,
371
+ actionTypeAutomationTasks
372
+ ) ;
366
373
367
374
// Checking for Zone dropdown
368
- assertSelectFieldWithLabel ( 'zone_id' ) ;
375
+ assertSelectFieldWithLabel ( zoneSelectFieldId ) ;
369
376
370
377
// Checking for Object Details
371
378
cy . get ( 'h3[name="object_details"]' ) . should ( 'exist' ) ;
372
379
// Checking for System/Process dropdown
373
- assertSelectFieldWithLabel ( 'instance_name' ) ;
380
+ assertSelectFieldWithLabel ( systemSelectFieldId ) ;
374
381
// Checking for Messsage textfield
375
- assertInputFieldWithLabel ( 'message' ) ;
382
+ assertInputFieldWithLabel ( messageInputFieldId ) ;
376
383
// Checking for Request textfield
377
- assertInputFieldWithLabel ( 'request' ) ;
384
+ assertInputFieldWithLabel ( requestInputFieldId ) ;
378
385
379
386
// Checking for Object
380
387
cy . get ( 'h3[name="object_attributes"]' ) . should ( 'exist' ) ;
381
388
// Checking for Type Combobox
382
- assertComboboxWithLabel ( 'target_class' ) ;
389
+ assertComboboxWithLabel ( typeInputFieldId ) ;
383
390
// Checking for Object Combobox
384
- assertComboboxWithLabel ( 'target_id' ) ;
391
+ assertComboboxWithLabel ( objectInputFieldId ) ;
385
392
386
393
// Checking for Attribute/Value pairs
387
394
cy . contains ( 'h3' , 'Attribute/Value Pairs' ) . should ( 'exist' ) ;
388
395
// Checking for 5 attribute-value pairs text fields
389
- cy . get ( 'input# attribute_1') . should ( 'exist' ) ;
390
- cy . get ( 'input# value_1') . should ( 'exist' ) ;
391
- cy . get ( 'input# attribute_2') . should ( 'exist' ) ;
392
- cy . get ( 'input# value_2') . should ( 'exist' ) ;
393
- cy . get ( 'input# attribute_3') . should ( 'exist' ) ;
394
- cy . get ( 'input# value_3') . should ( 'exist' ) ;
395
- cy . get ( 'input# attribute_4') . should ( 'exist' ) ;
396
- cy . get ( 'input# value_4') . should ( 'exist' ) ;
397
- cy . get ( 'input# attribute_5') . should ( 'exist' ) ;
398
- cy . get ( 'input# value_5') . should ( 'exist' ) ;
396
+ cy . getFormInputFieldById ( ' attribute_1') . should ( 'exist' ) ;
397
+ cy . getFormInputFieldById ( ' value_1') . should ( 'exist' ) ;
398
+ cy . getFormInputFieldById ( ' attribute_2') . should ( 'exist' ) ;
399
+ cy . getFormInputFieldById ( ' value_2') . should ( 'exist' ) ;
400
+ cy . getFormInputFieldById ( ' attribute_3') . should ( 'exist' ) ;
401
+ cy . getFormInputFieldById ( ' value_3') . should ( 'exist' ) ;
402
+ cy . getFormInputFieldById ( ' attribute_4') . should ( 'exist' ) ;
403
+ cy . getFormInputFieldById ( ' value_4') . should ( 'exist' ) ;
404
+ cy . getFormInputFieldById ( ' attribute_5') . should ( 'exist' ) ;
405
+ cy . getFormInputFieldById ( ' value_5') . should ( 'exist' ) ;
399
406
400
407
/* ===== Selecting "Once" option from "Run" dropdown does not show the "Every" dropdown ===== */
401
408
402
- selectAndAssertDropdownValue ( 'timer_typ' , timerTypeOnce ) ;
409
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , timerTypeOnce ) ;
403
410
// Checking whether the Every dropdown is hidden
404
- cy . get ( 'input#timer_value' ) . should ( 'not.exist' ) ;
411
+ cy . getFormInputFieldById ( timerValueSelectFieldId ) . should ( 'not.exist' ) ;
405
412
406
413
/* ===== Selecting any other option other than "Once" from "Run" dropdown shows the "Every" dropdown ===== */
407
414
// Selecting "Hourly" to verify timer dropdown
@@ -418,12 +425,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
418
425
// Open add schedule form
419
426
selectConfigMenu ( addScheduleConfigOption ) ;
420
427
// Cancel the form
421
- cy . contains (
422
- '#main-content .bx--btn-set button[type="button"]' ,
423
- cancelButton
424
- )
425
- . should ( 'be.enabled' )
426
- . click ( ) ;
428
+ cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
427
429
cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
428
430
} ) ;
429
431
@@ -438,8 +440,10 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
438
440
// Open edit schedule form
439
441
selectConfigMenu ( editScheduleConfigOption ) ;
440
442
// Editing name and description
441
- cy . get ( 'input#name' ) . clear ( ) . type ( editedScheduleName ) ;
442
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
443
+ cy . getFormInputFieldById ( nameInputFieldId ) . clear ( ) . type ( editedScheduleName ) ;
444
+ cy . getFormInputFieldById ( descriptionInputFieldId )
445
+ . clear ( )
446
+ . type ( editedDescription ) ;
443
447
// Confirms Save button is enabled after making edits
444
448
cy . getFormFooterButtonByType ( saveButton , 'submit' )
445
449
. should ( 'be.enabled' )
@@ -459,24 +463,27 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
459
463
// Open edit schedule form
460
464
selectConfigMenu ( editScheduleConfigOption ) ;
461
465
// Editing description and start date
462
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
463
- cy . get ( 'input#start_date' ) . clear ( ) . type ( editedStartDate ) ;
466
+ cy . getFormInputFieldById ( descriptionInputFieldId )
467
+ . clear ( )
468
+ . type ( editedDescription ) ;
469
+ cy . getFormInputFieldById ( startDateInputFieldId )
470
+ . clear ( )
471
+ . type ( editedStartDate ) ;
464
472
// Resetting
465
- cy . contains ( '#main-content .bx--btn-set button[type="button"]' , resetButton )
466
- . should ( 'be.enabled' )
467
- . click ( ) ;
473
+ cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.enabled' ) . click ( ) ;
468
474
cy . expect_flash ( flashTypeWarning , flashMessageResetSchedule ) ;
469
475
// Confirming the edited fields contain the old values after resetting
470
- cy . get ( 'input#description' ) . should ( 'have.value' , initialDescription ) ;
471
- cy . get ( 'input#start_date' ) . should ( 'have.value' , initialStartDate ) ;
476
+ cy . getFormInputFieldById ( descriptionInputFieldId ) . should (
477
+ 'have.value' ,
478
+ initialDescription
479
+ ) ;
480
+ cy . getFormInputFieldById ( startDateInputFieldId ) . should (
481
+ 'have.value' ,
482
+ initialStartDate
483
+ ) ;
472
484
473
485
/* ===== Checking whether Cancel button works ===== */
474
- cy . contains (
475
- '#main-content .bx--btn-set button[type="button"]' ,
476
- cancelButton
477
- )
478
- . should ( 'be.enabled' )
479
- . click ( ) ;
486
+ cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
480
487
cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
481
488
} ) ;
482
489
0 commit comments