mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1628] async await (#693)
* async / await on login component and utils * more async / awaits * remove fdescribe * expect for exact totalItems in waitForApi methods other async / awaits * pagination tests * more tries * disable selenium promise manager * try to fix shared-links tests * re-enable selenium_promise_manager and some more fixes * add target es2017 to e2e * set target to es2017 on tsconfig.spec.json * other tries * forgotten console.log * disable pagination tests * some fixes for pagination * temporary fix viewer actions tests * fix some actions tests * fix some tests for actions * fix some tests for undo action * try to fix some more tests * fixes for toolbar actions * fix NoSuchElementError for openMoreMenu * fix NoSuchElementError for rightClickOnMultipleSelection * fixes for mark as favourite * more fixes * more fixes * change order of some expects * forgot describe
This commit is contained in:
committed by
Denys Vuika
parent
0d4795bfa8
commit
7d73ae309c
@@ -27,56 +27,60 @@ import { ElementFinder, ElementArrayFinder, by, promise } 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'
|
||||
};
|
||||
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: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item));
|
||||
currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Breadcrumb.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Breadcrumb.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
getNthItem(nth: number): ElementFinder {
|
||||
return this.items.get(nth - 1);
|
||||
}
|
||||
getNthItem(nth: number): ElementFinder {
|
||||
return this.items.get(nth - 1);
|
||||
}
|
||||
|
||||
getNthItemName(nth: number) {
|
||||
return this.getNthItem(nth).getText();
|
||||
}
|
||||
async getNthItemName(nth: number) {
|
||||
return await this.getNthItem(nth).getText();
|
||||
}
|
||||
|
||||
getItemsCount(): promise.Promise<number> {
|
||||
return this.items.count();
|
||||
}
|
||||
async getItemsCount() {
|
||||
return await this.items.count();
|
||||
}
|
||||
|
||||
getAllItems() {
|
||||
return this.items.map(elem => elem.getText().then(str => str.split('\nchevron_right')[0]));
|
||||
}
|
||||
async getAllItems() {
|
||||
return this.items.map(async elem => {
|
||||
const str = await elem.getText();
|
||||
return str.split('\nchevron_right')[0];
|
||||
});
|
||||
}
|
||||
|
||||
getFirstItemName(): promise.Promise<string> {
|
||||
return this.items.get(0).getText();
|
||||
}
|
||||
async getFirstItemName() {
|
||||
return await this.items.get(0).getText();
|
||||
}
|
||||
|
||||
getCurrentItem() {
|
||||
return this.currentItem;
|
||||
}
|
||||
getCurrentItem() {
|
||||
return this.currentItem;
|
||||
}
|
||||
|
||||
getCurrentItemName(): promise.Promise<string> {
|
||||
return this.currentItem.getText();
|
||||
}
|
||||
async getCurrentItemName() {
|
||||
return await this.currentItem.getText();
|
||||
}
|
||||
|
||||
clickItem(name: string) {
|
||||
return this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`)).click();
|
||||
}
|
||||
async clickItem(name: string) {
|
||||
const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`));
|
||||
await elem.click();
|
||||
}
|
||||
|
||||
clickNthItem(nth: number) {
|
||||
return this.getNthItem(nth).click();
|
||||
}
|
||||
async clickNthItem(nth: number) {
|
||||
await this.getNthItem(nth).click();
|
||||
}
|
||||
|
||||
getNthItemTooltip(nth: number) {
|
||||
return this.getNthItem(nth).getAttribute('title');
|
||||
}
|
||||
async getNthItemTooltip(nth: number) {
|
||||
return await this.getNthItem(nth).getAttribute('title');
|
||||
}
|
||||
}
|
||||
|
@@ -23,21 +23,21 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, element, by, ExpectedConditions as EC, browser } from 'protractor';
|
||||
import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../configs';
|
||||
|
||||
export abstract class Component {
|
||||
component: ElementFinder;
|
||||
component: ElementFinder;
|
||||
|
||||
constructor(selector: string, ancestor?: ElementFinder) {
|
||||
const locator = selector;
|
||||
constructor(selector: string, ancestor?: ElementFinder) {
|
||||
const locator = selector;
|
||||
|
||||
this.component = ancestor
|
||||
? ancestor.$$(locator).first()
|
||||
: browser.$$(locator).first();
|
||||
}
|
||||
this.component = ancestor
|
||||
? ancestor.$$(locator).first()
|
||||
: browser.$$(locator).first();
|
||||
}
|
||||
|
||||
wait() {
|
||||
return browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
async wait() {
|
||||
await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, promise, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Menu } from '../menu/menu';
|
||||
@@ -76,252 +76,243 @@ export class DataTable extends Component {
|
||||
|
||||
// Wait methods (waits for elements)
|
||||
waitForHeader() {
|
||||
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
|
||||
try {
|
||||
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
|
||||
} catch (error) {
|
||||
console.log('----- wait for header catch : ', error);
|
||||
}
|
||||
}
|
||||
|
||||
waitForEmptyState() {
|
||||
return browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
|
||||
async waitForEmptyState() {
|
||||
await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
// Header/Column methods
|
||||
getColumnHeaders(): ElementArrayFinder {
|
||||
getColumnHeaders() {
|
||||
const locator = by.css(DataTable.selectors.columnHeader);
|
||||
return this.head.all(locator);
|
||||
}
|
||||
|
||||
getNthColumnHeader(nth: number): ElementFinder {
|
||||
async getHeaderText() {
|
||||
const el = this.getColumnHeaders();
|
||||
return await el.getText();
|
||||
}
|
||||
|
||||
getNthColumnHeader(nth: number) {
|
||||
return this.getColumnHeaders().get(nth - 1);
|
||||
}
|
||||
|
||||
getColumnHeaderByLabel(label: string): ElementFinder {
|
||||
getColumnHeaderByLabel(label: string) {
|
||||
const locator = by.cssContainingText(DataTable.selectors.columnHeader, label);
|
||||
return this.head.element(locator);
|
||||
}
|
||||
|
||||
getSortedColumnHeader(): ElementFinder {
|
||||
getSortedColumnHeader() {
|
||||
const locator = by.css(DataTable.selectors.sortedColumnHeader);
|
||||
return this.head.element(locator);
|
||||
}
|
||||
|
||||
getSortingOrder() {
|
||||
return this.getSortedColumnHeader()
|
||||
.getAttribute('class')
|
||||
.then(str => {
|
||||
if (str.includes('asc')) {
|
||||
return 'asc';
|
||||
} else {
|
||||
if (str.includes('desc')) {
|
||||
return 'desc';
|
||||
}
|
||||
}
|
||||
});
|
||||
async getSortedColumnHeaderText() {
|
||||
return await this.getSortedColumnHeader().getText();
|
||||
}
|
||||
|
||||
sortByColumn(columnName: string): promise.Promise<void> {
|
||||
const column = this.getColumnHeaderByLabel(columnName);
|
||||
const click = browser
|
||||
.actions()
|
||||
.mouseMove(column)
|
||||
.click();
|
||||
async getSortingOrder() {
|
||||
const str = await this.getSortedColumnHeader().getAttribute('class');
|
||||
if (str.includes('asc')) {
|
||||
return 'asc';
|
||||
}
|
||||
else {
|
||||
if (str.includes('desc')) {
|
||||
return 'desc';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return click.perform();
|
||||
async sortByColumn(columnName: string) {
|
||||
const column = this.getColumnHeaderByLabel(columnName);
|
||||
const click = browser.actions().mouseMove(column).click();
|
||||
|
||||
await click.perform();
|
||||
}
|
||||
|
||||
// Rows methods
|
||||
getRows(): ElementArrayFinder {
|
||||
getRows() {
|
||||
return this.body.all(by.css(DataTable.selectors.row));
|
||||
}
|
||||
|
||||
countRows(): promise.Promise<number> {
|
||||
return this.getRows().count();
|
||||
async countRows() {
|
||||
return await this.getRows().count();
|
||||
}
|
||||
|
||||
getSelectedRows(): ElementArrayFinder {
|
||||
getSelectedRows() {
|
||||
return this.body.all(by.css(DataTable.selectors.selectedRow));
|
||||
}
|
||||
|
||||
countSelectedRows(): promise.Promise<number> {
|
||||
return this.getSelectedRows().count();
|
||||
async countSelectedRows() {
|
||||
return await this.getSelectedRows().count();
|
||||
}
|
||||
|
||||
getNthRow(nth: number): ElementFinder {
|
||||
getNthRow(nth: number) {
|
||||
return this.getRows().get(nth - 1);
|
||||
}
|
||||
|
||||
getRowByName(name: string): ElementFinder {
|
||||
getRowByName(name: string) {
|
||||
return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
|
||||
}
|
||||
|
||||
getRowFirstCell(name: string) {
|
||||
return this.getRowByName(name)
|
||||
.all(by.css(DataTable.selectors.cell))
|
||||
.get(0);
|
||||
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(0);
|
||||
}
|
||||
|
||||
getRowNameCell(name: string) {
|
||||
return this.getRowByName(name)
|
||||
.all(by.css(DataTable.selectors.cell))
|
||||
.get(1);
|
||||
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1);
|
||||
}
|
||||
|
||||
getRowNameCellText(name: string) {
|
||||
return this.getRowNameCell(name).$('span');
|
||||
}
|
||||
|
||||
getItemNameTooltip(name: string): promise.Promise<string> {
|
||||
return this.getRowNameCellText(name).getAttribute('title');
|
||||
async getItemNameTooltip(name: string) {
|
||||
return await this.getRowNameCellText(name).getAttribute('title');
|
||||
}
|
||||
|
||||
hasCheckMarkIcon(itemName: string) {
|
||||
return this.getRowByName(itemName)
|
||||
.element(by.css(DataTable.selectors.selectedIcon))
|
||||
.isPresent();
|
||||
async hasCheckMarkIcon(itemName: string) {
|
||||
return await this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent();
|
||||
}
|
||||
|
||||
getNameLink(itemName: string) {
|
||||
return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink);
|
||||
}
|
||||
|
||||
hasLinkOnName(itemName: string) {
|
||||
return this.getNameLink(itemName).isPresent();
|
||||
async hasLinkOnName(itemName: string) {
|
||||
return await this.getNameLink(itemName).isPresent();
|
||||
}
|
||||
|
||||
// Navigation/selection methods
|
||||
doubleClickOnRowByName(name: string): promise.Promise<any> {
|
||||
async doubleClickOnRowByName(name: string) {
|
||||
const item = this.getRowFirstCell(name);
|
||||
return Utils.waitUntilElementClickable(item).then(() =>
|
||||
browser
|
||||
.actions()
|
||||
.mouseMove(item)
|
||||
.click()
|
||||
.click()
|
||||
.perform()
|
||||
);
|
||||
await Utils.waitUntilElementClickable(item);
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().click().click().perform();
|
||||
}
|
||||
|
||||
selectItem(name: string): promise.Promise<any> {
|
||||
const item = this.getRowFirstCell(name);
|
||||
return Utils.waitUntilElementClickable(item).then(() => item.click());
|
||||
async selectItem(name: string) {
|
||||
try{
|
||||
const item = this.getRowFirstCell(name);
|
||||
// await Utils.waitUntilElementClickable(item);
|
||||
await item.click();
|
||||
|
||||
} catch (e) {
|
||||
console.log('--- select item catch : ', e);
|
||||
}
|
||||
}
|
||||
|
||||
clickNameLink(itemName: string) {
|
||||
return this.getNameLink(itemName).click();
|
||||
async clickNameLink(itemName: string) {
|
||||
await this.getNameLink(itemName).click();
|
||||
}
|
||||
|
||||
selectMultipleItems(names: string[]): promise.Promise<void> {
|
||||
return this.clearSelection()
|
||||
.then(() =>
|
||||
browser
|
||||
.actions()
|
||||
.sendKeys(protractor.Key.COMMAND)
|
||||
.perform()
|
||||
)
|
||||
.then(() => {
|
||||
names.forEach(name => {
|
||||
this.selectItem(name);
|
||||
});
|
||||
})
|
||||
.then(() =>
|
||||
browser
|
||||
.actions()
|
||||
.sendKeys(protractor.Key.NULL)
|
||||
.perform()
|
||||
);
|
||||
async selectMultipleItems(names: string[]) {
|
||||
await this.clearSelection();
|
||||
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
|
||||
for (const name of names) {
|
||||
await this.selectItem(name);
|
||||
}
|
||||
await browser.actions().sendKeys(protractor.Key.NULL).perform();
|
||||
}
|
||||
|
||||
clearSelection(): promise.Promise<void> {
|
||||
return this.getSelectedRows()
|
||||
.count()
|
||||
.then(count => {
|
||||
if (count !== 0) {
|
||||
browser.refresh().then(() => this.waitForHeader());
|
||||
}
|
||||
});
|
||||
async clearSelection() {
|
||||
try {
|
||||
const count = await this.countSelectedRows();
|
||||
if (count !== 0) {
|
||||
await browser.refresh();
|
||||
await this.waitForHeader();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('------ clearSelection catch : ', error);
|
||||
}
|
||||
}
|
||||
|
||||
async rightClickOnItem(itemName: string) {
|
||||
const item = this.getRowFirstCell(itemName);
|
||||
await browser
|
||||
.actions()
|
||||
.click(item, protractor.Button.RIGHT)
|
||||
.perform();
|
||||
await browser.actions().click(item, protractor.Button.RIGHT).perform();
|
||||
}
|
||||
|
||||
async rightClickOnMultipleSelection() {
|
||||
await this.waitForHeader();
|
||||
const itemFromSelection = this.getSelectedRows().get(0);
|
||||
await browser
|
||||
.actions()
|
||||
.click(itemFromSelection, protractor.Button.RIGHT)
|
||||
.perform();
|
||||
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
|
||||
}
|
||||
|
||||
getItemLocation(name: string) {
|
||||
getItemLocationEl(name: string) {
|
||||
return this.getRowByName(name).element(this.locationLink);
|
||||
}
|
||||
|
||||
getItemLocationTooltip(name: string): promise.Promise<string> {
|
||||
return this.getItemLocation(name)
|
||||
.$('a')
|
||||
.getAttribute('title');
|
||||
async getItemLocation(name: string) {
|
||||
return await this.getItemLocationEl(name).getText();
|
||||
}
|
||||
|
||||
getItemLocationTileAttr(name: string) {
|
||||
const location = this.getItemLocation(name).$('a');
|
||||
async getItemLocationTooltip(name: string) {
|
||||
return await this.getItemLocationEl(name).$('a').getAttribute('title');
|
||||
}
|
||||
|
||||
async getItemLocationTileAttr(name: string) {
|
||||
const location = this.getItemLocationEl(name).$('a');
|
||||
const condition = () => location.getAttribute('title').then(value => value && value.length > 0);
|
||||
|
||||
browser
|
||||
.actions()
|
||||
.mouseMove(location)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(location).perform();
|
||||
|
||||
browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||
return location.getAttribute('title');
|
||||
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||
return await location.getAttribute('title');
|
||||
}
|
||||
|
||||
clickItemLocation(name: string) {
|
||||
return this.getItemLocation(name).click();
|
||||
async clickItemLocation(name: string) {
|
||||
await this.getItemLocationEl(name).click();
|
||||
}
|
||||
|
||||
// empty state methods
|
||||
isEmptyList(): promise.Promise<boolean> {
|
||||
return this.emptyList.isPresent();
|
||||
async isEmptyList() {
|
||||
return await this.emptyList.isPresent();
|
||||
}
|
||||
|
||||
isEmptyWithDragAndDrop(): promise.Promise<boolean> {
|
||||
return this.emptyFolderDragAndDrop.isDisplayed();
|
||||
async isEmptyWithDragAndDrop() {
|
||||
return await this.emptyFolderDragAndDrop.isDisplayed();
|
||||
}
|
||||
|
||||
getEmptyDragAndDropText(): promise.Promise<string> {
|
||||
return this.isEmptyWithDragAndDrop().then(() => {
|
||||
return this.emptyFolderDragAndDrop.getText();
|
||||
});
|
||||
async getEmptyDragAndDropText() {
|
||||
const isEmpty = await this.isEmptyWithDragAndDrop();
|
||||
if (isEmpty) {
|
||||
return await this.emptyFolderDragAndDrop.getText();
|
||||
}
|
||||
}
|
||||
|
||||
getEmptyStateTitle(): promise.Promise<string> {
|
||||
return this.isEmptyList().then(() => {
|
||||
return this.emptyListTitle.getText();
|
||||
});
|
||||
async getEmptyStateTitle() {
|
||||
const isEmpty = await this.isEmptyList();
|
||||
if (isEmpty) {
|
||||
return await this.emptyListTitle.getText();
|
||||
}
|
||||
}
|
||||
|
||||
getEmptyStateSubtitle(): promise.Promise<string> {
|
||||
return this.isEmptyList().then(() => {
|
||||
return this.emptyListSubtitle.getText();
|
||||
});
|
||||
async getEmptyStateSubtitle() {
|
||||
const isEmpty = await this.isEmptyList();
|
||||
if (isEmpty) {
|
||||
return await this.emptyListSubtitle.getText();
|
||||
}
|
||||
}
|
||||
|
||||
getEmptyStateText(): promise.Promise<string> {
|
||||
return this.isEmptyList().then(() => {
|
||||
return this.emptyListText.getText();
|
||||
});
|
||||
async getEmptyStateText() {
|
||||
const isEmpty = await this.isEmptyList();
|
||||
if (isEmpty) {
|
||||
return await this.emptyListText.getText();
|
||||
}
|
||||
}
|
||||
|
||||
getCellsContainingName(name: string) {
|
||||
return this.getRows()
|
||||
.all(by.cssContainingText(DataTable.selectors.cell, name))
|
||||
.map(cell => cell.getText());
|
||||
async getCellsContainingName(name: string) {
|
||||
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
|
||||
return rows.map(async cell => await cell.getText());
|
||||
}
|
||||
|
||||
async hasContextMenu() {
|
||||
return (await this.menu.getItemsCount()) > 0;
|
||||
const count = await this.menu.getItemsCount();
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
|
@@ -28,42 +28,42 @@ import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class ConfirmDialog extends Component {
|
||||
private static selectors = {
|
||||
root: 'adf-confirm-dialog',
|
||||
private static selectors = {
|
||||
root: 'adf-confirm-dialog',
|
||||
|
||||
title: '.mat-dialog-title',
|
||||
content: '.mat-dialog-content',
|
||||
delete: 'adf-confirm-accept',
|
||||
keep: 'adf-confirm-cancel'
|
||||
};
|
||||
title: '.mat-dialog-title',
|
||||
content: '.mat-dialog-content',
|
||||
delete: 'adf-confirm-accept',
|
||||
keep: 'adf-confirm-cancel'
|
||||
};
|
||||
|
||||
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
|
||||
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
|
||||
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete));
|
||||
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep));
|
||||
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
|
||||
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
|
||||
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete));
|
||||
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(ConfirmDialog.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(ConfirmDialog.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForDialogToClose() {
|
||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
async waitForDialogToClose() {
|
||||
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
}
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
}
|
||||
|
||||
async getText() {
|
||||
return await this.content.getText();
|
||||
}
|
||||
async getText() {
|
||||
return await this.content.getText();
|
||||
}
|
||||
|
||||
async clickDelete() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
async clickDelete() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
|
||||
async clickKeep() {
|
||||
await this.keepButton.click();
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
async clickKeep() {
|
||||
await this.keepButton.click();
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
}
|
||||
|
@@ -29,80 +29,75 @@ import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
export class CreateOrEditFolderDialog extends Component {
|
||||
private static selectors = {
|
||||
root: 'adf-folder-dialog',
|
||||
private static selectors = {
|
||||
root: 'adf-folder-dialog',
|
||||
|
||||
title: '.mat-dialog-title',
|
||||
nameInput: 'input[placeholder="Name" i]',
|
||||
descriptionTextArea: 'textarea[placeholder="Description" i]',
|
||||
button: '.mat-dialog-actions button',
|
||||
validationMessage: '.mat-hint span'
|
||||
};
|
||||
title: '.mat-dialog-title',
|
||||
nameInput: 'input[placeholder="Name" i]',
|
||||
descriptionTextArea: 'textarea[placeholder="Description" i]',
|
||||
button: '.mat-dialog-actions button',
|
||||
validationMessage: '.mat-hint span'
|
||||
};
|
||||
|
||||
title: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.title));
|
||||
nameInput: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
|
||||
descriptionTextArea: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
|
||||
createButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Create'));
|
||||
cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Cancel'));
|
||||
updateButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Update'));
|
||||
validationMessage: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
|
||||
title: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.title));
|
||||
nameInput: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
|
||||
descriptionTextArea: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
|
||||
createButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Create'));
|
||||
cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Cancel'));
|
||||
updateButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Update'));
|
||||
validationMessage: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(CreateOrEditFolderDialog.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(CreateOrEditFolderDialog.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
waitForDialogToOpen() {
|
||||
return browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT)
|
||||
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT));
|
||||
async waitForDialogToOpen() {
|
||||
await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
}
|
||||
async waitForDialogToClose() {
|
||||
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
waitForDialogToClose() {
|
||||
return browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
}
|
||||
|
||||
getTitle(): promise.Promise<string> {
|
||||
return this.title.getText();
|
||||
}
|
||||
async isValidationMessageDisplayed() {
|
||||
return await this.validationMessage.isDisplayed();
|
||||
}
|
||||
|
||||
isValidationMessageDisplayed(): promise.Promise<boolean> {
|
||||
return this.validationMessage.isDisplayed();
|
||||
}
|
||||
async getValidationMessage() {
|
||||
await this.isValidationMessageDisplayed();
|
||||
return await this.validationMessage.getText();
|
||||
}
|
||||
|
||||
getValidationMessage(): promise.Promise<string> {
|
||||
return this.isValidationMessageDisplayed()
|
||||
.then(() => this.validationMessage.getText());
|
||||
}
|
||||
async enterName(name: string) {
|
||||
await this.nameInput.clear();
|
||||
await Utils.typeInField(this.nameInput, name);
|
||||
}
|
||||
|
||||
enterName(name: string) {
|
||||
return this.nameInput.clear()
|
||||
// .then(() => this.nameInput.sendKeys(name));
|
||||
.then(() => Utils.typeInField(this.nameInput, name));
|
||||
}
|
||||
async enterDescription(description: string) {
|
||||
await this.descriptionTextArea.clear();
|
||||
await Utils.typeInField(this.descriptionTextArea, description);
|
||||
}
|
||||
|
||||
enterDescription(description: string) {
|
||||
return this.descriptionTextArea.clear()
|
||||
// .then(() => this.descriptionTextArea.sendKeys(description));
|
||||
.then(() => Utils.typeInField(this.descriptionTextArea, description));
|
||||
}
|
||||
async deleteNameWithBackspace() {
|
||||
await this.nameInput.clear();
|
||||
await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||
}
|
||||
|
||||
deleteNameWithBackspace(): promise.Promise<void> {
|
||||
return this.nameInput.clear()
|
||||
.then(() => {
|
||||
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||
});
|
||||
}
|
||||
async clickCreate() {
|
||||
await this.createButton.click();
|
||||
}
|
||||
|
||||
clickCreate() {
|
||||
return this.createButton.click();
|
||||
}
|
||||
async clickCancel() {
|
||||
await this.cancelButton.click();
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
|
||||
clickCancel() {
|
||||
return this.cancelButton.click()
|
||||
.then(() => this.waitForDialogToClose());
|
||||
}
|
||||
|
||||
clickUpdate() {
|
||||
return this.updateButton.click();
|
||||
}
|
||||
async clickUpdate() {
|
||||
await this.updateButton.click();
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ export class ShareDialog extends Component {
|
||||
}
|
||||
|
||||
async waitForDialogToClose() {
|
||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
|
@@ -30,34 +30,34 @@ import { protractor } from 'protractor';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
export class Header extends Component {
|
||||
private locators = {
|
||||
logoLink: by.css('.app-menu__title'),
|
||||
userInfo: by.css('aca-current-user'),
|
||||
searchButton: by.css('#adf-search-button'),
|
||||
searchBar: by.css('#adf-control-input')
|
||||
};
|
||||
private locators = {
|
||||
logoLink: by.css('.app-menu__title'),
|
||||
userInfo: by.css('aca-current-user'),
|
||||
searchButton: by.css('#adf-search-button'),
|
||||
searchBar: by.css('#adf-control-input')
|
||||
};
|
||||
|
||||
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
|
||||
userInfo: UserInfo = new UserInfo(this.component);
|
||||
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
|
||||
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
|
||||
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
|
||||
userInfo: UserInfo = new UserInfo(this.component);
|
||||
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
|
||||
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super('adf-layout-header', ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super('adf-layout-header', ancestor);
|
||||
}
|
||||
|
||||
searchForText(text: string) {
|
||||
return this.searchBar.clear()
|
||||
.then(() => this.searchBar.sendKeys(text))
|
||||
.then(() => this.searchBar.sendKeys(protractor.Key.ENTER));
|
||||
}
|
||||
async searchForText(text: string) {
|
||||
await this.searchBar.clear();
|
||||
await this.searchBar.sendKeys(text);
|
||||
await this.searchBar.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
async waitForSearchButton() {
|
||||
return await Utils.waitUntilElementClickable(this.searchButton);
|
||||
}
|
||||
async waitForSearchButton() {
|
||||
await Utils.waitUntilElementClickable(this.searchButton);
|
||||
}
|
||||
|
||||
async waitForSearchBar() {
|
||||
return await Utils.waitUntilElementClickable(this.searchBar);
|
||||
}
|
||||
async waitForSearchBar() {
|
||||
await Utils.waitUntilElementClickable(this.searchBar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,42 +23,40 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, promise } from 'protractor';
|
||||
import { ElementFinder, by } from 'protractor';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class UserInfo extends Component {
|
||||
private locators = {
|
||||
avatar: by.css('.current-user__avatar'),
|
||||
fullName: by.css('.current-user__full-name'),
|
||||
menuItems: by.css('[mat-menu-item]')
|
||||
};
|
||||
private locators = {
|
||||
avatar: by.css('.current-user__avatar'),
|
||||
fullName: by.css('.current-user__full-name'),
|
||||
menuItems: by.css('[mat-menu-item]')
|
||||
};
|
||||
|
||||
fullName: ElementFinder = this.component.element(this.locators.fullName);
|
||||
avatar: ElementFinder = this.component.element(this.locators.avatar);
|
||||
fullName: ElementFinder = this.component.element(this.locators.fullName);
|
||||
avatar: ElementFinder = this.component.element(this.locators.avatar);
|
||||
|
||||
menu: Menu = new Menu();
|
||||
menu: Menu = new Menu();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super('aca-current-user', ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super('aca-current-user', ancestor);
|
||||
}
|
||||
|
||||
openMenu(): promise.Promise<Menu> {
|
||||
const { menu, avatar } = this;
|
||||
async openMenu() {
|
||||
const { menu, avatar } = this;
|
||||
|
||||
return avatar.click()
|
||||
.then(() => menu.wait())
|
||||
.then(() => menu);
|
||||
}
|
||||
await avatar.click();
|
||||
await menu.wait();
|
||||
return menu;
|
||||
}
|
||||
|
||||
get name(): promise.Promise<string> {
|
||||
return this.fullName.getText();
|
||||
}
|
||||
getName() {
|
||||
return this.fullName.getText();
|
||||
}
|
||||
|
||||
signOut(): promise.Promise<void> {
|
||||
return this.openMenu()
|
||||
.then(menu => {
|
||||
menu.clickMenuItem('Sign out');
|
||||
});
|
||||
}
|
||||
async signOut() {
|
||||
const menu = await this.openMenu();
|
||||
await menu.clickMenuItem('Sign out');
|
||||
}
|
||||
}
|
||||
|
@@ -23,73 +23,73 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
|
||||
export class InfoDrawer extends Component {
|
||||
private static selectors = {
|
||||
root: 'aca-info-drawer',
|
||||
private static selectors = {
|
||||
root: 'aca-info-drawer',
|
||||
|
||||
header: '.adf-info-drawer-layout-header',
|
||||
content: '.adf-info-drawer-layout-content',
|
||||
header: '.adf-info-drawer-layout-header',
|
||||
content: '.adf-info-drawer-layout-content',
|
||||
|
||||
tabs: '.adf-info-drawer-tabs',
|
||||
tabLabel: '.mat-tab-label-content',
|
||||
tabActiveLabel: '.mat-tab-label-active',
|
||||
tabs: '.adf-info-drawer-tabs',
|
||||
tabLabel: '.mat-tab-label-content',
|
||||
tabActiveLabel: '.mat-tab-label-active',
|
||||
|
||||
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
|
||||
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
|
||||
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
|
||||
};
|
||||
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
|
||||
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
|
||||
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
|
||||
};
|
||||
|
||||
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
|
||||
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
|
||||
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
|
||||
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
|
||||
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
|
||||
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
|
||||
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
|
||||
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
|
||||
|
||||
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
|
||||
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
|
||||
|
||||
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
|
||||
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
|
||||
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
|
||||
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(InfoDrawer.selectors.root, ancestor);
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(InfoDrawer.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForInfoDrawerToOpen() {
|
||||
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async isEmpty() {
|
||||
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async waitForInfoDrawerToOpen() {
|
||||
return browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
getTabByTitle(title: string) {
|
||||
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
|
||||
}
|
||||
|
||||
async isEmpty() {
|
||||
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async isTabPresent(title: string) {
|
||||
return await this.getTabByTitle(title).isPresent();
|
||||
}
|
||||
|
||||
getTabByTitle(title: string) {
|
||||
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
|
||||
}
|
||||
async isTabDisplayed(title: string) {
|
||||
return await this.getTabByTitle(title).isDisplayed();
|
||||
}
|
||||
|
||||
async isTabPresent(title: string) {
|
||||
return await this.getTabByTitle(title).isPresent();
|
||||
}
|
||||
async getTabTitle(index: number) {
|
||||
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
|
||||
}
|
||||
|
||||
async isTabDisplayed(title: string) {
|
||||
return await this.getTabByTitle(title).isDisplayed();
|
||||
}
|
||||
async clickTab(title: string) {
|
||||
await this.getTabByTitle(title).click();
|
||||
}
|
||||
|
||||
async getTabTitle(index: number) {
|
||||
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
|
||||
}
|
||||
|
||||
async clickTab(title: string) {
|
||||
return await this.getTabByTitle(title).click();
|
||||
}
|
||||
|
||||
async getComponentIdOfTab(title: string) {
|
||||
return await this.tabActiveContent.getAttribute('data-automation-id');
|
||||
}
|
||||
async getComponentIdOfTab(title: string) {
|
||||
return await this.tabActiveContent.getAttribute('data-automation-id');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,83 +23,76 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, ElementFinder, promise } from 'protractor';
|
||||
import { by, ElementFinder } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class LoginComponent extends Component {
|
||||
static selector = 'adf-login';
|
||||
static selector = 'adf-login';
|
||||
|
||||
private locators = {
|
||||
usernameInput: by.css('input#username'),
|
||||
passwordInput: by.css('input#password'),
|
||||
passwordVisibility: by.css('.adf-login-password-icon'),
|
||||
submitButton: by.css('button#login-button'),
|
||||
errorMessage: by.css('.login-error-message'),
|
||||
copyright: by.css('.copyright')
|
||||
};
|
||||
private locators = {
|
||||
usernameInput: by.css('input#username'),
|
||||
passwordInput: by.css('input#password'),
|
||||
passwordVisibility: by.css('.adf-login-password-icon'),
|
||||
submitButton: by.css('button#login-button'),
|
||||
errorMessage: by.css('.login-error-message'),
|
||||
copyright: by.css('.copyright')
|
||||
};
|
||||
|
||||
usernameInput: ElementFinder = this.component.element(this.locators.usernameInput);
|
||||
passwordInput: ElementFinder = this.component.element(this.locators.passwordInput);
|
||||
submitButton: ElementFinder = this.component.element(this.locators.submitButton);
|
||||
errorMessage: ElementFinder = this.component.element(this.locators.errorMessage);
|
||||
copyright: ElementFinder = this.component.element(this.locators.copyright);
|
||||
passwordVisibility: ElementFinder = this.component.element(this.locators.passwordVisibility);
|
||||
usernameInput: ElementFinder = this.component.element(this.locators.usernameInput);
|
||||
passwordInput: ElementFinder = this.component.element(this.locators.passwordInput);
|
||||
submitButton: ElementFinder = this.component.element(this.locators.submitButton);
|
||||
errorMessage: ElementFinder = this.component.element(this.locators.errorMessage);
|
||||
copyright: ElementFinder = this.component.element(this.locators.copyright);
|
||||
passwordVisibility: ElementFinder = this.component.element(this.locators.passwordVisibility);
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(LoginComponent.selector, ancestor);
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(LoginComponent.selector, ancestor);
|
||||
}
|
||||
|
||||
async enterUsername(username: string) {
|
||||
const { usernameInput } = this;
|
||||
|
||||
await usernameInput.clear();
|
||||
await usernameInput.sendKeys(username);
|
||||
}
|
||||
|
||||
async enterPassword(password: string) {
|
||||
const { passwordInput } = this;
|
||||
|
||||
await passwordInput.clear();
|
||||
await passwordInput.sendKeys(password);
|
||||
}
|
||||
|
||||
async enterCredentials(username: string, password: string) {
|
||||
await this.enterUsername(username);
|
||||
await this.enterPassword(password);
|
||||
}
|
||||
|
||||
submit() {
|
||||
return this.submitButton.click();
|
||||
}
|
||||
|
||||
async getPasswordVisibility() {
|
||||
const text = await this.passwordVisibility.getText();
|
||||
if (text.endsWith('visibility_off')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
enterUsername(username: string): LoginComponent {
|
||||
const { usernameInput } = this;
|
||||
|
||||
usernameInput.clear();
|
||||
usernameInput.sendKeys(username);
|
||||
|
||||
return this;
|
||||
else {
|
||||
if (text.endsWith('visibility')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enterPassword(password: string): LoginComponent {
|
||||
const { passwordInput } = this;
|
||||
|
||||
passwordInput.clear();
|
||||
passwordInput.sendKeys(password);
|
||||
|
||||
return this;
|
||||
async isPasswordShown() {
|
||||
const type = await this.passwordInput.getAttribute('type');
|
||||
if (type === 'text') {
|
||||
return true;
|
||||
}
|
||||
|
||||
enterCredentials(username: string, password: string) {
|
||||
this.enterUsername(username).enterPassword(password);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
submit(): promise.Promise<void> {
|
||||
return this.submitButton.click();
|
||||
}
|
||||
|
||||
getPasswordVisibility() {
|
||||
return this.passwordVisibility.getText()
|
||||
.then(text => {
|
||||
if (text.endsWith('visibility_off')) {
|
||||
return false;
|
||||
} else {
|
||||
if (text.endsWith('visibility')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isPasswordShown() {
|
||||
return this.passwordInput.getAttribute('type')
|
||||
.then(type => {
|
||||
if (type === 'text') {
|
||||
return true;
|
||||
} else {
|
||||
if (type === 'password') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
else {
|
||||
if (type === 'password') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,92 +23,96 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, promise } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils'
|
||||
|
||||
export class Menu extends Component {
|
||||
private static selectors = {
|
||||
root: '.mat-menu-panel',
|
||||
item: '.mat-menu-item',
|
||||
icon: '.mat-icon',
|
||||
uploadFiles: 'app-upload-files'
|
||||
};
|
||||
private static selectors = {
|
||||
root: '.mat-menu-panel',
|
||||
item: '.mat-menu-item',
|
||||
icon: '.mat-icon',
|
||||
uploadFiles: 'app-upload-files'
|
||||
};
|
||||
|
||||
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
|
||||
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
|
||||
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
|
||||
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
|
||||
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
|
||||
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Menu.selectors.root, ancestor);
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Menu.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForMenuToOpen() {
|
||||
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async waitForMenuToClose() {
|
||||
await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async closeMenu() {
|
||||
// if (await this.backdrop.isPresent()) {
|
||||
// return await this.backdrop.click();
|
||||
// } else {
|
||||
// return await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||
// }
|
||||
return Utils.pressEscape();
|
||||
}
|
||||
|
||||
getNthItem(nth: number) {
|
||||
return this.items.get(nth - 1);
|
||||
}
|
||||
|
||||
getItemByLabel(menuItem: string) {
|
||||
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem));
|
||||
}
|
||||
|
||||
getItemById(id: string) {
|
||||
return this.component.element(by.id(id));
|
||||
}
|
||||
|
||||
async getItemTooltip(menuItem: string) {
|
||||
return await this.getItemByLabel(menuItem).getAttribute('title');
|
||||
}
|
||||
|
||||
async getItemIconText(menuItem: string) {
|
||||
return await this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
|
||||
}
|
||||
|
||||
async getItemIdAttribute(menuItem: string) {
|
||||
return await this.getItemByLabel(menuItem).getAttribute('id');
|
||||
}
|
||||
|
||||
async getItemsCount() {
|
||||
return await this.items.count();
|
||||
}
|
||||
|
||||
async clickNthItem(nth: number) {
|
||||
const elem = this.getNthItem(nth);
|
||||
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.actions().mouseMove(elem).click().perform();
|
||||
await this.waitForMenuToClose();
|
||||
}
|
||||
|
||||
async clickMenuItem(menuItem: string) {
|
||||
try {
|
||||
const elem = this.getItemByLabel(menuItem);
|
||||
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
|
||||
await elem.click();
|
||||
} catch (e) {
|
||||
console.log('___click menu item catch___', e);
|
||||
}
|
||||
}
|
||||
|
||||
waitForMenuToOpen() {
|
||||
return browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT)
|
||||
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT))
|
||||
.then(() => browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT));
|
||||
}
|
||||
async isMenuItemPresent(title: string) {
|
||||
return await this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
|
||||
}
|
||||
|
||||
waitForMenuToClose() {
|
||||
return browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
closeMenu() {
|
||||
if (this.backdrop.isPresent()) {
|
||||
return this.backdrop.click();
|
||||
} else {
|
||||
return browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||
}
|
||||
}
|
||||
|
||||
getNthItem(nth: number): ElementFinder {
|
||||
return this.items.get(nth - 1);
|
||||
}
|
||||
|
||||
getItemByLabel(menuItem: string): ElementFinder {
|
||||
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem));
|
||||
}
|
||||
|
||||
getItemById(id: string) {
|
||||
return this.component.element(by.id(id));
|
||||
}
|
||||
|
||||
getItemTooltip(menuItem: string): promise.Promise<string> {
|
||||
return this.getItemByLabel(menuItem).getAttribute('title');
|
||||
}
|
||||
|
||||
getItemIconText(menuItem: string) {
|
||||
return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
|
||||
|
||||
}
|
||||
|
||||
getItemIdAttribute(menuItem: string) {
|
||||
return this.getItemByLabel(menuItem).getAttribute('id');
|
||||
}
|
||||
|
||||
getItemsCount(): promise.Promise<number> {
|
||||
return this.items.count();
|
||||
}
|
||||
|
||||
clickNthItem(nth: number): promise.Promise<any> {
|
||||
const elem = this.getNthItem(nth);
|
||||
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT)
|
||||
.then(() => browser.actions().mouseMove(elem).click().perform())
|
||||
.then(() => this.waitForMenuToClose());
|
||||
}
|
||||
|
||||
clickMenuItem(menuItem: string): promise.Promise<any> {
|
||||
const elem = this.getItemByLabel(menuItem);
|
||||
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT)
|
||||
.then(() => elem.click())
|
||||
.then(() => this.waitForMenuToClose());
|
||||
}
|
||||
|
||||
isMenuItemPresent(title: string): promise.Promise<boolean> {
|
||||
return this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
|
||||
}
|
||||
|
||||
uploadFile() {
|
||||
return this.uploadFiles;
|
||||
}
|
||||
uploadFile() {
|
||||
return this.uploadFiles;
|
||||
}
|
||||
}
|
||||
|
@@ -23,76 +23,76 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, promise, by } from 'protractor';
|
||||
import { ElementFinder, by } from 'protractor';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class Pagination extends Component {
|
||||
private static selectors = {
|
||||
root: 'adf-pagination',
|
||||
range: '.adf-pagination__range',
|
||||
maxItems: '.adf-pagination__max-items',
|
||||
currentPage: '.adf-pagination__current-page',
|
||||
totalPages: '.adf-pagination__total-pages',
|
||||
private static selectors = {
|
||||
root: 'adf-pagination',
|
||||
range: '.adf-pagination__range',
|
||||
maxItems: '.adf-pagination__max-items',
|
||||
currentPage: '.adf-pagination__current-page',
|
||||
totalPages: '.adf-pagination__total-pages',
|
||||
|
||||
previousButton: '.adf-pagination__previous-button',
|
||||
nextButton: '.adf-pagination__next-button',
|
||||
maxItemsButton: '.adf-pagination__max-items + button[mat-icon-button]',
|
||||
pagesButton: '.adf-pagination__current-page + button[mat-icon-button]'
|
||||
};
|
||||
previousButton: '.adf-pagination__previous-button',
|
||||
nextButton: '.adf-pagination__next-button',
|
||||
maxItemsButton: '.adf-pagination__max-items + button[mat-icon-button]',
|
||||
pagesButton: '.adf-pagination__current-page + button[mat-icon-button]'
|
||||
};
|
||||
|
||||
range: ElementFinder = this.component.element(by.css(Pagination.selectors.range));
|
||||
maxItems: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItems));
|
||||
currentPage: ElementFinder = this.component.element(by.css(Pagination.selectors.currentPage));
|
||||
totalPages: ElementFinder = this.component.element(by.css(Pagination.selectors.totalPages));
|
||||
previousButton: ElementFinder = this.component.element(by.css(Pagination.selectors.previousButton));
|
||||
nextButton: ElementFinder = this.component.element(by.css(Pagination.selectors.nextButton));
|
||||
maxItemsButton: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItemsButton));
|
||||
pagesButton: ElementFinder = this.component.element(by.css(Pagination.selectors.pagesButton));
|
||||
range: ElementFinder = this.component.element(by.css(Pagination.selectors.range));
|
||||
maxItems: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItems));
|
||||
currentPage: ElementFinder = this.component.element(by.css(Pagination.selectors.currentPage));
|
||||
totalPages: ElementFinder = this.component.element(by.css(Pagination.selectors.totalPages));
|
||||
previousButton: ElementFinder = this.component.element(by.css(Pagination.selectors.previousButton));
|
||||
nextButton: ElementFinder = this.component.element(by.css(Pagination.selectors.nextButton));
|
||||
maxItemsButton: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItemsButton));
|
||||
pagesButton: ElementFinder = this.component.element(by.css(Pagination.selectors.pagesButton));
|
||||
|
||||
menu: Menu = new Menu();
|
||||
menu: Menu = new Menu();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Pagination.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Pagination.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
openMaxItemsMenu(): promise.Promise<Menu> {
|
||||
const { menu, maxItemsButton } = this;
|
||||
async openMaxItemsMenu() {
|
||||
const { menu, maxItemsButton } = this;
|
||||
|
||||
return maxItemsButton.click()
|
||||
.then(() => menu.waitForMenuToOpen())
|
||||
.then(() => menu);
|
||||
}
|
||||
await maxItemsButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
// return menu;
|
||||
}
|
||||
|
||||
openCurrentPageMenu(): promise.Promise<Menu> {
|
||||
const { menu, pagesButton } = this;
|
||||
async openCurrentPageMenu() {
|
||||
const { menu, pagesButton } = this;
|
||||
|
||||
return pagesButton.click()
|
||||
.then(() => menu.waitForMenuToOpen())
|
||||
.then(() => menu);
|
||||
}
|
||||
await pagesButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
// return menu;
|
||||
}
|
||||
|
||||
getText(elem: ElementFinder) {
|
||||
return elem.getText();
|
||||
}
|
||||
async getText(elem: ElementFinder) {
|
||||
return await elem.getText();
|
||||
}
|
||||
|
||||
resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return this.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => this.menu.waitForMenuToClose());
|
||||
}
|
||||
async resetToDefaultPageSize() {
|
||||
await this.openMaxItemsMenu();
|
||||
await this.menu.clickMenuItem('25');
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return this.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => this.menu.waitForMenuToClose());
|
||||
}
|
||||
async resetToDefaultPageNumber() {
|
||||
await this.openCurrentPageMenu();
|
||||
await this.menu.clickMenuItem('1');
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
clickNext(): promise.Promise<any> {
|
||||
return this.nextButton.click();
|
||||
}
|
||||
async clickNext() {
|
||||
await this.nextButton.click();
|
||||
}
|
||||
|
||||
clickPrevious(): promise.Promise<any> {
|
||||
return this.previousButton.click();
|
||||
}
|
||||
async clickPrevious() {
|
||||
await this.previousButton.click();
|
||||
}
|
||||
}
|
||||
|
@@ -23,60 +23,68 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
export class Sidenav extends Component {
|
||||
private static selectors = {
|
||||
root: 'app-sidenav',
|
||||
link: '.sidenav-menu__item',
|
||||
label: '.menu__item--label',
|
||||
activeLink: '.menu__item--active',
|
||||
newButton: '[data-automation-id="create-button"]'
|
||||
};
|
||||
private static selectors = {
|
||||
root: 'app-sidenav',
|
||||
link: '.sidenav-menu__item',
|
||||
label: '.menu__item--label',
|
||||
activeLink: '.menu__item--active',
|
||||
newButton: '[data-automation-id="create-button"]'
|
||||
};
|
||||
|
||||
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
|
||||
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeLink));
|
||||
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
|
||||
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
|
||||
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeLink));
|
||||
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
|
||||
|
||||
menu: Menu = new Menu();
|
||||
menu: Menu = new Menu();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Sidenav.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
openNewMenu(): promise.Promise<Menu> {
|
||||
const { menu, newButton } = this;
|
||||
|
||||
return newButton.click()
|
||||
.then(() => menu.waitForMenuToOpen())
|
||||
.then(() => menu);
|
||||
}
|
||||
|
||||
openCreateDialog(): any {
|
||||
return this.openNewMenu()
|
||||
.then(() => this.menu.clickMenuItem('Create folder'));
|
||||
}
|
||||
|
||||
isActiveByLabel(label: string): promise.Promise<boolean> {
|
||||
return this.getLinkByLabel(label).getAttribute('class')
|
||||
.then(className => className.includes(Sidenav.selectors.activeLink.replace('.', '')));
|
||||
}
|
||||
|
||||
getLink(label: string): ElementFinder {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
|
||||
}
|
||||
|
||||
getLinkByLabel(label: string): ElementFinder {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
|
||||
}
|
||||
|
||||
getLinkTooltip(label: string): promise.Promise<string> {
|
||||
return this.getLink(label).getAttribute('title');
|
||||
}
|
||||
|
||||
navigateToLinkByLabel(label: string): promise.Promise<any> {
|
||||
return this.getLinkByLabel(label).click();
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Sidenav.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async openNewMenu() {
|
||||
const { menu, newButton } = this;
|
||||
|
||||
await newButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
}
|
||||
|
||||
async openCreateDialog() {
|
||||
await this.openNewMenu();
|
||||
await this.menu.clickMenuItem('Create folder');
|
||||
}
|
||||
|
||||
async isActiveByLabel(label: string) {
|
||||
const className = await this.getLinkByLabel(label).getAttribute('class');
|
||||
return className.includes(Sidenav.selectors.activeLink.replace('.', ''));
|
||||
}
|
||||
|
||||
getLink(label: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
|
||||
}
|
||||
|
||||
getLinkByLabel(label: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
|
||||
// return browser.element(by.xpath(`.//*[.="${label}" and class="${Sidenav.selectors.label}"]`))
|
||||
}
|
||||
|
||||
async getLinkTooltip(label: string) {
|
||||
return await this.getLink(label).getAttribute('title');
|
||||
}
|
||||
|
||||
async navigateToLinkByLabel(label: string) {
|
||||
try{
|
||||
const link = this.getLinkByLabel(label);
|
||||
await Utils.waitUntilElementClickable(link);
|
||||
return await link.click();
|
||||
|
||||
} catch (e){
|
||||
console.log('---- sidebar navigation catch : ', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,54 +28,58 @@ import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class Toolbar extends Component {
|
||||
private static selectors = {
|
||||
root: '.adf-toolbar',
|
||||
button: '.mat-icon-button'
|
||||
};
|
||||
private static selectors = {
|
||||
root: '.adf-toolbar',
|
||||
button: '.mat-icon-button'
|
||||
};
|
||||
|
||||
menu: Menu = new Menu();
|
||||
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
|
||||
menu: Menu = new Menu();
|
||||
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Toolbar.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Toolbar.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async isEmpty() {
|
||||
return await this.buttons.count() === 0;
|
||||
}
|
||||
async isEmpty() {
|
||||
const count = await this.buttons.count();
|
||||
return count === 0;
|
||||
}
|
||||
|
||||
async isButtonPresent(title: string) {
|
||||
return await this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)).isPresent();
|
||||
}
|
||||
async isButtonPresent(title: string) {
|
||||
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
||||
return await elem.isPresent();
|
||||
}
|
||||
|
||||
getButtonByLabel(label: string) {
|
||||
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
|
||||
}
|
||||
getButtonByLabel(label: string) {
|
||||
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
|
||||
}
|
||||
|
||||
getButtonByTitleAttribute(title: string) {
|
||||
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
||||
}
|
||||
getButtonByTitleAttribute(title: string) {
|
||||
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
||||
}
|
||||
|
||||
getButtonById(id: string) {
|
||||
return this.component.element(by.id(id));
|
||||
}
|
||||
getButtonById(id: string) {
|
||||
return this.component.element(by.id(id));
|
||||
}
|
||||
|
||||
async openMoreMenu() {
|
||||
await this.getButtonByTitleAttribute('More actions').click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
return this.menu;
|
||||
}
|
||||
async openMoreMenu() {
|
||||
await this.isButtonPresent('More actions');
|
||||
const moreMenu = this.getButtonByTitleAttribute('More actions');
|
||||
await moreMenu.click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
// return this.menu;
|
||||
}
|
||||
|
||||
async closeMoreMenu() {
|
||||
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||
}
|
||||
async closeMoreMenu() {
|
||||
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||
}
|
||||
|
||||
async getButtonTooltip(button: ElementFinder) {
|
||||
return await button.getAttribute('title');
|
||||
}
|
||||
async getButtonTooltip(button: ElementFinder) {
|
||||
return await button.getAttribute('title');
|
||||
}
|
||||
|
||||
async clickButton(title: string) {
|
||||
const btn = this.getButtonByTitleAttribute(title);
|
||||
await btn.click();
|
||||
}
|
||||
async clickButton(title: string) {
|
||||
const btn = this.getButtonByTitleAttribute(title);
|
||||
await btn.click();
|
||||
}
|
||||
}
|
||||
|
@@ -29,74 +29,74 @@ import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Toolbar } from '../toolbar/toolbar';
|
||||
|
||||
export class Viewer extends Component {
|
||||
private static selectors = {
|
||||
root: 'adf-viewer',
|
||||
private static selectors = {
|
||||
root: 'adf-viewer',
|
||||
|
||||
layout: '.adf-viewer-layout-content',
|
||||
contentContainer: '.adf-viewer-content-container',
|
||||
closeBtn: '.adf-viewer-close-button',
|
||||
fileTitle: '.adf-viewer__file-title',
|
||||
layout: '.adf-viewer-layout-content',
|
||||
contentContainer: '.adf-viewer-content-container',
|
||||
closeBtn: '.adf-viewer-close-button',
|
||||
fileTitle: '.adf-viewer__file-title',
|
||||
|
||||
viewerExtensionContent: 'app-preview-extension'
|
||||
};
|
||||
viewerExtensionContent: 'app-preview-extension'
|
||||
};
|
||||
|
||||
root: ElementFinder = browser.$(Viewer.selectors.root);
|
||||
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
|
||||
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
|
||||
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
|
||||
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
|
||||
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
|
||||
root: ElementFinder = browser.$(Viewer.selectors.root);
|
||||
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
|
||||
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
|
||||
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
|
||||
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
|
||||
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
|
||||
|
||||
toolbar = new Toolbar(this.component);
|
||||
toolbar = new Toolbar(this.component);
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Viewer.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForViewerToOpen() {
|
||||
return await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT)
|
||||
.catch(err => err);
|
||||
}
|
||||
|
||||
async isViewerOpened() {
|
||||
return await browser.isElementPresent(this.viewerLayout);
|
||||
}
|
||||
|
||||
async isViewerContentDisplayed() {
|
||||
return await browser.isElementPresent(this.viewerContainer);
|
||||
}
|
||||
|
||||
async isViewerToolbarDisplayed() {
|
||||
return await browser.isElementPresent(this.toolbar.component);
|
||||
}
|
||||
|
||||
async isCloseButtonDisplayed() {
|
||||
return await browser.isElementPresent(this.closeButton);
|
||||
}
|
||||
|
||||
async isFileTitleDisplayed() {
|
||||
return await browser.isElementPresent(this.fileTitle);
|
||||
}
|
||||
|
||||
async clickClose() {
|
||||
return await this.closeButton.click();
|
||||
}
|
||||
|
||||
async getCloseButtonTooltip() {
|
||||
return await this.toolbar.getButtonTooltip(this.closeButton);
|
||||
}
|
||||
|
||||
async getFileTitle() {
|
||||
return await this.fileTitle.getText();
|
||||
}
|
||||
|
||||
async isCustomContentPresent() {
|
||||
return await browser.isElementPresent(this.viewerExtensionContent);
|
||||
}
|
||||
|
||||
async getComponentIdOfView() {
|
||||
if (await this.isCustomContentPresent()) {
|
||||
return await this.viewerExtensionContent.getAttribute('data-automation-id');
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Viewer.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForViewerToOpen() {
|
||||
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async isViewerOpened() {
|
||||
return await browser.isElementPresent(this.viewerLayout);
|
||||
// return await this.viewerLayout.isPresent();
|
||||
}
|
||||
|
||||
async isViewerContentDisplayed() {
|
||||
return await browser.isElementPresent(this.viewerContainer);
|
||||
}
|
||||
|
||||
async isViewerToolbarDisplayed() {
|
||||
return await browser.isElementPresent(this.toolbar.component);
|
||||
}
|
||||
|
||||
async isCloseButtonDisplayed() {
|
||||
return await browser.isElementPresent(this.closeButton);
|
||||
}
|
||||
|
||||
async isFileTitleDisplayed() {
|
||||
return await browser.isElementPresent(this.fileTitle);
|
||||
}
|
||||
|
||||
async clickClose() {
|
||||
await this.closeButton.click();
|
||||
}
|
||||
|
||||
async getCloseButtonTooltip() {
|
||||
return await this.toolbar.getButtonTooltip(this.closeButton);
|
||||
}
|
||||
|
||||
async getFileTitle() {
|
||||
return await this.fileTitle.getText();
|
||||
}
|
||||
|
||||
async isCustomContentPresent() {
|
||||
return await browser.isElementPresent(this.viewerExtensionContent);
|
||||
}
|
||||
|
||||
async getComponentIdOfView() {
|
||||
if (await this.isCustomContentPresent()) {
|
||||
return await this.viewerExtensionContent.getAttribute('data-automation-id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user