From fcdce3589d380937e2e480d11dcae06793daf136 Mon Sep 17 00:00:00 2001 From: Rafael Quintero Date: Thu, 1 Aug 2019 10:49:53 -0400 Subject: [PATCH] mgr/dashboard: Verify fields on Monitors page Fixes: https://tracker.ceph.com/issues/41048 Signed-off-by: Adam King Signed-off-by: Rafael Quintero --- .../frontend/e2e/cluster/monitors.e2e-spec.ts | 92 +++++++++++++++++++ .../dashboard/frontend/e2e/page-helper.po.ts | 19 ++++ 2 files changed, 111 insertions(+) diff --git a/src/pybind/mgr/dashboard/frontend/e2e/cluster/monitors.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/cluster/monitors.e2e-spec.ts index 9c7f9635f5d4f..e9b47bd16aba3 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/cluster/monitors.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/cluster/monitors.e2e-spec.ts @@ -20,4 +20,96 @@ describe('Monitors page', () => { expect(monitors.getBreadcrumbText()).toEqual('Monitors'); }); }); + + describe('fields check', () => { + beforeAll(() => { + monitors.navigateTo(); + }); + + it('should check status table is present', () => { + // check for table header 'Status' + expect( + monitors + .getLegends() + .get(0) + .getText() + ).toMatch('Status'); + + // check for fields in table + expect(monitors.getStatusTable().getText()).toMatch('Cluster ID'); + expect(monitors.getStatusTable().getText()).toMatch('monmap modified'); + expect(monitors.getStatusTable().getText()).toMatch('monmap epoch'); + expect(monitors.getStatusTable().getText()).toMatch('quorum con'); + expect(monitors.getStatusTable().getText()).toMatch('quorum mon'); + expect(monitors.getStatusTable().getText()).toMatch('required con'); + expect(monitors.getStatusTable().getText()).toMatch('required mon'); + }); + + it('should check In Quorum and Not In Quorum tables are present', () => { + // check for there to be two tables + expect(monitors.getDataTable().count()).toEqual(2); + + // check for table header 'In Quorum' + expect( + monitors + .getLegends() + .get(1) + .getText() + ).toMatch('In Quorum'); + + // check for table header 'Not In Quorum' + expect( + monitors + .getLegends() + .get(2) + .getText() + ).toMatch('Not In Quorum'); + + // verify correct columns on In Quorum table + expect( + monitors + .getDataTableHeaders() + .get(0) + .getText() + ).toMatch('Name'); + expect( + monitors + .getDataTableHeaders() + .get(0) + .getText() + ).toMatch('Rank'); + expect( + monitors + .getDataTableHeaders() + .get(0) + .getText() + ).toMatch('Public Address'); + expect( + monitors + .getDataTableHeaders() + .get(0) + .getText() + ).toMatch('Open Sessions'); + + // verify correct columns on Not In Quorum table + expect( + monitors + .getDataTableHeaders() + .get(1) + .getText() + ).toMatch('Name'); + expect( + monitors + .getDataTableHeaders() + .get(1) + .getText() + ).toMatch('Rank'); + expect( + monitors + .getDataTableHeaders() + .get(1) + .getText() + ).toMatch('Public Address'); + }); + }); }); 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 37dbc9668cd11..8f2207ee3f5a4 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts @@ -121,4 +121,23 @@ export abstract class PageHelper { const url = this.pages[page]; return browser.get(url); } + + getDataTable() { + return $$('cd-table'); + } + + getStatusTable() { + // Grabs striped tables + return $$('.table.table-striped'); + } + + getLegends() { + // Grabs legends above tables + return $$('legend'); + } + + getDataTableHeaders() { + // Gets column headers of table + return $$('.datatable-header'); + } } -- 2.39.5