+import { $ } from 'protractor';
import { Helper } from '../helper.po';
import { ConfigurationPageHelper } from './configuration.po';
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();
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));
}
async waitFn(func: Function, message?: string) {
return browser.wait(func, TIMEOUT, message);
}
+
+ getFirstCell(): ElementFinder {
+ return $$('.datatable-body-cell-label').first();
+ }
}
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';
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('')
+ );
+ });
});