Skip to content

Commit afded13

Browse files
committed
mgr/dashboard: add basic e2e to verify wizard
and topology viewer Fixes: https://tracker.ceph.com/issues/69925 Signed-off-by: Nizamudeen A <[email protected]>
1 parent 5c8fa84 commit afded13

File tree

5 files changed

+105
-6
lines changed

5 files changed

+105
-6
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.e2e-spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,31 @@ describe('Multisite page', () => {
102102
multisite.deletePipe('new-pipe');
103103
});
104104
});
105+
106+
describe('Multi-site topology viewer', () => {
107+
it('should show topology viewer', () => {
108+
multisite.navigateTo('topology');
109+
multisite.topologyViewerExist();
110+
});
111+
112+
describe('Multisite replication wizard', () => {
113+
beforeEach(() => {
114+
multisite.navigateTo('wizard');
115+
});
116+
117+
it('should show replication wizard', () => {
118+
multisite.replicationWizardExist();
119+
});
120+
121+
it('should verify the wizard is properly loaded', () => {
122+
multisite.replicationWizardExist();
123+
// // Verify first step
124+
multisite.verifyWizardContents('CreateRealmZonegroup');
125+
// Verify second step
126+
multisite.verifyWizardContents('CreateZone');
127+
// Verify the review
128+
multisite.verifyWizardContents('Review');
129+
});
130+
});
131+
});
105132
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.po.ts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ const pages = {
77
url: '#/rgw/multisite/sync-policy/(modal:create)',
88
id: 'cd-rgw-multisite-sync-policy-form'
99
},
10-
edit: { url: '#/rgw/multisite/sync-policy/(modal:edit', id: 'cd-rgw-multisite-sync-policy-form' }
10+
edit: { url: '#/rgw/multisite/sync-policy/(modal:edit', id: 'cd-rgw-multisite-sync-policy-form' },
11+
topology: { url: '#/rgw/multisite/configuration', id: 'cd-rgw-multisite-details' },
12+
wizard: {
13+
url: '#/rgw/multisite/configuration/(modal:setup-multisite-replication)',
14+
id: 'cd-rgw-multisite-wizard'
15+
}
1116
};
17+
18+
enum WizardSteps {
19+
CreateRealmZonegroup = 'Create Realm & Zonegroup',
20+
CreateZone = 'Create Zone',
21+
Review = 'Review'
22+
}
23+
24+
type Step = keyof typeof WizardSteps;
25+
1226
export class MultisitePageHelper extends PageHelper {
1327
pages = pages;
1428

@@ -289,4 +303,51 @@ export class MultisitePageHelper extends PageHelper {
289303
// Waits for item to be removed from table
290304
getRow(pipe_id).should('not.exist');
291305
}
306+
307+
@PageHelper.restrictTo(pages.topology.url)
308+
topologyViewerExist() {
309+
cy.get(pages.topology.id).should('be.visible');
310+
cy.get('[data-testid=rgw-multisite-details-header]').should('have.text', 'Topology Viewer');
311+
}
312+
313+
@PageHelper.restrictTo(pages.wizard.url)
314+
replicationWizardExist() {
315+
cy.get('cds-modal').then(() => {
316+
cy.get('[data-testid=rgw-multisite-wizard-header]').should(
317+
'have.text',
318+
'Set up Multi-site Replication'
319+
);
320+
});
321+
}
322+
323+
@PageHelper.restrictTo(pages.index.url)
324+
verifyWizardContents(step: Step) {
325+
cy.get('cds-modal').then(() => {
326+
this.gotoStep(step);
327+
if (step === 'CreateRealmZonegroup') {
328+
this.typeValueToField('realmName', 'test-realm');
329+
this.typeValueToField('zonegroupName', 'test-zg');
330+
} else if (step === 'CreateZone') {
331+
this.typeValueToField('zoneName', 'test-zone');
332+
} else {
333+
this.gotoStep('Review');
334+
cy.get('.form-group.row').then(() => {
335+
cy.get('#realmName').invoke('text').should('eq', 'test-realm');
336+
cy.get('#zonegroupName').invoke('text').should('eq', 'test-zg');
337+
cy.get('#zoneName').invoke('text').should('eq', 'test-zone');
338+
});
339+
}
340+
});
341+
}
342+
343+
typeValueToField(fieldID: string, value: string) {
344+
cy.get(`#${fieldID}`).clear().type(value).should('have.value', value);
345+
}
346+
347+
gotoStep(step: Step) {
348+
cy.get('cd-wizard').then(() => {
349+
cy.get('form').should('be.visible');
350+
cy.get('button').contains(WizardSteps[step]).click();
351+
});
352+
}
292353
}

src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ Cypress.on('uncaught:exception', (err: Error) => {
1717
}
1818
return true;
1919
});
20+
21+
Cypress.on('fail', (err: Error) => {
22+
if (err.message.includes('xhr') && err.message.includes('canceled')) {
23+
return false; // Ignore canceled XHR requests
24+
}
25+
return true;
26+
});

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
</div>
5252
<div class="card">
5353
<div class="card-header"
54-
i18n>Topology Viewer
55-
</div>
54+
data-testid="rgw-multisite-details-header"
55+
i18n>Topology Viewer</div>
5656
<div class="row">
5757
<div class="col-sm-6 col-lg-6 tree-container">
5858
<i *ngIf="loadingIndicator"

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
(overlaySelected)="closeModal()">
66
<cds-modal-header (closeSelect)="closeModal()">
77
<h3 cdsModalHeaderHeading
8+
data-testid="rgw-multisite-wizard-header"
89
i18n>Set up Multi-site Replication</h3>
910
</cds-modal-header>
1011

@@ -323,14 +324,16 @@
323324
<div class="form-group row">
324325
<label class="cd-col-form-label"
325326
i18n>Realm Name:</label>
326-
<div class="cd-col-form-input mt-2 text-muted">
327+
<div class="cd-col-form-input mt-2 text-muted"
328+
id="realmName">
327329
<b>{{ multisiteSetupForm.get('realmName').value }}</b>
328330
</div>
329331
</div>
330332
<div class="form-group row">
331333
<label class="cd-col-form-label"
332334
i18n>Zonegroup Name:</label>
333-
<div class="cd-col-form-input mt-2 text-muted">
335+
<div class="cd-col-form-input mt-2 text-muted"
336+
id="zonegroupName">
334337
<b>{{ multisiteSetupForm.get('zonegroupName').value }}</b>
335338
</div>
336339
</div>
@@ -344,7 +347,8 @@
344347
<div class="form-group row">
345348
<label class="cd-col-form-label"
346349
i18n>Zone Name:</label>
347-
<div class="cd-col-form-input mt-2 text-muted">
350+
<div class="cd-col-form-input mt-2 text-muted"
351+
id="zoneName">
348352
<b>{{ multisiteSetupForm.get('zoneName').value }}</b>
349353
</div>
350354
</div>

0 commit comments

Comments
 (0)