add methods to check if an action is present in the menu

This commit is contained in:
Adina Parpalita
2017-11-17 23:08:25 +02:00
parent c10774a6ba
commit 03c81d8b60
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -54,4 +54,8 @@ export class Menu extends Component {
clickMenuItem(label: string): promise.Promise<void> { clickMenuItem(label: string): promise.Promise<void> {
return this.getItemByLabel(label).click(); return this.getItemByLabel(label).click();
} }
isMenuItemPresent(title: string): promise.Promise<boolean> {
return this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
}
} }
@@ -36,6 +36,10 @@ export class ToolbarActions extends Component {
return this.buttons.count().then(count => (count === 0)); return this.buttons.count().then(count => (count === 0));
} }
isButtonPresent(title: string): promise.Promise<boolean> {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent();
}
getButtonByLabel(label: string): ElementFinder { getButtonByLabel(label: string): ElementFinder {
return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label)); return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label));
} }