]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Verify fields on Configuration page
authorRafael Quintero <rafaelq@bu.edu>
Fri, 9 Aug 2019 20:02:36 +0000 (16:02 -0400)
committerAdam King <kingamk3@gmail.com>
Fri, 30 Aug 2019 12:27:49 +0000 (08:27 -0400)
Fixes: https://tracker.ceph.com/issues/41193
Signed-off-by: Adam King <adking@redhat.com>
Signed-off-by: Rafael Quintero <rquinter@redhat.com>
src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts

index 527704c771b0ca159f48142bee380517b2571392..05209f5b53762e8606f15e51510f3d0f31ec164f 100644 (file)
@@ -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();
index 519344a364fdc1f04f3b7b2128a14eba53fe56e1..df5fbf2cfb54f922518bf2fc3420ab97686f2366 100644 (file)
@@ -96,6 +96,14 @@ export abstract class PageHelper {
     return Number(text.match(/(\d+)\s+total/)[1]);
   }
 
+  async getTableSelectedCount(): Promise<number> {
+    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();
+  }
 }
index b58ef58c938598cfc98b1a2d6ed2b3f97456a3ad..712c478dab20538f98ea34c51a1190cdd14cfe83 100644 (file)
@@ -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('')
+    );
+  });
 });