From: Nizamudeen A Date: Mon, 20 Dec 2021 09:14:29 +0000 (+0530) Subject: mgr/dashboard: fix timeout error in dashboard cephadm e2e job X-Git-Tag: v17.1.0~182^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44364%2Fhead;p=ceph.git mgr/dashboard: fix timeout error in dashboard cephadm e2e job 1. Fix the timeout error happening in the dashboard e2e job 2. Take care of the flaky force maintenance check Most of the time our test is getting timed out while searching for an item in the table. Its because `.clear().type()` is not clearing the content in the search field sometimes and that creates a wrong data to be entered into the search field and it starts searching based on this wrong name. To avoid this I am explicitly clearing the search area before typing. Fixes: https://tracker.ceph.com/issues/53672 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.po.ts index f309120c60d6..0133dc31f903 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.po.ts @@ -23,7 +23,7 @@ export class ConfigurationPageHelper extends PageHelper { cy.get('[data-cy=submitBtn]').click(); // Enter config setting name into filter box - this.seachTable(name); + this.searchTable(name); // Expand row this.getExpandCollapseElement(name).click(); @@ -60,7 +60,7 @@ export class ConfigurationPageHelper extends PageHelper { cy.get('[data-cy=submitBtn]').click(); // Enter config setting name into filter box - this.seachTable(name); + this.searchTable(name); // Checks for visibility of config in table this.getExpandCollapseElement(name).should('be.visible').click(); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts index bca48766227d..f2be649ae5fe 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts @@ -69,7 +69,6 @@ export class HostsPageHelper extends PageHelper { } 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) { @@ -127,6 +126,7 @@ export class HostsPageHelper extends PageHelper { @PageHelper.restrictTo(pages.index.url) maintenance(hostname: string, exit = false, force = false) { + this.clearTableSearchInput(); if (force) { this.getTableCell(this.columnIndex.hostname, hostname).click(); this.clickActionButton('enter-maintenance'); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.po.ts index 263dfd89ec16..862c7c6011d4 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.po.ts @@ -36,7 +36,7 @@ export class OSDsPageHelper extends PageHelper { @PageHelper.restrictTo(pages.index.url) checkStatus(id: number, status: string[]) { - this.seachTable(`id:${id}`); + this.searchTable(`id:${id}`); this.expectTableCount('found', 1); cy.get(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`).should(($ele) => { const allStatus = $ele.toArray().map((v) => v.innerText); @@ -48,7 +48,7 @@ export class OSDsPageHelper extends PageHelper { @PageHelper.restrictTo(pages.index.url) ensureNoOsd(id: number) { - this.seachTable(`id:${id}`); + this.searchTable(`id:${id}`); this.expectTableCount('found', 0); this.clearTableSearchInput(); } diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index 50bd6121ce5f..0b70e90b6563 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -81,13 +81,15 @@ export class ServicesPageHelper extends PageHelper { } checkServiceStatus(daemon: string) { - this.getTableCell(this.serviceDetailColumnIndex.daemonType, daemon) - .parent() - .find(`datatable-body-cell:nth-child(${this.serviceDetailColumnIndex.status}) .badge`) - .should(($ele) => { - const status = $ele.toArray().map((v) => v.innerText); - expect(status).to.include('running'); - }); + cy.get('cd-service-daemon-list').within(() => { + this.getTableCell(this.serviceDetailColumnIndex.daemonType, daemon) + .parent() + .find(`datatable-body-cell:nth-child(${this.serviceDetailColumnIndex.status}) .badge`) + .should(($ele) => { + const status = $ele.toArray().map((v) => v.innerText); + expect(status).to.include('running'); + }); + }); } expectPlacementCount(serviceName: string, expectedCount: string) { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts index be09371013cb..46cd5fa19c9f 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts @@ -62,10 +62,6 @@ describe('when cluster creation is completed', () => { }); }); - it('should force maintenance and exit', { retries: 1 }, () => { - hosts.maintenance(hostnames[3], true, true); - }); - it('should drain, remove and add the host back', () => { hosts.drain(hostnames[1]); hosts.remove(hostnames[1]); @@ -73,6 +69,10 @@ describe('when cluster creation is completed', () => { hosts.add(hostnames[1]); hosts.checkExist(hostnames[1], true); }); + + it('should force maintenance and exit', { retries: 1 }, () => { + hosts.maintenance(hostnames[3], true, true); + }); }); describe('OSDs page', () => { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts index 85a536f05a9a..72d811065a8c 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts @@ -171,7 +171,7 @@ export abstract class PageHelper { getTableRow(content: string) { this.waitDataTableToLoad(); - this.seachTable(content); + this.searchTable(content); return cy.contains('.datatable-body-row', content); } @@ -189,7 +189,7 @@ export abstract class PageHelper { this.waitDataTableToLoad(); if (content) { - this.seachTable(content); + this.searchTable(content); return cy.contains('.datatable-body-cell-label', content); } else { return cy.get('.datatable-body-cell-label').first(); @@ -198,7 +198,8 @@ export abstract class PageHelper { getTableCell(columnIndex: number, exactContent: string) { this.waitDataTableToLoad(); - this.seachTable(exactContent); + this.clearTableSearchInput(); + this.searchTable(exactContent); return cy.contains( `datatable-body-row datatable-body-cell:nth-child(${columnIndex})`, new RegExp(`^${exactContent}$`) @@ -250,7 +251,7 @@ export abstract class PageHelper { cy.get('cd-table .dataTables_paginate input').first().clear({ force: true }).type(size); } - seachTable(text: string) { + searchTable(text: string) { this.waitDataTableToLoad(); this.setPageSize('10'); @@ -260,7 +261,7 @@ export abstract class PageHelper { clearTableSearchInput() { this.waitDataTableToLoad(); - return cy.get('cd-table .search button').click(); + return cy.get('cd-table .search button').first().click(); } // Click the action button