@@ -42,6 +42,29 @@ describe('Automation > Embedded Automate > Customization > Buttons', () => {
4242 cy . get ( '#object_request' ) . scrollIntoView ( ) ;
4343 cy . get ( '#object_request' ) . type ( 'test_request' ) ;
4444
45+ // Scroll to role access section and select "<By Role>" from dropdown
46+ cy . get ( '#form_role_visibility button[data-id="visibility_typ"]' ) . scrollIntoView ( ) ;
47+ cy . get ( '#form_role_visibility button[data-id="visibility_typ"]' ) . click ( ) ;
48+ cy . get ( '#form_role_visibility .dropdown-menu [data-original-index="1"] > a' ) . click ( ) ;
49+
50+ // Scroll to User Roles section to make roles visible
51+ cy . contains ( 'User Roles' ) . scrollIntoView ( ) ;
52+
53+ // Check EvmRole-auditor and EvmRole-desktop
54+ cy . interceptApi ( {
55+ alias : 'checkAuditorRole' ,
56+ urlPattern : '/miq_ae_customization/automate_button_field_changed' ,
57+ triggerFn : ( ) => cy . get ( '#form_role_visibility' ) . contains ( 'EvmRole-auditor' ) . closest ( 'td' ) . find ( 'input[type="checkbox"]' ) . check ( ) ,
58+ waitOnlyIfRequestIntercepted : true ,
59+ } ) ;
60+
61+ cy . interceptApi ( {
62+ alias : 'checkDesktopRole' ,
63+ urlPattern : '/miq_ae_customization/automate_button_field_changed' ,
64+ triggerFn : ( ) => cy . get ( '#form_role_visibility' ) . contains ( 'EvmRole-desktop' ) . closest ( 'td' ) . find ( 'input[type="checkbox"]' ) . check ( ) ,
65+ waitOnlyIfRequestIntercepted : true ,
66+ } ) ;
67+
4568 // Click Add button
4669 cy . get ( '#buttons_on > .btn-primary' ) . click ( ) ;
4770
@@ -51,10 +74,12 @@ describe('Automation > Embedded Automate > Customization > Buttons', () => {
5174 // Verify the button was added successfully by clicking it in the accordion
5275 cy . get ( '.clickable-row' ) . contains ( 'Test Availability Zone Button' ) . click ( ) ;
5376
54- // Verify the name, description, and request are displayed correctly in the main div
77+ // Verify the name, description, request, and roles are displayed correctly in the main div
5578 cy . get ( '#main_div' ) . contains ( 'Test Availability Zone Button' ) ;
5679 cy . get ( '#main_div' ) . contains ( 'Test button for availability zone' ) ;
5780 cy . get ( '#main_div' ) . contains ( 'test_request' ) ;
81+ cy . get ( '.visibility' ) . contains ( 'EvmRole-auditor' ) ;
82+ cy . get ( '.visibility' ) . contains ( 'EvmRole-desktop' ) ;
5883 } ) ;
5984 } ) ;
6085} ) ;
0 commit comments