Optimize e2e framework (#1428)

* reduce breadcrumb page

* imrpove readability of code

* reduce data-table page size

* reduce datetime-picker code

* fix datatable page

* header and info drawer

* update datatable page

* toolbar cleanup

* more test components cleanup

* even move component cleanup

* move wait utils to the Utils

* unified waits

* cleanup menu page

* code fixes

* fix code

* code improvements

* rename api

* fix code

* fix code

* cleanup dialog pages

* more fixes and dead code removal

* code fixes

* try to fix the flaky teset

* fix code

* fix code

* update code

* fix lint

* unified text input

* fix lint

* add missing await

* reduce the wrapper method around clear text

* resolve element value

Co-authored-by: Cilibiu Bogdan <bogdan.cilibiu@ness.com>
This commit is contained in:
Denys Vuika
2020-04-29 08:40:55 +01:00
committed by GitHub
parent ebdaa39209
commit 5259f840a8
78 changed files with 1521 additions and 2486 deletions

View File

@@ -23,71 +23,35 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by } from 'protractor';
import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled, typeText } from '../../utilities/utils';
export class UploadNewVersionDialog extends GenericDialog {
private static selectors = {
root: '.aca-node-version-upload-dialog',
cancelButton: by.cssContainingText('.mat-button', 'Cancel'),
uploadButton: by.cssContainingText('.mat-button', 'Upload'),
radioButton: `.mat-radio-label`,
descriptionTextArea: 'textarea'
};
majorOption: ElementFinder = this.rootElem.element(by.cssContainingText(UploadNewVersionDialog.selectors.radioButton, 'Major'));
minorOption: ElementFinder = this.rootElem.element(by.cssContainingText(UploadNewVersionDialog.selectors.radioButton, 'Minor'));
description: ElementFinder = this.rootElem.element(by.css(UploadNewVersionDialog.selectors.descriptionTextArea));
cancelButton = this.childElement(by.cssContainingText('.mat-button', 'Cancel'));
uploadButton = this.childElement(by.cssContainingText('.mat-button', 'Upload'));
majorOption = this.childElement(by.cssContainingText(`.mat-radio-label`, 'Major'));
minorOption = this.childElement(by.cssContainingText(`.mat-radio-label`, 'Minor'));
description = this.childElement(by.css('textarea'));
constructor() {
super(UploadNewVersionDialog.selectors.root);
}
async isDescriptionDisplayed(): Promise<boolean> {
return this.description.isDisplayed();
}
async isMinorOptionDisplayed(): Promise<boolean> {
return this.minorOption.isDisplayed();
}
async isMajorOptionDisplayed(): Promise<boolean> {
return this.majorOption.isDisplayed();
super('.aca-node-version-upload-dialog');
}
async isCancelButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(UploadNewVersionDialog.selectors.cancelButton);
return isPresentAndEnabled(this.cancelButton);
}
async isUploadButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(UploadNewVersionDialog.selectors.uploadButton);
return isPresentAndEnabled(this.uploadButton);
}
async clickCancel(): Promise<void> {
await this.clickButton(UploadNewVersionDialog.selectors.cancelButton);
await this.cancelButton.click();
await this.waitForDialogToClose();
}
async clickUpload(): Promise<void> {
await this.clickButton(UploadNewVersionDialog.selectors.uploadButton);
}
async clickMajor(): Promise<void> {
await this.majorOption.click();
}
async clickMinor(): Promise<void> {
await this.minorOption.click();
}
async enterDescription(description: string): Promise<void> {
await this.description.clear();
await this.description.sendKeys(description);
await typeText(this.description, description);
}
}