|
| 1 | +/* eslint-disable no-undef */ |
| 2 | + |
| 3 | +const textConstants = { |
| 4 | + // Menu options |
| 5 | + settingsMenuOption: 'Settings', |
| 6 | + appSettingsMenuOption: 'Application Settings', |
| 7 | + toolBarConfigMenu: 'Configuration', |
| 8 | + |
| 9 | + // added item information |
| 10 | + initialTenantName: 'Test-name', |
| 11 | + initialTenantDescription: 'test description', |
| 12 | + |
| 13 | + // List items |
| 14 | + accessControlAccordion: 'Access Control', |
| 15 | + |
| 16 | + // flash message assertions |
| 17 | + flashMessageOperationAdded: 'added', |
| 18 | + flashMessageOperationDeleted: 'delete', |
| 19 | + flashTypeSuccess: 'success', |
| 20 | + |
| 21 | + // Configuration menu options and browser alert text snippets |
| 22 | + deleteItem: 'Delete this item', |
| 23 | +} |
| 24 | + |
| 25 | +const { |
| 26 | + accessControlAccordion, |
| 27 | + appSettingsMenuOption, |
| 28 | + deleteItem, |
| 29 | + flashMessageOperationAdded, |
| 30 | + flashMessageOperationDeleted, |
| 31 | + flashTypeSuccess, |
| 32 | + initialTenantDescription, |
| 33 | + initialTenantName, |
| 34 | + settingsMenuOption, |
| 35 | + toolBarConfigMenu, |
| 36 | +} = textConstants; |
| 37 | + |
| 38 | +describe('Settings > Application Settings > Access Control', () => { |
| 39 | + beforeEach(() => { |
| 40 | + cy.login(); |
| 41 | + cy.menu(settingsMenuOption, appSettingsMenuOption); |
| 42 | + cy.accordion(accessControlAccordion); |
| 43 | + }); |
| 44 | + |
| 45 | + it('should be able to create and delete a tenant', () => { |
| 46 | + cy.selectAccordionItem([ |
| 47 | + /^ManageIQ Region/, |
| 48 | + 'Tenants', |
| 49 | + 'My Company', |
| 50 | + ]); |
| 51 | + |
| 52 | + cy.toolbar(toolBarConfigMenu, 'Add child Tenant to this Tenant'); |
| 53 | + cy.get('input#name').type(initialTenantName); |
| 54 | + cy.get('input#description').type(initialTenantDescription); |
| 55 | + cy.contains('.bx--btn--primary', 'Add').click(); |
| 56 | + cy.expect_flash(flashTypeSuccess, flashMessageOperationAdded); |
| 57 | + cy.selectAccordionItem([ |
| 58 | + /^ManageIQ Region/, |
| 59 | + 'Tenants', |
| 60 | + 'My Company', |
| 61 | + initialTenantName |
| 62 | + ]); |
| 63 | + |
| 64 | + cy.expect_browser_confirm_with_text({ |
| 65 | + confirmTriggerFn: () => cy.toolbar(toolBarConfigMenu, deleteItem), |
| 66 | + containsText: deleteItem, |
| 67 | + }); |
| 68 | + cy.expect_flash(flashTypeSuccess, flashMessageOperationDeleted); |
| 69 | + }); |
| 70 | +}); |
0 commit comments