diff --git a/e2e/components/breadcrumb/breadcrumb.ts b/e2e/components/breadcrumb/breadcrumb.ts
index 1bc3e6739..543f7a978 100755
--- a/e2e/components/breadcrumb/breadcrumb.ts
+++ b/e2e/components/breadcrumb/breadcrumb.ts
@@ -23,29 +23,14 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { Component } from '../component';
export class Breadcrumb extends Component {
- private static selectors = {
- root: 'adf-breadcrumb',
- item: '.adf-breadcrumb-item',
- currentItem: '.adf-breadcrumb-item-current'
- };
-
- items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item));
- currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem));
+ items = this.allByCss('.adf-breadcrumb-item');
+ currentItem = this.byCss('.adf-breadcrumb-item-current');
constructor(ancestor?: string) {
- super(Breadcrumb.selectors.root, ancestor);
- }
-
- getNthItem(nth: number): ElementFinder {
- return this.items.get(nth - 1);
- }
-
- async getItemsCount(): Promise {
- return this.items.count();
+ super('adf-breadcrumb', ancestor);
}
async getAllItems(): Promise {
@@ -56,20 +41,8 @@ export class Breadcrumb extends Component {
return items;
}
- getCurrentItem(): ElementFinder {
- return this.currentItem;
- }
-
- async getCurrentItemName(): Promise {
- return this.currentItem.getText();
- }
-
async clickItem(name: string): Promise {
- const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`));
+ const elem = this.byCss(`.adf-breadcrumb-item[title=${name}]`);
await elem.click();
}
-
- async getNthItemTooltip(nth: number): Promise {
- return this.getNthItem(nth).getAttribute('title');
- }
}
diff --git a/e2e/components/breadcrumb/dropdown-breadcrumb.ts b/e2e/components/breadcrumb/dropdown-breadcrumb.ts
index 9a5cbed69..a31740814 100755
--- a/e2e/components/breadcrumb/dropdown-breadcrumb.ts
+++ b/e2e/components/breadcrumb/dropdown-breadcrumb.ts
@@ -23,39 +23,33 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { by, browser } from 'protractor';
import { Component } from '../component';
+import { waitForPresence, waitForStaleness } from '../../utilities/utils';
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));
+ pathOptionCss = '.adf-dropdown-breadcrumb-path-option .mat-option-text';
+ trigger = this.byCss('.adf-dropdown-breadcrumb-trigger');
+ pathItems = browser.$$(this.pathOptionCss);
+ pathItemsContainer = this.byCss('.mat-select-panel', browser);
+ currentFolder = this.byCss('.adf-current-folder');
constructor(ancestor?: string) {
- super(DropDownBreadcrumb.selectors.root, ancestor);
+ super('.adf-dropdown-breadcrumb', ancestor);
}
async waitForPathListDropdownToOpen(): Promise {
- await browser.wait(EC.presenceOf(this.pathItemsContainer), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to open');
+ return waitForPresence(
+ this.pathItemsContainer,
+ 'Timeout waiting for breadcrumb dropdown to open'
+ );
}
async waitForPathListDropdownToClose(): Promise {
- await browser.wait(EC.stalenessOf(browser.$(DropDownBreadcrumb.selectors.pathOption)), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to close');
- }
-
- async getCurrentFolderName(): Promise {
- return this.currentFolder.getText();
+ return waitForStaleness(
+ browser.$(this.pathOptionCss),
+ 'Timeout waiting for breadcrumb dropdown to close'
+ );
}
async openPath(): Promise {
@@ -64,7 +58,9 @@ export class DropDownBreadcrumb extends Component {
}
async clickPathItem(name: string): Promise {
- const elem = browser.element(by.cssContainingText(DropDownBreadcrumb.selectors.pathOption, name));
+ const elem = browser.element(
+ by.cssContainingText(this.pathOptionCss, name)
+ );
await elem.click();
}
diff --git a/e2e/components/component.ts b/e2e/components/component.ts
index 6a43ea35e..05727340a 100755
--- a/e2e/components/component.ts
+++ b/e2e/components/component.ts
@@ -23,21 +23,60 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../configs';
+import {
+ ElementFinder,
+ browser,
+ by,
+ ElementArrayFinder,
+ ProtractorBrowser
+} from 'protractor';
+import { waitForPresence } from '../utilities/utils';
export abstract class Component {
component: ElementFinder;
+ protected byCss(
+ css: string,
+ root: ElementFinder | ProtractorBrowser = this.component
+ ): ElementFinder {
+ return root.element(by.css(css));
+ }
+
+ protected byCssText(
+ css: string,
+ text: string,
+ root: ElementFinder | ProtractorBrowser = this.component
+ ): ElementFinder {
+ return root.element(by.cssContainingText(css, text));
+ }
+
+ protected byId(
+ css: string,
+ root: ElementFinder | ProtractorBrowser = this.component
+ ): ElementFinder {
+ return root.element(by.id(css));
+ }
+
+ protected allByCss(
+ css: string,
+ root: ElementFinder | ProtractorBrowser = this.component
+ ): ElementArrayFinder {
+ return root.all(by.css(css));
+ }
+
constructor(selector: string, ancestor?: string) {
const locator = selector;
this.component = ancestor
- ? browser.$$(ancestor).first().$$(locator).first()
+ ? browser
+ .$$(ancestor)
+ .first()
+ .$$(locator)
+ .first()
: browser.$$(locator).first();
}
async wait() {
- await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
+ await waitForPresence(this.component);
}
}
diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts
index ed5dd0ad1..ca744ad88 100755
--- a/e2e/components/data-table/data-table.ts
+++ b/e2e/components/data-table/data-table.ts
@@ -23,91 +23,61 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
+import { ElementFinder, ElementArrayFinder, by, browser, protractor } from 'protractor';
import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
import { Menu } from '../menu/menu';
-import { Utils } from '../../utilities/utils';
+import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils';
export class DataTable extends Component {
private static selectors = {
- root: 'adf-datatable',
-
- head: '.adf-datatable-header',
columnHeader: '.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value',
sortedColumnHeader: `
.adf-datatable__header--sorted-asc .adf-datatable-cell-value,
.adf-datatable__header--sorted-desc .adf-datatable-cell-value
`,
-
- body: '.adf-datatable-body',
row: '.adf-datatable-row[role]',
- selectedRow: '.adf-datatable-row.adf-is-selected',
cell: '.adf-datatable-cell-container',
- locationLink: '.aca-location-link',
- nameLink: '.adf-datatable-link',
- libraryRole: 'adf-library-role-column',
-
- selectedIcon: '.mat-icon[class*="selected"]',
- lockIcon: 'img[src*="lock"]',
lockOwner: '.aca-locked-by',
-
- emptyListContainer: 'div.adf-no-content-container',
- emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
-
- emptyListTitle: '.adf-empty-content__title',
- emptyListSubtitle: '.adf-empty-content__subtitle',
-
- emptySearchText: '.empty-search__text',
-
searchResultsRow: 'aca-search-results-row',
searchResultsRowLine: '.line',
- searchResultsNameLink: '.link'
};
- head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
- body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
+ head = this.byCss('.adf-datatable-header');
+ body = this.byCss('.adf-datatable-body');
+ emptyList = this.byCss('div.adf-no-content-container');
+ emptyFolderDragAndDrop = this.byCss('.adf-empty-list_template .adf-empty-folder');
+ emptyListTitle = this.byCss('.adf-empty-content__title');
+ emptyListSubtitle = this.byCss('.adf-empty-content__subtitle');
+ emptySearchText = this.byCss('.empty-search__text');
+ selectedRow = this.byCss('.adf-datatable-row.adf-is-selected');
- emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
- emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
- emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
- emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle));
-
- emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText));
-
- menu: Menu = new Menu();
+ menu = new Menu();
constructor(ancestor?: string) {
- super(DataTable.selectors.root, ancestor);
+ super('adf-datatable', ancestor);
}
- // Wait methods (waits for elements)
async waitForHeader(): Promise {
- await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
+ return waitForPresence(this.head, '--- timeout waitForHeader ---');
}
async waitForBody(): Promise {
- await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
+ return waitForPresence(this.body, '--- timeout waitForBody ---');
}
async waitForEmptyState(): Promise {
- await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
+ return waitForPresence(this.emptyList);
}
- // Header/Column methods
- getColumnHeaders(): ElementArrayFinder {
+ private getColumnHeaders(): ElementArrayFinder {
const locator = by.css(DataTable.selectors.columnHeader);
return this.head.all(locator);
}
async getColumnHeadersText(): Promise {
- const el = this.getColumnHeaders();
- return el.getText();
- }
-
- getNthColumnHeader(nth: number): ElementFinder {
- return this.getColumnHeaders().get(nth - 1);
+ return this.getColumnHeaders().getText();
}
getColumnHeaderByLabel(label: string): ElementFinder {
@@ -115,7 +85,7 @@ export class DataTable extends Component {
return this.head.element(locator);
}
- getSortedColumnHeader(): ElementFinder {
+ private getSortedColumnHeader(): ElementFinder {
const locator = by.css(DataTable.selectors.sortedColumnHeader);
return this.head.element(locator);
}
@@ -137,15 +107,7 @@ export class DataTable extends Component {
return 'none';
}
- async sortByColumn(columnName: string): Promise {
- const column = this.getColumnHeaderByLabel(columnName);
- const click = browser.actions().mouseMove(column).click();
-
- await click.perform();
- }
-
- // Rows methods
- getRows(): ElementArrayFinder {
+ private getRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.row));
}
@@ -153,12 +115,8 @@ export class DataTable extends Component {
return this.getRows().count();
}
- async waitForRowToBeSelected(): Promise {
- await browser.wait(EC.presenceOf(this.component.element(by.css(DataTable.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for row to be selected');
- }
-
- getSelectedRows(): ElementArrayFinder {
- return this.body.all(by.css(DataTable.selectors.selectedRow));
+ private getSelectedRows(): ElementArrayFinder {
+ return this.body.all(by.css('.adf-datatable-row.adf-is-selected'));
}
async getSelectedRowsNames(): Promise {
@@ -172,10 +130,6 @@ export class DataTable extends Component {
return this.getSelectedRows().count();
}
- getNthRow(nth: number): ElementFinder {
- return this.getRows().get(nth - 1);
- }
-
getRowByName(name: string, location: string = ''): ElementFinder {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.row, name))
@@ -193,15 +147,15 @@ export class DataTable extends Component {
return this.getRowCells(itemName).count();
}
- getRowFirstCell(name: string, location: string = ''): ElementFinder {
+ private getRowFirstCell(name: string, location: string = ''): ElementFinder {
return this.getRowCells(name, location).get(0);
}
- getRowNameCell(name: string, location: string = ''): ElementFinder {
+ private getRowNameCell(name: string, location: string = ''): ElementFinder {
return this.getRowCells(name, location).get(1);
}
- getRowNameCellSpan(name: string, location: string = ''): ElementFinder {
+ private getRowNameCellSpan(name: string, location: string = ''): ElementFinder {
return this.getRowNameCell(name, location).$('span');
}
@@ -210,17 +164,17 @@ export class DataTable extends Component {
}
async hasCheckMarkIcon(itemName: string, location: string = ''): Promise {
- const row: ElementFinder = this.getRowByName(itemName, location);
- return row.element(by.css(DataTable.selectors.selectedIcon)).isPresent();
+ const row = this.getRowByName(itemName, location);
+ return row.element(by.css('.mat-icon[class*="selected"]')).isPresent();
}
async hasLockIcon(itemName: string, location: string = ''): Promise {
- const row: ElementFinder = this.getRowByName(itemName, location);
- return row.element(by.css(DataTable.selectors.lockIcon)).isPresent();
+ const row = this.getRowByName(itemName, location);
+ return row.element(by.css('img[src*="lock"]')).isPresent();
}
- async hasLockOwnerInfo(itemName: string, location: string = ''): Promise {
- const row: ElementFinder = this.getRowByName(itemName, location);
+ private async hasLockOwnerInfo(itemName: string, location: string = ''): Promise {
+ const row = this.getRowByName(itemName, location);
return row.element(by.css(DataTable.selectors.lockOwner)).isPresent();
}
@@ -232,19 +186,18 @@ export class DataTable extends Component {
return '';
}
- getNameLink(itemName: string): ElementFinder {
- return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink);
+ private getNameLink(itemName: string): ElementFinder {
+ return this.getRowNameCell(itemName).$('.adf-datatable-link');
}
async hasLinkOnName(itemName: string): Promise {
return this.getNameLink(itemName).isPresent();
}
- // Navigation/selection methods
async doubleClickOnRowByName(name: string, location: string = ''): Promise {
try {
const item = this.getRowFirstCell(name, location);
- await Utils.waitUntilElementClickable(item);
+ await waitForClickable(item);
await browser.actions().mouseMove(item).perform();
await browser.actions().doubleClick().perform();
} catch (error) {
@@ -320,8 +273,8 @@ export class DataTable extends Component {
await browser.actions().click(protractor.Button.RIGHT).perform();
}
- getItemLocationEl(name: string): ElementFinder {
- return this.getRowByName(name).element(by.css(DataTable.selectors.locationLink));
+ private getItemLocationEl(name: string): ElementFinder {
+ return this.getRowByName(name).element(by.css('.aca-location-link'));
}
async getItemLocation(name: string): Promise {
@@ -342,17 +295,12 @@ export class DataTable extends Component {
await this.getItemLocationEl(name).click();
}
- // empty state methods
async isEmpty(): Promise {
return this.emptyList.isPresent();
}
- async isEmptyWithDragAndDrop(): Promise {
- return this.emptyFolderDragAndDrop.isDisplayed();
- }
-
async getEmptyDragAndDropText(): Promise {
- const isEmpty = await this.isEmptyWithDragAndDrop();
+ const isEmpty = await this.emptyFolderDragAndDrop.isDisplayed();
if (isEmpty) {
return this.emptyFolderDragAndDrop.getText();
}
@@ -378,17 +326,13 @@ export class DataTable extends Component {
async getEmptyListText(): Promise {
const isEmpty = await this.isEmpty();
if (isEmpty) {
- return this.component.element(by.css('adf-custom-empty-content-template')).getText();
+ return this.byCss('adf-custom-empty-content-template').getText();
}
return '';
}
- async getEmptySearchResultsText(): Promise {
- return this.emptySearchText.getText();
- }
-
async getCellsContainingName(name: string): Promise {
- const rows: ElementArrayFinder = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
+ const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
const cellsText: string[] = await rows.map(async cell => {
return cell.getText();
});
@@ -401,14 +345,14 @@ export class DataTable extends Component {
}
async getLibraryRole(name: string): Promise {
- return this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText();
+ return this.getRowByName(name).element(by.css('adf-library-role-column')).getText();
}
async isItemPresent(name: string, location? : string): Promise {
return this.getRowByName(name, location).isPresent();
}
- async getEntireDataTableText(): Promise {
+ private async getEntireDataTableText(): Promise {
const text: string[] = await this.getRows().map((row) => {
return row.all(by.css(DataTable.selectors.cell)).map(async cell => {
return cell.getText();
@@ -433,7 +377,7 @@ export class DataTable extends Component {
}, {});
}
- getSearchResultsRows(): ElementArrayFinder {
+ private getSearchResultsRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.searchResultsRow));
}
@@ -441,7 +385,7 @@ export class DataTable extends Component {
return this.getSearchResultsRows().get(nth - 1);
}
- getSearchResultsRowByName(name: string, location: string = ''): ElementFinder {
+ private getSearchResultsRowByName(name: string, location: string = ''): ElementFinder {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
.filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
@@ -450,7 +394,7 @@ export class DataTable extends Component {
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
}
- getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder {
+ private getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder {
return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine));
}
@@ -458,7 +402,7 @@ export class DataTable extends Component {
return this.getSearchResultRowLines(name, location).count();
}
- getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder {
+ private getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder {
return this.getSearchResultRowLines(name, location).get(index);
}
@@ -478,8 +422,8 @@ export class DataTable extends Component {
return this.getSearchResultNthLine(name, location, 3).getText();
}
- getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder {
- return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink);
+ private getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder {
+ return this.getSearchResultsRowByName(itemName, location).$('.link');
}
async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise {
diff --git a/e2e/components/datetime-picker/datetime-picker.ts b/e2e/components/datetime-picker/datetime-picker.ts
index 3340f4d4c..bfb23abaf 100755
--- a/e2e/components/datetime-picker/datetime-picker.ts
+++ b/e2e/components/datetime-picker/datetime-picker.ts
@@ -23,44 +23,24 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { by, browser } from 'protractor';
import { Component } from '../component';
import * as moment from 'moment';
-import { isPresentAndDisplayed } from '../../utilities/utils';
+import { isPresentAndDisplayed, waitForStaleness } from '../../utilities/utils';
export class DateTimePicker extends Component {
- private static selectors = {
- root: '.mat-datetimepicker-popup',
-
- header: '.mat-datetimepicker-calendar-header',
- year: '.mat-datetimepicker-calendar-header-year',
- date: '.mat-datetimepicker-calendar-header-date',
-
- content: '.mat-datetimepicker-calendar-content',
- dayPicker: 'mat-datetimepicker-month-view',
-
- today: '.mat-datetimepicker-calendar-body-today',
- firstActiveDay: '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content',
- };
-
- calendar: ElementFinder = browser.element(by.css(DateTimePicker.selectors.root));
- headerDate: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.date));
- headerYear: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.year));
- dayPicker: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.dayPicker));
-
- rootElemLocator = by.css(DateTimePicker.selectors.root);
+ calendar = this.byCss('.mat-datetimepicker-popup', browser);
+ headerDate = this.byCss('.mat-datetimepicker-calendar-header-date');
+ headerYear = this.byCss('.mat-datetimepicker-calendar-header-year');
+ dayPicker = this.byCss('mat-datetimepicker-month-view');
+ rootElemLocator = by.css('.mat-datetimepicker-popup');
constructor(ancestor?: string) {
- super(DateTimePicker.selectors.root, ancestor);
- }
-
- async waitForDateTimePickerToOpen(): Promise {
- await browser.wait(EC.presenceOf(this.calendar), BROWSER_WAIT_TIMEOUT);
+ super('.mat-datetimepicker-popup', ancestor);
}
async waitForDateTimePickerToClose(): Promise {
- await browser.wait(EC.stalenessOf(this.calendar), BROWSER_WAIT_TIMEOUT);
+ return waitForStaleness(this.calendar);
}
async isCalendarOpen(): Promise {
@@ -69,21 +49,14 @@ export class DateTimePicker extends Component {
return isPresentAndDisplayed(element);
}
- async getDate(): Promise {
- return this.headerDate.getText();
- }
-
- async getYear(): Promise {
- return this.headerYear.getText();
- }
-
async setDefaultDay(): Promise {
const today = moment();
const tomorrow = today.add(1, 'day');
const dayOfTomorrow = tomorrow.date();
- const date = await this.getDate();
- const year = await this.getYear();
- const elem = this.dayPicker.element(by.cssContainingText(DateTimePicker.selectors.firstActiveDay, `${dayOfTomorrow}`));
+ const date = await this.headerDate.getText();
+ const year = await this.headerYear.getText();
+ const firstActiveDay = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content';
+ const elem = this.dayPicker.element(by.cssContainingText(firstActiveDay, `${dayOfTomorrow}`));
await elem.click();
return `${date} ${year}`;
}
diff --git a/e2e/components/dialog/confirm-dialog.ts b/e2e/components/dialog/confirm-dialog.ts
index f5a8fe416..aa7bd88f0 100755
--- a/e2e/components/dialog/confirm-dialog.ts
+++ b/e2e/components/dialog/confirm-dialog.ts
@@ -25,20 +25,17 @@
import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
+import { isPresentAndEnabled } from '../../utilities/utils';
export class ConfirmDialog extends GenericDialog {
- private static selectors = {
- root: 'adf-confirm-dialog',
-
- okButton: by.buttonText('OK'),
- cancelButton: by.buttonText('Cancel'),
- keepButton: by.buttonText('Keep'),
- deleteButton: by.buttonText('Delete'),
- removeButton: by.buttonText('Remove')
- }
+ okButton = this.childElement(by.buttonText('OK'));
+ cancelButton = this.childElement(by.buttonText('Cancel'));
+ keepButton = this.childElement(by.buttonText('Keep'));
+ deleteButton = this.childElement(by.buttonText('Delete'));
+ removeButton = this.childElement(by.buttonText('Remove'));
constructor() {
- super(ConfirmDialog.selectors.root);
+ super('adf-confirm-dialog');
}
async getText(): Promise {
@@ -46,43 +43,22 @@ export class ConfirmDialog extends GenericDialog {
}
async isOkEnabled(): Promise {
- return this.isButtonEnabled(ConfirmDialog.selectors.okButton);
+ return isPresentAndEnabled(this.okButton);
}
async isCancelEnabled(): Promise {
- return this.isButtonEnabled(ConfirmDialog.selectors.cancelButton);
+ return isPresentAndEnabled(this.cancelButton);
}
async isKeepEnabled(): Promise {
- return this.isButtonEnabled(ConfirmDialog.selectors.keepButton);
+ return isPresentAndEnabled(this.keepButton);
}
async isDeleteEnabled(): Promise {
- return this.isButtonEnabled(ConfirmDialog.selectors.deleteButton);
+ return isPresentAndEnabled(this.deleteButton);
}
async isRemoveEnabled(): Promise {
- return this.isButtonEnabled(ConfirmDialog.selectors.removeButton);
+ return isPresentAndEnabled(this.removeButton);
}
-
- async clickOk(): Promise {
- await this.clickButton(ConfirmDialog.selectors.okButton);
- }
-
- async clickCancel(): Promise {
- await this.clickButton(ConfirmDialog.selectors.cancelButton);
- }
-
- async clickKeep(): Promise {
- await this.clickButton(ConfirmDialog.selectors.keepButton);
- }
-
- async clickDelete(): Promise {
- await this.clickButton(ConfirmDialog.selectors.deleteButton);
- }
-
- async clickRemove(): Promise {
- await this.clickButton(ConfirmDialog.selectors.removeButton);
- }
-
}
diff --git a/e2e/components/dialog/content-node-selector-dialog.ts b/e2e/components/dialog/content-node-selector-dialog.ts
index 78abb9e28..104ad195c 100755
--- a/e2e/components/dialog/content-node-selector-dialog.ts
+++ b/e2e/components/dialog/content-node-selector-dialog.ts
@@ -23,73 +23,38 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { by, browser, protractor } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
-import { Utils, isPresentAndDisplayed } from '../../utilities/utils';
+import { Utils, isPresentAndDisplayed, waitForStaleness, waitForPresence, isPresentAndEnabled, waitForClickable } from '../../utilities/utils';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table';
export class ContentNodeSelectorDialog extends GenericDialog {
- private static selectors = {
- root: '.adf-content-node-selector-dialog',
+ cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]'));
+ copyButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy'));
+ moveButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move'));
- locationDropDown: 'site-dropdown-container',
- locationOption: '.mat-option .mat-option-text',
+ locationDropDown = this.rootElem.element(by.id('site-dropdown-container'));
+ locationPersonalFiles = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'Personal Files'));
+ locationFileLibraries = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'File Libraries'));
- dataTable: '.adf-datatable-body',
- selectedRow: '.adf-is-selected',
+ searchInput = this.rootElem.element(by.css('#searchInput'));
+ toolbarTitle = this.rootElem.element(by.css('.adf-toolbar-title'));
- searchInput: '#searchInput',
- toolbarTitle: '.adf-toolbar-title',
-
- cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]'),
- copyButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy'),
- moveButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move')
- };
-
- locationDropDown: ElementFinder = this.rootElem.element(by.id(ContentNodeSelectorDialog.selectors.locationDropDown));
- locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'Personal Files'));
- locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'File Libraries'));
-
- searchInput: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.searchInput));
- toolbarTitle: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.toolbarTitle));
-
- breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb();
- dataTable: DataTable = new DataTable(ContentNodeSelectorDialog.selectors.root);
+ breadcrumb = new DropDownBreadcrumb();
+ dataTable = new DataTable('.adf-content-node-selector-dialog');
constructor() {
- super(ContentNodeSelectorDialog.selectors.root);
- }
-
- async waitForDropDownToOpen(): Promise {
- await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT);
+ super('.adf-content-node-selector-dialog');
}
async waitForDropDownToClose(): Promise {
- await browser.wait(EC.stalenessOf(browser.$(ContentNodeSelectorDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT);
- }
-
- async waitForRowToBeSelected(): Promise {
- await browser.wait(EC.presenceOf(browser.element(by.css(ContentNodeSelectorDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT);
- }
-
- async clickCancel(): Promise {
- await this.clickButton(ContentNodeSelectorDialog.selectors.cancelButton);
- await this.waitForDialogToClose();
- }
-
- async clickCopy(): Promise {
- await this.clickButton(ContentNodeSelectorDialog.selectors.copyButton);
- }
-
- async clickMove(): Promise {
- await this.clickButton(ContentNodeSelectorDialog.selectors.moveButton);
+ await waitForStaleness(browser.$('.mat-option .mat-option-text'))
}
async selectLocation(location: 'Personal Files' | 'File Libraries'): Promise {
await this.locationDropDown.click();
- await this.waitForDropDownToOpen();
+ await waitForPresence(this.locationPersonalFiles);
if (location === 'Personal Files') {
await this.locationPersonalFiles.click();
@@ -102,13 +67,9 @@ export class ContentNodeSelectorDialog extends GenericDialog {
async selectDestination(folderName: string): Promise {
const row = this.dataTable.getRowByName(folderName);
- await Utils.waitUntilElementClickable(row);
+ await waitForClickable(row);
await row.click();
- await this.waitForRowToBeSelected();
- }
-
- async isSearchInputPresent(): Promise {
- return this.searchInput.isPresent();
+ await waitForPresence(browser.element(by.css('.adf-is-selected')));
}
async isSelectLocationDropdownDisplayed(): Promise {
@@ -116,11 +77,11 @@ export class ContentNodeSelectorDialog extends GenericDialog {
}
async isCopyButtonEnabled(): Promise {
- return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.copyButton);
+ return isPresentAndEnabled(this.copyButton);
}
async isCancelButtonEnabled(): Promise {
- return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.cancelButton);
+ return isPresentAndEnabled(this.cancelButton);
}
async searchFor(text: string): Promise {
diff --git a/e2e/components/dialog/create-edit-folder-dialog.ts b/e2e/components/dialog/create-edit-folder-dialog.ts
index 257fb84ad..cb381472c 100755
--- a/e2e/components/dialog/create-edit-folder-dialog.ts
+++ b/e2e/components/dialog/create-edit-folder-dialog.ts
@@ -23,64 +23,42 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
-import { isPresentAndDisplayed } from '../../utilities/utils';
+import { isPresentAndDisplayed, waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateOrEditFolderDialog extends GenericDialog {
- private static selectors = {
- root: 'adf-folder-dialog',
+ createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
+ cancelButton = this.childElement(by.id('adf-folder-cancel-button'));
+ updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update'));
- nameInput: 'input[placeholder="Name" i]',
- descriptionTextArea: 'textarea[placeholder="Description" i]',
-
- validationMessage: '.mat-hint span',
-
- createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
- cancelButton: by.id('adf-folder-cancel-button'),
- updateButton: by.cssContainingText('.mat-dialog-actions button', 'Update')
- };
-
- nameInput: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
- descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
- validationMessage: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
+ nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
+ descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]'));
+ validationMessage = this.rootElem.element(by.css('.mat-hint span'));
constructor() {
- super(CreateOrEditFolderDialog.selectors.root);
+ super('adf-folder-dialog');
}
async waitForDialogToOpen() {
await super.waitForDialogToOpen();
- await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---');
- }
-
- async isValidationMessageDisplayed(): Promise {
- return isPresentAndDisplayed(this.validationMessage);
+ await waitForClickable(this.nameInput);
}
async isUpdateButtonEnabled(): Promise {
- return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.updateButton);
+ return isPresentAndEnabled(this.updateButton);
}
async isCreateButtonEnabled(): Promise {
- return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.createButton);
+ return isPresentAndEnabled(this.createButton);
}
async isCancelButtonEnabled(): Promise {
- return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.cancelButton);
- }
-
- async isNameDisplayed(): Promise {
- return this.nameInput.isDisplayed();
- }
-
- async isDescriptionDisplayed(): Promise {
- return this.descriptionTextArea.isDisplayed();
+ return isPresentAndEnabled(this.cancelButton);
}
async getValidationMessage(): Promise {
- if (await this.isValidationMessageDisplayed()) {
+ if (await isPresentAndDisplayed(this.validationMessage)) {
return this.validationMessage.getText();
} else {
return '';
@@ -96,31 +74,15 @@ export class CreateOrEditFolderDialog extends GenericDialog {
}
async enterName(name: string): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(name);
+ await typeText(this.nameInput, name);
}
async enterDescription(description: string): Promise {
- await this.descriptionTextArea.clear();
- await this.descriptionTextArea.sendKeys(description);
- }
-
- async deleteNameWithBackspace(): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
- }
-
- async clickCreate(): Promise {
- await this.clickButton(CreateOrEditFolderDialog.selectors.createButton);
+ await typeText(this.descriptionTextArea, description);
}
async clickCancel(): Promise {
- await this.clickButton(CreateOrEditFolderDialog.selectors.cancelButton);
+ await this.cancelButton.click();
await this.waitForDialogToClose();
}
-
- async clickUpdate(): Promise {
- await this.clickButton(CreateOrEditFolderDialog.selectors.updateButton);
- }
-
}
diff --git a/e2e/components/dialog/create-from-template-dialog.ts b/e2e/components/dialog/create-from-template-dialog.ts
index 65e8bc847..ca838c669 100755
--- a/e2e/components/dialog/create-from-template-dialog.ts
+++ b/e2e/components/dialog/create-from-template-dialog.ts
@@ -23,30 +23,21 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, protractor } from 'protractor';
+import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
-import { isPresentAndDisplayed } from '../../utilities/utils';
+import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateFromTemplateDialog extends GenericDialog {
- private static selectors = {
- root: '.aca-create-from-template-dialog',
+ createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
+ cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL'));
- nameInput: 'input[placeholder="Name" i]',
- titleInput: 'input[placeholder="Title" i]',
- descriptionTextArea: 'textarea[placeholder="Description" i]',
- validationMessage: '.mat-error',
-
- createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
- cancelButton: by.cssContainingText('.mat-dialog-actions button', 'CANCEL')
- };
-
- nameInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.nameInput));
- titleInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.titleInput));
- descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.descriptionTextArea));
- validationMessage: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.validationMessage));
+ nameInput = this.childElement(by.css('input[placeholder="Name" i]'));
+ titleInput = this.childElement(by.css('input[placeholder="Title" i]'));
+ descriptionTextArea = this.childElement(by.css('textarea[placeholder="Description" i]'));
+ validationMessage = this.childElement(by.css('.mat-error'));
constructor() {
- super(CreateFromTemplateDialog.selectors.root);
+ super('.aca-create-from-template-dialog');
}
async isValidationMessageDisplayed(): Promise {
@@ -54,23 +45,11 @@ export class CreateFromTemplateDialog extends GenericDialog {
}
async isCreateButtonEnabled(): Promise {
- return this.isButtonEnabled(CreateFromTemplateDialog.selectors.createButton);
+ return isPresentAndEnabled(this.createButton);
}
async isCancelButtonEnabled(): Promise {
- return this.isButtonEnabled(CreateFromTemplateDialog.selectors.cancelButton);
- }
-
- async isNameFieldDisplayed(): Promise {
- return this.nameInput.isDisplayed();
- }
-
- async isTitleFieldDisplayed(): Promise {
- return this.titleInput.isDisplayed();
- }
-
- async isDescriptionFieldDisplayed(): Promise {
- return this.descriptionTextArea.isDisplayed();
+ return isPresentAndEnabled(this.cancelButton);
}
async getValidationMessage(): Promise {
@@ -90,32 +69,19 @@ export class CreateFromTemplateDialog extends GenericDialog {
}
async enterName(name: string): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(name);
+ await typeText(this.nameInput, name);
}
async enterTitle(title: string): Promise {
- await this.titleInput.clear();
- await this.titleInput.sendKeys(title);
+ await typeText(this.titleInput, title);
}
async enterDescription(description: string): Promise {
- await this.descriptionTextArea.clear();
- await this.descriptionTextArea.sendKeys(description);
- }
-
- async deleteNameWithBackspace(): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
- }
-
- async clickCreate(): Promise {
- await this.clickButton(CreateFromTemplateDialog.selectors.createButton);
+ await typeText(this.descriptionTextArea, description);
}
async clickCancel(): Promise {
- await this.clickButton(CreateFromTemplateDialog.selectors.cancelButton);
+ await this.cancelButton.click();
await this.waitForDialogToClose();
}
-
}
diff --git a/e2e/components/dialog/create-library-dialog.ts b/e2e/components/dialog/create-library-dialog.ts
index 9e053e70a..4a235759a 100755
--- a/e2e/components/dialog/create-library-dialog.ts
+++ b/e2e/components/dialog/create-library-dialog.ts
@@ -23,140 +23,78 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
+import { by, ElementFinder } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateLibraryDialog extends GenericDialog {
- private static selectors = {
- root: 'adf-library-dialog',
+ createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
+ cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel'));
- nameInput: 'input[placeholder="Name" i]',
- libraryIdInput: 'input[placeholder="Library ID" i]',
- descriptionTextArea: 'textarea[placeholder="Description" i]',
+ nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
+ libraryIdInput = this.rootElem.element(by.css('input[placeholder="Library ID" i]'));
+ descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]'));
+ visibilityPublic = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Public'));
+ visibilityModerated = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Moderated'));
+ visibilityPrivate = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Private'));
- radioButton: '.mat-radio-label',
- radioChecked: 'mat-radio-checked',
- errorMessage: '.mat-error',
-
- createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
- cancelButton: by.cssContainingText('.mat-dialog-actions button', 'Cancel')
- };
-
- nameInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.nameInput));
- libraryIdInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.libraryIdInput));
- descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.descriptionTextArea));
- visibilityPublic: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Public'));
- visibilityModerated: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Moderated'));
- visibilityPrivate: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Private'));
-
- errorMessage: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.errorMessage));
+ errorMessage = this.rootElem.element(by.css('.mat-error'));
constructor() {
- super(CreateLibraryDialog.selectors.root);
+ super('adf-library-dialog');
}
async waitForDialogToOpen(): Promise {
await super.waitForDialogToOpen();
- await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---');
- }
-
- async isErrorMessageDisplayed(): Promise {
- return this.errorMessage.isDisplayed();
+ await waitForClickable(this.nameInput);
}
async getErrorMessage(): Promise {
- if (await this.isErrorMessageDisplayed()) {
+ if (await this.errorMessage.isDisplayed()) {
return this.errorMessage.getText();
}
return '';
}
- async isNameDisplayed(): Promise {
- return this.nameInput.isDisplayed();
- }
-
- async isLibraryIdDisplayed(): Promise {
- return this.libraryIdInput.isDisplayed();
- }
-
- async isDescriptionDisplayed(): Promise {
- return this.descriptionTextArea.isDisplayed();
- }
-
- async isPublicDisplayed(): Promise {
- return this.visibilityPublic.isDisplayed();
- }
-
- async isModeratedDisplayed(): Promise {
- return this.visibilityModerated.isDisplayed();
- }
-
- async isPrivateDisplayed(): Promise {
- return this.visibilityPrivate.isDisplayed();
- }
-
async enterName(name: string): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(name);
+ await typeText(this.nameInput, name);
}
async enterLibraryId(id: string): Promise {
- await this.libraryIdInput.clear();
- await this.libraryIdInput.sendKeys(id);
+ await typeText(this.libraryIdInput, id);
}
async enterDescription(description: string): Promise {
- await this.descriptionTextArea.clear();
- await this.descriptionTextArea.sendKeys(description);
- }
-
- async deleteNameWithBackspace(): Promise {
- await this.nameInput.clear();
- await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
+ await typeText(this.descriptionTextArea, description);
}
async isCreateEnabled(): Promise {
- return this.isButtonEnabled(CreateLibraryDialog.selectors.createButton);
+ return isPresentAndEnabled(this.createButton);
}
async isCancelEnabled(): Promise {
- return this.isButtonEnabled(CreateLibraryDialog.selectors.cancelButton);
- }
-
- async clickCreate(): Promise {
- await this.clickButton(CreateLibraryDialog.selectors.createButton);
+ return isPresentAndEnabled(this.cancelButton);
}
async clickCancel(): Promise {
- await this.clickButton(CreateLibraryDialog.selectors.cancelButton);
+ await this.cancelButton.click();
await this.waitForDialogToClose();
}
+ private async isChecked(target: ElementFinder): Promise {
+ const elemClass = await target.element(by.xpath('..')).getAttribute('class');
+ return elemClass.includes('mat-radio-checked');
+ }
+
async isPublicChecked(): Promise {
- const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class');
- return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
+ return this.isChecked(this.visibilityPublic);
}
async isModeratedChecked(): Promise {
- const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class');
- return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
+ return this.isChecked(this.visibilityModerated);
}
async isPrivateChecked(): Promise {
- const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class');
- return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
- }
-
- async selectPublic(): Promise {
- await this.visibilityPublic.click();
- }
-
- async selectModerated(): Promise {
- await this.visibilityModerated.click();
- }
-
- async selectPrivate(): Promise {
- await this.visibilityPrivate.click();
+ return this.isChecked(this.visibilityPrivate);
}
}
diff --git a/e2e/components/dialog/generic-dialog.ts b/e2e/components/dialog/generic-dialog.ts
index 1570be07a..0c1df3417 100644
--- a/e2e/components/dialog/generic-dialog.ts
+++ b/e2e/components/dialog/generic-dialog.ts
@@ -23,32 +23,23 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
-import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils';
+import { ElementFinder, by, browser, Locator } from 'protractor';
+import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils';
export abstract class GenericDialog {
- private static locators = {
- title: '.mat-dialog-title',
- content: '.mat-dialog-content'
- };
- private rootCssSelector: string;
-
- constructor(selector?: string) {
- this.rootCssSelector = selector;
- }
+ constructor(private rootCssSelector?: string) {}
get rootElem(): ElementFinder {
return browser.element(by.css(this.rootCssSelector));
}
get title(): ElementFinder {
- return this.rootElem.element(by.css(GenericDialog.locators.title));
+ return this.rootElem.element(by.css('.mat-dialog-title'));
}
get content(): ElementFinder {
- return this.rootElem.element(by.css(GenericDialog.locators.content));
+ return this.rootElem.element(by.css('.mat-dialog-content'));
}
async getText(): Promise {
@@ -56,13 +47,13 @@ export abstract class GenericDialog {
}
async waitForDialogToOpen(): Promise {
- await browser.wait(EC.presenceOf(this.rootElem), BROWSER_WAIT_TIMEOUT);
- await browser.wait(EC.visibilityOf(this.content), BROWSER_WAIT_TIMEOUT);
- await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
+ await waitForPresence(this.rootElem);
+ await waitForVisibility(this.content);
+ await waitForPresence(browser.element(by.css('.cdk-overlay-backdrop')));
}
async waitForDialogToClose(): Promise {
- await browser.wait(EC.stalenessOf(this.content), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for dialog to close ----');
+ await waitForStaleness(this.content);
}
async isDialogOpen(): Promise {
@@ -73,15 +64,7 @@ export abstract class GenericDialog {
return this.title.getText();
}
- getActionButton(selector: Locator): ElementFinder {
+ protected childElement(selector: Locator): ElementFinder {
return this.rootElem.element(selector);
}
-
- async isButtonEnabled(selector: Locator): Promise {
- return isPresentAndEnabled(this.getActionButton(selector));
- }
-
- async clickButton(selector: Locator): Promise {
- await this.getActionButton(selector).click();
- }
}
diff --git a/e2e/components/dialog/manage-versions-dialog.ts b/e2e/components/dialog/manage-versions-dialog.ts
index 714e2ea74..2989d543e 100755
--- a/e2e/components/dialog/manage-versions-dialog.ts
+++ b/e2e/components/dialog/manage-versions-dialog.ts
@@ -27,18 +27,14 @@ import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
export class ManageVersionsDialog extends GenericDialog {
- private static selectors = {
- root: '.aca-node-versions-dialog',
-
- closeButton: by.cssContainingText('.mat-button', 'Close')
- };
+ closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close'));
constructor() {
- super(ManageVersionsDialog.selectors.root);
+ super('.aca-node-versions-dialog');
}
async clickClose(): Promise {
- await this.clickButton(ManageVersionsDialog.selectors.closeButton);
+ await this.closeButton.click();
await this.waitForDialogToClose();
}
}
diff --git a/e2e/components/dialog/password-dialog.ts b/e2e/components/dialog/password-dialog.ts
index 8d7a73817..8e4561c6f 100755
--- a/e2e/components/dialog/password-dialog.ts
+++ b/e2e/components/dialog/password-dialog.ts
@@ -23,35 +23,23 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { by, browser } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
+import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class PasswordDialog extends GenericDialog {
- private static selectors = {
- root: 'adf-pdf-viewer-password-dialog',
-
- passwordInput: 'input[type="Password"]',
- errorMessage: '.mat-error',
-
- closeButton: by.css('[data-automation-id="adf-password-dialog-close"]'),
- submitButton: by.css('[data-automation-id="adf-password-dialog-submit"]')
- };
-
- passwordInput: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.passwordInput));
- errorMessage: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.errorMessage));
+ closeButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-close"]'));
+ submitButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-submit"]'));
+ passwordInput = this.childElement(by.css('input[type="Password"]'));
+ errorMessage = this.childElement(by.css('.mat-error'));
constructor() {
- super(PasswordDialog.selectors.root);
- }
-
- async waitForPasswordInputToBeInteractive() {
- await browser.wait(EC.elementToBeClickable(this.passwordInput), BROWSER_WAIT_TIMEOUT, '--- timeout wait for passwordInput ---');
+ super('adf-pdf-viewer-password-dialog');
}
async waitForDialogToOpen(): Promise {
await super.waitForDialogToOpen();
- await this.waitForPasswordInputToBeInteractive();
+ await waitForClickable(this.passwordInput);
}
async isDialogOpen(): Promise {
@@ -64,19 +52,11 @@ export class PasswordDialog extends GenericDialog {
}
async isCloseEnabled(): Promise {
- return this.isButtonEnabled(PasswordDialog.selectors.closeButton);
+ return isPresentAndEnabled(this.closeButton);
}
async isSubmitEnabled(): Promise {
- return this.isButtonEnabled(PasswordDialog.selectors.submitButton);
- }
-
- async clickClose(): Promise {
- await this.clickButton(PasswordDialog.selectors.closeButton);
- }
-
- async clickSubmit(): Promise {
- await this.clickButton(PasswordDialog.selectors.submitButton);
+ return isPresentAndEnabled(this.submitButton);
}
async isPasswordInputDisplayed(): Promise {
@@ -106,7 +86,6 @@ export class PasswordDialog extends GenericDialog {
}
async enterPassword(password: string): Promise {
- await this.passwordInput.clear();
- await this.passwordInput.sendKeys(password);
+ await typeText(this.passwordInput, password);
}
}
diff --git a/e2e/components/dialog/select-template-dialog.ts b/e2e/components/dialog/select-template-dialog.ts
index ec68de603..2a3628e7c 100755
--- a/e2e/components/dialog/select-template-dialog.ts
+++ b/e2e/components/dialog/select-template-dialog.ts
@@ -27,37 +27,39 @@ import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table';
+import { isPresentAndEnabled } from '../../utilities/utils';
export class SelectTemplateDialog extends GenericDialog {
- private static selectors = {
- root: '.aca-template-node-selector-dialog',
+ nextButton = this.childElement(
+ by.css('[data-automation-id="content-node-selector-actions-choose"]')
+ );
- nextButton: by.css('[data-automation-id="content-node-selector-actions-choose"]'),
- cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]')
- };
+ cancelButton = this.childElement(
+ by.css('[data-automation-id="content-node-selector-actions-cancel"]')
+ );
- breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb();
- dataTable: DataTable = new DataTable(SelectTemplateDialog.selectors.root);
+ breadcrumb = new DropDownBreadcrumb();
+ dataTable = new DataTable('.aca-template-node-selector-dialog');
constructor() {
- super(SelectTemplateDialog.selectors.root);
+ super('.aca-template-node-selector-dialog');
}
async isCancelButtonEnabled(): Promise {
- return this.isButtonEnabled(SelectTemplateDialog.selectors.cancelButton);
+ return isPresentAndEnabled(this.cancelButton);
}
async isNextButtonEnabled(): Promise {
- return this.isButtonEnabled(SelectTemplateDialog.selectors.nextButton);
+ return isPresentAndEnabled(this.nextButton);
}
async clickCancel(): Promise {
- await this.clickButton(SelectTemplateDialog.selectors.cancelButton);
+ await this.cancelButton.click();
await this.waitForDialogToClose();
}
async clickNext(): Promise {
- await this.clickButton(SelectTemplateDialog.selectors.nextButton);
+ await this.nextButton.click();
await this.waitForDialogToClose();
}
}
diff --git a/e2e/components/dialog/share-dialog.ts b/e2e/components/dialog/share-dialog.ts
index d44e59c8b..f438b02ab 100755
--- a/e2e/components/dialog/share-dialog.ts
+++ b/e2e/components/dialog/share-dialog.ts
@@ -23,41 +23,28 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, ElementArrayFinder, by } from 'protractor';
+import { by } from 'protractor';
import { DateTimePicker } from '../../components/datetime-picker/datetime-picker';
import { GenericDialog } from '../dialog/generic-dialog';
+import { isPresentAndEnabled } from '../../utilities/utils';
export class ShareDialog extends GenericDialog {
- private static selectors = {
- root: '.adf-share-dialog',
-
- dialogTitle: `[data-automation-id='adf-share-dialog-title']`,
- info: '.adf-share-link__info',
- label: '.adf-share-link__label',
- shareToggle: `[data-automation-id='adf-share-toggle']`,
- linkUrl: `[data-automation-id='adf-share-link']`,
- inputAction: '.adf-input-action',
- expireToggle: `[data-automation-id='adf-expire-toggle']`,
- datetimePickerButton: '.mat-datetimepicker-toggle',
- expirationInput: 'input[formcontrolname="time"]',
-
- closeButton: by.css(`[data-automation-id='adf-share-dialog-close']`)
- };
-
dateTimePicker = new DateTimePicker();
- dialogTitle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.dialogTitle));
- infoText: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.info));
- labels: ElementArrayFinder = this.rootElem.all(by.css(ShareDialog.selectors.label));
- shareToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.shareToggle));
- url: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.linkUrl));
- urlAction: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.inputAction));
- expireToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expireToggle));
- expireInput: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expirationInput));
- datetimePickerButton: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.datetimePickerButton));
+ dialogTitle = this.childElement(by.css(`[data-automation-id='adf-share-dialog-title']`));
+ infoText = this.childElement(by.css('.adf-share-link__info'));
+ labels = this.rootElem.all(by.css('.adf-share-link__label'));
+ shareToggle = this.childElement(by.css(`[data-automation-id='adf-share-toggle']`));
+ url = this.childElement(by.css(`[data-automation-id='adf-share-link']`));
+ urlAction = this.childElement(by.css('.adf-input-action'));
+ expireToggle = this.childElement(by.css(`[data-automation-id='adf-expire-toggle']`));
+ expireInput = this.childElement(by.css('input[formcontrolname="time"]'));
+ datetimePickerButton = this.childElement(by.css('.mat-datetimepicker-toggle'));
+
+ closeButton = this.childElement(by.css(`[data-automation-id='adf-share-dialog-close']`));
constructor() {
- super(ShareDialog.selectors.root);
+ super('.adf-share-dialog');
}
async getTitle(): Promise {
@@ -68,10 +55,6 @@ export class ShareDialog extends GenericDialog {
return this.infoText.getText();
}
- getLabels(): ElementArrayFinder {
- return this.labels;
- }
-
async getLinkUrl(): Promise {
return this.url.getAttribute('value');
}
@@ -82,49 +65,29 @@ export class ShareDialog extends GenericDialog {
}
async isCloseEnabled(): Promise {
- return this.isButtonEnabled(ShareDialog.selectors.closeButton);
+ return isPresentAndEnabled(this.closeButton);
}
async clickClose(): Promise {
- await this.clickButton(ShareDialog.selectors.closeButton);
+ await this.closeButton.click();
await this.waitForDialogToClose();
}
- getShareToggle(): ElementFinder {
- return this.shareToggle;
- }
-
- getExpireToggle(): ElementFinder {
- return this.expireToggle;
- }
-
- getExpireInput(): ElementFinder {
- return this.expireInput;
- }
-
async isShareToggleChecked(): Promise {
- const toggleClass = await this.getShareToggle().getAttribute('class');
+ const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('checked');
}
async isShareToggleDisabled(): Promise {
- const toggleClass = await this.getShareToggle().getAttribute('class');
+ const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('mat-disabled');
}
async isExpireToggleEnabled(): Promise {
- const toggleClass = await this.getExpireToggle().getAttribute('class');
+ const toggleClass = await this.expireToggle.getAttribute('class');
return toggleClass.includes('checked');
}
- async copyUrl(): Promise {
- await this.urlAction.click();
- }
-
- async openDatetimePicker(): Promise {
- await this.datetimePickerButton.click();
- }
-
async closeDatetimePicker(): Promise {
if (await this.dateTimePicker.isCalendarOpen()) {
await this.datetimePickerButton.click();
@@ -132,14 +95,6 @@ export class ShareDialog extends GenericDialog {
}
async getExpireDate(): Promise {
- return this.getExpireInput().getAttribute('value');
- }
-
- async clickExpirationToggle(): Promise {
- await this.expireToggle.click();
- }
-
- async clickShareToggle(): Promise {
- await this.shareToggle.click();
+ return this.expireInput.getAttribute('value');
}
}
diff --git a/e2e/components/dialog/upload-new-version-dialog.ts b/e2e/components/dialog/upload-new-version-dialog.ts
index d09459d3b..d29ab14f5 100755
--- a/e2e/components/dialog/upload-new-version-dialog.ts
+++ b/e2e/components/dialog/upload-new-version-dialog.ts
@@ -23,71 +23,35 @@
* along with Alfresco. If not, see .
*/
-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 {
- return this.description.isDisplayed();
- }
-
- async isMinorOptionDisplayed(): Promise {
- return this.minorOption.isDisplayed();
- }
-
- async isMajorOptionDisplayed(): Promise {
- return this.majorOption.isDisplayed();
+ super('.aca-node-version-upload-dialog');
}
async isCancelButtonEnabled(): Promise {
- return this.isButtonEnabled(UploadNewVersionDialog.selectors.cancelButton);
+ return isPresentAndEnabled(this.cancelButton);
}
async isUploadButtonEnabled(): Promise {
- return this.isButtonEnabled(UploadNewVersionDialog.selectors.uploadButton);
+ return isPresentAndEnabled(this.uploadButton);
}
async clickCancel(): Promise {
- await this.clickButton(UploadNewVersionDialog.selectors.cancelButton);
+ await this.cancelButton.click();
await this.waitForDialogToClose();
}
- async clickUpload(): Promise {
- await this.clickButton(UploadNewVersionDialog.selectors.uploadButton);
- }
-
- async clickMajor(): Promise {
- await this.majorOption.click();
- }
-
- async clickMinor(): Promise {
- await this.minorOption.click();
- }
-
async enterDescription(description: string): Promise {
- await this.description.clear();
- await this.description.sendKeys(description);
+ await typeText(this.description, description);
}
-
}
diff --git a/e2e/components/header/header.ts b/e2e/components/header/header.ts
index 3faf45cf1..785d1c24f 100755
--- a/e2e/components/header/header.ts
+++ b/e2e/components/header/header.ts
@@ -23,71 +23,54 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by, browser, until } from 'protractor';
+import { by, browser } from 'protractor';
import { Component } from '../component';
import { UserInfo } from './user-info';
import { Menu } from '../menu/menu';
import { Toolbar } from './../toolbar/toolbar';
import { SearchInput } from '../search/search-input';
-import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { waitElement } from '../../utilities/utils';
export class Header extends Component {
- private static selectors = {
- root: 'app-header',
- logoLink: by.css('.app-menu__title'),
- userInfo: by.css('aca-current-user'),
- moreActions: by.id('app.header.more'),
+ logoLink = this.byCss('.app-menu__title');
+ moreActions = browser.element(by.id('app.header.more'));
+ sidenavToggle = this.byCss(`[id='adf-sidebar-toggle-start']`);
- sidenavToggle: `[id='adf-sidebar-toggle-start']`,
- expandedSidenav: by.css(`[data-automation-id='expanded']`),
- collapsedSidenav: by.css(`[data-automation-id='collapsed']`)
- };
-
- logoLink: ElementFinder = this.component.element(Header.selectors.logoLink);
- moreActions: ElementFinder = browser.element(Header.selectors.moreActions);
- sidenavToggle: ElementFinder = this.component.element(by.css(Header.selectors.sidenavToggle));
-
- userInfo: UserInfo = new UserInfo();
- menu: Menu = new Menu();
- toolbar: Toolbar = new Toolbar();
- searchInput: SearchInput = new SearchInput();
+ userInfo = new UserInfo();
+ menu = new Menu();
+ toolbar = new Toolbar();
+ searchInput = new SearchInput();
constructor(ancestor?: string) {
super('adf-layout-header', ancestor);
}
- async openMoreMenu() {
+ async openMoreMenu(): Promise {
await this.moreActions.click();
await this.menu.waitForMenuToOpen();
}
- async isSignOutDisplayed() {
+ async isSignOutDisplayed(): Promise {
return this.userInfo.menu.isMenuItemPresent('Sign out');
}
- async clickSidenavToggle() {
- await this.sidenavToggle.click();
+ async isSidenavExpanded(): Promise {
+ return browser.isElementPresent(by.css(`[data-automation-id='expanded']`));
}
- async isSidenavExpanded() {
- return browser.isElementPresent(Header.selectors.expandedSidenav);
- }
-
- async expandSideNav() {
+ async expandSideNav(): Promise {
const expanded = await this.isSidenavExpanded();
- if ( !expanded ) {
- await this.clickSidenavToggle();
- await browser.wait(until.elementLocated(Header.selectors.expandedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for expanded sidenav' );
+ if (!expanded) {
+ await this.sidenavToggle.click();
+ await waitElement(`[data-automation-id='expanded']`);
}
}
- async collapseSideNav() {
+ async collapseSideNav(): Promise {
const expanded = await this.isSidenavExpanded();
- if ( expanded ) {
- await this.clickSidenavToggle();
- await browser.wait(until.elementLocated(Header.selectors.collapsedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for collapsed sidenav')
+ if (expanded) {
+ await this.sidenavToggle.click();
+ await waitElement(`[data-automation-id='collapsed']`);
}
}
-
}
-
diff --git a/e2e/components/header/user-info.ts b/e2e/components/header/user-info.ts
index 88a3c9b93..0437b99fa 100755
--- a/e2e/components/header/user-info.ts
+++ b/e2e/components/header/user-info.ts
@@ -23,39 +23,27 @@
* along with Alfresco. If not, see .
*/
-import { ElementFinder, by } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
export class UserInfo extends Component {
- private static selectors = {
- avatar: by.css('.current-user__avatar'),
- fullName: by.css('.current-user__full-name'),
- menuItems: by.css('[mat-menu-item]')
- };
+ fullName = this.byCss('.current-user__full-name');
+ avatar = this.byCss('.current-user__avatar');
- fullName: ElementFinder = this.component.element(UserInfo.selectors.fullName);
- avatar: ElementFinder = this.component.element(UserInfo.selectors.avatar);
-
- menu: Menu = new Menu();
+ menu = new Menu();
constructor(ancestor?: string) {
super('aca-current-user', ancestor);
}
- async openMenu() {
- const { menu, avatar } = this;
+ async openMenu(): Promise