From 0a65823be009789daff37c807221ec03d99f7059 Mon Sep 17 00:00:00 2001 From: Rafael Quintero Date: Fri, 9 Aug 2019 16:02:36 -0400 Subject: [PATCH] mgr/dashboard: Verify fields on Configuration page Fixes: https://tracker.ceph.com/issues/41193 Signed-off-by: Adam King Signed-off-by: Rafael Quintero --- .../e2e/cluster/configuration.e2e-spec.ts | 21 +++++++++++++++++++ .../dashboard/frontend/e2e/page-helper.po.ts | 12 +++++++++++ .../configuration.component.spec.ts | 7 +++++++ 3 files changed, 40 insertions(+) diff --git a/src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.e2e-spec.ts index 527704c771b..05209f5b537 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.e2e-spec.ts @@ -1,3 +1,4 @@ +import { $ } from 'protractor'; import { Helper } from '../helper.po'; import { ConfigurationPageHelper } from './configuration.po'; @@ -21,6 +22,26 @@ describe('Configuration page', () => { await expect(configuration.getBreadcrumbText()).toEqual('Configuration'); }); }); + + describe('fields check', () => { + beforeAll(() => { + configuration.navigateTo(); + }); + + it('should verify that selected footer increases when an entry is clicked', async () => { + await configuration.getFirstCell().click(); + const selectedCount = await configuration.getTableSelectedCount(); + await expect(selectedCount).toBe(1); + }); + + it('should check that details table opens and tab is correct', async () => { + await configuration.getFirstCell().click(); + await expect($('.table.table-striped.table-bordered').isDisplayed()); + await expect(configuration.getTabsCount()).toEqual(1); + await expect(configuration.getTabText(0)).toEqual('Details'); + }); + }); + describe('edit configuration test', () => { beforeAll(async () => { await configuration.navigateTo(); 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 519344a364f..df5fbf2cfb5 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts @@ -96,6 +96,14 @@ export abstract class PageHelper { return Number(text.match(/(\d+)\s+total/)[1]); } + async getTableSelectedCount(): Promise { + const text = await $$('.datatable-footer-inner .page-count span') + .filter(async (e) => (await e.getText()).includes('selected')) + .first() + .getText(); + return Number(text.match(/(\d+)\s+selected/)[1]); + } + getTableCell(content: string): ElementFinder { return element(by.cssContainingText('.datatable-body-cell-label', content)); } @@ -266,4 +274,8 @@ export abstract class PageHelper { async waitFn(func: Function, message?: string) { return browser.wait(func, TIMEOUT, message); } + + getFirstCell(): ElementFinder { + return $$('.datatable-body-cell-label').first(); + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts index b58ef58c938..712c478dab2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts @@ -1,6 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TabsModule } from 'ngx-bootstrap/tabs'; @@ -35,4 +36,10 @@ describe('ConfigurationComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should check header text', () => { + expect(fixture.debugElement.query(By.css('.datatable-header')).nativeElement.textContent).toBe( + ['Name', 'Description', 'Current value', 'Default', 'Editable'].join('') + ); + }); }); -- 2.39.5