]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: fix issue in dashbboard test
authorPatrick Seidensal <pseidensal@suse.com>
Tue, 27 Aug 2019 13:29:15 +0000 (15:29 +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/dashboard.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts

index ba30234776545e28f172e42769b6256efb20bc21..a5908163465cb475ecd88ecc7dd12f7fa788ceb4 100644 (file)
@@ -133,7 +133,7 @@ describe('Dashboard Main Page', () => {
       const tableCount = await spec.pageObject.getTableTotalCount();
       await expect(dashCount).toBe(
         tableCount,
-        `Text of card ${spec.cardName} and regex ${spec.regexMatcher} resulted in ${dashCount} ` +
+        `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` +
           `but did not match table count ${tableCount}`
       );
     }
index 0b89f49ae31afe1c6ac848e11a6b88606c6ab04c..70b34fbc6645897849a1c92f34b1bbd138123a02 100644 (file)
@@ -89,12 +89,11 @@ export abstract class PageHelper {
   }
 
   async getTableTotalCount(): Promise<number> {
-    return Number(
-      (await $$('.datatable-footer-inner .page-count span')
-        .filter(async (e) => (await e.getText()).includes('total'))
-        .first()
-        .getText()).match(/.*(\d+\s+)total.*/)[1]
-    );
+    const text = await $$('.datatable-footer-inner .page-count span')
+      .filter(async (e) => (await e.getText()).includes('total'))
+      .first()
+      .getText();
+    return Number(text.match(/(\d+)\s+total/)[1]);
   }
 
   getTableCell(content: string): ElementFinder {