|
1 | 1 | /* eslint-disable no-undef */ |
2 | 2 |
|
3 | 3 | describe('Automation > Embedded Automate > Explorer', () => { |
4 | | - before(() => { |
5 | | - // Create a Domain and Namespace before all the tests |
| 4 | + beforeEach(() => { |
| 5 | + cy.appFactories([ |
| 6 | + ['create', 'miq_ae_domain', {name: 'TestDomain'}], |
| 7 | + ]).then((results) => { |
| 8 | + cy.appFactories([ |
| 9 | + ['create', 'miq_ae_namespace', {name: 'TestNameSpace', domain_id: results[0].id}] |
| 10 | + ]) |
| 11 | + }); |
| 12 | + |
6 | 13 | cy.login(); |
7 | 14 | cy.intercept('POST', '/ops/accordion_select?id=rbac_accord').as('accordion'); |
8 | 15 | cy.menu('Automation', 'Embedded Automate', 'Explorer'); |
9 | 16 | cy.get('#explorer_title_text'); |
10 | | - |
11 | | - // Creates a Domain |
12 | | - cy.get('[title="Datastore"]').click(); |
13 | | - cy.get('[title="Configuration"]').click(); |
14 | | - cy.get('[title="Add a New Domain"]').click(); |
15 | | - cy.get('[name="name"]').type('TestDomain', {force: true}); |
16 | | - cy.get('[name="description"]').type('This is a test domain'); |
17 | | - cy.get('#enabled').check(); |
18 | | - cy.get('[class="bx--btn bx--btn--primary"]').contains('Add').click(); |
19 | | - |
20 | | - // Check for the success message |
21 | | - cy.get('div.alert.alert-success.alert-dismissable').should('exist').and('contain', 'Automate Domain "TestDomain" was added').find('button.close').should('exist'); |
22 | | - |
23 | | - // Creates a Namespace |
24 | | - cy.get('[title="Datastore"]').click(); |
25 | | - cy.get('[title="Automate Domain: TestDomain"]').click(); // Click on Domain |
26 | | - cy.get('[title="Configuration"]').click(); |
27 | | - cy.get('[title="Add a New Namespace"]').click(); |
28 | | - cy.get('[name="name"]').type('TestNameSpace', {force: true}); |
29 | | - cy.get('[name="description"]').type('This is a test NameSpace'); |
30 | | - cy.get('.bx--btn--primary').contains('Add').click(); |
31 | | - |
32 | | - // Wait for namespace to be visible |
33 | | - cy.get('[title="Automate Namespace: TestNameSpace"]', {timeout: 1000}).should('be.visible') |
34 | 17 | }); |
35 | 18 |
|
36 | | - beforeEach(() => { |
37 | | - cy.login(); |
38 | | - cy.intercept('POST', '/ops/accordion_select?id=rbac_accord').as('accordion'); |
39 | | - cy.menu('Automation', 'Embedded Automate', 'Explorer'); |
40 | | - cy.get('#explorer_title_text'); |
| 19 | + afterEach(() => { |
| 20 | + cy.appDbState('restore'); |
41 | 21 | }); |
42 | 22 |
|
43 | 23 | describe('Class Form', () => { |
@@ -268,15 +248,4 @@ describe('Automation > Embedded Automate > Explorer', () => { |
268 | 248 | cy.get('#ns_details_div > .alert').contains('The selected Namespace is empty'); |
269 | 249 | }); |
270 | 250 | }); |
271 | | - |
272 | | - after(() => { |
273 | | - // Remove the Domain after all the tests |
274 | | - cy.menu('Automation', 'Embedded Automate', 'Explorer'); |
275 | | - cy.get('[title="Datastore"]').click({force: true}); |
276 | | - cy.get('[title="Automate Domain: TestDomain"]').click({force: true}); |
277 | | - cy.get('[title="Configuration"]').click({force: true}); |
278 | | - cy.get('[title="Remove this Domain"]').click({force: true}); |
279 | | - |
280 | | - cy.get('.bx--data-table-content tbody tr').should('not.contain', 'Automate Domain: TestDomain'); |
281 | | - }); |
282 | 251 | }); |
0 commit comments