split toolbar and breadcrumb e2e components (#626)

This commit is contained in:
Adina Parpalita
2018-09-13 11:01:16 +03:00
committed by Denys Vuika
parent 28a4fb7ba7
commit aafa606ceb
22 changed files with 398 additions and 444 deletions

View File

@@ -23,20 +23,51 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, promise, protractor, browser } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
import { ToolbarActions } from './toolbar-actions';
import { ToolbarBreadcrumb } from './toolbar-breadcrumb';
export class Toolbar extends Component {
private static selectors = {
root: '.inner-layout__header'
root: 'adf-toolbar',
button: '.mat-icon-button'
};
actions: ToolbarActions = new ToolbarActions(this.component);
breadcrumb: ToolbarBreadcrumb = new ToolbarBreadcrumb(this.component);
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
constructor(ancestor?: ElementFinder) {
super(Toolbar.selectors.root, ancestor);
}
async isEmpty() {
return await this.buttons.count() === 0;
}
async isButtonPresent(title: string) {
return await this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)).isPresent();
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
}
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
}
async openMoreMenu() {
await this.getButtonByTitleAttribute('More actions').click();
await this.menu.waitForMenuToOpen();
return this.menu;
}
async closeMoreMenu() {
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
}