]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Cluster expansion e2e cleanups 42557/head
authorNizamudeen A <nia@redhat.com>
Fri, 17 Sep 2021 13:13:01 +0000 (18:43 +0530)
committerNizamudeen A <nia@redhat.com>
Wed, 13 Oct 2021 10:32:51 +0000 (16:02 +0530)
Fixes: https://tracker.ceph.com/issues/52645
Signed-off-by: Nizamudeen A <nia@redhat.com>
14 files changed:
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/create-cluster.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/02-hosts-inventory.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/01-create-cluster-welcome-page.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/01-hosts.e2e-spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-osds.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/05-create-cluster-review.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts

index a528c0fc12e0535ed1c509865743f65320f9da5f..52be703af28eb61ec60c45f6585d71dced6f6f30 100644 (file)
@@ -1,26 +1,18 @@
-import { PageHelper } from '../page-helper.po';
-import { NotificationSidebarPageHelper } from '../ui/notification.po';
+import { HostsPageHelper } from 'cypress/integration/cluster/hosts.po';
+import { ServicesPageHelper } from 'cypress/integration/cluster/services.po';
+import { PageHelper } from 'cypress/integration/page-helper.po';
+import { NotificationSidebarPageHelper } from 'cypress/integration/ui/notification.po';
 
 const pages = {
   index: { url: '#/expand-cluster', id: 'cd-create-cluster' }
 };
-
 export class CreateClusterWizardHelper extends PageHelper {
   pages = pages;
-  columnIndex = {
-    hostname: 1,
-    labels: 2,
-    status: 3
-  };
-
-  serviceColumnIndex = {
-    service_name: 1,
-    placement: 2
-  };
 
   createCluster() {
     cy.get('cd-create-cluster').should('contain.text', 'Please expand your cluster first');
     cy.get('[name=expand-cluster]').click();
+    cy.get('cd-wizard').should('exist');
   }
 
   doSkip() {
@@ -33,91 +25,6 @@ export class CreateClusterWizardHelper extends PageHelper {
     notification.getNotifications().should('contain', 'Cluster expansion skipped by user');
   }
 
-  check_for_host() {
-    this.getTableCount('total').should('not.be.eq', 0);
-  }
-
-  clickHostTab(hostname: string, tabName: string) {
-    this.getExpandCollapseElement(hostname).click();
-    cy.get('cd-host-details').within(() => {
-      this.getTab(tabName).click();
-    });
-  }
-
-  add(hostname: string, exist?: boolean, maintenance?: boolean) {
-    cy.get('.btn.btn-accent').first().click({ force: true });
-    cy.get('cd-modal').should('exist');
-    cy.get('cd-modal').within(() => {
-      cy.get('#hostname').type(hostname);
-      if (maintenance) {
-        cy.get('label[for=maintenance]').click();
-      }
-      if (exist) {
-        cy.get('#hostname').should('have.class', 'ng-invalid');
-      }
-      cy.get('cd-submit-button').click();
-    });
-    // back to host list
-    cy.get(`${this.pages.index.id}`);
-  }
-
-  checkExist(hostname: string, exist: boolean) {
-    this.clearTableSearchInput();
-    this.getTableCell(this.columnIndex.hostname, hostname).should(($elements) => {
-      const hosts = $elements.map((_, el) => el.textContent).get();
-      if (exist) {
-        expect(hosts).to.include(hostname);
-      } else {
-        expect(hosts).to.not.include(hostname);
-      }
-    });
-  }
-
-  delete(hostname: string) {
-    super.delete(hostname, this.columnIndex.hostname, 'hosts');
-  }
-
-  // Add or remove labels on a host, then verify labels in the table
-  editLabels(hostname: string, labels: string[], add: boolean) {
-    this.getTableCell(this.columnIndex.hostname, hostname).click();
-    this.clickActionButton('edit');
-
-    // add or remove label badges
-    if (add) {
-      cy.get('cd-modal').find('.select-menu-edit').click();
-      for (const label of labels) {
-        cy.contains('cd-modal .badge', new RegExp(`^${label}$`)).should('not.exist');
-        cy.get('.popover-body input').type(`${label}{enter}`);
-      }
-    } else {
-      for (const label of labels) {
-        cy.contains('cd-modal .badge', new RegExp(`^${label}$`))
-          .find('.badge-remove')
-          .click();
-      }
-    }
-    cy.get('cd-modal cd-submit-button').click();
-    this.checkLabelExists(hostname, labels, add);
-  }
-
-  checkLabelExists(hostname: string, labels: string[], add: boolean) {
-    // Verify labels are added or removed from Labels column
-    // First find row with hostname, then find labels in the row
-    this.getTableCell(this.columnIndex.hostname, hostname)
-      .parent()
-      .find(`datatable-body-cell:nth-child(${this.columnIndex.labels}) .badge`)
-      .should(($ele) => {
-        const newLabels = $ele.toArray().map((v) => v.innerText);
-        for (const label of labels) {
-          if (add) {
-            expect(newLabels).to.include(label);
-          } else {
-            expect(newLabels).to.not.include(label);
-          }
-        }
-      });
-  }
-
   createOSD(deviceType: 'hdd' | 'ssd') {
     // Click Primary devices Add button
     cy.get('cd-osd-devices-selection-groups[name="Primary"]').as('primaryGroups');
@@ -131,59 +38,33 @@ export class CreateClusterWizardHelper extends PageHelper {
       cy.get('@addButton').click();
     });
   }
+}
 
-  private selectServiceType(serviceType: string) {
-    return this.selectOption('service_type', serviceType);
-  }
-
-  addService(serviceType: string) {
-    cy.get('.btn.btn-accent').first().click({ force: true });
-    cy.get('cd-modal').should('exist');
-    cy.get('cd-modal').within(() => {
-      this.selectServiceType(serviceType);
-      if (serviceType === 'rgw') {
-        cy.get('#service_id').type('rgw');
-        cy.get('#count').type('1');
-      } else if (serviceType === 'ingress') {
-        this.selectOption('backend_service', 'rgw.rgw');
-        cy.get('#service_id').should('have.value', 'rgw.rgw');
-        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();
-    });
-  }
-
-  checkServiceExist(serviceName: string, exist: boolean) {
-    this.getTableCell(this.serviceColumnIndex.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);
-      }
-    });
-  }
-
-  deleteService(serviceName: string, wait: number) {
-    const getRow = this.getTableCell.bind(this, this.serviceColumnIndex.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();
+export class CreateClusterHostPageHelper extends HostsPageHelper {
+  pages = {
+    index: { url: '#/expand-cluster', id: 'cd-wizard' },
+    add: { url: '', id: 'cd-host-form' }
+  };
 
-    // Wait for modal to close
-    cy.get('cd-modal').should('not.exist');
+  columnIndex = {
+    hostname: 1,
+    labels: 2,
+    status: 3,
+    services: 0
+  };
+}
 
-    // wait for delete operation to complete: tearing down the service daemons
-    cy.wait(wait);
+export class CreateClusterServicePageHelper extends ServicesPageHelper {
+  pages = {
+    index: { url: '#/expand-cluster', id: 'cd-wizard' },
+    create: { url: '', id: 'cd-service-form' }
+  };
 
-    this.checkServiceExist(serviceName, false);
-  }
+  columnIndex = {
+    service_name: 1,
+    placement: 2,
+    running: 0,
+    size: 0,
+    last_refresh: 0
+  };
 }
index 5f3d39dcedc50a03cf4e4618944578cf3a841a83..c615b945a5d6a61136c5f15d10cc87780069c745 100644 (file)
@@ -41,15 +41,6 @@ export class HostsPageHelper extends PageHelper {
       });
   }
 
-  @PageHelper.restrictTo(pages.index.url)
-  clickHostTab(hostname: string, tabName: string) {
-    this.getExpandCollapseElement(hostname).click();
-    cy.get('cd-host-details').within(() => {
-      this.getTab(tabName).click();
-    });
-  }
-
-  @PageHelper.restrictTo(pages.add.url)
   add(hostname: string, exist?: boolean, maintenance?: boolean) {
     cy.get(`${this.pages.add.id}`).within(() => {
       cy.get('#hostname').type(hostname);
@@ -65,8 +56,8 @@ export class HostsPageHelper extends PageHelper {
     cy.get(`${this.pages.index.id}`);
   }
 
-  @PageHelper.restrictTo(pages.index.url)
   checkExist(hostname: string, exist: boolean) {
+    this.clearTableSearchInput();
     this.getTableCell(this.columnIndex.hostname, hostname).should(($elements) => {
       const hosts = $elements.map((_, el) => el.textContent).get();
       if (exist) {
@@ -77,13 +68,11 @@ export class HostsPageHelper extends PageHelper {
     });
   }
 
-  @PageHelper.restrictTo(pages.index.url)
   delete(hostname: string) {
     super.delete(hostname, this.columnIndex.hostname, 'hosts');
   }
 
   // Add or remove labels on a host, then verify labels in the table
-  @PageHelper.restrictTo(pages.index.url)
   editLabels(hostname: string, labels: string[], add: boolean) {
     this.getTableCell(this.columnIndex.hostname, hostname).click();
     this.clickActionButton('edit');
@@ -103,7 +92,10 @@ export class HostsPageHelper extends PageHelper {
       }
     }
     cy.get('cd-modal cd-submit-button').click();
+    this.checkLabelExists(hostname, labels, add);
+  }
 
+  checkLabelExists(hostname: string, labels: string[], add: boolean) {
     // Verify labels are added or removed from Labels column
     // First find row with hostname, then find labels in the row
     this.getTableCell(this.columnIndex.hostname, hostname)
index 0a943d4b0553fc085fcf1f675bb6e14064150c60..4265329db042ab8754563d189476e57f9a2449d8 100644 (file)
@@ -30,7 +30,6 @@ export class ServicesPageHelper extends PageHelper {
     return this.selectOption('service_type', serviceType);
   }
 
-  @PageHelper.restrictTo(pages.index.url)
   clickServiceTab(serviceName: string, tabName: string) {
     this.getExpandCollapseElement(serviceName).click();
     cy.get('cd-service-details').within(() => {
@@ -38,7 +37,6 @@ export class ServicesPageHelper extends PageHelper {
     });
   }
 
-  @PageHelper.restrictTo(pages.create.url)
   addService(serviceType: string, exist?: boolean, count = '1') {
     cy.get(`${this.pages.create.id}`).within(() => {
       this.selectServiceType(serviceType);
@@ -73,7 +71,6 @@ export class ServicesPageHelper extends PageHelper {
       });
   }
 
-  @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();
@@ -85,7 +82,6 @@ export class ServicesPageHelper extends PageHelper {
     });
   }
 
-  @PageHelper.restrictTo(pages.index.url)
   deleteService(serviceName: string) {
     const getRow = this.getTableCell.bind(this, this.columnIndex.service_name);
     getRow(serviceName).click();
index 6c79a74662dff6aaea887465d44b9394205e2dcd..ffc5fa83ab43059a37e0c98ee86147f8bd153336 100644 (file)
@@ -33,7 +33,7 @@ describe('Hosts page', () => {
 
     it('should display inventory', function () {
       for (const host of this.hosts) {
-        hosts.clickHostTab(host.name, 'Physical Disks');
+        hosts.clickTab('cd-host-details', host.name, 'Physical Disks');
         cy.get('cd-host-details').within(() => {
           hosts.getTableCount('total').should('be.gte', 0);
         });
@@ -42,7 +42,7 @@ describe('Hosts page', () => {
 
     it('should display daemons', function () {
       for (const host of this.hosts) {
-        hosts.clickHostTab(host.name, 'Daemons');
+        hosts.clickTab('cd-host-details', host.name, 'Daemons');
         cy.get('cd-host-details').within(() => {
           hosts.getTableCount('total').should('be.gte', 0);
         });
index 43e8aee595d8cf9b25ae105c6b4d7c382680fec7..f26228510f5e99e8fdbc123bef45652f3978b41f 100644 (file)
@@ -16,7 +16,7 @@ describe('Hosts page', () => {
 
     it('should display correct inventory', function () {
       for (const host of this.hosts) {
-        hosts.clickHostTab(host.name, 'Physical Disks');
+        hosts.clickTab('cd-host-details', host.name, 'Physical Disks');
         cy.get('cd-host-details').within(() => {
           hosts.getTableCount('total').should('be.eq', host.devices.length);
         });
index d36ffc17eed162ef1cb7d6f7491b937f53b1efaa..9f5e8ceda862b81501ba9a10cccbd6da8e67e03d 100644 (file)
@@ -14,16 +14,16 @@ describe('Services page', () => {
       services.navigateTo('create');
       services.addService('rgw');
 
-      services.checkExist('rgw.rgw.foo', true);
+      services.checkExist('rgw.foo', true);
     });
 
     it('should create and delete an ingress service', () => {
       services.navigateTo('create');
       services.addService('ingress');
 
-      services.checkExist('ingress.rgw.rgw.foo', true);
+      services.checkExist('ingress.rgw.foo', true);
 
-      services.deleteService('ingress.rgw.rgw.foo');
+      services.deleteService('ingress.rgw.foo');
     });
   });
 });
index d776a210a57eeb276d86dbdbe03e51c475e8cb81..02ebb184b39d69f772cb9e4d4467179649b0727e 100644 (file)
@@ -9,11 +9,11 @@ describe('Create cluster page', () => {
     createCluster.navigateTo();
   });
 
-  it('should fail to create cluster', () => {
+  it('should open the wizard when Expand Cluster is clicked', () => {
     createCluster.createCluster();
   });
 
-  it('should skip to dashboard landing page', () => {
+  it('should skip to dashboard landing page when Skip is clicked', () => {
     createCluster.doSkip();
   });
 });
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/01-hosts.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/01-hosts.e2e-spec.ts
deleted file mode 100644 (file)
index e8dea8e..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-import { HostsPageHelper } from 'cypress/integration/cluster/hosts.po';
-import { ServicesPageHelper } from 'cypress/integration/cluster/services.po';
-
-describe('Hosts page', () => {
-  const hosts = new HostsPageHelper();
-  const services = new ServicesPageHelper();
-
-  const serviceName = 'rgw.foo';
-  const hostnames = [
-    'ceph-node-00.cephlab.com',
-    'ceph-node-01.cephlab.com',
-    'ceph-node-02.cephlab.com'
-  ];
-  const addHost = (hostname: string, exist?: boolean, maintenance?: boolean) => {
-    hosts.navigateTo('add');
-    hosts.add(hostname, exist, maintenance);
-    hosts.checkExist(hostname, true);
-  };
-
-  beforeEach(() => {
-    cy.login();
-    Cypress.Cookies.preserveOnce('token');
-    hosts.navigateTo();
-  });
-
-  describe('when Orchestrator is available', () => {
-    it('should add a host', () => {
-      addHost(hostnames[2], false, false);
-    });
-
-    it('should display inventory', function () {
-      hosts.clickHostTab(hostnames[0], 'Physical Disks');
-      cy.get('cd-host-details').within(() => {
-        hosts.getTableCount('total').should('be.gte', 0);
-      });
-    });
-
-    it('should display daemons', function () {
-      hosts.clickHostTab(hostnames[0], 'Daemons');
-      cy.get('cd-host-details').within(() => {
-        hosts.getTableCount('total').should('be.gte', 0);
-      });
-    });
-
-    it('should edit host labels', function () {
-      const labels = ['foo', 'bar'];
-      hosts.editLabels(hostnames[0], labels, true);
-      hosts.editLabels(hostnames[0], labels, false);
-    });
-
-    it('should not add an existing host', function () {
-      hosts.navigateTo('add');
-      hosts.add(hostnames[0], true);
-    });
-
-    it('should add a host in maintenance mode', function () {
-      addHost(hostnames[1], false, true);
-    });
-
-    it('should delete a host and add it back', function () {
-      hosts.delete(hostnames[1]);
-      addHost(hostnames[1], false, true);
-    });
-
-    it('should exit host from maintenance', function () {
-      hosts.maintenance(hostnames[1], true);
-    });
-
-    it('should check if mon service is running', () => {
-      hosts.clickHostTab(hostnames[1], 'Daemons');
-      cy.get('cd-host-details').within(() => {
-        services.checkServiceStatus('mon');
-      });
-    });
-
-    it('should create rgw services', () => {
-      services.navigateTo('create');
-      services.addService('rgw', false, '3');
-      services.checkExist(serviceName, true);
-      hosts.navigateTo();
-      hosts.clickHostTab(hostnames[1], 'Daemons');
-      cy.get('cd-host-details').within(() => {
-        services.checkServiceStatus('rgw');
-      });
-    });
-
-    it('should force maintenance', () => {
-      hosts.maintenance(hostnames[1], true, true);
-    });
-  });
-});
index 3b64c2987c9e55f0d25e2daa11b9cf76ec06a34f..a35bd6c10748ee3e6dbd9ce5eda9fc8c5afa979f 100644 (file)
@@ -1,15 +1,20 @@
-import { CreateClusterWizardHelper } from 'cypress/integration/cluster/create-cluster.po';
+import {
+  CreateClusterHostPageHelper,
+  CreateClusterWizardHelper
+} from 'cypress/integration/cluster/create-cluster.po';
 
 describe('Create cluster add host page', () => {
   const createCluster = new CreateClusterWizardHelper();
+  const createClusterHostPage = new CreateClusterHostPageHelper();
   const hostnames = [
     'ceph-node-00.cephlab.com',
     'ceph-node-01.cephlab.com',
     'ceph-node-02.cephlab.com'
   ];
   const addHost = (hostname: string, exist?: boolean) => {
-    createCluster.add(hostname, exist, false);
-    createCluster.checkExist(hostname, true);
+    cy.get('.btn.btn-accent').first().click({ force: true });
+    createClusterHostPage.add(hostname, exist, false);
+    createClusterHostPage.checkExist(hostname, true);
   };
 
   beforeEach(() => {
@@ -19,35 +24,37 @@ describe('Create cluster add host page', () => {
     createCluster.createCluster();
   });
 
-  it('should check if nav-link and title contains Add Hosts', () => {
+  it('should check if title contains Add Hosts', () => {
     cy.get('.nav-link').should('contain.text', 'Add Hosts');
 
     cy.get('.title').should('contain.text', 'Add Hosts');
   });
 
   it('should check existing host and add new hosts', () => {
-    createCluster.checkExist(hostnames[0], true);
+    createClusterHostPage.checkExist(hostnames[0], true);
 
     addHost(hostnames[1], false);
     addHost(hostnames[2], false);
   });
 
+  it('should delete a host and add it back', () => {
+    createClusterHostPage.delete(hostnames[1]);
+    addHost(hostnames[1], false);
+  });
+
   it('should verify "_no_schedule" label is added', () => {
-    createCluster.checkLabelExists(hostnames[1], ['_no_schedule'], true);
-    createCluster.checkLabelExists(hostnames[2], ['_no_schedule'], true);
+    createClusterHostPage.checkLabelExists(hostnames[1], ['_no_schedule'], true);
+    createClusterHostPage.checkLabelExists(hostnames[2], ['_no_schedule'], true);
   });
 
   it('should not add an existing host', () => {
-    createCluster.add(hostnames[0], true);
+    cy.get('.btn.btn-accent').first().click({ force: true });
+    createClusterHostPage.add(hostnames[0], true);
   });
 
   it('should edit host labels', () => {
     const labels = ['foo', 'bar'];
-    createCluster.editLabels(hostnames[0], labels, true);
-    createCluster.editLabels(hostnames[0], labels, false);
-  });
-
-  it('should delete a host', () => {
-    createCluster.delete(hostnames[1]);
+    createClusterHostPage.editLabels(hostnames[0], labels, true);
+    createClusterHostPage.editLabels(hostnames[0], labels, false);
   });
 });
index ee272bcf943b23387857a9c210277c7a3c941a40..c8d93b4796230a2b55e11bff0b2957127a590db7 100644 (file)
@@ -11,12 +11,10 @@ describe('Create cluster create osds page', () => {
     Cypress.Cookies.preserveOnce('token');
     createCluster.navigateTo();
     createCluster.createCluster();
-    cy.get('button[aria-label="Next"]').click();
+    cy.get('.nav-link').contains('Create OSDs').click();
   });
 
-  it('should check if nav-link and title contains Create OSDs', () => {
-    cy.get('.nav-link').should('contain.text', 'Create OSDs');
-
+  it('should check if title contains Create OSDs', () => {
     cy.get('.title').should('contain.text', 'Create OSDs');
   });
 
@@ -27,13 +25,16 @@ describe('Create cluster create osds page', () => {
 
       createCluster.navigateTo();
       createCluster.createCluster();
-      cy.get('button[aria-label="Next"]').click();
+      cy.get('.nav-link').contains('Create OSDs').click();
 
       createCluster.createOSD('hdd');
 
+      // Go to the Review section and Expand the cluster
+      // because the drive group spec is only stored
+      // in frontend and will be lost when refreshed
+      cy.get('.nav-link').contains('Review').click();
       cy.get('button[aria-label="Next"]').click();
-      cy.get('button[aria-label="Next"]').click();
-      cy.get('button[aria-label="Next"]').click();
+      cy.get('cd-dashboard').should('exist');
     });
   });
 });
index 0a95474c91d3f25745fcb1ed237db73849d8bd92..5060a22649b57028b7fff509c6c223cc6c81ca85 100644 (file)
@@ -1,36 +1,38 @@
-import { CreateClusterWizardHelper } from 'cypress/integration/cluster/create-cluster.po';
+import {
+  CreateClusterServicePageHelper,
+  CreateClusterWizardHelper
+} from 'cypress/integration/cluster/create-cluster.po';
 
 describe('Create cluster create services page', () => {
   const createCluster = new CreateClusterWizardHelper();
+  const createClusterServicePage = new CreateClusterServicePageHelper();
 
   beforeEach(() => {
     cy.login();
     Cypress.Cookies.preserveOnce('token');
     createCluster.navigateTo();
     createCluster.createCluster();
-    cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
+    cy.get('.nav-link').contains('Create Services').click();
   });
 
-  it('should check if nav-link and title contains Create Services', () => {
-    cy.get('.nav-link').should('contain.text', 'Create Services');
-
+  it('should check if title contains Create Services', () => {
     cy.get('.title').should('contain.text', 'Create Services');
   });
 
   describe('when Orchestrator is available', () => {
     it('should create an rgw service', () => {
-      createCluster.addService('rgw');
+      cy.get('.btn.btn-accent').first().click({ force: true });
 
-      createCluster.checkExist('rgw.rgw', true);
+      createClusterServicePage.addService('rgw', false, '3');
+      createClusterServicePage.checkExist('rgw.foo', true);
     });
 
     it('should create and delete an ingress service', () => {
-      createCluster.addService('ingress');
-
-      createCluster.checkExist('ingress.rgw.rgw', true);
+      cy.get('.btn.btn-accent').first().click({ force: true });
 
-      createCluster.deleteService('ingress.rgw.rgw', 60000);
+      createClusterServicePage.addService('ingress');
+      createClusterServicePage.checkExist('ingress.rgw.foo', true);
+      createClusterServicePage.deleteService('ingress.rgw.foo');
     });
   });
 });
index 29fd3a27f8edf34ad9b0018e4fa50cdf74c7a203..411522290259a5bf2bb9facde924d626e52afefa 100644 (file)
@@ -1,7 +1,11 @@
-import { CreateClusterWizardHelper } from 'cypress/integration/cluster/create-cluster.po';
+import {
+  CreateClusterHostPageHelper,
+  CreateClusterWizardHelper
+} from 'cypress/integration/cluster/create-cluster.po';
 
 describe('Create Cluster Review page', () => {
   const createCluster = new CreateClusterWizardHelper();
+  const createClusterHostPage = new CreateClusterHostPageHelper();
 
   beforeEach(() => {
     cy.login();
@@ -9,14 +13,12 @@ describe('Create Cluster Review page', () => {
     createCluster.navigateTo();
     createCluster.createCluster();
 
-    cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
+    cy.get('.nav-link').contains('Review').click();
   });
 
   describe('navigation link test', () => {
-    it('should check if nav-link contains Review', () => {
-      cy.get('.nav-link').should('contain.text', 'Review');
+    it('should check if active nav-link is of Review section', () => {
+      cy.get('.nav-link.active').should('contain.text', 'Review');
     });
   });
 
@@ -68,7 +70,7 @@ describe('Create Cluster Review page', () => {
     });
 
     it('should check default host name is present', () => {
-      createCluster.check_for_host();
+      createClusterHostPage.check_for_host();
     });
   });
 });
index a5b54786b87388bdb8ed1a9d279a724fd580f9b9..ac21714d321cb2dab762be55aae9f5d826f782c5 100644 (file)
@@ -5,6 +5,8 @@ import { ServicesPageHelper } from 'cypress/integration/cluster/services.po';
 
 describe('when cluster creation is completed', () => {
   const createCluster = new CreateClusterWizardHelper();
+  const services = new ServicesPageHelper();
+  const serviceName = 'rgw.foo';
 
   beforeEach(() => {
     cy.login();
@@ -15,40 +17,53 @@ describe('when cluster creation is completed', () => {
     createCluster.navigateTo();
     createCluster.createCluster();
 
+    cy.get('.nav-link').contains('Review').click();
     cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
-    cy.get('button[aria-label="Next"]').click();
-
     cy.get('cd-dashboard').should('exist');
   });
 
   describe('Hosts page', () => {
     const hosts = new HostsPageHelper();
-    const hostnames = ['ceph-node-00.cephlab.com', 'ceph-node-02.cephlab.com'];
+    const hostnames = [
+      'ceph-node-00.cephlab.com',
+      'ceph-node-01.cephlab.com',
+      'ceph-node-02.cephlab.com'
+    ];
 
     beforeEach(() => {
       hosts.navigateTo();
     });
+
     it('should have removed "_no_schedule" label', () => {
-      for (let host = 0; host < hostnames.length; host++) {
-        cy.get('datatable-row-wrapper').should('not.have.text', '_no_schedule');
+      for (const hostname of hostnames) {
+        hosts.checkLabelExists(hostname, ['_no_schedule'], false);
       }
     });
 
     it('should display inventory', () => {
-      hosts.clickHostTab(hostnames[1], 'Physical Disks');
+      hosts.clickTab('cd-host-details', hostnames[1], 'Physical Disks');
       cy.get('cd-host-details').within(() => {
         hosts.getTableCount('total').should('be.gte', 0);
       });
     });
 
     it('should display daemons', () => {
-      hosts.clickHostTab(hostnames[1], 'Daemons');
+      hosts.clickTab('cd-host-details', hostnames[1], 'Daemons');
       cy.get('cd-host-details').within(() => {
         hosts.getTableCount('total').should('be.gte', 0);
       });
     });
+
+    it('should check if rgw service is running', () => {
+      hosts.clickTab('cd-host-details', hostnames[1], 'Daemons');
+      cy.get('cd-host-details').within(() => {
+        services.checkServiceStatus('rgw');
+      });
+    });
+
+    it('should force maintenance and exit', { retries: 1 }, () => {
+      hosts.maintenance(hostnames[1], true, true);
+    });
   });
 
   describe('OSDs page', () => {
@@ -59,19 +74,17 @@ describe('when cluster creation is completed', () => {
     });
 
     it('should check if osds are created', { retries: 1 }, () => {
-      osds.expectTableCount('total', 2);
+      osds.getTableCount('total').should('be.gte', 1);
     });
   });
 
   describe('Services page', () => {
-    const services = new ServicesPageHelper();
-
     beforeEach(() => {
       services.navigateTo();
     });
 
     it('should check if services are created', () => {
-      services.checkExist('rgw.rgw', true);
+      services.checkExist(serviceName, true);
     });
   });
 });
index 5405da94f0128bfbb55570e2cee832bb58a175ac..6395128c9473470e0f47accdc86a98e515ae2eda 100644 (file)
@@ -85,6 +85,19 @@ export abstract class PageHelper {
     return this.getTabs().its('length');
   }
 
+  /**
+   * Helper method to navigate/click a tab inside the expanded table row.
+   * @param selector The selector of the expanded table row.
+   * @param name The name of the row which should expand.
+   * @param tabName Name of the tab to be navigated/clicked.
+   */
+  clickTab(selector: string, name: string, tabName: string) {
+    this.getExpandCollapseElement(name).click();
+    cy.get(selector).within(() => {
+      this.getTab(tabName).click();
+    });
+  }
+
   /**
    * Helper method to select an option inside a select element.
    * This method will also expect that the option was set.