Skip to content

Commit 09d3e67

Browse files
committed
mgr/dashboard: fixing cephadm dashboard e2e failures
the wizard component changes caused issue to the e2e, so fixing it. It was uncaught before because of the test were unable to run due to some lab issues. Fixes: https://tracker.ceph.com/issues/68871 Signed-off-by: Nizamudeen A <[email protected]>
1 parent 6cc1305 commit 09d3e67

File tree

12 files changed

+55
-46
lines changed

12 files changed

+55
-46
lines changed

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

Lines changed: 2 additions & 1 deletion
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
}

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: 7 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
}
@@ -84,7 +85,7 @@ And('I confirm to {string} on carbon modal', (action: string) => {
8485
});
8586

8687
Then('I should see an error in {string} field', (field: string) => {
87-
cy.get('cd-modal').within(() => {
88+
cy.get('cds-modal').within(() => {
8889
cy.get(`input[id=${field}]`).should('have.class', 'ng-invalid');
8990
});
9091
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/02-create-cluster-add-host.feature

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ Feature: Cluster expansion host addition
1212
Scenario Outline: Add hosts
1313
Given I am on the "Add Hosts" section
1414
When I click on "Add" button
15-
And enter "hostname" "<hostname>" in the modal
16-
And select options "<labels>"
15+
And enter "hostname" "<hostname>" in the carbon modal
16+
And "add" option "<labels>"
1717
And I click on "Add Host" button
18-
Then I should not see the modal
1918
And I should see a row with "<hostname>"
2019
And I should see row "<hostname>" have "<labels>"
2120

@@ -32,7 +31,6 @@ Feature: Cluster expansion host addition
3231
Then I should see the carbon modal
3332
And I check the tick box in carbon modal
3433
And I click on "Remove Host" button
35-
Then I should not see the carbon modal
3634
And I should not see a row with "<hostname>"
3735

3836
Examples:
@@ -43,9 +41,8 @@ Feature: Cluster expansion host addition
4341
Scenario: Add hosts using pattern 'ceph-node-[01-02]'
4442
Given I am on the "Add Hosts" section
4543
When I click on "Add" button
46-
And enter "hostname" "ceph-node-[01-02]" in the modal
44+
And enter "hostname" "ceph-node-[01-02]" in the carbon modal
4745
And I click on "Add Host" button
48-
Then I should not see the modal
4946
And I should see rows with following entries
5047
| hostname |
5148
| ceph-node-01 |
@@ -55,7 +52,7 @@ Feature: Cluster expansion host addition
5552
Given I am on the "Add Hosts" section
5653
And I should see a row with "ceph-node-00"
5754
When I click on "Add" button
58-
And enter "hostname" "ceph-node-00" in the modal
55+
And enter "hostname" "ceph-node-00" in the carbon modal
5956
Then I should see an error in "hostname" field
6057

6158
Scenario Outline: Add and remove labels on host

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ describe('Create cluster create services page', () => {
1919
cy.login();
2020
createCluster.navigateTo();
2121
createCluster.createCluster();
22-
cy.get('.nav-link').contains('Create Services').click();
22+
23+
cy.get('cd-wizard').within(() => {
24+
cy.get('button').contains('Create Services').click();
25+
});
2326
});
2427

2528
it('should check if title contains Create Services', () => {

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ describe('Create cluster create osds page', () => {
1212
cy.login();
1313
createCluster.navigateTo();
1414
createCluster.createCluster();
15-
cy.get('.nav-link').contains('Create OSDs').click();
15+
cy.get('cd-wizard').within(() => {
16+
cy.get('button').contains('Create OSDs').click();
17+
});
1618
});
1719

1820
it('should check if title contains Create OSDs', () => {
@@ -28,12 +30,16 @@ describe('Create cluster create osds page', () => {
2830
// Go to the Review section and Expand the cluster
2931
// because the drive group spec is only stored
3032
// in frontend and will be lost when refreshed
31-
cy.get('.nav-link').contains('Review').click();
33+
cy.get('cd-wizard').within(() => {
34+
cy.get('button').contains('Review').click();
35+
});
3236
cy.get('button[aria-label="Next"]').click();
3337
cy.get('cd-dashboard').should('exist');
3438
createCluster.navigateTo();
3539
createCluster.createCluster();
36-
cy.get('.nav-link').contains('Create OSDs').click();
40+
cy.get('cd-wizard').within(() => {
41+
cy.get('button').contains('Create OSDs').click();
42+
});
3743
}
3844
});
3945
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/05-create-cluster-review.e2e-spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ describe('Create Cluster Review page', () => {
1414
createCluster.navigateTo();
1515
createCluster.createCluster();
1616

17-
cy.get('.nav-link').contains('Review').click();
18-
});
19-
20-
describe('navigation link test', () => {
21-
it('should check if active nav-link is of Review section', () => {
22-
cy.get('.nav-link.active').should('contain.text', 'Review');
17+
cy.get('cd-wizard').within(() => {
18+
cy.get('button').contains('Review').click();
2319
});
2420
});
2521

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/06-cluster-check.e2e-spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ describe('when cluster creation is completed', () => {
2121

2222
// Explicitly skip OSD Creation Step so that it prevents from
2323
// deploying OSDs to the hosts automatically.
24-
cy.get('.nav-link').contains('Create OSDs').click();
24+
cy.get('cd-wizard').within(() => {
25+
cy.get('button').contains('Create OSDs').click();
26+
});
2527
cy.get('button[aria-label="Skip this step"]').click();
2628

27-
cy.get('.nav-link').contains('Review').click();
29+
cy.get('cd-wizard').within(() => {
30+
cy.get('button').contains('Review').click();
31+
});
2832
cy.get('button[aria-label="Next"]').click();
2933
cy.get('cd-dashboard').should('exist');
3034
});

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
328328
const host = this.selection.first();
329329
const labels = new Set(resp.concat(this.hostService.predefinedLabels));
330330
const allLabels = Array.from(labels).map((label) => {
331-
return { content: label };
331+
return { content: label, selected: host['labels'].includes(label) };
332332
});
333333
this.cdsModalService.show(FormModalComponent, {
334334
titleText: $localize`Edit Host: ${host.hostname}`,

0 commit comments

Comments
 (0)