@@ -180,30 +180,32 @@ function addSchedule() {
180
180
// Open add schedule form
181
181
selectConfigMenu ( addScheduleConfigOption ) ;
182
182
// Checks if Save button is disabled initially
183
- cy . getFormFooterButtonByType ( saveButton , 'submit' ) . should (
184
- 'be.disabled'
185
- ) ;
183
+ cy . getFormFooterButtonByType ( saveButton , 'submit' ) . should ( 'be.disabled' ) ;
186
184
// Adding data
187
185
cy . getFormInputFieldById ( nameInputFieldId ) . type ( initialScheduleName ) ;
188
186
cy . getFormInputFieldById ( descriptionInputFieldId ) . type ( initialDescription ) ;
189
187
cy . getFormInputFieldById ( activeCheckboxFieldId , 'checkbox' ) . check ( {
190
188
force : true ,
191
189
} ) ;
192
190
// Select Action type option: 'VM Analysis'
193
- cy . get ( 'select#action_typ' ) . select ( actionTypeVmAnalysis ) ;
191
+ cy . getFormSelectFieldById ( actionTypeSelectFieldId ) . select (
192
+ actionTypeVmAnalysis
193
+ ) ;
194
194
// Select Filter type option: 'A Single VM'
195
- cy . get ( 'select#filter_typ' ) . select ( actionTypeVmAnalysis ) ;
195
+ cy . getFormSelectFieldById ( filterTypeSelectFieldId ) . select (
196
+ actionTypeVmAnalysis
197
+ ) ;
196
198
// Select Run option: 'Hours'
197
- cy . get ( 'select#timer_typ' ) . select ( timerTypeHourly ) ;
199
+ cy . getFormSelectFieldById ( timerTypeSelectFieldId ) . select ( timerTypeHourly ) ;
198
200
// Select Every option: '1 Hour'
199
- cy . get ( 'select#timer_value' ) . select ( frequencyTypeHour ) ;
201
+ cy . getFormSelectFieldById ( timerValueSelectFieldId ) . select ( frequencyTypeHour ) ;
200
202
// Select Time zone option: '(GMT-10:00) Hawaii'
201
- cy . get ( 'input[role="combobox"]#time_zone' ) . click ( ) ;
203
+ cy . getFormInputFieldById ( timeZoneInputFieldId ) . click ( ) ;
202
204
cy . contains ( '[role="option"]' , timezoneTypeHawaii )
203
205
. should ( 'be.visible' )
204
206
. click ( ) ;
205
- cy . get ( 'input#start_date' ) . type ( initialStartDate ) ;
206
- cy . get ( 'input#start_time' ) . type ( startTime ) ;
207
+ cy . getFormInputFieldById ( startDateInputFieldId ) . type ( initialStartDate ) ;
208
+ cy . getFormInputFieldById ( startTimeInputFieldId ) . type ( startTime ) ;
207
209
// Intercepting the API call for adding a new schedule
208
210
cy . interceptApi ( {
209
211
alias : 'addScheduleApi' ,
@@ -276,33 +278,33 @@ function invokeCleanupDeletion() {
276
278
}
277
279
278
280
function selectAndAssertDropdownValue ( id , value ) {
279
- cy . get ( `select# ${ id } ` ) . select ( value ) ;
280
- cy . get ( `select# ${ id } ` ) . should ( 'have.value' , value ) ;
281
+ cy . getFormSelectFieldById ( id ) . select ( value ) ;
282
+ cy . getFormSelectFieldById ( id ) . should ( 'have.value' , value ) ;
281
283
}
282
284
283
285
function assertSelectFieldWithLabel ( id ) {
284
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
285
- cy . get ( `select# ${ id } ` ) . should ( 'exist' ) ;
286
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
287
+ cy . getFormSelectFieldById ( id ) . should ( 'exist' ) ;
286
288
}
287
289
288
290
function selectActionTypeAndAssertFilterTypeDropdown ( value ) {
289
- selectAndAssertDropdownValue ( 'action_typ' , value ) ;
290
- assertSelectFieldWithLabel ( 'filter_typ' ) ;
291
+ selectAndAssertDropdownValue ( actionTypeSelectFieldId , value ) ;
292
+ assertSelectFieldWithLabel ( filterTypeSelectFieldId ) ;
291
293
}
292
294
293
295
function selectTimerTypeAndAssertTimerDropdown ( value ) {
294
- selectAndAssertDropdownValue ( 'timer_typ' , value ) ;
295
- assertSelectFieldWithLabel ( 'timer_value' ) ;
296
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , value ) ;
297
+ assertSelectFieldWithLabel ( timerValueSelectFieldId ) ;
296
298
}
297
299
298
300
function assertComboboxWithLabel ( id ) {
299
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
300
- cy . get ( `input[role="combobox"]# ${ id } ` ) . should ( 'exist' ) ;
301
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
302
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
301
303
}
302
304
303
305
function assertInputFieldWithLabel ( id ) {
304
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
305
- cy . get ( `input# ${ id } ` ) . should ( 'exist' ) ;
306
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
307
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
306
308
}
307
309
308
310
describe ( 'Automate Schedule form operations: Settings > Application Settings > Settings > Schedules > Configuration > Add a new schedule' , ( ) => {
@@ -353,46 +355,49 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
353
355
354
356
/* ===== Selecting "Automation Tasks" option from "Action" dropdown shows Zone, Object details & Object fields ===== */
355
357
356
- selectAndAssertDropdownValue ( 'action_typ' , actionTypeAutomationTasks ) ;
358
+ selectAndAssertDropdownValue (
359
+ actionTypeSelectFieldId ,
360
+ actionTypeAutomationTasks
361
+ ) ;
357
362
358
363
// Checking for Zone dropdown
359
- assertSelectFieldWithLabel ( 'zone_id' ) ;
364
+ assertSelectFieldWithLabel ( zoneSelectFieldId ) ;
360
365
361
366
// Checking for Object Details
362
367
cy . get ( 'h3[name="object_details"]' ) . should ( 'exist' ) ;
363
368
// Checking for System/Process dropdown
364
- assertSelectFieldWithLabel ( 'instance_name' ) ;
369
+ assertSelectFieldWithLabel ( systemSelectFieldId ) ;
365
370
// Checking for Messsage textfield
366
- assertInputFieldWithLabel ( 'message' ) ;
371
+ assertInputFieldWithLabel ( messageInputFieldId ) ;
367
372
// Checking for Request textfield
368
- assertInputFieldWithLabel ( 'request' ) ;
373
+ assertInputFieldWithLabel ( requestInputFieldId ) ;
369
374
370
375
// Checking for Object
371
376
cy . get ( 'h3[name="object_attributes"]' ) . should ( 'exist' ) ;
372
377
// Checking for Type Combobox
373
- assertComboboxWithLabel ( 'target_class' ) ;
378
+ assertComboboxWithLabel ( typeInputFieldId ) ;
374
379
// Checking for Object Combobox
375
- assertComboboxWithLabel ( 'target_id' ) ;
380
+ assertComboboxWithLabel ( objectInputFieldId ) ;
376
381
377
382
// Checking for Attribute/Value pairs
378
383
cy . contains ( 'h3' , 'Attribute/Value Pairs' ) . should ( 'exist' ) ;
379
384
// Checking for 5 attribute-value pairs text fields
380
- cy . get ( 'input# attribute_1') . should ( 'exist' ) ;
381
- cy . get ( 'input# value_1') . should ( 'exist' ) ;
382
- cy . get ( 'input# attribute_2') . should ( 'exist' ) ;
383
- cy . get ( 'input# value_2') . should ( 'exist' ) ;
384
- cy . get ( 'input# attribute_3') . should ( 'exist' ) ;
385
- cy . get ( 'input# value_3') . should ( 'exist' ) ;
386
- cy . get ( 'input# attribute_4') . should ( 'exist' ) ;
387
- cy . get ( 'input# value_4') . should ( 'exist' ) ;
388
- cy . get ( 'input# attribute_5') . should ( 'exist' ) ;
389
- cy . get ( 'input# value_5') . should ( 'exist' ) ;
385
+ cy . getFormInputFieldById ( ' attribute_1') . should ( 'exist' ) ;
386
+ cy . getFormInputFieldById ( ' value_1') . should ( 'exist' ) ;
387
+ cy . getFormInputFieldById ( ' attribute_2') . should ( 'exist' ) ;
388
+ cy . getFormInputFieldById ( ' value_2') . should ( 'exist' ) ;
389
+ cy . getFormInputFieldById ( ' attribute_3') . should ( 'exist' ) ;
390
+ cy . getFormInputFieldById ( ' value_3') . should ( 'exist' ) ;
391
+ cy . getFormInputFieldById ( ' attribute_4') . should ( 'exist' ) ;
392
+ cy . getFormInputFieldById ( ' value_4') . should ( 'exist' ) ;
393
+ cy . getFormInputFieldById ( ' attribute_5') . should ( 'exist' ) ;
394
+ cy . getFormInputFieldById ( ' value_5') . should ( 'exist' ) ;
390
395
391
396
/* ===== Selecting "Once" option from "Run" dropdown does not show the "Every" dropdown ===== */
392
397
393
- selectAndAssertDropdownValue ( 'timer_typ' , timerTypeOnce ) ;
398
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , timerTypeOnce ) ;
394
399
// Checking whether the Every dropdown is hidden
395
- cy . get ( 'input#timer_value' ) . should ( 'not.exist' ) ;
400
+ cy . getFormInputFieldById ( timerValueSelectFieldId ) . should ( 'not.exist' ) ;
396
401
397
402
/* ===== Selecting any other option other than "Once" from "Run" dropdown shows the "Every" dropdown ===== */
398
403
// Selecting "Hourly" to verify timer dropdown
@@ -424,8 +429,10 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
424
429
// Open edit schedule form
425
430
selectConfigMenu ( editScheduleConfigOption ) ;
426
431
// Editing name and description
427
- cy . get ( 'input#name' ) . clear ( ) . type ( editedScheduleName ) ;
428
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
432
+ cy . getFormInputFieldById ( nameInputFieldId ) . clear ( ) . type ( editedScheduleName ) ;
433
+ cy . getFormInputFieldById ( descriptionInputFieldId )
434
+ . clear ( )
435
+ . type ( editedDescription ) ;
429
436
// Confirms Save button is enabled after making edits
430
437
cy . getFormFooterButtonByType ( saveButton , 'submit' )
431
438
. should ( 'be.enabled' )
@@ -445,14 +452,24 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
445
452
// Open edit schedule form
446
453
selectConfigMenu ( editScheduleConfigOption ) ;
447
454
// Editing description and start date
448
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
449
- cy . get ( 'input#start_date' ) . clear ( ) . type ( editedStartDate ) ;
455
+ cy . getFormInputFieldById ( descriptionInputFieldId )
456
+ . clear ( )
457
+ . type ( editedDescription ) ;
458
+ cy . getFormInputFieldById ( startDateInputFieldId )
459
+ . clear ( )
460
+ . type ( editedStartDate ) ;
450
461
// Resetting
451
462
cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.enabled' ) . click ( ) ;
452
463
cy . expect_flash ( flashClassMap . warning , flashMessageResetSchedule ) ;
453
464
// Confirming the edited fields contain the old values after resetting
454
- cy . get ( 'input#description' ) . should ( 'have.value' , initialDescription ) ;
455
- cy . get ( 'input#start_date' ) . should ( 'have.value' , initialStartDate ) ;
465
+ cy . getFormInputFieldById ( descriptionInputFieldId ) . should (
466
+ 'have.value' ,
467
+ initialDescription
468
+ ) ;
469
+ cy . getFormInputFieldById ( startDateInputFieldId ) . should (
470
+ 'have.value' ,
471
+ initialStartDate
472
+ ) ;
456
473
457
474
/* ===== Checking whether Cancel button works ===== */
458
475
cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
0 commit comments