From: Abhishek Desai Date: Tue, 28 Oct 2025 06:11:36 +0000 (+0530) Subject: mgr/dasboard : Carbonize pools form X-Git-Tag: testing/wip-jcollin-testing-20260212.143545-tentacle~42^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7620364e8e7bf0c46722ed15c94efcde69a32d7e;p=ceph-ci.git mgr/dasboard : Carbonize pools form fixes : https://tracker.ceph.com/issues/68263 Signed-off-by: Abhishek Desai Conflicts: src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.po.ts src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.html src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool.module.ts --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts index dcc1a159210..1a24ac6ef16 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts @@ -41,10 +41,17 @@ And('enter {string} {string} in the carbon modal', (field: string, value: string And('select options {string}', (labels: string) => { if (labels) { - cy.get('a[data-testid=select-menu-edit]').click(); + // Open Carbon combo-box dropdown (finds first multi-select combo-box) + cy.get('cds-combo-box[type="multi"] input.cds--text-input').first().click({ force: true }); + cy.get('.cds--list-box__menu.cds--multi-select').should('be.visible'); for (const label of labels.split(', ')) { - cy.get('.popover-body div.select-menu-item-content').contains(label).click(); + cy.get('.cds--list-box__menu.cds--multi-select .cds--checkbox-label') + .contains('.cds--checkbox-label-text', label, { matchCase: false }) + .parent() + .click({ force: true }); } + // Close the dropdown + cy.get('body').type('{esc}'); } }); @@ -103,6 +110,22 @@ Then('I should see an error in {string} field', (field: string) => { }); And('select {string} {string}', (selectionName: string, option: string) => { - cy.get(`select[id=${selectionName}]`).select(option); - cy.get(`select[id=${selectionName}] option:checked`).contains(option); + cy.get('body').then(($body) => { + if ($body.find(`cds-select[id=${selectionName}]`).length > 0) { + // Carbon Design System select + cy.get(`cds-select[id=${selectionName}] select`).select(option, { force: true }); + cy.get(`cds-select[id=${selectionName}] select option:checked`).should(($opt) => { + expect($opt.text().trim().toLowerCase()).to.include(option.toLowerCase()); + }); + } else if ($body.find(`cds-radio-group[formControlName=${selectionName}]`).length > 0) { + // Carbon Design System radio group + cy.get( + `cds-radio-group[formControlName=${selectionName}] cds-radio input[type="radio"][value="${option}"]` + ).check({ force: true }); + } else { + // Native select + cy.get(`select[id=${selectionName}]`).select(option); + cy.get(`select[id=${selectionName}] option:checked`).contains(option); + } + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts index 78ef39682ab..7d21d0427c0 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts @@ -120,19 +120,45 @@ export abstract class PageHelper { * Helper method to select an option inside a select element. * This method will also expect that the option was set. * @param option The option text (not value) to be selected. + * @param isCarbon If true, uses Carbon select element selector (cds-select). + * This is a temporary parameter that will be removed once carbonization is complete. */ - selectOption(selectionName: string, option: string) { - cy.get(`select[id=${selectionName}]`).select(option); - return this.expectSelectOption(selectionName, option); + selectOption(selectionName: string, option: string, isCarbon = false) { + if (isCarbon) { + cy.get(`cds-select[id=${selectionName}] select`).select(option, { force: true }); + } else { + cy.get(`select[id=${selectionName}]`).select(option); + } + return this.expectSelectOption(selectionName, option, isCarbon); } /** * Helper method to expect a set option inside a select element. * @param option The selected option text (not value) that is to * be expected. + * @param isCarbon If true, uses Carbon select element selector (cds-select). + * This is a temporary parameter that will be removed once carbonization is complete. + */ + expectSelectOption(selectionName: string, option: string, isCarbon = false) { + if (isCarbon) { + return cy.get(`cds-select[id=${selectionName}] select option:checked`).should(($option) => { + const text = $option.text().trim().toLowerCase(); + expect(text).to.include(option.toLowerCase()); + }); + } else { + return cy.get(`select[id=${selectionName}] option:checked`).contains(option); + } + } + + /** + * Helper method to select an option inside a cds-radio-group element. + * @param testId The data-testid attribute of the cds-radio-group. + * @param option The option value to be selected. */ - expectSelectOption(selectionName: string, option: string) { - return cy.get(`select[id=${selectionName}] option:checked`).contains(option); + selectRadioOption(testId: string, option: string) { + cy.get(`[data-testid="${testId}"] cds-radio input[type="radio"][value="${option}"]`).check({ + force: true + }); } getLegends() { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.po.ts index 0701a84a2d9..f050b806a9e 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.po.ts @@ -19,16 +19,17 @@ export class PoolPageHelper extends PageHelper { this.isPowerOf2(placement_groups); - this.selectOption('poolType', 'replicated'); + this.selectRadioOption('pool-type-select', 'replicated'); - this.expectSelectOption('pgAutoscaleMode', 'on'); - this.selectOption('pgAutoscaleMode', 'off'); // To show pgNum field - cy.get('input[name=pgNum]').clear().type(`${placement_groups}`); + this.expectSelectOption('pgAutoscaleMode', 'on', true); + this.selectOption('pgAutoscaleMode', 'off', true); // To show pgNum field + cy.get('[data-testid="pgNum"]').clear().type(`${placement_groups}`); this.setApplications(apps); if (mirroring) { - cy.get('#rbdMirroring').check({ force: true }); + cy.get('[data-testid="rbd-mirroring-check"] input[type="checkbox"]').check({ force: true }); } cy.get('cd-submit-button').click(); + this.navigateBack(); } edit_pool_pg(name: string, new_pg: number, wait = true, mirroring = false) { @@ -36,7 +37,7 @@ export class PoolPageHelper extends PageHelper { this.navigateEdit(name); if (mirroring) { - cy.get('#rbdMirroring').should('be.checked'); + cy.get('[data-testid="rbd-mirroring-check"] input[type="checkbox"]').should('be.checked'); } cy.get('input[name=pgNum]').clear().type(`${new_pg}`); @@ -68,8 +69,14 @@ export class PoolPageHelper extends PageHelper { if (!apps || apps.length === 0) { return; } - cy.get('.float-start.me-2.select-menu-edit').click(); - cy.get('.popover-body').should('be.visible'); - apps.forEach((app) => cy.get('.select-menu-item-content').contains(app).click()); + cy.get('cds-combo-box[id="applications"] input.cds--text-input').click({ force: true }); + cy.get('.cds--list-box__menu.cds--multi-select').should('be.visible'); + apps.forEach((app) => { + cy.get('.cds--list-box__menu.cds--multi-select .cds--checkbox-label') + .contains('.cds--checkbox-label-text', app, { matchCase: false }) + .parent() + .click({ force: true }); + }); + cy.get('body').type('{esc}'); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.html index dd199e6ca0a..5699d556e0c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.html @@ -1,124 +1,197 @@ - - {{ action | titlecase }} {{ resource | upperFirst }} + + +

+ {{ action | titlecase }} {{ resource | upperFirst }} +

+
- -
-