[ACA-1683] add tests for viewer - general (#570)

* rename method to be more clear

* change some files to async / await as they were very difficult to follow

* add uploadApi and a few resource files needed by Viewer tests

* add Viewer e2e component and viewer general tests

* add tests for the other list views as well

* add “docx” to dictionary
This commit is contained in:
Adina Parpalita
2018-08-17 14:27:22 +03:00
committed by Denys Vuika
parent 5e4e8ed28c
commit c0321fe449
20 changed files with 747 additions and 449 deletions

View File

@@ -40,29 +40,34 @@ export class ToolbarActions extends Component {
super(ToolbarActions.selectors.root, ancestor);
}
isEmpty(): promise.Promise<boolean> {
return this.buttons.count().then(count => (count === 0));
async isEmpty() {
return await this.buttons.count() === 0;
}
isButtonPresent(title: string): promise.Promise<boolean> {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent();
async isButtonPresent(title: string) {
return await this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent();
}
getButtonByLabel(label: string): ElementFinder {
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label));
}
getButtonByTitleAttribute(title: string): ElementFinder {
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`));
}
openMoreMenu() {
return this.getButtonByTitleAttribute('More actions').click()
.then(() => this.menu.waitForMenuToOpen())
.then(() => this.menu);
async openMoreMenu() {
await this.getButtonByTitleAttribute('More actions').click();
await this.menu.waitForMenuToOpen();
return this.menu;
}
closeMoreMenu() {
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
async closeMoreMenu() {
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
}