diff options
Diffstat (limited to '')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.e2e-spec.ts | 54 | ||||
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.po.ts | 70 |
2 files changed, 124 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.e2e-spec.ts new file mode 100644 index 000000000..b4c3c75ac --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.e2e-spec.ts @@ -0,0 +1,54 @@ +import { PoolPageHelper } from './pools.po'; + +describe('Pools page', () => { + const pools = new PoolPageHelper(); + const poolName = 'pool_e2e_pool-test'; + + beforeEach(() => { + cy.login(); + Cypress.Cookies.preserveOnce('token'); + pools.navigateTo(); + }); + + describe('breadcrumb and tab tests', () => { + it('should open and show breadcrumb', () => { + pools.expectBreadcrumbText('Pools'); + }); + + it('should show two tabs', () => { + pools.getTabsCount().should('equal', 2); + }); + + it('should show pools list tab at first', () => { + pools.getTabText(0).should('eq', 'Pools List'); + }); + + it('should show overall performance as a second tab', () => { + pools.getTabText(1).should('eq', 'Overall Performance'); + }); + }); + + describe('Create, update and destroy', () => { + it('should create a pool', () => { + pools.existTableCell(poolName, false); + pools.navigateTo('create'); + pools.create(poolName, 8, 'rbd'); + pools.existTableCell(poolName); + }); + + it('should edit a pools placement group', () => { + pools.existTableCell(poolName); + pools.edit_pool_pg(poolName, 32); + }); + + it('should show updated configuration field values', () => { + pools.existTableCell(poolName); + const bpsLimit = '4 B/s'; + pools.edit_pool_configuration(poolName, bpsLimit); + }); + + it('should delete a pool', () => { + pools.delete(poolName); + }); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.po.ts new file mode 100644 index 000000000..98cee470e --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/pools/pools.po.ts @@ -0,0 +1,70 @@ +import { PageHelper } from '../page-helper.po'; + +const pages = { + index: { url: '#/pool', id: 'cd-pool-list' }, + create: { url: '#/pool/create', id: 'cd-pool-form' } +}; + +export class PoolPageHelper extends PageHelper { + pages = pages; + + private isPowerOf2(n: number) { + // tslint:disable-next-line: no-bitwise + return expect((n & (n - 1)) === 0, `Placement groups ${n} are not a power of 2`).to.be.true; + } + + @PageHelper.restrictTo(pages.create.url) + create(name: string, placement_groups: number, ...apps: string[]) { + cy.get('input[name=name]').clear().type(name); + + this.isPowerOf2(placement_groups); + + this.selectOption('poolType', 'replicated'); + + this.expectSelectOption('pgAutoscaleMode', 'on'); + this.selectOption('pgAutoscaleMode', 'off'); // To show pgNum field + cy.get('input[name=pgNum]').clear().type(`${placement_groups}`); + this.setApplications(apps); + cy.get('cd-submit-button').click(); + } + + edit_pool_pg(name: string, new_pg: number, wait = true) { + this.isPowerOf2(new_pg); + this.navigateEdit(name); + + cy.get('input[name=pgNum]').clear().type(`${new_pg}`); + cy.get('cd-submit-button').click(); + const str = `${new_pg} active+clean`; + this.getTableRow(name); + if (wait) { + this.getTableRow(name).contains(str); + } + } + + edit_pool_configuration(name: string, bpsLimit: string) { + this.navigateEdit(name); + + cy.get('.collapsible').click(); + cy.get('cd-rbd-configuration-form') + .get('input[name=rbd_qos_bps_limit]') + .clear() + .type(`${bpsLimit}`); + cy.get('cd-submit-button').click(); + + this.navigateEdit(name); + + cy.get('.collapsible').click(); + cy.get('cd-rbd-configuration-form') + .get('input[name=rbd_qos_bps_limit]') + .should('have.value', bpsLimit); + } + + private setApplications(apps: string[]) { + if (!apps || apps.length === 0) { + return; + } + cy.get('.float-left.mr-2.select-menu-edit').click(); + cy.get('.popover-body').should('be.visible'); + apps.forEach((app) => cy.get('.select-menu-item-content').contains(app).click()); + } +} |