|
| 1 | +/* eslint-disable no-undef */ |
| 2 | +import { flashClassMap } from '../../../../support/assertions/assertion_constants'; |
| 3 | + |
| 4 | +describe('Automation > Embedded Automate > Customization > Buttons', () => { |
| 5 | + beforeEach(() => { |
| 6 | + cy.login(); |
| 7 | + cy.menu('Automation', 'Embedded Automate', 'Customization'); |
| 8 | + cy.get('#explorer_title_text'); |
| 9 | + |
| 10 | + // Navigate to Buttons accordion |
| 11 | + cy.accordion('Buttons'); |
| 12 | + }); |
| 13 | + |
| 14 | + afterEach(() => { |
| 15 | + cy.appDbState('restore'); |
| 16 | + }); |
| 17 | + |
| 18 | + describe('Button Creation', () => { |
| 19 | + it('Creates a new button for Availability Zone', () => { |
| 20 | + // Navigate through the accordion: Object Types > Availability Zone > [Unassigned Buttons] |
| 21 | + cy.selectAccordionItem(['Object Types', 'Availability Zone', '[Unassigned Buttons]']); |
| 22 | + |
| 23 | + // Use toolbar command to add a new button |
| 24 | + cy.toolbar('Configuration', 'Add a new Button'); |
| 25 | + |
| 26 | + // Verify we're on the add button page |
| 27 | + cy.get('#explorer_title_text').contains('Adding a new Button'); |
| 28 | + |
| 29 | + // Fill in name and description with hardcoded values |
| 30 | + cy.get('#name').type('Test Availability Zone Button'); |
| 31 | + cy.get('#description').type('Test button for availability zone'); |
| 32 | + |
| 33 | + // Select an icon from the dropdown |
| 34 | + cy.get('.icon-button').click(); |
| 35 | + cy.get(':nth-child(1) > span > .ff').click(); |
| 36 | + cy.get('.bx--modal-footer > .bx--btn--primary').click(); |
| 37 | + |
| 38 | + // Click the Advanced tab |
| 39 | + cy.tabs({ tabLabel: 'Advanced' }); |
| 40 | + |
| 41 | + // Scroll to object details part of the form and fill in the request field |
| 42 | + cy.get('#object_request').scrollIntoView(); |
| 43 | + cy.get('#object_request').type('test_request'); |
| 44 | + |
| 45 | + // Click Add button |
| 46 | + cy.get('#buttons_on > .btn-primary').click(); |
| 47 | + |
| 48 | + // Verify flash message that button was added |
| 49 | + cy.expect_flash(flashClassMap.success, 'was added'); |
| 50 | + |
| 51 | + // Verify the button was added successfully by clicking it in the accordion |
| 52 | + cy.get('.clickable-row').contains('Test Availability Zone Button').click(); |
| 53 | + |
| 54 | + // Verify the name, description, and request are displayed correctly in the main div |
| 55 | + cy.get('#main_div').contains('Test Availability Zone Button'); |
| 56 | + cy.get('#main_div').contains('Test button for availability zone'); |
| 57 | + cy.get('#main_div').contains('test_request'); |
| 58 | + }); |
| 59 | + }); |
| 60 | +}); |
0 commit comments