[ACA-1940] add tests for search input (#776)

This commit is contained in:
Adina Parpalita
2018-11-03 18:38:39 +02:00
committed by Denys Vuika
parent 68fc762dd2
commit ae382f8b39
8 changed files with 212 additions and 30 deletions

View File

@@ -26,48 +26,30 @@
import { ElementFinder, by, browser } from 'protractor';
import { Component } from '../component';
import { UserInfo } from './user-info';
import { protractor } from 'protractor';
import { Utils } from '../../utilities/utils';
import { Menu } from '../menu/menu';
import { Toolbar } from './../toolbar/toolbar';
import { SearchInput } from '../search/search-input';
export class Header extends Component {
private locators = {
root: 'app-header',
logoLink: by.css('.app-menu__title'),
userInfo: by.css('aca-current-user'),
searchButton: by.css('.app-search-button'),
searchBar: by.css('#app-control-input'),
moreActions: by.id('app.header.more')
};
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
userInfo: UserInfo = new UserInfo(this.component);
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
searchBar: ElementFinder = browser.element(this.locators.searchBar);
moreActions: ElementFinder = browser.element(this.locators.moreActions);
menu: Menu = new Menu();
toolbar: Toolbar = new Toolbar();
searchInput: SearchInput = new SearchInput();
constructor(ancestor?: ElementFinder) {
super('adf-layout-header', ancestor);
}
async searchForText(text: string) {
await this.searchBar.clear();
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
async waitForSearchButton() {
await Utils.waitUntilElementClickable(this.searchButton);
}
async waitForSearchBar() {
await Utils.waitUntilElementClickable(this.searchBar);
}
async openMoreMenu() {
await this.moreActions.click();
await this.menu.waitForMenuToOpen();