[ACA-1920] automate tests for Create file from template (#1303)

* change component ancestor from ElementFinder to string for better usability
better naming for some methods
small code cleanup

* add test components and automate tests for Create File from Template action

* ignore e2e-downloads folder

* add return types

* enable check

* enable check after issue got fixed
This commit is contained in:
Adina Parpalita
2020-01-16 13:16:18 +02:00
committed by Cilibiu Bogdan
parent 0bc4a3453b
commit 569ee98e8d
61 changed files with 1262 additions and 416 deletions

View File

@@ -0,0 +1,77 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
export class DropDownBreadcrumb extends Component {
private static selectors = {
root: '.adf-dropdown-breadcrumb',
trigger: '.adf-dropdown-breadcrumb-trigger',
currentFolder: '.adf-current-folder',
pathOption: '.adf-dropdown-breadcrumb-path-option .mat-option-text'
};
trigger: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.trigger));
pathItems: ElementArrayFinder = browser.$$(DropDownBreadcrumb.selectors.pathOption);
pathItemsContainer: ElementFinder = browser.element(by.css('.mat-select-panel'));
currentFolder: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.currentFolder));
constructor(ancestor?: string) {
super(DropDownBreadcrumb.selectors.root, ancestor);
}
async waitForPathListDropdownToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(this.pathItemsContainer), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to open');
}
async waitForPathListDropdownToClose(): Promise<void> {
await browser.wait(EC.stalenessOf(browser.$(DropDownBreadcrumb.selectors.pathOption)), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to close');
}
async getCurrentFolderName(): Promise<string> {
return this.currentFolder.getText();
}
async openPath(): Promise<void> {
await this.trigger.click();
await this.waitForPathListDropdownToOpen();
}
async clickPathItem(name: string): Promise<void> {
const elem = browser.element(by.cssContainingText(DropDownBreadcrumb.selectors.pathOption, name));
await elem.click();
}
async getPathItems(): Promise<string[]> {
const items: string[] = await this.pathItems.map(async elem => {
return elem.getText();
});
return items;
}
}