X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fcypress%2Fintegration%2Fcluster%2Fservices.po.ts;fp=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fcypress%2Fintegration%2Fcluster%2Fservices.po.ts;h=55763285e290efadc111765b477a08b1a293a52a;hb=b3b6e05ebb17ef6ac03c6f6f46d242185719a08e;hp=0000000000000000000000000000000000000000;hpb=a912ff2c95b1f9a8e2e48509e602ee008d5c9434;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts new file mode 100644 index 000000000..55763285e --- /dev/null +++ b/ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -0,0 +1,84 @@ +import { PageHelper } from '../page-helper.po'; + +const pages = { + index: { url: '#/services', id: 'cd-services' }, + create: { url: '#/services/create', id: 'cd-service-form' } +}; + +export class ServicesPageHelper extends PageHelper { + pages = pages; + + columnIndex = { + service_name: 2, + placement: 3, + running: 4, + size: 5, + last_refresh: 6 + }; + + check_for_service() { + this.getTableCount('total').should('not.be.eq', 0); + } + + private selectServiceType(serviceType: string) { + return this.selectOption('service_type', serviceType); + } + + @PageHelper.restrictTo(pages.create.url) + addService(serviceType: string, exist?: boolean) { + cy.get(`${this.pages.create.id}`).within(() => { + this.selectServiceType(serviceType); + if (serviceType === 'rgw') { + cy.get('#service_id').type('rgw.foo'); + cy.get('#count').type('1'); + } else if (serviceType === 'ingress') { + this.selectOption('backend_service', 'rgw.rgw.foo'); + cy.get('#service_id').should('have.value', 'rgw.rgw.foo'); + cy.get('#virtual_ip').type('192.168.20.1/24'); + cy.get('#frontend_port').type('8081'); + cy.get('#monitor_port').type('8082'); + } + + cy.get('cd-submit-button').click(); + }); + if (exist) { + cy.get('#service_id').should('have.class', 'ng-invalid'); + } else { + // back to service list + cy.get(`${this.pages.index.id}`); + } + } + + @PageHelper.restrictTo(pages.index.url) + checkExist(serviceName: string, exist: boolean) { + this.getTableCell(this.columnIndex.service_name, serviceName).should(($elements) => { + const services = $elements.map((_, el) => el.textContent).get(); + if (exist) { + expect(services).to.include(serviceName); + } else { + expect(services).to.not.include(serviceName); + } + }); + } + + @PageHelper.restrictTo(pages.index.url) + deleteService(serviceName: string, wait: number) { + const getRow = this.getTableCell.bind(this, this.columnIndex.service_name); + getRow(serviceName).click(); + + // Clicks on table Delete button + this.clickActionButton('delete'); + + // Confirms deletion + cy.get('cd-modal .custom-control-label').click(); + cy.contains('cd-modal button', 'Delete').click(); + + // Wait for modal to close + cy.get('cd-modal').should('not.exist'); + + // wait for delete operation to complete: tearing down the service daemons + cy.wait(wait); + + this.checkExist(serviceName, false); + } +}