]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: refactoring E2E mirroring test
authorPatrick Seidensal <pseidensal@suse.com>
Mon, 26 Aug 2019 15:14:34 +0000 (17:14 +0200)
committerPatrick Seidensal <pseidensal@suse.com>
Wed, 28 Aug 2019 07:38:49 +0000 (09:38 +0200)
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
src/pybind/mgr/dashboard/frontend/e2e/block/mirroring.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/e2e/block/mirroring.po.ts
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts

index 205779a6d2e8c1bb25030bb3edee1bdb333d6111..8cbc45061fb8f1e6af5f1fe440e664177bcbaf35 100644 (file)
@@ -36,30 +36,28 @@ describe('Mirroring page', () => {
   });
 
   describe('checks that edit mode functionality shows in the pools table', async () => {
-    const poolName = 'mirrorpoolrq';
+    const poolName = 'mirroring_test';
 
     beforeAll(async () => {
       await pools.navigateTo('create'); // Need pool for mirroring testing
       await pools.create(poolName, 8, 'rbd');
-      // console.log(`before second navigateTo()`);
       await pools.navigateTo();
-      // console.log(`before pools.exist(${poolName})`);
       await pools.exist(poolName, true);
-      // console.log(`beforeAll done`);
     });
 
     it('tests editing mode for pools', async () => {
       await mirroring.navigateTo();
-      expect(await mirroring.editMirror(poolName, 'Pool'));
+
+      await mirroring.editMirror(poolName, 'Pool');
       expect(await mirroring.getFirstTableCellWithText('pool').isPresent()).toBe(true);
-      expect(await mirroring.editMirror(poolName, 'Image'));
+      await mirroring.editMirror(poolName, 'Image');
       expect(await mirroring.getFirstTableCellWithText('image').isPresent()).toBe(true);
-      expect(await mirroring.editMirror(poolName, 'Disabled'));
+      await mirroring.editMirror(poolName, 'Disabled');
       expect(await mirroring.getFirstTableCellWithText('disabled').isPresent()).toBe(true);
     });
 
     afterAll(async () => {
-      await pools.navigateTo(); // Deletes mirroring test pool
+      await pools.navigateTo();
       await pools.delete(poolName);
       await pools.navigateTo();
       await pools.exist(poolName, false);
index a95fa4225866a42e4563a8c97ae5b0bafaa45e39..d428288a3f8d36e2433a09fecddaf66cf99580e3 100644 (file)
@@ -2,11 +2,16 @@ import { $, browser, by, element } from 'protractor';
 import { Helper } from '../helper.po';
 import { PageHelper } from '../page-helper.po';
 
+const pages = { index: '/#/block/mirroring' };
+
 export class MirroringPageHelper extends PageHelper {
-  pages = { index: '/#/block/mirroring' };
+  pages = pages;
 
-  // Goes to the mirroring page and edits a pool in the Pool table. Clicks on the
-  // pool and chooses a option (either pool, image, or disabled)
+  /**
+   * Goes to the mirroring page and edits a pool in the Pool table. Clicks on the
+   * pool and chooses an option (either pool, image, or disabled)
+   */
+  @PageHelper.restrictTo(pages.index)
   async editMirror(name, option) {
     // Clicks the pool in the table
     await browser.wait(
index 64e7db0555d6cc2fbca40420a48c8a5450244bde..0b89f49ae31afe1c6ac848e11a6b88606c6ab04c 100644 (file)
@@ -113,7 +113,10 @@ export abstract class PageHelper {
     return $$('.nav.nav-tabs li').count();
   }
 
-  getFirstTableCellWithText(content): ElementFinder {
+  /**
+   * Searches multiple tables and returns the first cell of any table that matches the criteria.
+   */
+  getFirstTableCellWithText(content: string): ElementFinder {
     return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first();
   }