]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Move some e2e into new "ui" folder
authorTiago Melo <tmelo@suse.com>
Thu, 29 Aug 2019 16:50:55 +0000 (16:50 +0000)
committerTiago Melo <tmelo@suse.com>
Wed, 11 Sep 2019 11:00:41 +0000 (11:00 +0000)
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/e2e/dashboard.e2e-spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/e2e/dashboard.po.ts [deleted file]
src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts
src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.po.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.e2e-spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.po.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.e2e-spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.po.ts [deleted file]

diff --git a/src/pybind/mgr/dashboard/frontend/e2e/dashboard.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/dashboard.e2e-spec.ts
deleted file mode 100644 (file)
index f06c515..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-import { browser } from 'protractor';
-import { IscsiPageHelper } from './block/iscsi.po';
-import { HostsPageHelper } from './cluster/hosts.po';
-import { MonitorsPageHelper } from './cluster/monitors.po';
-import { OSDsPageHelper } from './cluster/osds.po';
-import { DashboardPageHelper } from './dashboard.po';
-import { Helper } from './helper.po';
-import { PageHelper } from './page-helper.po';
-import { PoolPageHelper } from './pools/pools.po';
-import { DaemonsPageHelper } from './rgw/daemons.po';
-
-describe('Dashboard Main Page', () => {
-  let dashboard: DashboardPageHelper;
-  let daemons: DaemonsPageHelper;
-  let hosts: HostsPageHelper;
-  let osds: OSDsPageHelper;
-  let pools: PoolPageHelper;
-  let monitors: MonitorsPageHelper;
-  let iscsi: IscsiPageHelper;
-
-  beforeAll(() => {
-    dashboard = new DashboardPageHelper();
-    daemons = new DaemonsPageHelper();
-    hosts = new HostsPageHelper();
-    osds = new OSDsPageHelper();
-    pools = new PoolPageHelper();
-    monitors = new MonitorsPageHelper();
-    iscsi = new IscsiPageHelper();
-  });
-
-  afterEach(async () => {
-    await Helper.checkConsole();
-  });
-
-  describe('Check that all hyperlinks on info cards lead to the correct page and fields exist', () => {
-    beforeEach(async () => {
-      await dashboard.navigateTo();
-    });
-
-    it('should ensure that all linked info cards lead to correct page', async () => {
-      const expectationMap = {
-        Monitors: 'Monitors',
-        OSDs: 'OSDs',
-        Hosts: 'Hosts',
-        'Object Gateways': 'Daemons',
-        'iSCSI Gateways': 'Overview',
-        Pools: 'Pools'
-      };
-
-      for (const [linkText, breadcrumbText] of Object.entries(expectationMap)) {
-        await expect(browser.getCurrentUrl()).toContain('/#/dashboard');
-        await dashboard.clickInfoCardLink(linkText);
-        await dashboard.waitTextToBePresent(dashboard.getBreadcrumb(), breadcrumbText);
-        await dashboard.navigateBack();
-      }
-    });
-
-    it('should verify that info cards exist on dashboard in proper order', async () => {
-      // Ensures that info cards are all displayed on the dashboard tab while being in the proper
-      // order, checks for card title and position via indexing into a list of all info cards.
-      const order = [
-        'Cluster Status',
-        'Monitors',
-        'OSDs',
-        'Manager Daemons',
-        'Hosts',
-        'Object Gateways',
-        'Metadata Servers',
-        'iSCSI Gateways',
-        'Client IOPS',
-        'Client Throughput',
-        'Client Read/Write',
-        'Recovery Throughput',
-        'Scrub',
-        'Pools',
-        'Raw Capacity',
-        'Objects',
-        'PGs per OSD',
-        'PG Status'
-      ];
-
-      for (let i = 0; i < order.length; i++) {
-        await expect((await dashboard.infoCard(i)).getText()).toContain(
-          order[i],
-          `Order of ${order[i]} seems to be wrong`
-        );
-      }
-    });
-
-    it('should verify that info card group titles are present and in the right order', async () => {
-      await expect(browser.getCurrentUrl()).toContain('/#/dashboard');
-      await expect(dashboard.infoGroupTitle(0)).toBe('Status');
-      await expect(dashboard.infoGroupTitle(1)).toBe('Performance');
-      await expect(dashboard.infoGroupTitle(2)).toBe('Capacity');
-    });
-  });
-
-  it('Should check that dashboard cards have correct information', async () => {
-    interface TestSpec {
-      cardName: string;
-      regexMatcher?: RegExp;
-      pageObject: PageHelper;
-    }
-
-    const testSpecs: TestSpec[] = [
-      { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons },
-      { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors },
-      { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts },
-      { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds },
-      { cardName: 'Pools', pageObject: pools },
-      { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi }
-    ];
-
-    for (let i = 0; i < testSpecs.length; i++) {
-      const spec = testSpecs[i];
-      await dashboard.navigateTo();
-      const infoCardBodyText = await dashboard.infoCardBodyText(spec.cardName);
-      let dashCount = 0;
-      if (spec.regexMatcher) {
-        const match = infoCardBodyText.match(new RegExp(spec.regexMatcher));
-        if (match && match.length > 1) {
-          dashCount = Number(match[1]);
-        } else {
-          return Promise.reject(
-            `Regex ${spec.regexMatcher} did not find a match for card with name ` +
-              `${spec.cardName}`
-          );
-        }
-      } else {
-        dashCount = Number(infoCardBodyText);
-      }
-      await spec.pageObject.navigateTo();
-      const tableCount = await spec.pageObject.getTableTotalCount();
-      await expect(dashCount).toBe(
-        tableCount,
-        `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` +
-          `but did not match table count ${tableCount}`
-      );
-    }
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/dashboard.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/dashboard.po.ts
deleted file mode 100644 (file)
index a4271d9..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-import { $, $$, by, ElementFinder } from 'protractor';
-import { PageHelper } from './page-helper.po';
-
-export class DashboardPageHelper extends PageHelper {
-  pages = {
-    index: '/#/dashboard'
-  };
-
-  async infoGroupTitle(index: number): Promise<string> {
-    return $$('.info-group-title')
-      .get(index)
-      .getText();
-  }
-
-  async clickInfoCardLink(cardName: string): Promise<void> {
-    await $(`cd-info-card[cardtitle="${cardName}"]`)
-      .element(by.linkText(cardName))
-      .click();
-  }
-
-  async infoCard(indexOrTitle: number | string): Promise<ElementFinder> {
-    let infoCards = $$('cd-info-card');
-    if (typeof indexOrTitle === 'number') {
-      if ((await infoCards.count()) <= indexOrTitle) {
-        return Promise.reject(
-          `No element found for index ${indexOrTitle}. Elements array has ` +
-            `only ${await infoCards.count()} elements.`
-        );
-      }
-      return infoCards.get(indexOrTitle);
-    } else if (typeof indexOrTitle === 'string') {
-      infoCards = infoCards.filter(
-        async (e) => (await e.$('.card-title').getText()) === indexOrTitle
-      );
-      if ((await infoCards.count()) === 0) {
-        return Promise.reject(`No element found for title "${indexOrTitle}"`);
-      }
-      return infoCards.first();
-    }
-  }
-
-  async infoCardBodyText(
-    infoCard: ElementFinder | Promise<ElementFinder> | string
-  ): Promise<string> {
-    let _infoCard: ElementFinder;
-    if (typeof infoCard === 'string') {
-      _infoCard = await this.infoCard(infoCard);
-    } else {
-      _infoCard = typeof infoCard.then === 'function' ? await infoCard : infoCard;
-    }
-    return _infoCard.$('.card-text').getText();
-  }
-}
index 1bf9ca2131bdbdc0d5c411e3d6a7a48beeccb4f2..8c3259b730898af3ed543af6675a616829e0cc8e 100644 (file)
@@ -10,14 +10,14 @@ import { LogsPageHelper } from './cluster/logs.po';
 import { ManagerModulesPageHelper } from './cluster/mgr-modules.po';
 import { MonitorsPageHelper } from './cluster/monitors.po';
 import { OSDsPageHelper } from './cluster/osds.po';
-import { DashboardPageHelper } from './dashboard.po';
 import { FilesystemsPageHelper } from './filesystems/filesystems.po';
 import { NfsPageHelper } from './nfs/nfs.po';
 import { PoolPageHelper } from './pools/pools.po';
 import { BucketsPageHelper } from './rgw/buckets.po';
 import { DaemonsPageHelper } from './rgw/daemons.po';
 import { UsersPageHelper } from './rgw/users.po';
-import { UserMgmtPageHelper } from './user-mgmt.po';
+import { DashboardPageHelper } from './ui/dashboard.po';
+import { UserMgmtPageHelper } from './ui/user-mgmt.po';
 
 export class Helper {
   pools: PoolPageHelper;
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts
new file mode 100644 (file)
index 0000000..a0ece31
--- /dev/null
@@ -0,0 +1,141 @@
+import { browser } from 'protractor';
+import { IscsiPageHelper } from '../block/iscsi.po';
+import { HostsPageHelper } from '../cluster/hosts.po';
+import { MonitorsPageHelper } from '../cluster/monitors.po';
+import { OSDsPageHelper } from '../cluster/osds.po';
+import { Helper } from '../helper.po';
+import { PageHelper } from '../page-helper.po';
+import { PoolPageHelper } from '../pools/pools.po';
+import { DaemonsPageHelper } from '../rgw/daemons.po';
+import { DashboardPageHelper } from './dashboard.po';
+
+describe('Dashboard Main Page', () => {
+  let dashboard: DashboardPageHelper;
+  let daemons: DaemonsPageHelper;
+  let hosts: HostsPageHelper;
+  let osds: OSDsPageHelper;
+  let pools: PoolPageHelper;
+  let monitors: MonitorsPageHelper;
+  let iscsi: IscsiPageHelper;
+
+  beforeAll(() => {
+    dashboard = new DashboardPageHelper();
+    daemons = new DaemonsPageHelper();
+    hosts = new HostsPageHelper();
+    osds = new OSDsPageHelper();
+    pools = new PoolPageHelper();
+    monitors = new MonitorsPageHelper();
+    iscsi = new IscsiPageHelper();
+  });
+
+  afterEach(async () => {
+    await Helper.checkConsole();
+  });
+
+  describe('Check that all hyperlinks on info cards lead to the correct page and fields exist', () => {
+    beforeEach(async () => {
+      await dashboard.navigateTo();
+    });
+
+    it('should ensure that all linked info cards lead to correct page', async () => {
+      const expectationMap = {
+        Monitors: 'Monitors',
+        OSDs: 'OSDs',
+        Hosts: 'Hosts',
+        'Object Gateways': 'Daemons',
+        'iSCSI Gateways': 'Overview',
+        Pools: 'Pools'
+      };
+
+      for (const [linkText, breadcrumbText] of Object.entries(expectationMap)) {
+        await expect(browser.getCurrentUrl()).toContain('/#/dashboard');
+        await dashboard.clickInfoCardLink(linkText);
+        await dashboard.waitTextToBePresent(dashboard.getBreadcrumb(), breadcrumbText);
+        await dashboard.navigateBack();
+      }
+    });
+
+    it('should verify that info cards exist on dashboard in proper order', async () => {
+      // Ensures that info cards are all displayed on the dashboard tab while being in the proper
+      // order, checks for card title and position via indexing into a list of all info cards.
+      const order = [
+        'Cluster Status',
+        'Monitors',
+        'OSDs',
+        'Manager Daemons',
+        'Hosts',
+        'Object Gateways',
+        'Metadata Servers',
+        'iSCSI Gateways',
+        'Client IOPS',
+        'Client Throughput',
+        'Client Read/Write',
+        'Recovery Throughput',
+        'Scrub',
+        'Pools',
+        'Raw Capacity',
+        'Objects',
+        'PGs per OSD',
+        'PG Status'
+      ];
+
+      for (let i = 0; i < order.length; i++) {
+        await expect((await dashboard.infoCard(i)).getText()).toContain(
+          order[i],
+          `Order of ${order[i]} seems to be wrong`
+        );
+      }
+    });
+
+    it('should verify that info card group titles are present and in the right order', async () => {
+      await expect(browser.getCurrentUrl()).toContain('/#/dashboard');
+      await expect(dashboard.infoGroupTitle(0)).toBe('Status');
+      await expect(dashboard.infoGroupTitle(1)).toBe('Performance');
+      await expect(dashboard.infoGroupTitle(2)).toBe('Capacity');
+    });
+  });
+
+  it('Should check that dashboard cards have correct information', async () => {
+    interface TestSpec {
+      cardName: string;
+      regexMatcher?: RegExp;
+      pageObject: PageHelper;
+    }
+
+    const testSpecs: TestSpec[] = [
+      { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons },
+      { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors },
+      { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts },
+      { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds },
+      { cardName: 'Pools', pageObject: pools },
+      { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi }
+    ];
+
+    for (let i = 0; i < testSpecs.length; i++) {
+      const spec = testSpecs[i];
+      await dashboard.navigateTo();
+      const infoCardBodyText = await dashboard.infoCardBodyText(spec.cardName);
+      let dashCount = 0;
+      if (spec.regexMatcher) {
+        const match = infoCardBodyText.match(new RegExp(spec.regexMatcher));
+        if (match && match.length > 1) {
+          dashCount = Number(match[1]);
+        } else {
+          return Promise.reject(
+            `Regex ${spec.regexMatcher} did not find a match for card with name ` +
+              `${spec.cardName}`
+          );
+        }
+      } else {
+        dashCount = Number(infoCardBodyText);
+      }
+      await spec.pageObject.navigateTo();
+      const tableCount = await spec.pageObject.getTableTotalCount();
+      await expect(dashCount).toBe(
+        tableCount,
+        `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` +
+          `but did not match table count ${tableCount}`
+      );
+    }
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.po.ts
new file mode 100644 (file)
index 0000000..f0a2338
--- /dev/null
@@ -0,0 +1,53 @@
+import { $, $$, by, ElementFinder } from 'protractor';
+import { PageHelper } from '../page-helper.po';
+
+export class DashboardPageHelper extends PageHelper {
+  pages = {
+    index: '/#/dashboard'
+  };
+
+  async infoGroupTitle(index: number): Promise<string> {
+    return $$('.info-group-title')
+      .get(index)
+      .getText();
+  }
+
+  async clickInfoCardLink(cardName: string): Promise<void> {
+    await $(`cd-info-card[cardtitle="${cardName}"]`)
+      .element(by.linkText(cardName))
+      .click();
+  }
+
+  async infoCard(indexOrTitle: number | string): Promise<ElementFinder> {
+    let infoCards = $$('cd-info-card');
+    if (typeof indexOrTitle === 'number') {
+      if ((await infoCards.count()) <= indexOrTitle) {
+        return Promise.reject(
+          `No element found for index ${indexOrTitle}. Elements array has ` +
+            `only ${await infoCards.count()} elements.`
+        );
+      }
+      return infoCards.get(indexOrTitle);
+    } else if (typeof indexOrTitle === 'string') {
+      infoCards = infoCards.filter(
+        async (e) => (await e.$('.card-title').getText()) === indexOrTitle
+      );
+      if ((await infoCards.count()) === 0) {
+        return Promise.reject(`No element found for title "${indexOrTitle}"`);
+      }
+      return infoCards.first();
+    }
+  }
+
+  async infoCardBodyText(
+    infoCard: ElementFinder | Promise<ElementFinder> | string
+  ): Promise<string> {
+    let _infoCard: ElementFinder;
+    if (typeof infoCard === 'string') {
+      _infoCard = await this.infoCard(infoCard);
+    } else {
+      _infoCard = typeof infoCard.then === 'function' ? await infoCard : infoCard;
+    }
+    return _infoCard.$('.card-text').getText();
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.e2e-spec.ts
new file mode 100644 (file)
index 0000000..e3f10e8
--- /dev/null
@@ -0,0 +1,71 @@
+import { Helper } from '../helper.po';
+import { UserMgmtPageHelper } from './user-mgmt.po';
+
+describe('User Management page', () => {
+  let userManagement: UserMgmtPageHelper;
+  const user_name = 'user_mgmt_create_edit_delete_user';
+  const role_name = 'user_mgmt_create_edit_delete_role';
+
+  beforeAll(() => {
+    userManagement = new UserMgmtPageHelper();
+  });
+
+  afterEach(async () => {
+    await Helper.checkConsole();
+  });
+
+  describe('breadcrumb tests', () => {
+    it('should check breadcrumb on users tab of user management page', async () => {
+      await userManagement.navigateTo('users');
+      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Users');
+    });
+
+    it('should check breadcrumb on roles tab of user management page', async () => {
+      await userManagement.navigateTo('roles');
+      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Roles');
+    });
+
+    it('should check breadcrumb on user creation page', async () => {
+      await userManagement.navigateTo('userCreate');
+      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
+    });
+
+    it('should check breadcrumb on role creation page', async () => {
+      await userManagement.navigateTo('roleCreate');
+      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
+    });
+  });
+
+  describe('user create, edit & delete test', () => {
+    it('should create a user', async () => {
+      await userManagement.userCreate(
+        user_name,
+        'cool_password',
+        'Jeff',
+        'realemail@realwebsite.com'
+      );
+    });
+
+    it('should edit a user', async () => {
+      await userManagement.userEdit(user_name, 'cool_password_number_2', 'Geoff', 'w@m');
+    });
+
+    it('should delete a user', async () => {
+      await userManagement.userDelete(user_name);
+    });
+  });
+
+  describe('role create, edit & delete test', () => {
+    it('should create a role', async () => {
+      await userManagement.roleCreate(role_name, 'An interesting description');
+    });
+
+    it('should edit a role', async () => {
+      await userManagement.roleEdit(role_name, 'A far more interesting description');
+    });
+
+    it('should delete a role', async () => {
+      await userManagement.roleDelete(role_name);
+    });
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.po.ts
new file mode 100644 (file)
index 0000000..70fd02d
--- /dev/null
@@ -0,0 +1,108 @@
+import { $, by, element } from 'protractor';
+import { PageHelper } from '../page-helper.po';
+
+export class UserMgmtPageHelper extends PageHelper {
+  pages = {
+    index: '/#/user-management',
+    users: '/#/user-management/users',
+    userCreate: '/#/user-management/users/create',
+    roles: '/#/user-management/roles',
+    roleCreate: '/#/user-management/roles/create'
+  };
+
+  async userCreate(username, password, name, email): Promise<void> {
+    await this.navigateTo('userCreate');
+
+    // fill in fields
+    await element(by.id('username')).sendKeys(username);
+    await element(by.id('password')).sendKeys(password);
+    await element(by.id('confirmpassword')).sendKeys(password);
+    await element(by.id('name')).sendKeys(name);
+    await element(by.id('email')).sendKeys(email);
+
+    // Click the create button and wait for user to be made
+    const createButton = element(by.cssContainingText('button', 'Create User'));
+    await createButton.click();
+    await this.waitPresence(this.getTableCell(username));
+  }
+
+  async userEdit(username, password, name, email): Promise<void> {
+    await this.navigateTo('users');
+
+    await this.getTableCell(username).click(); // select user from table
+    await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
+
+    // fill in fields with new values
+    await element(by.id('password')).clear();
+    await element(by.id('password')).sendKeys(password);
+    await element(by.id('confirmpassword')).clear();
+    await element(by.id('confirmpassword')).sendKeys(password);
+    await element(by.id('name')).clear();
+    await element(by.id('name')).sendKeys(name);
+    await element(by.id('email')).clear();
+    await element(by.id('email')).sendKeys(email);
+
+    // Click the edit button and check new values are present in table
+    const editButton = element(by.cssContainingText('button', 'Edit User'));
+    await editButton.click();
+    await this.waitPresence(this.getTableCell(email));
+    await this.waitPresence(this.getTableCell(name));
+  }
+
+  async userDelete(username): Promise<void> {
+    await this.navigateTo('users');
+
+    await this.getTableCell(username).click(); // select user from table
+    await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
+    await $('li.delete a').click(); // click delete
+
+    await this.waitVisibility($('.custom-control-label'));
+    await $('.custom-control-label').click(); // click confirmation checkbox
+    await element(by.cssContainingText('button', 'Delete User')).click();
+    await this.waitStaleness(this.getFirstTableCellWithText(username));
+  }
+
+  async roleCreate(name, description): Promise<void> {
+    await this.navigateTo('roleCreate');
+
+    // fill in fields
+    await element(by.id('name')).sendKeys(name);
+    await element(by.id('description')).sendKeys(description);
+
+    // Click the create button and wait for user to be made
+    const createButton = element(by.cssContainingText('button', 'Create Role'));
+    await createButton.click();
+    await this.waitPresence(this.getTableCell(name));
+  }
+
+  async roleEdit(name, description): Promise<void> {
+    await this.navigateTo('roles');
+
+    await this.getTableCell(name).click(); // select role from table
+    await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
+
+    // fill in fields with new values
+    await element(by.id('description')).clear();
+    await element(by.id('description')).sendKeys(description);
+
+    // Click the edit button and check new values are present in table
+    const editButton = element(by.cssContainingText('button', 'Edit Role'));
+    await editButton.click();
+
+    await this.waitPresence(this.getTableCell(name));
+    await this.waitPresence(this.getTableCell(description));
+  }
+
+  async roleDelete(name) {
+    await this.navigateTo('roles');
+
+    await this.getTableCell(name).click(); // select role from table
+    await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
+    await $('li.delete a').click(); // click delete
+
+    await this.waitVisibility($('.custom-control-label'));
+    await $('.custom-control-label').click(); // click confirmation checkbox
+    await element(by.cssContainingText('button', 'Delete Role')).click();
+    await this.waitStaleness(this.getFirstTableCellWithText(name));
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.e2e-spec.ts
deleted file mode 100644 (file)
index 410b7b6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Helper } from './helper.po';
-import { UserMgmtPageHelper } from './user-mgmt.po';
-
-describe('User Management page', () => {
-  let userManagement: UserMgmtPageHelper;
-  const user_name = 'user_mgmt_create_edit_delete_user';
-  const role_name = 'user_mgmt_create_edit_delete_role';
-
-  beforeAll(() => {
-    userManagement = new UserMgmtPageHelper();
-  });
-
-  afterEach(async () => {
-    await Helper.checkConsole();
-  });
-
-  describe('breadcrumb tests', () => {
-    it('should check breadcrumb on users tab of user management page', async () => {
-      await userManagement.navigateTo('users');
-      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Users');
-    });
-
-    it('should check breadcrumb on roles tab of user management page', async () => {
-      await userManagement.navigateTo('roles');
-      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Roles');
-    });
-
-    it('should check breadcrumb on user creation page', async () => {
-      await userManagement.navigateTo('userCreate');
-      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
-    });
-
-    it('should check breadcrumb on role creation page', async () => {
-      await userManagement.navigateTo('roleCreate');
-      await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
-    });
-  });
-
-  describe('user create, edit & delete test', () => {
-    it('should create a user', async () => {
-      await userManagement.userCreate(
-        user_name,
-        'cool_password',
-        'Jeff',
-        'realemail@realwebsite.com'
-      );
-    });
-
-    it('should edit a user', async () => {
-      await userManagement.userEdit(user_name, 'cool_password_number_2', 'Geoff', 'w@m');
-    });
-
-    it('should delete a user', async () => {
-      await userManagement.userDelete(user_name);
-    });
-  });
-
-  describe('role create, edit & delete test', () => {
-    it('should create a role', async () => {
-      await userManagement.roleCreate(role_name, 'An interesting description');
-    });
-
-    it('should edit a role', async () => {
-      await userManagement.roleEdit(role_name, 'A far more interesting description');
-    });
-
-    it('should delete a role', async () => {
-      await userManagement.roleDelete(role_name);
-    });
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.po.ts b/src/pybind/mgr/dashboard/frontend/e2e/user-mgmt.po.ts
deleted file mode 100644 (file)
index 8b4de34..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-import { $, by, element } from 'protractor';
-import { PageHelper } from './page-helper.po';
-
-export class UserMgmtPageHelper extends PageHelper {
-  pages = {
-    index: '/#/user-management',
-    users: '/#/user-management/users',
-    userCreate: '/#/user-management/users/create',
-    roles: '/#/user-management/roles',
-    roleCreate: '/#/user-management/roles/create'
-  };
-
-  async userCreate(username, password, name, email): Promise<void> {
-    await this.navigateTo('userCreate');
-
-    // fill in fields
-    await element(by.id('username')).sendKeys(username);
-    await element(by.id('password')).sendKeys(password);
-    await element(by.id('confirmpassword')).sendKeys(password);
-    await element(by.id('name')).sendKeys(name);
-    await element(by.id('email')).sendKeys(email);
-
-    // Click the create button and wait for user to be made
-    const createButton = element(by.cssContainingText('button', 'Create User'));
-    await createButton.click();
-    await this.waitPresence(this.getTableCell(username));
-  }
-
-  async userEdit(username, password, name, email): Promise<void> {
-    await this.navigateTo('users');
-
-    await this.getTableCell(username).click(); // select user from table
-    await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
-
-    // fill in fields with new values
-    await element(by.id('password')).clear();
-    await element(by.id('password')).sendKeys(password);
-    await element(by.id('confirmpassword')).clear();
-    await element(by.id('confirmpassword')).sendKeys(password);
-    await element(by.id('name')).clear();
-    await element(by.id('name')).sendKeys(name);
-    await element(by.id('email')).clear();
-    await element(by.id('email')).sendKeys(email);
-
-    // Click the edit button and check new values are present in table
-    const editButton = element(by.cssContainingText('button', 'Edit User'));
-    await editButton.click();
-    await this.waitPresence(this.getTableCell(email));
-    await this.waitPresence(this.getTableCell(name));
-  }
-
-  async userDelete(username): Promise<void> {
-    await this.navigateTo('users');
-
-    await this.getTableCell(username).click(); // select user from table
-    await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
-    await $('li.delete a').click(); // click delete
-
-    await this.waitVisibility($('.custom-control-label'));
-    await $('.custom-control-label').click(); // click confirmation checkbox
-    await element(by.cssContainingText('button', 'Delete User')).click();
-    await this.waitStaleness(this.getFirstTableCellWithText(username));
-  }
-
-  async roleCreate(name, description): Promise<void> {
-    await this.navigateTo('roleCreate');
-
-    // fill in fields
-    await element(by.id('name')).sendKeys(name);
-    await element(by.id('description')).sendKeys(description);
-
-    // Click the create button and wait for user to be made
-    const createButton = element(by.cssContainingText('button', 'Create Role'));
-    await createButton.click();
-    await this.waitPresence(this.getTableCell(name));
-  }
-
-  async roleEdit(name, description): Promise<void> {
-    await this.navigateTo('roles');
-
-    await this.getTableCell(name).click(); // select role from table
-    await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
-
-    // fill in fields with new values
-    await element(by.id('description')).clear();
-    await element(by.id('description')).sendKeys(description);
-
-    // Click the edit button and check new values are present in table
-    const editButton = element(by.cssContainingText('button', 'Edit Role'));
-    await editButton.click();
-
-    await this.waitPresence(this.getTableCell(name));
-    await this.waitPresence(this.getTableCell(description));
-  }
-
-  async roleDelete(name) {
-    await this.navigateTo('roles');
-
-    await this.getTableCell(name).click(); // select role from table
-    await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
-    await $('li.delete a').click(); // click delete
-
-    await this.waitVisibility($('.custom-control-label'));
-    await $('.custom-control-label').click(); // click confirmation checkbox
-    await element(by.cssContainingText('button', 'Delete Role')).click();
-    await this.waitStaleness(this.getFirstTableCellWithText(name));
-  }
-}