|
1 |
| -const randomProvider = Math.floor(Math.random() * 100); // Generate random integer |
| 1 | +const randomProvider = Math.floor(Math.random() * 100); // includes 0 to 300 |
2 | 2 |
|
3 | 3 | describe('Creating a new provider', () => {
|
4 |
| - before(() => { |
5 |
| - // cy.session('kubeadmin-session', () => { |
6 |
| - cy.login(); |
| 4 | + beforeEach(() => { |
| 5 | + cy.session('kubeadmin-session', () => { |
| 6 | + cy.login(); |
| 7 | + }); |
| 8 | + }); |
| 9 | + |
| 10 | + after(() => { |
| 11 | + cy.visit('/'); |
| 12 | + cy.get('body').then(($body) => { |
| 13 | + if ($body.text().includes('tour')) { |
| 14 | + // pop windows skip tour |
| 15 | + cy.get('#tour-step-footer-secondary').check(); |
| 16 | + } |
| 17 | + }); |
| 18 | + cy.wait(10000); |
| 19 | + cy.findByTestId('migration-nav-item').should('exist').click(); |
| 20 | + cy.findByTestId('providers-nav-item').should('exist').click(); |
| 21 | + |
| 22 | + cy.contains('a', `${randomProvider}`) // Find the <a> with the provider name |
| 23 | + .closest('tr') // Go to the parent <tr> |
| 24 | + .within(() => { |
| 25 | + // Click the toggle button |
| 26 | + cy.get('button.pf-v5-c-menu-toggle').click(); |
| 27 | + |
| 28 | + // Now click the "Delete Provider" menu item |
| 29 | + cy.contains('span.pf-v5-c-menu__item-text', 'Delete Provider').click(); |
| 30 | + }); |
| 31 | + cy.get('.pf-m-danger').should('have.text', 'Delete').click(); |
7 | 32 | });
|
8 | 33 |
|
9 | 34 | it('navigate to providers', () => {
|
@@ -52,5 +77,30 @@ describe('Creating a new provider', () => {
|
52 | 77 | cy.get('.pf-v5-c-button.pf-m-primary.pf-m-progress')
|
53 | 78 | .should('have.text', 'Create provider')
|
54 | 79 | .click();
|
| 80 | + cy.wait(10000); |
55 | 81 | });
|
| 82 | + |
| 83 | + // it('clean the new provider', () => { |
| 84 | + // cy.visit('/'); |
| 85 | + // cy.get('body').then(($body) => { |
| 86 | + // if ($body.text().includes('tour')) { |
| 87 | + // // pop windows skip tour |
| 88 | + // cy.get('#tour-step-footer-secondary').check(); |
| 89 | + // } |
| 90 | + // }); |
| 91 | + // cy.wait(10000); |
| 92 | + // cy.findByTestId('migration-nav-item').should('exist').click(); |
| 93 | + // cy.findByTestId('providers-nav-item').should('exist').click(); |
| 94 | + |
| 95 | + // cy.contains('a', `${randomProvider}`) // Find the <a> with the provider name |
| 96 | + // .closest('tr') // Go to the parent <tr> |
| 97 | + // .within(() => { |
| 98 | + // // Click the toggle button |
| 99 | + // cy.get('button.pf-v5-c-menu-toggle').click(); |
| 100 | + |
| 101 | + // // Now click the "Delete Provider" menu item |
| 102 | + // cy.contains('span.pf-v5-c-menu__item-text', 'Delete Provider').click(); |
| 103 | + // }); |
| 104 | + // cy.get('.pf-m-danger').should('have.text', 'Delete').click(); |
| 105 | + // }); |
56 | 106 | });
|
0 commit comments