@@ -74,35 +74,36 @@ function addSchedule() {
74
74
// Open add schedule form
75
75
selectConfigMenu ( ADD_SCHEDULE_CONFIG_OPTION ) ;
76
76
// Checks if Save button is disabled initially
77
- cy . contains (
78
- '#main-content .bx--btn-set button[type="submit"]' ,
79
- saveButton
80
- ) . should ( 'be.disabled' ) ;
77
+ cy . getFormFooterButtonByType ( SAVE_BUTTON_TEXT , 'submit' ) . should (
78
+ 'be.disabled'
79
+ ) ;
81
80
// Adding data
82
- cy . get ( 'input#name' ) . type ( initialScheduleName ) ;
83
- cy . get ( 'input#description' ) . type ( initialDescription ) ;
84
- cy . get ( 'input[type="checkbox"]#enabled' ) . check ( { force : true } ) ;
81
+ cy . getFormInputFieldById ( 'name' ) . type ( INITIAL_SCHEDULE_NAME ) ;
82
+ cy . getFormInputFieldById ( 'description' ) . type ( INITIAL_DESCRIPTION ) ;
83
+ // Check "Active" checkbox using its associated label
84
+ cy . getFormLabelByInputId ( 'enabled' ) . click ( ) ;
85
85
// Select Action type option: 'VM Analysis'
86
- cy . get ( 'select# action_typ') . select ( actionTypeVmAnalysis ) ;
86
+ cy . getFormSelectFieldById ( ' action_typ') . select ( ACTION_TYPE_VM_ANALYSIS ) ;
87
87
// Select Filter type option: 'A Single VM'
88
- cy . get ( 'select# filter_typ') . select ( actionTypeVmAnalysis ) ;
88
+ cy . getFormSelectFieldById ( ' filter_typ') . select ( ACTION_TYPE_VM_ANALYSIS ) ;
89
89
// Select Run option: 'Hours'
90
- cy . get ( 'select# timer_typ') . select ( timerTypeHourly ) ;
90
+ cy . getFormSelectFieldById ( ' timer_typ') . select ( TIMER_TYPE_HOURLY ) ;
91
91
// Select Every option: '1 Hour'
92
- cy . get ( 'select# timer_value') . select ( frequencyTypeHour ) ;
92
+ cy . getFormSelectFieldById ( ' timer_value') . select ( FREQUENCY_TYPE_HOUR ) ;
93
93
// Select Time zone option: '(GMT-10:00) Hawaii'
94
- cy . get ( 'input[role="combobox"]# time_zone') . click ( ) ;
95
- cy . contains ( '[role="option"]' , timezoneTypeHawaii )
94
+ cy . getFormInputFieldById ( ' time_zone') . click ( ) ;
95
+ cy . contains ( '[role="option"]' , TIMEZONE_TYPE_HAWAII )
96
96
. should ( 'be.visible' )
97
97
. click ( ) ;
98
- cy . get ( 'input# start_date') . type ( initialStartDate ) ;
99
- cy . get ( 'input# start_time') . type ( startTime ) ;
98
+ cy . getFormInputFieldById ( ' start_date') . type ( INITIAL_START_DATE ) ;
99
+ cy . getFormInputFieldById ( ' start_time') . type ( START_TIME ) ;
100
100
// Intercepting the API call for adding a new schedule
101
101
cy . interceptApi ( {
102
102
alias : 'addScheduleApi' ,
103
103
urlPattern : '/ops/schedule_edit/new?button=save' ,
104
104
triggerFn : ( ) =>
105
- cy . contains ( '#main-content .bx--btn-set button[type="submit"]' , saveButton )
105
+ cy
106
+ . getFormFooterButtonByType ( SAVE_BUTTON_TEXT , 'submit' )
106
107
. should ( 'be.enabled' ) // Checks if Save button is enabled once all required fields are filled
107
108
. click ( ) ,
108
109
} ) ;
@@ -174,11 +175,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
174
175
cy . interceptApi ( {
175
176
alias : 'treeSelectApi' ,
176
177
urlPattern : / \/ o p s \/ t r e e _ s e l e c t \? i d = .* & t e x t = .* / ,
177
- triggerFn : ( ) =>
178
- cy . selectAccordionItem ( [
179
- MANAGEIQ_REGION_ACCORDION_ITEM ,
180
- SCHEDULES_ACCORDION_ITEM ,
181
- ] ) ,
178
+ triggerFn : ( ) => cy . accordionItem ( SCHEDULES_ACCORDION_ITEM ) ,
182
179
} ) ;
183
180
} ) ;
184
181
@@ -188,146 +185,139 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
188
185
189
186
/* ===== Selecting any option other than "Automation Tasks" from "Action" dropdown does not hide the Filter dropdown ===== */
190
187
191
- cy . get ( 'select#action_typ' ) . select ( actionTypeVmAnalysis ) ;
192
- cy . get ( 'select#action_typ' ) . should ( 'have.value' , actionTypeVmAnalysis ) ;
193
- // Checking for Filter type dropdown
194
- verifyFilterTypeDropdownExists ( ) ;
195
-
196
- cy . get ( 'select#action_typ' ) . select ( actionTypeTemplateAnalysis ) ;
197
- cy . get ( 'select#action_typ' ) . should (
198
- 'have.value' ,
199
- actionTypeTemplateAnalysis
188
+ // Selecting "Vm Analysis" to verify filter type dropdown
189
+ cy . getFormSelectFieldById ( 'action_typ' ) . select ( ACTION_TYPE_VM_ANALYSIS ) ;
190
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
191
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
192
+ // Selecting "Template Analysis" to verify filter type dropdown
193
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
194
+ ACTION_TYPE_TEMPLATE_ANALYSIS
200
195
) ;
201
- // Checking for Filter type dropdown
202
- verifyFilterTypeDropdownExists ( ) ;
203
-
204
- cy . get ( 'select#action_typ' ) . select ( actionTypeHostAnalysis ) ;
205
- cy . get ( 'select#action_typ' ) . should ( 'have.value' , actionTypeHostAnalysis ) ;
206
- // Checking for Filter type dropdown
207
- verifyFilterTypeDropdownExists ( ) ;
208
-
209
- cy . get ( 'select#action_typ' ) . select ( actionTypeContainerAnalysis ) ;
210
- cy . get ( 'select#action_typ' ) . should (
211
- 'have.value' ,
212
- actionTypeContainerAnalysis
196
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
197
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
198
+ // Selecting "Host Analysis" to verify filter type dropdown
199
+ cy . getFormSelectFieldById ( 'action_typ' ) . select ( ACTION_TYPE_HOST_ANALYSIS ) ;
200
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
201
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
202
+ // Selecting "Container Analysis" to verify filter type dropdown
203
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
204
+ ACTION_TYPE_CONTAINER_ANALYSIS
213
205
) ;
214
- // Checking for Filter type dropdown
215
- verifyFilterTypeDropdownExists ( ) ;
216
-
217
- cy . get ( 'select#action_typ' ) . select ( actionTypeClusterAnalysis ) ;
218
- cy . get ( 'select#action_typ' ) . should ( 'have.value' , actionTypeClusterAnalysis ) ;
219
- // Checking for Filter type dropdown
220
- verifyFilterTypeDropdownExists ( ) ;
221
-
222
- cy . get ( 'select#action_typ' ) . select ( actionTypeDataStoreAnalysis ) ;
223
- cy . get ( 'select#action_typ' ) . should (
224
- 'have.value' ,
225
- actionTypeDataStoreAnalysis
206
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
207
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
208
+ // Selecting "Cluster Analysis" to verify filter type dropdown
209
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
210
+ ACTION_TYPE_CLUSTER_ANALYSIS
226
211
) ;
227
- // Checking for Filter type dropdown
228
- verifyFilterTypeDropdownExists ( ) ;
229
-
230
- cy . get ( 'select#action_typ' ) . select ( actionTypeVmCompilanceCheck ) ;
231
- cy . get ( 'select#action_typ' ) . should (
232
- 'have.value' ,
233
- actionTypeVmCompilanceCheck
212
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
213
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
214
+ // Selecting "DataStore Analysis" to verify filter type dropdown
215
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
216
+ ACTION_TYPE_DATA_STORE_ANALYSIS
234
217
) ;
235
- // Checking for Filter type dropdown
236
- verifyFilterTypeDropdownExists ( ) ;
237
-
238
- cy . get ( 'select#action_typ' ) . select ( actionTypeHostCompilanceCheck ) ;
239
- cy . get ( 'select#action_typ' ) . should (
240
- 'have.value' ,
241
- actionTypeHostCompilanceCheck
218
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
219
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
220
+ // Selecting "Vm Compilance Check" to verify filter type dropdown
221
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
222
+ ACTION_TYPE_VM_COMPILANCE_CHECK
242
223
) ;
243
- // Checking for Filter type dropdown
244
- verifyFilterTypeDropdownExists ( ) ;
245
-
246
- cy . get ( 'select#action_typ' ) . select ( actionTypeContainerCompilanceCheck ) ;
247
- cy . get ( 'select#action_typ' ) . should (
248
- 'have.value' ,
249
- actionTypeContainerCompilanceCheck
224
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
225
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
226
+ // Selecting "Host Compilance Check" to verify filter type dropdown
227
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
228
+ ACTION_TYPE_HOST_COMPILANCE_CHECK
229
+ ) ;
230
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
231
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
232
+ // Selecting "Container Compilance Check" to verify filter type dropdown
233
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
234
+ ACTION_TYPE_CONTAINER_COMPILANCE_CHECK
250
235
) ;
251
- // Checking for Filter type dropdown
252
- verifyFilterTypeDropdownExists ( ) ;
236
+ cy . getFormLabelByInputId ( 'filter_typ' ) . should ( 'exist' ) ;
237
+ cy . getFormSelectFieldById ( 'filter_typ' ) . should ( 'exist' ) ;
253
238
254
239
/* ===== Selecting "Automation Tasks" option from "Action" dropdown shows Zone, Object details & Object fields ===== */
255
240
256
- cy . get ( 'select#action_typ' ) . select ( actionTypeAutomationTasks ) ;
257
- cy . get ( 'select#action_typ' ) . should ( 'have.value' , actionTypeAutomationTasks ) ;
241
+ cy . getFormSelectFieldById ( 'action_typ' ) . select (
242
+ ACTION_TYPE_AUTOMATION_TASKS
243
+ ) ;
244
+ cy . getFormSelectFieldById ( 'action_typ' ) . should (
245
+ 'have.value' ,
246
+ ACTION_TYPE_AUTOMATION_TASKS
247
+ ) ;
258
248
259
249
// Checking for Zone dropdown
260
- cy . get ( 'label[for=" zone_id"] ') . should ( 'exist' ) ;
261
- cy . get ( 'select# zone_id') . should ( 'exist' ) ;
250
+ cy . getFormLabelByInputId ( ' zone_id') . should ( 'exist' ) ;
251
+ cy . getFormSelectFieldById ( ' zone_id') . should ( 'exist' ) ;
262
252
263
253
// Checking for Object Details
264
254
cy . get ( 'h3[name="object_details"]' ) . should ( 'exist' ) ;
265
255
// Checking for System/Process dropdown
266
- cy . get ( 'label[for=" instance_name"] ') . should ( 'exist' ) ;
267
- cy . get ( 'select# instance_name') . should ( 'exist' ) ;
256
+ cy . getFormLabelByInputId ( ' instance_name') . should ( 'exist' ) ;
257
+ cy . getFormSelectFieldById ( ' instance_name') . should ( 'exist' ) ;
268
258
// Checking for Messsage textfield
269
- cy . get ( 'label[for=" message"] ') . should ( 'exist' ) ;
270
- cy . get ( 'input# message') . should ( 'exist' ) ;
259
+ cy . getFormLabelByInputId ( ' message') . should ( 'exist' ) ;
260
+ cy . getFormInputFieldById ( ' message') . should ( 'exist' ) ;
271
261
// Checking for Request textfield
272
- cy . get ( 'label[for=" request"] ') . should ( 'exist' ) ;
273
- cy . get ( 'input# request') . should ( 'exist' ) ;
262
+ cy . getFormLabelByInputId ( ' request') . should ( 'exist' ) ;
263
+ cy . getFormInputFieldById ( ' request') . should ( 'exist' ) ;
274
264
275
265
// Checking for Object
276
266
cy . get ( 'h3[name="object_attributes"]' ) . should ( 'exist' ) ;
277
267
// Checking for Type Combobox
278
- cy . get ( 'label[for=" target_class"] ') . should ( 'exist' ) ;
279
- cy . get ( 'input[role="combobox"]# target_class') . should ( 'exist' ) ;
268
+ cy . getFormLabelByInputId ( ' target_class') . should ( 'exist' ) ;
269
+ cy . getFormInputFieldById ( ' target_class') . should ( 'exist' ) ;
280
270
// Checking for Object Combobox
281
- cy . get ( 'label[for=" target_id"] ') . should ( 'exist' ) ;
282
- cy . get ( 'input[role="combobox"]# target_id') . should ( 'exist' ) ;
271
+ cy . getFormLabelByInputId ( ' target_id') . should ( 'exist' ) ;
272
+ cy . getFormInputFieldById ( ' target_id') . should ( 'exist' ) ;
283
273
284
274
// Checking for Attribute/Value pairs
285
275
cy . contains ( 'h3' , 'Attribute/Value Pairs' ) . should ( 'exist' ) ;
286
276
// Checking for 5 attribute-value pairs text fields
287
- cy . get ( 'input# attribute_1') . should ( 'exist' ) ;
288
- cy . get ( 'input# value_1') . should ( 'exist' ) ;
289
- cy . get ( 'input# attribute_2') . should ( 'exist' ) ;
290
- cy . get ( 'input# value_2') . should ( 'exist' ) ;
291
- cy . get ( 'input# attribute_3') . should ( 'exist' ) ;
292
- cy . get ( 'input# value_3') . should ( 'exist' ) ;
293
- cy . get ( 'input# attribute_4') . should ( 'exist' ) ;
294
- cy . get ( 'input# value_4') . should ( 'exist' ) ;
295
- cy . get ( 'input# attribute_5') . should ( 'exist' ) ;
296
- cy . get ( 'input# value_5') . should ( 'exist' ) ;
277
+ cy . getFormInputFieldById ( ' attribute_1') . should ( 'exist' ) ;
278
+ cy . getFormInputFieldById ( ' value_1') . should ( 'exist' ) ;
279
+ cy . getFormInputFieldById ( ' attribute_2') . should ( 'exist' ) ;
280
+ cy . getFormInputFieldById ( ' value_2') . should ( 'exist' ) ;
281
+ cy . getFormInputFieldById ( ' attribute_3') . should ( 'exist' ) ;
282
+ cy . getFormInputFieldById ( ' value_3') . should ( 'exist' ) ;
283
+ cy . getFormInputFieldById ( ' attribute_4') . should ( 'exist' ) ;
284
+ cy . getFormInputFieldById ( ' value_4') . should ( 'exist' ) ;
285
+ cy . getFormInputFieldById ( ' attribute_5') . should ( 'exist' ) ;
286
+ cy . getFormInputFieldById ( ' value_5') . should ( 'exist' ) ;
297
287
298
288
/* ===== Selecting "Once" option from "Run" dropdown does not show the "Every" dropdown ===== */
299
-
300
- cy . get ( 'select#timer_typ' ) . select ( timerTypeOnce ) ;
289
+ cy . getFormSelectFieldById ( 'timer_typ' ) . select ( TIMER_TYPE_ONCE ) ;
290
+ cy . getFormSelectFieldById ( 'timer_typ' ) . should (
291
+ 'have.value' ,
292
+ TIMER_TYPE_ONCE
293
+ ) ;
301
294
// Checking whether the Every dropdown is hidden
302
- cy . get ( 'input# timer_value') . should ( 'not.exist' ) ;
295
+ cy . getFormInputFieldById ( ' timer_value') . should ( 'not.exist' ) ;
303
296
304
297
/* ===== Selecting any other option other than "Once" from "Run" dropdown shows the "Every" dropdown ===== */
305
-
306
- cy . get ( 'select# timer_typ') . select ( timerTypeHourly ) ;
307
- // Checking whether the "Every" dropdown exist
308
- verifyTimerDropdownExists ( ) ;
309
-
310
- cy . get ( 'select# timer_typ') . select ( timerTypeDaily ) ;
311
- // Checking whether the "Every" dropdown exist
312
- verifyTimerDropdownExists ( ) ;
313
-
314
- cy . get ( 'select# timer_typ') . select ( timerTypeWeekly ) ;
315
- // Checking whether the "Every" dropdown exist
316
- verifyTimerDropdownExists ( ) ;
317
-
318
- cy . get ( 'select# timer_typ') . select ( timerTypeMonthly ) ;
319
- // Checking whether the "Every" dropdown exist
320
- verifyTimerDropdownExists ( ) ;
298
+ // Selecting "Hourly" to verify timer dropdown
299
+ cy . getFormSelectFieldById ( ' timer_typ') . select ( TIMER_TYPE_HOURLY ) ;
300
+ cy . getFormLabelByInputId ( 'timer_value' ) . should ( ' exist' ) ;
301
+ cy . getFormSelectFieldById ( 'timer_value' ) . should ( 'exist' ) ;
302
+ // Selecting "Daily" to verify timer dropdown
303
+ cy . getFormSelectFieldById ( ' timer_typ') . select ( TIMER_TYPE_DAILY ) ;
304
+ cy . getFormLabelByInputId ( 'timer_value' ) . should ( ' exist' ) ;
305
+ cy . getFormSelectFieldById ( 'timer_value' ) . should ( 'exist' ) ;
306
+ // Selecting "Weekly" to verify timer dropdown
307
+ cy . getFormSelectFieldById ( ' timer_typ') . select ( TIMER_TYPE_WEEKLY ) ;
308
+ cy . getFormLabelByInputId ( 'timer_value' ) . should ( ' exist' ) ;
309
+ cy . getFormSelectFieldById ( 'timer_value' ) . should ( 'exist' ) ;
310
+ // Selecting "Monthly" to verify timer dropdown
311
+ cy . getFormSelectFieldById ( ' timer_typ') . select ( TIMER_TYPE_MONTHLY ) ;
312
+ cy . getFormLabelByInputId ( 'timer_value' ) . should ( ' exist' ) ;
313
+ cy . getFormSelectFieldById ( 'timer_value' ) . should ( 'exist' ) ;
321
314
} ) ;
322
315
323
316
it ( 'Checking whether Cancel button works on the Add form' , ( ) => {
324
317
// Open add schedule form
325
318
selectConfigMenu ( ADD_SCHEDULE_CONFIG_OPTION ) ;
326
319
// Cancel the form
327
- cy . contains (
328
- '#main-content .bx--btn-set button[type="button"]' ,
329
- cancelButton
330
- )
320
+ cy . getFormFooterButtonByType ( CANCEL_BUTTON_TEXT )
331
321
. should ( 'be.enabled' )
332
322
. click ( ) ;
333
323
cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_OPERATION_CANCELED ) ;
@@ -344,10 +334,10 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
344
334
// Open edit schedule form
345
335
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
346
336
// Editing name and description
347
- cy . get ( 'input# name') . clear ( ) . type ( editedScheduleName ) ;
348
- cy . get ( 'input# description') . clear ( ) . type ( editedDescription ) ;
337
+ cy . getFormInputFieldById ( ' name') . clear ( ) . type ( EDITED_SCHEDULE_NAME ) ;
338
+ cy . getFormInputFieldById ( ' description') . clear ( ) . type ( EDITED_DESCRIPTION ) ;
349
339
// Confirms Save button is enabled after making edits
350
- cy . contains ( '#main-content .bx--btn-set button[type=" submit"]' , saveButton )
340
+ cy . getFormFooterButtonByType ( SAVE_BUTTON_TEXT , ' submit' )
351
341
. should ( 'be.enabled' )
352
342
. click ( ) ;
353
343
cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_SCHEDULE_SAVED ) ;
@@ -365,18 +355,25 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
365
355
// Open edit schedule form
366
356
selectConfigMenu ( EDIT_SCHEDULE_CONFIG_OPTION ) ;
367
357
// Editing description and start date
368
- cy . get ( 'input#description' ) . clear ( ) . type ( editedDescription ) ;
369
- cy . get ( 'input#start_date' ) . clear ( ) . type ( editedStartDate ) ;
370
- cy . contains ( '#main-content .bx--btn-set button[type="button"]' , resetButton )
358
+ cy . getFormInputFieldById ( 'description' ) . clear ( ) . type ( EDITED_DESCRIPTION ) ;
359
+ cy . getFormInputFieldById ( 'start_date' ) . clear ( ) . type ( EDITED_START_DATE ) ;
360
+ // Resetting
361
+ cy . getFormFooterButtonByType ( RESET_BUTTON_TEXT )
371
362
. should ( 'be.enabled' )
372
363
. click ( ) ;
373
364
cy . expect_flash ( flashClassMap . warning , FLASH_MESSAGE_RESET_SCHEDULE ) ;
374
365
// Confirming the edited fields contain the old values after resetting
375
- cy . get ( 'input#description' ) . should ( 'have.value' , initialDescription ) ;
376
- cy . get ( 'input#start_date' ) . should ( 'have.value' , initialStartDate ) ;
366
+ cy . getFormInputFieldById ( 'description' ) . should (
367
+ 'have.value' ,
368
+ INITIAL_DESCRIPTION
369
+ ) ;
370
+ cy . getFormInputFieldById ( 'start_date' ) . should (
371
+ 'have.value' ,
372
+ INITIAL_START_DATE
373
+ ) ;
377
374
378
375
/* ===== Checking whether Cancel button works ===== */
379
- cy . contains ( '#main-content .bx--btn-set button[type="button"]' , CANCEL_BUTTON_TEXT )
376
+ cy . getFormFooterButtonByType ( CANCEL_BUTTON_TEXT )
380
377
. should ( 'be.enabled' )
381
378
. click ( ) ;
382
379
cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_OPERATION_CANCELED ) ;
0 commit comments