From c97d960ba945bb5ec4d3a5a5f137e3e06fe2e1f6 Mon Sep 17 00:00:00 2001 From: Patrick Seidensal Date: Mon, 19 Aug 2019 10:23:39 +0200 Subject: [PATCH] mgr/dashboard: migrate E2E daemons to async/await Fixes: https://tracker.ceph.com/issues/40693 Signed-off-by: Patrick Seidensal --- .../mgr/dashboard/frontend/e2e/helper.po.ts | 4 +++ .../dashboard/frontend/e2e/page-helper.po.ts | 6 ++-- .../frontend/e2e/rgw/daemons.e2e-spec.ts | 30 +++++++++---------- .../dashboard/frontend/e2e/rgw/daemons.po.ts | 26 ++++++++-------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts index ac24fa3909df6..ab3324a030ec8 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts @@ -17,6 +17,8 @@ export class Helper { mirroring: MirroringPageHelper; dashboard: DashboardPageHelper; usermgmt: UserMgmtPageHelper; + daemons: DaemonsPageHelper; + users: UsersPageHelper; constructor() { this.pools = new PoolPageHelper(); @@ -26,6 +28,8 @@ export class Helper { this.mirroring = new MirroringPageHelper(); this.dashboard = new DashboardPageHelper(); this.usermgmt = new UserMgmtPageHelper(); + this.daemons = new DaemonsPageHelper(); + this.users = new UsersPageHelper(); } /** diff --git a/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts index ed893bb1358e2..2649cf5d3d25a 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts @@ -71,9 +71,9 @@ export abstract class PageHelper { return $$('.nav.nav-tabs li').count(); } - // getFirstTableCellWithText(content) { - // return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first(); - // } + getFirstTableCellWithText(content): ElementFinder { + return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first(); + } /** * Used for instances where a modal container would receive the click rather diff --git a/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.e2e-spec.ts index b2c4c5eed4833..e5f4bd9311586 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.e2e-spec.ts @@ -7,25 +7,25 @@ describe('RGW daemons page', () => { daemons = new Helper().daemons; }); - afterEach(() => { - Helper.checkConsole(); + afterEach(async () => { + await Helper.checkConsole(); }); describe('breadcrumb and tab tests', () => { - beforeAll(() => { - daemons.navigateTo(); + beforeAll(async () => { + await daemons.navigateTo(); }); - it('should open and show breadcrumb', () => { - expect(daemons.getBreadcrumbText()).toEqual('Daemons'); + it('should open and show breadcrumb', async () => { + expect(await daemons.getBreadcrumbText()).toEqual('Daemons'); }); - it('should show two tabs', () => { - expect(daemons.getTabsCount()).toEqual(2); + it('should show two tabs', async () => { + expect(await daemons.getTabsCount()).toEqual(2); }); - it('should show daemons list tab at first', () => { - expect(daemons.getTabText(0)).toEqual('Daemons List'); + it('should show daemons list tab at first', async () => { + expect(await daemons.getTabText(0)).toEqual('Daemons List'); }); it('should show overall performance as a second tab', () => { @@ -33,13 +33,13 @@ describe('RGW daemons page', () => { }); }); - describe('details and performance counters table tests', () => { - beforeAll(() => { - daemons.navigateTo(); + describe('details and performance counters table tests', async () => { + beforeAll(async () => { + await daemons.navigateTo(); }); - it('should check that details/performance tables are visible when daemon is selected', () => { - daemons.checkTables(); + it('should check that details/performance tables are visible when daemon is selected', async () => { + await daemons.checkTables(); }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.po.ts index 65f4c863ca8cb..6000b667a4b58 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.po.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.po.ts @@ -4,11 +4,11 @@ import { PageHelper } from '../page-helper.po'; export class DaemonsPageHelper extends PageHelper { pages = { index: '/#/rgw/daemon' }; - checkTables() { - this.navigateTo(); + async checkTables() { + await this.navigateTo(); // click on a daemon so details table appears - $$('.datatable-body-cell-label') + await $$('.datatable-body-cell-label') .first() .click(); @@ -17,25 +17,25 @@ export class DaemonsPageHelper extends PageHelper { const performance_counters_table = tab_container.all(by.css('cd-table')).get(1); // check details table is visible - expect(details_table.isDisplayed()).toBe(true); + expect(await details_table.isDisplayed()).toBe(true); // check at least one field is present - expect(details_table.getText()).toMatch('ceph_version'); + expect(await details_table.getText()).toMatch('ceph_version'); // check performance counters table is not currently visible - expect(performance_counters_table.isDisplayed()).toBe(false); + expect(await performance_counters_table.isDisplayed()).toBe(false); // click on performance counters tab and check table is loaded - element(by.cssContainingText('.nav-link', 'Performance Counters')).click(); - expect(performance_counters_table.isDisplayed()).toBe(true); + await element(by.cssContainingText('.nav-link', 'Performance Counters')).click(); + expect(await performance_counters_table.isDisplayed()).toBe(true); // check at least one field is present - expect(performance_counters_table.getText()).toMatch('objecter.op_r'); + expect(await performance_counters_table.getText()).toMatch('objecter.op_r'); // check details table is not currently visible - expect(details_table.isDisplayed()).toBe(false); + expect(await details_table.isDisplayed()).toBe(false); // click on performance details tab - element(by.cssContainingText('.nav-link', 'Performance Details')).click(); + await element(by.cssContainingText('.nav-link', 'Performance Details')).click(); // checks the other tabs' content isn't visible - expect(details_table.isDisplayed()).toBe(false); - expect(performance_counters_table.isDisplayed()).toBe(false); + expect(await details_table.isDisplayed()).toBe(false); + expect(await performance_counters_table.isDisplayed()).toBe(false); // TODO: Expect Grafana iFrame } } -- 2.39.5