Skip to content

Commit 7680fe4

Browse files
authored
Merge pull request ceph#60014 from rhcs-dashboard/cephadm-e2e-endless-fix-1
mgr/dashboard: fix cephadm dashboard e2e and a combobox issue Reviewed-by: Afreen Misbah <[email protected]>
2 parents 812add8 + 7a2a472 commit 7680fe4

File tree

46 files changed

+328
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+328
-101
lines changed

src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ cypress_run () {
3838

3939
cd ${CEPH_DEV_FOLDER}/src/pybind/mgr/dashboard/frontend
4040

41-
cypress_run ["cypress/e2e/orchestrator/workflow/*.feature","cypress/e2e/orchestrator/workflow/*-spec.ts","cypress/e2e/orchestrator/grafana/*.feature"]
41+
cypress_run ["cypress/e2e/orchestrator/workflow/*.feature","cypress/e2e/orchestrator/workflow/*-spec.ts"]
42+
cypress_run ["cypress/e2e/orchestrator/grafana/*.feature"]

src/pybind/mgr/dashboard/frontend/cypress.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from 'cypress';
2+
import fs from 'fs'
23

34
export default defineConfig({
45
video: true,
@@ -37,6 +38,21 @@ export default defineConfig({
3738
// We've imported your old cypress plugins here.
3839
// You may want to clean this up later by importing these.
3940
setupNodeEvents(on, config) {
41+
on(
42+
'after:spec',
43+
(_: Cypress.Spec, results: CypressCommandLine.RunResult) => {
44+
if (results && results.video) {
45+
// Do we have failures for any retry attempts?
46+
const failures = results.tests.some((test) =>
47+
test.attempts.some((attempt) => attempt.state === 'failed')
48+
)
49+
if (!failures) {
50+
// delete the video if the spec passed and no tests retried
51+
fs.unlinkSync(results.video)
52+
}
53+
}
54+
}
55+
)
4056
return require('./cypress/plugins/index.js')(on, config);
4157
},
4258
baseUrl: 'https://localhost:4200/',

src/pybind/mgr/dashboard/frontend/cypress/e2e/block/images.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Images page', () => {
1818
after(() => {
1919
// Deletes images test pool
2020
pools.navigateTo();
21-
pools.delete(poolName, null, null, true);
21+
pools.delete(poolName, null, null, true, false, false, true);
2222
pools.navigateTo();
2323
pools.existTableCell(poolName, false);
2424
});
@@ -58,7 +58,7 @@ describe('Images page', () => {
5858
});
5959

6060
it('should delete image', () => {
61-
images.delete(newImageName, null, null, true);
61+
images.delete(newImageName, null, null, true, false, false, true);
6262
});
6363
});
6464

src/pybind/mgr/dashboard/frontend/cypress/e2e/block/mirroring.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('Mirroring page', () => {
112112

113113
afterEach(() => {
114114
pools.navigateTo();
115-
pools.delete(poolName, null, null, true);
115+
pools.delete(poolName, null, null, true, false, false, true);
116116
});
117117
});
118118
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/hosts.po.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class HostsPageHelper extends PageHelper {
2121

2222
add(hostname: string, exist?: boolean, maintenance?: boolean, labels: string[] = []) {
2323
cy.get(`${this.pages.add.id}`).within(() => {
24-
cy.get('#hostname').type(hostname);
24+
cy.get('#hostname').type(hostname, { force: true });
2525
if (maintenance) {
2626
cy.get('label[for=maintenance]').click();
2727
}
@@ -35,6 +35,7 @@ export class HostsPageHelper extends PageHelper {
3535
}
3636

3737
cy.get('cd-submit-button').click();
38+
cy.get('cds-modal').should('not.exist');
3839
// back to host list
3940
cy.get(`${this.pages.index.id}`);
4041
}
@@ -64,7 +65,7 @@ export class HostsPageHelper extends PageHelper {
6465
}
6566

6667
remove(hostname: string) {
67-
super.delete(hostname, this.columnIndex.hostname, 'hosts', true, false, true);
68+
super.delete(hostname, this.columnIndex.hostname, 'hosts', true, false, true, true);
6869
}
6970

7071
// Add or remove labels on a host, then verify labels in the table

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/logs.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('Logs page', () => {
5454

5555
it('should delete pool and check audit logs reacted', () => {
5656
pools.navigateTo();
57-
pools.delete(poolname, null, null, true);
57+
pools.delete(poolname, null, null, true, false, false, true);
5858
logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
5959
});
6060
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/osds.po.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ export class OSDsPageHelper extends PageHelper {
5050

5151
@PageHelper.restrictTo(pages.index.url)
5252
checkStatus(id: number, status: string[]) {
53-
this.searchTable(`id:${id}`);
53+
this.searchTable(id.toString());
5454
cy.wait(5 * 1000);
55-
this.expectTableCount('found', 1);
5655
cy.get(`[cdstabledata]:nth-child(${this.columnIndex.status}) .badge`).should(($ele) => {
5756
const allStatus = $ele.toArray().map((v) => v.innerText);
5857
for (const s of status) {

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/create-cluster/create-cluster.feature.po.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
22

33
Given('I am on the {string} section', (page: string) => {
44
cy.get('cd-wizard').within(() => {
5-
cy.get('.nav-link').should('contain.text', page).first().click();
6-
cy.get('.nav-link.active').should('contain.text', page);
5+
cy.get('button').should('have.attr', 'title', page).first().click();
6+
cy.get('.cds--assistive-text').should('contain.text', 'Current');
77
});
88
});
99

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,17 @@ And('select options {string}', (labels: string) => {
4242

4343
And('{string} option {string}', (action: string, labels: string) => {
4444
if (labels) {
45+
cy.get('cds-modal').find('input[id=labels]').click();
4546
if (action === 'add') {
46-
cy.get('cd-modal').find('.select-menu-edit').click();
4747
for (const label of labels.split(', ')) {
48-
cy.get('.popover-body input').type(`${label}{enter}`);
48+
cy.get('input[id=labels]').clear().type(`${label}`);
49+
50+
cy.get('cds-dropdown-list').find('li').should('have.attr', 'title', label).click();
4951
}
5052
} else {
5153
for (const label of labels.split(', ')) {
52-
cy.contains('cd-modal .badge', new RegExp(`^${label}$`))
53-
.find('.badge-remove')
54-
.click();
54+
cy.get('input[id=labels]').clear().type(`${label}`);
55+
cy.get('cds-dropdown-list').find('li').should('have.attr', 'title', label).click();
5556
}
5657
}
5758
}
@@ -73,6 +74,10 @@ Then('I check the tick box in carbon modal', () => {
7374
cy.get('cds-modal input#confirmation_input').click({ force: true });
7475
});
7576

77+
Then('I confirm the resource {string}', (name: string) => {
78+
cy.get('cds-modal input#resource_name').type(name);
79+
});
80+
7681
And('I confirm to {string}', (action: string) => {
7782
cy.contains('cd-modal button', action).click();
7883
cy.get('cd-modal').should('not.exist');
@@ -84,7 +89,7 @@ And('I confirm to {string} on carbon modal', (action: string) => {
8489
});
8590

8691
Then('I should see an error in {string} field', (field: string) => {
87-
cy.get('cd-modal').within(() => {
92+
cy.get('cds-modal').within(() => {
8893
cy.get(`input[id=${field}]`).should('have.class', 'ng-invalid');
8994
});
9095
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/filesystems.e2e-spec.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ Feature: CephFS Management
2626
And I select a row "test_cephfs"
2727
And I click on "Remove" button from the table actions
2828
Then I should see the carbon modal
29-
And I check the tick box in carbon modal
29+
And I confirm the resource "test_cephfs"
3030
And I click on "Remove File System" button
3131
Then I should not see a row with "test_cephfs"

0 commit comments

Comments
 (0)