Merge pull request #29583 from rafaelquint/configfield2

mgr/dashboard: Verify fields on Configuration page

Reviewed-by: Patrick Seidensal <pnawracay@suse.com>
This commit is contained in:
Ricardo Marques 2019-08-31 10:36:01 +01:00 committed by GitHub
commit c5d45ab88a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View 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();

View 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();
}
}

View 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('')
);
});
});