Skip to content

Commit 9643c3c

Browse files
committed
teardown - deleting the provider
1 parent 91646eb commit 9643c3c

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

testing/cypress/e2e/tests/Providers/CreateProvider.cy.ts

+54-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1-
const randomProvider = Math.floor(Math.random() * 100); // Generate random integer
1+
const randomProvider = Math.floor(Math.random() * 100); // includes 0 to 300
22

33
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();
732
});
833

934
it('navigate to providers', () => {
@@ -52,5 +77,30 @@ describe('Creating a new provider', () => {
5277
cy.get('.pf-v5-c-button.pf-m-primary.pf-m-progress')
5378
.should('have.text', 'Create provider')
5479
.click();
80+
cy.wait(10000);
5581
});
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+
// });
56106
});

0 commit comments

Comments
 (0)