]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: migrate E2E daemons to async/await
authorPatrick Seidensal <pseidensal@suse.com>
Mon, 19 Aug 2019 08:23:39 +0000 (10:23 +0200)
committerPatrick Seidensal <pseidensal@suse.com>
Wed, 28 Aug 2019 07:38:48 +0000 (09:38 +0200)
Fixes: https://tracker.ceph.com/issues/40693
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts
src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/e2e/rgw/daemons.po.ts

index ac24fa3909df6b415927bb2d20756aebd1f16e26..ab3324a030ec8e28c307ca3a51b6ab34f1292cd9 100644 (file)
@@ -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();
   }
 
   /**
index ed893bb1358e2611b16b388ea02dfaf4cbfcdb08..2649cf5d3d25a40af4c84a45915a903800a52c49 100644 (file)
@@ -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
index b2c4c5eed4833839ca3bf26e78cf66a7ce459e76..e5f4bd93115868a7404d2fdc1e86adacf55c0486 100644 (file)
@@ -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();
     });
   });
 });
index 65f4c863ca8cb9513ea22d3cf3e999768067b2b0..6000b667a4b584ca105868cb62266acb9c622f1e 100644 (file)
@@ -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
   }
 }