@@ -71,44 +71,42 @@ function interceptAndAwaitApi({
7171 cy . wait ( `@${ alias } ` ) ;
7272}
7373
74- function invokeAndAwaitRegionInfo ( {
75- currentApiIntercepts,
76- } ) {
74+ function invokeAndAwaitRegionInfo ( { currentApiIntercepts } ) {
7775 interceptAndAwaitApi ( {
7876 alias : 'getRegionInfo' ,
7977 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 .* / ,
8078 triggerFn : ( ) =>
81- cy . accordionItem ( 'ManageIQ Region:' , true , 'diagnostics_accord' ) ,
79+ cy . accordionItem (
80+ manageIQRegionAccordItem ,
81+ true ,
82+ diagnosticsAccordionItemId
83+ ) ,
8284 currentApiIntercepts,
8385 } ) ;
8486}
8587
86- function invokeAndAwaitZoneDefaultInfo ( {
87- currentApiIntercepts,
88- } ) {
88+ function invokeAndAwaitZoneDefaultInfo ( { currentApiIntercepts } ) {
8989 interceptAndAwaitApi ( {
9090 alias : 'getZoneDefaultInfo' ,
9191 urlPattern :
9292 / 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 ) ,
9495 currentApiIntercepts,
9596 } ) ;
9697}
9798
98- function invokeAndAwaitServerInfo ( {
99- currentApiIntercepts,
100- } ) {
99+ function invokeAndAwaitServerInfo ( { currentApiIntercepts } ) {
101100 interceptAndAwaitApi ( {
102101 alias : 'getServerInfo' ,
103102 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 ) ,
105105 currentApiIntercepts,
106106 } ) ;
107107}
108108
109- function invokeAndAwaitCollectLogsTabInfo ( {
110- currentApiIntercepts,
111- } ) {
109+ function invokeAndAwaitCollectLogsTabInfo ( { currentApiIntercepts } ) {
112110 interceptAndAwaitApi ( {
113111 alias : 'getCollectLogsTabInfo' ,
114112 urlPattern : '/ops/change_tab?tab_id=diagnostics_collect_logs' ,
@@ -122,9 +120,7 @@ function invokeAndAwaitCollectLogsTabInfo({
122120 } ) ;
123121}
124122
125- function invokeAndAwaitEditEventForServer ( {
126- currentApiIntercepts,
127- } ) {
123+ function invokeAndAwaitEditEventForServer ( { currentApiIntercepts } ) {
128124 interceptAndAwaitApi ( {
129125 alias : 'editEventForServer' ,
130126 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({
164160 ( $select ) => {
165161 const currentValue = $select . val ( ) ;
166162 // 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 ) ;
169165 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
170- . contains ( 'Save' )
166+ . contains ( saveButton )
171167 . click ( ) ;
172168 cy . get ( '#main_div #flash_msg_div .alert-success' ) . contains (
173169 'Log Depot Settings were saved'
@@ -180,7 +176,7 @@ function resetProtocolDropdown({
180176function cancelButtonValidation ( ) {
181177 // Click cancel button in the form
182178 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
183- . contains ( 'Cancel' )
179+ . contains ( cancelButton )
184180 . should ( 'be.enabled' )
185181 . click ( ) ;
186182 // Validating confirmation alert text displayed
@@ -192,36 +188,36 @@ function cancelButtonValidation() {
192188function resetButtonValidation ( ) {
193189 // Confirm Reset button is disabled initially
194190 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
195- . contains ( 'Reset' )
191+ . contains ( resetButton )
196192 . should ( 'be.disabled' ) ;
197193 // Selecting Samba option from dropdown
198194 cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . select (
199- 'FileDepotSmb'
195+ sambaDropdownValue
200196 ) ;
201197 // Confirm Reset button is enabled once dropdown value is changed and then click on Reset
202198 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="button"]' )
203- . contains ( 'Reset' )
199+ . contains ( resetButton )
204200 . should ( 'be.enabled' )
205201 . click ( ) ;
206202 // Confirm dropdown has the old value
207203 cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . should (
208204 'have.value' ,
209- 'BLANK_VALUE'
205+ dropdownBlankValue
210206 ) ;
211207}
212208
213209function saveButtonValidation ( ) {
214210 // Confirm Save button is disabled initially
215211 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
216- . contains ( 'Save' )
212+ . contains ( saveButton )
217213 . should ( 'be.disabled' ) ;
218214 // Selecting Samba option from dropdown
219215 cy . get ( '#log-depot-settings .bx--select select#log_protocol' ) . select (
220- 'FileDepotSmb'
216+ sambaDropdownValue
221217 ) ;
222218 // Confirm Save button is enabled once dropdown value is changed and then click on Save
223219 cy . get ( '#diagnostics_collect_logs .bx--btn-set button[type="Submit"]' )
224- . contains ( 'Save' )
220+ . contains ( saveButton )
225221 . should ( 'be.enabled' )
226222 . click ( ) ;
227223 // Validating confirmation alert text displayed
@@ -287,13 +283,13 @@ describe('Automate Collect logs Edit form operations', () => {
287283 after ( ( ) => {
288284 cy ?. url ( ) ?. then ( ( url ) => {
289285 // Ensures navigation to Settings -> Application-Settings in the UI
290- if ( url ?. includes ( '/ops/explorer' ) ) {
286+ if ( url ?. includes ( componentRouteUrl ) ) {
291287 resetProtocolDropdown ( {
292288 currentApiIntercepts : registeredApiIntercepts ,
293289 } ) ;
294290 } else {
295291 // Navigate to Settings -> Application-Settings before selecting Diagnostics
296- cy . menu ( 'Settings' , 'Application Settings' ) ;
292+ cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
297293 resetProtocolDropdown ( {
298294 currentApiIntercepts : registeredApiIntercepts ,
299295 } ) ;
@@ -333,14 +329,14 @@ describe('Automate Collect logs Edit form operations', () => {
333329 after ( ( ) => {
334330 cy ?. url ( ) ?. then ( ( url ) => {
335331 // Ensures navigation to Settings -> Application-Settings in the UI
336- if ( url ?. includes ( '/ops/explorer' ) ) {
332+ if ( url ?. includes ( componentRouteUrl ) ) {
337333 resetProtocolDropdown ( {
338334 currentApiIntercepts : registeredApiIntercepts ,
339335 needsServerInfoFetch : false ,
340336 } ) ;
341337 } else {
342338 // Navigate to Settings -> Application-Settings before selecting Diagnostics
343- cy . menu ( 'Settings' , 'Application Settings' ) ;
339+ cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
344340 resetProtocolDropdown ( {
345341 currentApiIntercepts : registeredApiIntercepts ,
346342 needsServerInfoFetch : false ,
0 commit comments