@@ -71,44 +71,42 @@ function interceptAndAwaitApi({
71
71
cy . wait ( `@${ alias } ` ) ;
72
72
}
73
73
74
- function invokeAndAwaitRegionInfo ( {
75
- currentApiIntercepts,
76
- } ) {
74
+ function invokeAndAwaitRegionInfo ( { currentApiIntercepts } ) {
77
75
interceptAndAwaitApi ( {
78
76
alias : 'getRegionInfo' ,
79
77
urlPattern : / o p s \/ t r e e _ s e l e c t \? i d = .* & t e x t = .* M a n a g e I Q .* R e g i o n .* R e g i o n .* / ,
80
78
triggerFn : ( ) =>
81
- cy . accordionItem ( 'ManageIQ Region:' , true , 'diagnostics_accord' ) ,
79
+ cy . accordionItem (
80
+ manageIQRegionAccordItem ,
81
+ true ,
82
+ diagnosticsAccordionItemId
83
+ ) ,
82
84
currentApiIntercepts,
83
85
} ) ;
84
86
}
85
87
86
- function invokeAndAwaitZoneDefaultInfo ( {
87
- currentApiIntercepts,
88
- } ) {
88
+ function invokeAndAwaitZoneDefaultInfo ( { currentApiIntercepts } ) {
89
89
interceptAndAwaitApi ( {
90
90
alias : 'getZoneDefaultInfo' ,
91
91
urlPattern :
92
92
/ o p s \/ t r e e _ s e l e c t \? i d = .* & t e x t = .* Z o n e .* D e f a u l t .* Z o n e .* ( c u r r e n t ) .* / ,
93
- triggerFn : ( ) => cy . accordionItem ( 'Zone:' , true , 'diagnostics_accord' ) ,
93
+ triggerFn : ( ) =>
94
+ cy . accordionItem ( zoneAccordItem , true , diagnosticsAccordionItemId ) ,
94
95
currentApiIntercepts,
95
96
} ) ;
96
97
}
97
98
98
- function invokeAndAwaitServerInfo ( {
99
- currentApiIntercepts,
100
- } ) {
99
+ function invokeAndAwaitServerInfo ( { currentApiIntercepts } ) {
101
100
interceptAndAwaitApi ( {
102
101
alias : 'getServerInfo' ,
103
102
urlPattern : / o p s \/ t r e e _ s e l e c t \? i d = .* & t e x t = .* S e r v e r .* E V M .* ( c u r r e n t ) .* / ,
104
- triggerFn : ( ) => cy . accordionItem ( 'Server:' , true , 'diagnostics_accord' ) ,
103
+ triggerFn : ( ) =>
104
+ cy . accordionItem ( serverAccordItem , true , diagnosticsAccordionItemId ) ,
105
105
currentApiIntercepts,
106
106
} ) ;
107
107
}
108
108
109
- function invokeAndAwaitCollectLogsTabInfo ( {
110
- currentApiIntercepts,
111
- } ) {
109
+ function invokeAndAwaitCollectLogsTabInfo ( { currentApiIntercepts } ) {
112
110
interceptAndAwaitApi ( {
113
111
alias : 'getCollectLogsTabInfo' ,
114
112
urlPattern : '/ops/change_tab?tab_id=diagnostics_collect_logs' ,
@@ -122,9 +120,7 @@ function invokeAndAwaitCollectLogsTabInfo({
122
120
} ) ;
123
121
}
124
122
125
- function invokeAndAwaitEditEventForServer ( {
126
- currentApiIntercepts,
127
- } ) {
123
+ function invokeAndAwaitEditEventForServer ( { currentApiIntercepts } ) {
128
124
interceptAndAwaitApi ( {
129
125
alias : 'editEventForServer' ,
130
126
urlPattern : / \/ o p s \/ x _ b u t t o n \/ [ ^ / ] + \? p r e s s e d = .* l o g _ d e p o t _ e d i t / , // matches both /ops/x_button/1?pressed=log_depot_edit & /ops/x_button/2?pressed=zone_log_depot_edit endpoints
@@ -164,10 +160,10 @@ function resetProtocolDropdown({
164
160
( $select ) => {
165
161
const currentValue = $select . val ( ) ;
166
162
// If the value is not default one(BLANK_VALUE), then setting it to blank
167
- if ( currentValue !== 'BLANK_VALUE' ) {
168
- cy . wrap ( $select ) . select ( 'BLANK_VALUE' ) ;
163
+ if ( currentValue !== dropdownBlankValue ) {
164
+ cy . wrap ( $select ) . select ( dropdownBlankValue ) ;
169
165
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
170
- . contains ( 'Save' )
166
+ . contains ( saveButton )
171
167
. click ( ) ;
172
168
cy . get ( '#main_div #flash_msg_div .alert-success' ) . contains (
173
169
'Log Depot Settings were saved'
@@ -180,7 +176,7 @@ function resetProtocolDropdown({
180
176
function cancelButtonValidation ( ) {
181
177
// Click cancel button in the form
182
178
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
183
- . contains ( 'Cancel' )
179
+ . contains ( cancelButton )
184
180
. should ( 'be.enabled' )
185
181
. click ( ) ;
186
182
// Validating confirmation alert text displayed
@@ -192,36 +188,36 @@ function cancelButtonValidation() {
192
188
function resetButtonValidation ( ) {
193
189
// Confirm Reset button is disabled initially
194
190
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
195
- . contains ( 'Reset' )
191
+ . contains ( resetButton )
196
192
. should ( 'be.disabled' ) ;
197
193
// Selecting Samba option from dropdown
198
194
cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . select (
199
- 'FileDepotSmb'
195
+ sambaDropdownValue
200
196
) ;
201
197
// Confirm Reset button is enabled once dropdown value is changed and then click on Reset
202
198
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
203
- . contains ( 'Reset' )
199
+ . contains ( resetButton )
204
200
. should ( 'be.enabled' )
205
201
. click ( ) ;
206
202
// Confirm dropdown has the old value
207
203
cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . should (
208
204
'have.value' ,
209
- 'BLANK_VALUE'
205
+ dropdownBlankValue
210
206
) ;
211
207
}
212
208
213
209
function saveButtonValidation ( ) {
214
210
// Confirm Save button is disabled initially
215
211
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
216
- . contains ( 'Save' )
212
+ . contains ( saveButton )
217
213
. should ( 'be.disabled' ) ;
218
214
// Selecting Samba option from dropdown
219
215
cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . select (
220
- 'FileDepotSmb'
216
+ sambaDropdownValue
221
217
) ;
222
218
// Confirm Save button is enabled once dropdown value is changed and then click on Save
223
219
cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
224
- . contains ( 'Save' )
220
+ . contains ( saveButton )
225
221
. should ( 'be.enabled' )
226
222
. click ( ) ;
227
223
// Validating confirmation alert text displayed
@@ -287,13 +283,13 @@ describe('Automate Collect logs Edit form operations', () => {
287
283
after ( ( ) => {
288
284
cy ?. url ( ) ?. then ( ( url ) => {
289
285
// Ensures navigation to Settings -> Application-Settings in the UI
290
- if ( url ?. includes ( '/ops/explorer' ) ) {
286
+ if ( url ?. includes ( componentRouteUrl ) ) {
291
287
resetProtocolDropdown ( {
292
288
currentApiIntercepts : registeredApiIntercepts ,
293
289
} ) ;
294
290
} else {
295
291
// Navigate to Settings -> Application-Settings before selecting Diagnostics
296
- cy . menu ( 'Settings' , 'Application Settings' ) ;
292
+ cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
297
293
resetProtocolDropdown ( {
298
294
currentApiIntercepts : registeredApiIntercepts ,
299
295
} ) ;
@@ -333,14 +329,14 @@ describe('Automate Collect logs Edit form operations', () => {
333
329
after ( ( ) => {
334
330
cy ?. url ( ) ?. then ( ( url ) => {
335
331
// Ensures navigation to Settings -> Application-Settings in the UI
336
- if ( url ?. includes ( '/ops/explorer' ) ) {
332
+ if ( url ?. includes ( componentRouteUrl ) ) {
337
333
resetProtocolDropdown ( {
338
334
currentApiIntercepts : registeredApiIntercepts ,
339
335
needsServerInfoFetch : false ,
340
336
} ) ;
341
337
} else {
342
338
// Navigate to Settings -> Application-Settings before selecting Diagnostics
343
- cy . menu ( 'Settings' , 'Application Settings' ) ;
339
+ cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
344
340
resetProtocolDropdown ( {
345
341
currentApiIntercepts : registeredApiIntercepts ,
346
342
needsServerInfoFetch : false ,
0 commit comments