@@ -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' ,
@@ -275,33 +277,33 @@ function invokeCleanupDeletion() {
275
277
}
276
278
277
279
function selectAndAssertDropdownValue ( id , value ) {
278
- cy . get ( `select# ${ id } ` ) . select ( value ) ;
279
- cy . get ( `select# ${ id } ` ) . should ( 'have.value' , value ) ;
280
+ cy . getFormSelectFieldById ( id ) . select ( value ) ;
281
+ cy . getFormSelectFieldById ( id ) . should ( 'have.value' , value ) ;
280
282
}
281
283
282
284
function assertSelectFieldWithLabel ( id ) {
283
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
284
- cy . get ( `select# ${ id } ` ) . should ( 'exist' ) ;
285
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
286
+ cy . getFormSelectFieldById ( id ) . should ( 'exist' ) ;
285
287
}
286
288
287
289
function selectActionTypeAndAssertFilterTypeDropdown ( value ) {
288
- selectAndAssertDropdownValue ( 'action_typ' , value ) ;
289
- assertSelectFieldWithLabel ( 'filter_typ' ) ;
290
+ selectAndAssertDropdownValue ( actionTypeSelectFieldId , value ) ;
291
+ assertSelectFieldWithLabel ( filterTypeSelectFieldId ) ;
290
292
}
291
293
292
294
function selectTimerTypeAndAssertTimerDropdown ( value ) {
293
- selectAndAssertDropdownValue ( 'timer_typ' , value ) ;
294
- assertSelectFieldWithLabel ( 'timer_value' ) ;
295
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , value ) ;
296
+ assertSelectFieldWithLabel ( timerValueSelectFieldId ) ;
295
297
}
296
298
297
299
function assertComboboxWithLabel ( id ) {
298
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
299
- cy . get ( `input[role="combobox"]# ${ id } ` ) . should ( 'exist' ) ;
300
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
301
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
300
302
}
301
303
302
304
function assertInputFieldWithLabel ( id ) {
303
- cy . get ( `label[for=" ${ id } "]` ) . should ( 'exist' ) ;
304
- cy . get ( `input# ${ id } ` ) . should ( 'exist' ) ;
305
+ cy . getFormLabelByInputId ( id ) . should ( 'exist' ) ;
306
+ cy . getFormInputFieldById ( id ) . should ( 'exist' ) ;
305
307
}
306
308
307
309
describe ( 'Automate Schedule form operations: Settings > Application Settings > Settings > Schedules > Configuration > Add a new schedule' , ( ) => {
@@ -350,46 +352,49 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
350
352
351
353
/* ===== Selecting "Automation Tasks" option from "Action" dropdown shows Zone, Object details & Object fields ===== */
352
354
353
- selectAndAssertDropdownValue ( 'action_typ' , actionTypeAutomationTasks ) ;
355
+ selectAndAssertDropdownValue (
356
+ actionTypeSelectFieldId ,
357
+ actionTypeAutomationTasks
358
+ ) ;
354
359
355
360
// Checking for Zone dropdown
356
- assertSelectFieldWithLabel ( 'zone_id' ) ;
361
+ assertSelectFieldWithLabel ( zoneSelectFieldId ) ;
357
362
358
363
// Checking for Object Details
359
364
cy . get ( 'h3[name="object_details"]' ) . should ( 'exist' ) ;
360
365
// Checking for System/Process dropdown
361
- assertSelectFieldWithLabel ( 'instance_name' ) ;
366
+ assertSelectFieldWithLabel ( systemSelectFieldId ) ;
362
367
// Checking for Messsage textfield
363
- assertInputFieldWithLabel ( 'message' ) ;
368
+ assertInputFieldWithLabel ( messageInputFieldId ) ;
364
369
// Checking for Request textfield
365
- assertInputFieldWithLabel ( 'request' ) ;
370
+ assertInputFieldWithLabel ( requestInputFieldId ) ;
366
371
367
372
// Checking for Object
368
373
cy . get ( 'h3[name="object_attributes"]' ) . should ( 'exist' ) ;
369
374
// Checking for Type Combobox
370
- assertComboboxWithLabel ( 'target_class' ) ;
375
+ assertComboboxWithLabel ( typeInputFieldId ) ;
371
376
// Checking for Object Combobox
372
- assertComboboxWithLabel ( 'target_id' ) ;
377
+ assertComboboxWithLabel ( objectInputFieldId ) ;
373
378
374
379
// Checking for Attribute/Value pairs
375
380
cy . contains ( 'h3' , 'Attribute/Value Pairs' ) . should ( 'exist' ) ;
376
381
// Checking for 5 attribute-value pairs text fields
377
- cy . get ( 'input# attribute_1') . should ( 'exist' ) ;
378
- cy . get ( 'input# value_1') . should ( 'exist' ) ;
379
- cy . get ( 'input# attribute_2') . should ( 'exist' ) ;
380
- cy . get ( 'input# value_2') . should ( 'exist' ) ;
381
- cy . get ( 'input# attribute_3') . should ( 'exist' ) ;
382
- cy . get ( 'input# value_3') . should ( 'exist' ) ;
383
- cy . get ( 'input# attribute_4') . should ( 'exist' ) ;
384
- cy . get ( 'input# value_4') . should ( 'exist' ) ;
385
- cy . get ( 'input# attribute_5') . should ( 'exist' ) ;
386
- cy . get ( 'input# value_5') . should ( 'exist' ) ;
382
+ cy . getFormInputFieldById ( ' attribute_1') . should ( 'exist' ) ;
383
+ cy . getFormInputFieldById ( ' value_1') . should ( 'exist' ) ;
384
+ cy . getFormInputFieldById ( ' attribute_2') . should ( 'exist' ) ;
385
+ cy . getFormInputFieldById ( ' value_2') . should ( 'exist' ) ;
386
+ cy . getFormInputFieldById ( ' attribute_3') . should ( 'exist' ) ;
387
+ cy . getFormInputFieldById ( ' value_3') . should ( 'exist' ) ;
388
+ cy . getFormInputFieldById ( ' attribute_4') . should ( 'exist' ) ;
389
+ cy . getFormInputFieldById ( ' value_4') . should ( 'exist' ) ;
390
+ cy . getFormInputFieldById ( ' attribute_5') . should ( 'exist' ) ;
391
+ cy . getFormInputFieldById ( ' value_5') . should ( 'exist' ) ;
387
392
388
393
/* ===== Selecting "Once" option from "Run" dropdown does not show the "Every" dropdown ===== */
389
394
390
- selectAndAssertDropdownValue ( 'timer_typ' , timerTypeOnce ) ;
395
+ selectAndAssertDropdownValue ( timerTypeSelectFieldId , timerTypeOnce ) ;
391
396
// Checking whether the Every dropdown is hidden
392
- cy . get ( 'input#timer_value' ) . should ( 'not.exist' ) ;
397
+ cy . getFormInputFieldById ( timerValueSelectFieldId ) . should ( 'not.exist' ) ;
393
398
394
399
/* ===== Selecting any other option other than "Once" from "Run" dropdown shows the "Every" dropdown ===== */
395
400
// Selecting "Hourly" to verify timer dropdown
@@ -421,8 +426,10 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
421
426
// Open edit schedule form
422
427
selectConfigMenu ( editScheduleConfigOption ) ;
423
428
// Editing name and description
424
- cy . get ( 'input#name' ) . clear ( ) . type ( editedScheduleName ) ;
425
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
429
+ cy . getFormInputFieldById ( nameInputFieldId ) . clear ( ) . type ( editedScheduleName ) ;
430
+ cy . getFormInputFieldById ( descriptionInputFieldId )
431
+ . clear ( )
432
+ . type ( editedDescription ) ;
426
433
// Confirms Save button is enabled after making edits
427
434
cy . getFormFooterButtonByType ( saveButton , 'submit' )
428
435
. should ( 'be.enabled' )
@@ -442,14 +449,24 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
442
449
// Open edit schedule form
443
450
selectConfigMenu ( editScheduleConfigOption ) ;
444
451
// Editing description and start date
445
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
446
- cy . get ( 'input#start_date' ) . clear ( ) . type ( editedStartDate ) ;
452
+ cy . getFormInputFieldById ( descriptionInputFieldId )
453
+ . clear ( )
454
+ . type ( editedDescription ) ;
455
+ cy . getFormInputFieldById ( startDateInputFieldId )
456
+ . clear ( )
457
+ . type ( editedStartDate ) ;
447
458
// Resetting
448
459
cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.enabled' ) . click ( ) ;
449
460
cy . expect_flash ( flashClassMap . warning , flashMessageResetSchedule ) ;
450
461
// Confirming the edited fields contain the old values after resetting
451
- cy . get ( 'input#description' ) . should ( 'have.value' , initialDescription ) ;
452
- cy . get ( 'input#start_date' ) . should ( 'have.value' , initialStartDate ) ;
462
+ cy . getFormInputFieldById ( descriptionInputFieldId ) . should (
463
+ 'have.value' ,
464
+ initialDescription
465
+ ) ;
466
+ cy . getFormInputFieldById ( startDateInputFieldId ) . should (
467
+ 'have.value' ,
468
+ initialStartDate
469
+ ) ;
453
470
454
471
/* ===== Checking whether Cancel button works ===== */
455
472
cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
0 commit comments