[ACA-990] stabilise e2e tests (#104)

This commit is contained in:
Adina Parpalita
2017-12-01 13:12:24 +02:00
committed by Denys Vuika
parent 2ce7d57737
commit 2d6ae127aa
6 changed files with 222 additions and 286 deletions

View File

@@ -21,11 +21,11 @@ import { Component } from '../component';
export class CreateOrEditFolderDialog extends Component {
private static selectors = {
root: '.mat-dialog-container',
root: 'adf-folder-dialog',
title: '.mat-dialog-title',
nameInput: '.mat-dialog-container .mat-input-element[placeholder="Name"]',
descriptionTextArea: '.mat-dialog-container .mat-input-element[placeholder="Description"]',
nameInput: 'input',
descriptionTextArea: 'textarea',
button: '.mat-dialog-actions button',
validationMessage: '.mat-hint span'
};
@@ -64,33 +64,27 @@ export class CreateOrEditFolderDialog extends Component {
.catch(() => '');
}
enterName(name: string): CreateOrEditFolderDialog {
const { nameInput } = this;
enterName(name: string): promise.Promise<CreateOrEditFolderDialog> {
return this.nameInput.clear()
.then(() => this.nameInput.sendKeys(name))
.then(() => this);
}
nameInput.clear();
nameInput.sendKeys(name);
return this;
enterDescription(description: string): promise.Promise<CreateOrEditFolderDialog> {
return this.descriptionTextArea.clear()
.then(() => {
browser.actions().click(this.descriptionTextArea).sendKeys(description).perform();
})
.then(() => this);
}
deleteNameWithBackspace(): promise.Promise<void> {
const { nameInput } = this;
return nameInput.clear()
return this.nameInput.clear()
.then(() => {
return nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
});
}
enterDescription(description: string): CreateOrEditFolderDialog {
const { descriptionTextArea } = this;
descriptionTextArea.clear();
descriptionTextArea.sendKeys(description);
return this;
}
clickCreate() {
return this.createButton.click();
}