@@ -18,14 +18,7 @@ describe('Settings > Application Settings Tests', () => {
1818 it ( 'Correctly loads admin user' , ( ) => {
1919 // Navigate to user list and click on Administrator user in table
2020 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
21- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
22- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
23- nums . forEach ( ( index ) => {
24- if ( rows [ index ] . children [ 1 ] . textContent === 'Administrator' ) {
25- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
26- }
27- } ) ;
28- } ) ;
21+ cy . selectAccordionItem ( [ 'Users' , 'Administrator' ] ) ;
2922
3023 // Check Administrator user values on summary page
3124 cy . get ( '#accordion-item-15 > .bx--structured-list > .bx--structured-list-tbody > :nth-child(1) > .label_header' ) . contains ( 'ID' ) ;
@@ -78,14 +71,7 @@ describe('Settings > Application Settings Tests', () => {
7871 it ( 'Edit admin user' , ( ) => {
7972 // Navigate to user list and click on Administrator user in table
8073 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
81- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
82- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
83- nums . forEach ( ( index ) => {
84- if ( rows [ index ] . children [ 1 ] . textContent === 'Administrator' ) {
85- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
86- }
87- } ) ;
88- } ) ;
74+ cy . selectAccordionItem ( [ 'Users' , 'Administrator' ] ) ;
8975
9076 // Click edit button
9177 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -135,15 +121,7 @@ describe('Settings > Application Settings Tests', () => {
135121 } ) ;
136122 cy . get ( '.bx--btn-set > .bx--btn--primary' ) . click ( ) ; // Click the add button
137123
138- // Find the new user in the table and click it
139- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
140- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
141- nums . forEach ( ( index ) => {
142- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Add' ) {
143- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
144- }
145- } ) ;
146- } ) ;
124+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Add' ] ) ;
147125
148126 // Verify that the new user was created with the correct values on the summary page
149127 cy . get ( ':nth-child(1) > .label_header' ) . contains ( 'ID' ) ;
@@ -180,15 +158,7 @@ describe('Settings > Application Settings Tests', () => {
180158 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
181159 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
182160
183- // Find the new user in the table and click on that row
184- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
185- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
186- nums . forEach ( ( index ) => {
187- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Add' ) {
188- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
189- }
190- } ) ;
191- } ) ;
161+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Add' ] ) ;
192162
193163 // Click the edit user button
194164 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -256,15 +226,7 @@ describe('Settings > Application Settings Tests', () => {
256226 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
257227 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
258228
259- // Find the editted user in the table and click it
260- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
261- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
262- nums . forEach ( ( index ) => {
263- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Edit' ) {
264- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
265- }
266- } ) ;
267- } ) ;
229+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Edit' ] ) ;
268230
269231 // Click the delete user button
270232 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -312,15 +274,7 @@ describe('Settings > Application Settings Tests', () => {
312274 } ) ;
313275 cy . get ( '.bx--btn-set > .bx--btn--primary' ) . click ( ) ; // Click the add button
314276
315- // Find the new user in the table and click it
316- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
317- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
318- nums . forEach ( ( index ) => {
319- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Add 2' ) {
320- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
321- }
322- } ) ;
323- } ) ;
277+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Add 2' ] ) ;
324278
325279 // Click copy user button
326280 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -410,15 +364,7 @@ describe('Settings > Application Settings Tests', () => {
410364 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
411365 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
412366
413- // Find the copied user in the table and click it
414- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
415- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
416- nums . forEach ( ( index ) => {
417- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Copy' ) {
418- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
419- }
420- } ) ;
421- } ) ;
367+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Copy' ] ) ;
422368
423369 // Verify that the copied user was created with the correct values on the summary page
424370 cy . get ( ':nth-child(1) > .label_header' ) . contains ( 'ID' ) ;
@@ -443,15 +389,7 @@ describe('Settings > Application Settings Tests', () => {
443389 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
444390 cy . get ( ':nth-child(3) > .bx--overflow-menu-options__btn' ) . click ( ) ;
445391
446- // Find the new user in the table and click it
447- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
448- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
449- nums . forEach ( ( index ) => {
450- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Add 2' ) {
451- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
452- }
453- } ) ;
454- } ) ;
392+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Add 2' ] ) ;
455393
456394 // Verify that the new user was created with the correct values on the summary page
457395 cy . get ( ':nth-child(1) > .label_header' ) . contains ( 'ID' ) ;
@@ -529,15 +467,7 @@ describe('Settings > Application Settings Tests', () => {
529467 cy . get ( '.bx--btn-set > .bx--btn--primary' ) . should ( 'be.enabled' ) ;
530468 cy . get ( '.bx--btn-set > .bx--btn--primary' ) . click ( ) ;
531469
532- // Find the new user in the table and click it
533- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
534- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
535- nums . forEach ( ( index ) => {
536- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Validation' ) {
537- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
538- }
539- } ) ;
540- } ) ;
470+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Validation' ] ) ;
541471
542472 // Verify that the new user was created with the correct values on the summary page
543473 cy . get ( ':nth-child(1) > .label_header' ) . contains ( 'ID' ) ;
@@ -576,15 +506,7 @@ describe('Settings > Application Settings Tests', () => {
576506 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
577507 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
578508
579- // Find the new user in the table and click on that row
580- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
581- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
582- nums . forEach ( ( index ) => {
583- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Validation' ) {
584- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
585- }
586- } ) ;
587- } ) ;
509+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Validation' ] ) ;
588510
589511 // Click the edit user button
590512 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -656,15 +578,7 @@ describe('Settings > Application Settings Tests', () => {
656578 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
657579 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
658580
659- // Find the editted user in the table and click it
660- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
661- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
662- nums . forEach ( ( index ) => {
663- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Validation Edit' ) {
664- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
665- }
666- } ) ;
667- } ) ;
581+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Validation Edit' ] ) ;
668582
669583 // Click the edit user button
670584 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
@@ -716,15 +630,7 @@ describe('Settings > Application Settings Tests', () => {
716630 cy . wait ( '@accordion' ) ; // Wait for explorer screen to load
717631 cy . get ( '[title="View Users"] > .content_value' ) . click ( { force : true } ) ;
718632
719- // Find the editted user in the table and click it
720- cy . get ( '.clickable-row' ) . then ( ( rows ) => {
721- const nums = [ ...Array ( rows . length ) . keys ( ) ] ;
722- nums . forEach ( ( index ) => {
723- if ( rows [ index ] . children [ 1 ] . textContent === 'Cypress Test Validation Edit' ) {
724- cy . get ( rows [ index ] . children [ 1 ] ) . click ( { force : true } ) ;
725- }
726- } ) ;
727- } ) ;
633+ cy . selectAccordionItem ( [ 'Users' , 'Cypress Test Validation Edit' ] ) ;
728634
729635 // Click the delete user button
730636 cy . get ( '#user_vmdb_choice' ) . click ( ) ;
0 commit comments