From: Nizamudeen A Date: Wed, 12 Feb 2025 14:14:15 +0000 (+0530) Subject: mgr/dashboard: add basic e2e to verify wizard X-Git-Tag: testing/wip-rishabh-testing-20250315.120910-debug~12^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=afded137307e88ad1673b83f2a4d33cc98819da0;p=ceph-ci.git mgr/dashboard: add basic e2e to verify wizard and topology viewer Fixes: https://tracker.ceph.com/issues/69925 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.e2e-spec.ts index 8d8ed22da0b..5ec787f2e33 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.e2e-spec.ts @@ -102,4 +102,31 @@ describe('Multisite page', () => { multisite.deletePipe('new-pipe'); }); }); + + describe('Multi-site topology viewer', () => { + it('should show topology viewer', () => { + multisite.navigateTo('topology'); + multisite.topologyViewerExist(); + }); + + describe('Multisite replication wizard', () => { + beforeEach(() => { + multisite.navigateTo('wizard'); + }); + + it('should show replication wizard', () => { + multisite.replicationWizardExist(); + }); + + it('should verify the wizard is properly loaded', () => { + multisite.replicationWizardExist(); + // // Verify first step + multisite.verifyWizardContents('CreateRealmZonegroup'); + // Verify second step + multisite.verifyWizardContents('CreateZone'); + // Verify the review + multisite.verifyWizardContents('Review'); + }); + }); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.po.ts index 0f2078f20bb..5240c836424 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/multisite.po.ts @@ -7,8 +7,22 @@ const pages = { url: '#/rgw/multisite/sync-policy/(modal:create)', id: 'cd-rgw-multisite-sync-policy-form' }, - edit: { url: '#/rgw/multisite/sync-policy/(modal:edit', id: 'cd-rgw-multisite-sync-policy-form' } + edit: { url: '#/rgw/multisite/sync-policy/(modal:edit', id: 'cd-rgw-multisite-sync-policy-form' }, + topology: { url: '#/rgw/multisite/configuration', id: 'cd-rgw-multisite-details' }, + wizard: { + url: '#/rgw/multisite/configuration/(modal:setup-multisite-replication)', + id: 'cd-rgw-multisite-wizard' + } }; + +enum WizardSteps { + CreateRealmZonegroup = 'Create Realm & Zonegroup', + CreateZone = 'Create Zone', + Review = 'Review' +} + +type Step = keyof typeof WizardSteps; + export class MultisitePageHelper extends PageHelper { pages = pages; @@ -289,4 +303,51 @@ export class MultisitePageHelper extends PageHelper { // Waits for item to be removed from table getRow(pipe_id).should('not.exist'); } + + @PageHelper.restrictTo(pages.topology.url) + topologyViewerExist() { + cy.get(pages.topology.id).should('be.visible'); + cy.get('[data-testid=rgw-multisite-details-header]').should('have.text', 'Topology Viewer'); + } + + @PageHelper.restrictTo(pages.wizard.url) + replicationWizardExist() { + cy.get('cds-modal').then(() => { + cy.get('[data-testid=rgw-multisite-wizard-header]').should( + 'have.text', + 'Set up Multi-site Replication' + ); + }); + } + + @PageHelper.restrictTo(pages.index.url) + verifyWizardContents(step: Step) { + cy.get('cds-modal').then(() => { + this.gotoStep(step); + if (step === 'CreateRealmZonegroup') { + this.typeValueToField('realmName', 'test-realm'); + this.typeValueToField('zonegroupName', 'test-zg'); + } else if (step === 'CreateZone') { + this.typeValueToField('zoneName', 'test-zone'); + } else { + this.gotoStep('Review'); + cy.get('.form-group.row').then(() => { + cy.get('#realmName').invoke('text').should('eq', 'test-realm'); + cy.get('#zonegroupName').invoke('text').should('eq', 'test-zg'); + cy.get('#zoneName').invoke('text').should('eq', 'test-zone'); + }); + } + }); + } + + typeValueToField(fieldID: string, value: string) { + cy.get(`#${fieldID}`).clear().type(value).should('have.value', value); + } + + gotoStep(step: Step) { + cy.get('cd-wizard').then(() => { + cy.get('form').should('be.visible'); + cy.get('button').contains(WizardSteps[step]).click(); + }); + } } diff --git a/src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts b/src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts index 4db2c6a4926..8b55b576589 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts @@ -17,3 +17,10 @@ Cypress.on('uncaught:exception', (err: Error) => { } return true; }); + +Cypress.on('fail', (err: Error) => { + if (err.message.includes('xhr') && err.message.includes('canceled')) { + return false; // Ignore canceled XHR requests + } + return true; +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html index c3b740ec7c6..48fc0eeb5f2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html @@ -51,8 +51,8 @@
Topology Viewer -
+ data-testid="rgw-multisite-details-header" + i18n>Topology Viewer

Set up Multi-site Replication

@@ -323,14 +324,16 @@
-
+
{{ multisiteSetupForm.get('realmName').value }}
-
+
{{ multisiteSetupForm.get('zonegroupName').value }}
@@ -344,7 +347,8 @@
-
+
{{ multisiteSetupForm.get('zoneName').value }}