mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
Prettier upgrade and e2e type checks (#1522)
* upgrade prettier * noImplicitAny rule * fix type * update tsconfig * upgrade to 150 print width
This commit is contained in:
@@ -34,7 +34,7 @@ export class Breadcrumb extends Component {
|
||||
}
|
||||
|
||||
async getAllItems(): Promise<string[]> {
|
||||
const items: string[] = await this.items.map(async elem => {
|
||||
const items: string[] = await this.items.map(async (elem) => {
|
||||
const str = await elem.getText();
|
||||
return str.split('\nchevron_right')[0];
|
||||
});
|
||||
|
@@ -39,17 +39,11 @@ export class DropDownBreadcrumb extends Component {
|
||||
}
|
||||
|
||||
async waitForPathListDropdownToOpen(): Promise<void> {
|
||||
return waitForPresence(
|
||||
this.pathItemsContainer,
|
||||
'Timeout waiting for breadcrumb dropdown to open'
|
||||
);
|
||||
return waitForPresence(this.pathItemsContainer, 'Timeout waiting for breadcrumb dropdown to open');
|
||||
}
|
||||
|
||||
async waitForPathListDropdownToClose(): Promise<void> {
|
||||
return waitForStaleness(
|
||||
browser.$(this.pathOptionCss),
|
||||
'Timeout waiting for breadcrumb dropdown to close'
|
||||
);
|
||||
return waitForStaleness(browser.$(this.pathOptionCss), 'Timeout waiting for breadcrumb dropdown to close');
|
||||
}
|
||||
|
||||
async openPath(): Promise<void> {
|
||||
@@ -58,14 +52,12 @@ export class DropDownBreadcrumb extends Component {
|
||||
}
|
||||
|
||||
async clickPathItem(name: string): Promise<void> {
|
||||
const elem = browser.element(
|
||||
by.cssContainingText(this.pathOptionCss, name)
|
||||
);
|
||||
const elem = browser.element(by.cssContainingText(this.pathOptionCss, name));
|
||||
await elem.click();
|
||||
}
|
||||
|
||||
async getPathItems(): Promise<string[]> {
|
||||
const items: string[] = await this.pathItems.map(async elem => {
|
||||
const items: string[] = await this.pathItems.map(async (elem) => {
|
||||
return elem.getText();
|
||||
});
|
||||
return items;
|
||||
|
@@ -23,57 +23,32 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
ElementFinder,
|
||||
browser,
|
||||
by,
|
||||
ElementArrayFinder,
|
||||
ProtractorBrowser
|
||||
} from 'protractor';
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
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.$$(locator).first();
|
||||
this.component = ancestor ? browser.$$(ancestor).first().$$(locator).first() : browser.$$(locator).first();
|
||||
}
|
||||
|
||||
async wait() {
|
||||
|
@@ -23,27 +23,16 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
ElementFinder,
|
||||
ElementArrayFinder,
|
||||
by,
|
||||
browser,
|
||||
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,
|
||||
waitForPresence,
|
||||
waitForClickable
|
||||
} from '../../utilities/utils';
|
||||
import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils';
|
||||
|
||||
export class DataTable extends Component {
|
||||
private static selectors = {
|
||||
columnHeader:
|
||||
'.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value',
|
||||
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
|
||||
@@ -58,9 +47,7 @@ export class DataTable extends Component {
|
||||
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'
|
||||
);
|
||||
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');
|
||||
@@ -94,10 +81,7 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
getColumnHeaderByLabel(label: string): ElementFinder {
|
||||
const locator = by.cssContainingText(
|
||||
DataTable.selectors.columnHeader,
|
||||
label
|
||||
);
|
||||
const locator = by.cssContainingText(DataTable.selectors.columnHeader, label);
|
||||
return this.head.element(locator);
|
||||
}
|
||||
|
||||
@@ -111,9 +95,7 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async getSortingOrder(): Promise<string> {
|
||||
const str = await this.getSortedColumnHeader()
|
||||
.element(by.xpath('..'))
|
||||
.getAttribute('class');
|
||||
const str = await this.getSortedColumnHeader().element(by.xpath('..')).getAttribute('class');
|
||||
if (str.includes('asc')) {
|
||||
return 'asc';
|
||||
}
|
||||
@@ -138,7 +120,7 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async getSelectedRowsNames(): Promise<string[]> {
|
||||
const rowsText: string[] = await this.getSelectedRows().map(row => {
|
||||
const rowsText: string[] = await this.getSelectedRows().map((row) => {
|
||||
return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText();
|
||||
});
|
||||
return rowsText;
|
||||
@@ -152,24 +134,14 @@ export class DataTable extends Component {
|
||||
if (location) {
|
||||
return this.body
|
||||
.all(by.cssContainingText(DataTable.selectors.row, name))
|
||||
.filter(async elem =>
|
||||
browser.isElementPresent(
|
||||
elem.element(
|
||||
by.cssContainingText(DataTable.selectors.cell, location)
|
||||
)
|
||||
)
|
||||
)
|
||||
.filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location))))
|
||||
.first();
|
||||
}
|
||||
return this.body.element(
|
||||
by.cssContainingText(DataTable.selectors.row, name)
|
||||
);
|
||||
return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
|
||||
}
|
||||
|
||||
getRowCells(name: string, location: string = ''): ElementArrayFinder {
|
||||
return this.getRowByName(name, location).all(
|
||||
by.css(DataTable.selectors.cell)
|
||||
);
|
||||
return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell));
|
||||
}
|
||||
|
||||
async getRowCellsCount(itemName: string): Promise<number> {
|
||||
@@ -184,24 +156,15 @@ export class DataTable extends Component {
|
||||
return this.getRowCells(name, location).get(1);
|
||||
}
|
||||
|
||||
private getRowNameCellSpan(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): ElementFinder {
|
||||
private getRowNameCellSpan(name: string, location: string = ''): ElementFinder {
|
||||
return this.getRowNameCell(name, location).$('span');
|
||||
}
|
||||
|
||||
async getItemNameTooltip(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<string> {
|
||||
async getItemNameTooltip(name: string, location: string = ''): Promise<string> {
|
||||
return this.getRowNameCellSpan(name, location).getAttribute('title');
|
||||
}
|
||||
|
||||
async hasCheckMarkIcon(
|
||||
itemName: string,
|
||||
location: string = ''
|
||||
): Promise<boolean> {
|
||||
async hasCheckMarkIcon(itemName: string, location: string = ''): Promise<boolean> {
|
||||
const row = this.getRowByName(itemName, location);
|
||||
return row.element(by.css('.mat-icon[class*="selected"]')).isPresent();
|
||||
}
|
||||
@@ -211,10 +174,7 @@ export class DataTable extends Component {
|
||||
return row.element(by.css('img[src*="lock"]')).isPresent();
|
||||
}
|
||||
|
||||
private async hasLockOwnerInfo(
|
||||
itemName: string,
|
||||
location: string = ''
|
||||
): Promise<boolean> {
|
||||
private async hasLockOwnerInfo(itemName: string, location: string = ''): Promise<boolean> {
|
||||
const row = this.getRowByName(itemName, location);
|
||||
return row.element(by.css(DataTable.selectors.lockOwner)).isPresent();
|
||||
}
|
||||
@@ -222,10 +182,7 @@ export class DataTable extends Component {
|
||||
async getLockOwner(itemName: string, location: string = ''): Promise<string> {
|
||||
if (await this.hasLockOwnerInfo(itemName, location)) {
|
||||
const row = this.getRowByName(itemName, location);
|
||||
return row
|
||||
.$(DataTable.selectors.lockOwner)
|
||||
.$('.locked_by--name')
|
||||
.getText();
|
||||
return row.$(DataTable.selectors.lockOwner).$('.locked_by--name').getText();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@@ -238,21 +195,12 @@ export class DataTable extends Component {
|
||||
return this.getNameLink(itemName).isPresent();
|
||||
}
|
||||
|
||||
async doubleClickOnRowByName(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<void> {
|
||||
async doubleClickOnRowByName(name: string, location: string = ''): Promise<void> {
|
||||
try {
|
||||
const item = this.getRowFirstCell(name, location);
|
||||
await waitForClickable(item);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(item)
|
||||
.perform();
|
||||
await browser
|
||||
.actions()
|
||||
.doubleClick()
|
||||
.perform();
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().doubleClick().perform();
|
||||
} catch (error) {
|
||||
Logger.error('--- catch: doubleClickOnRowByName', error);
|
||||
}
|
||||
@@ -291,10 +239,7 @@ export class DataTable extends Component {
|
||||
await this.getNameLink(itemName).click();
|
||||
}
|
||||
|
||||
async selectMultipleItems(
|
||||
names: string[],
|
||||
location: string = ''
|
||||
): Promise<void> {
|
||||
async selectMultipleItems(names: string[], location: string = ''): Promise<void> {
|
||||
await this.clearSelection();
|
||||
await Utils.pressCmd();
|
||||
for (const name of names) {
|
||||
@@ -317,26 +262,14 @@ export class DataTable extends Component {
|
||||
|
||||
async rightClickOnItem(itemName: string): Promise<void> {
|
||||
const item = this.getRowFirstCell(itemName);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(item)
|
||||
.perform();
|
||||
await browser
|
||||
.actions()
|
||||
.click(protractor.Button.RIGHT)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().click(protractor.Button.RIGHT).perform();
|
||||
}
|
||||
|
||||
async rightClickOnMultipleSelection(): Promise<void> {
|
||||
const itemFromSelection = this.getSelectedRows().get(0);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(itemFromSelection)
|
||||
.perform();
|
||||
await browser
|
||||
.actions()
|
||||
.click(protractor.Button.RIGHT)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(itemFromSelection).perform();
|
||||
await browser.actions().click(protractor.Button.RIGHT).perform();
|
||||
}
|
||||
|
||||
private getItemLocationEl(name: string): ElementFinder {
|
||||
@@ -349,13 +282,9 @@ export class DataTable extends Component {
|
||||
|
||||
async getItemLocationTooltip(name: string): Promise<string> {
|
||||
const location = this.getItemLocationEl(name).$('a');
|
||||
const condition = () =>
|
||||
location.getAttribute('title').then(value => value && value.length > 0);
|
||||
const condition = () => location.getAttribute('title').then((value) => value && value.length > 0);
|
||||
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(location)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(location).perform();
|
||||
|
||||
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||
return location.getAttribute('title');
|
||||
@@ -402,10 +331,8 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async getCellsContainingName(name: string): Promise<string[]> {
|
||||
const rows = this.getRows().all(
|
||||
by.cssContainingText(DataTable.selectors.cell, name)
|
||||
);
|
||||
const cellsText: string[] = await rows.map(async cell => {
|
||||
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
|
||||
const cellsText: string[] = await rows.map(async (cell) => {
|
||||
return cell.getText();
|
||||
});
|
||||
return cellsText;
|
||||
@@ -417,9 +344,7 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async getLibraryRole(name: string): Promise<string> {
|
||||
return this.getRowByName(name)
|
||||
.element(by.css('adf-library-role-column'))
|
||||
.getText();
|
||||
return this.getRowByName(name).element(by.css('adf-library-role-column')).getText();
|
||||
}
|
||||
|
||||
async isItemPresent(name: string, location?: string): Promise<boolean> {
|
||||
@@ -427,25 +352,25 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
private async getEntireDataTableText(): Promise<string[]> {
|
||||
const text: string[] = await this.getRows().map(row => {
|
||||
return row.all(by.css(DataTable.selectors.cell)).map(async cell => {
|
||||
const text: string[] = await this.getRows().map((row) => {
|
||||
return row.all(by.css(DataTable.selectors.cell)).map(async (cell) => {
|
||||
return cell.getText();
|
||||
});
|
||||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
async getSitesNameAndVisibility(): Promise<{}> {
|
||||
const data = await this.getEntireDataTableText();
|
||||
return data.reduce((acc, cell) => {
|
||||
async getSitesNameAndVisibility(): Promise<any> {
|
||||
const data: string[] = await this.getEntireDataTableText();
|
||||
return data.reduce((acc: any, cell) => {
|
||||
acc[cell[1]] = cell[4].toUpperCase();
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
async getSitesNameAndRole(): Promise<{}> {
|
||||
const data = await this.getEntireDataTableText();
|
||||
return data.reduce((acc, cell) => {
|
||||
async getSitesNameAndRole(): Promise<any> {
|
||||
const data: string[] = await this.getEntireDataTableText();
|
||||
return data.reduce((acc: any, cell) => {
|
||||
acc[cell[1]] = cell[3];
|
||||
return acc;
|
||||
}, {});
|
||||
@@ -459,100 +384,53 @@ export class DataTable extends Component {
|
||||
return this.getSearchResultsRows().get(nth - 1);
|
||||
}
|
||||
|
||||
private 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
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
|
||||
.first();
|
||||
}
|
||||
return this.body.element(
|
||||
by.cssContainingText(DataTable.selectors.searchResultsRow, name)
|
||||
);
|
||||
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
|
||||
}
|
||||
|
||||
private getSearchResultRowLines(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): ElementArrayFinder {
|
||||
return this.getSearchResultsRowByName(name, location).all(
|
||||
by.css(DataTable.selectors.searchResultsRowLine)
|
||||
);
|
||||
private getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder {
|
||||
return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine));
|
||||
}
|
||||
|
||||
async getSearchResultLinesCount(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<number> {
|
||||
async getSearchResultLinesCount(name: string, location: string = ''): Promise<number> {
|
||||
return this.getSearchResultRowLines(name, location).count();
|
||||
}
|
||||
|
||||
private getSearchResultNthLine(
|
||||
name: string,
|
||||
location: string = '',
|
||||
index: number
|
||||
): ElementFinder {
|
||||
private getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder {
|
||||
return this.getSearchResultRowLines(name, location).get(index);
|
||||
}
|
||||
|
||||
async getSearchResultNameAndTitle(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<string> {
|
||||
async getSearchResultNameAndTitle(name: string, location: string = ''): Promise<string> {
|
||||
return this.getSearchResultNthLine(name, location, 0).getText();
|
||||
}
|
||||
|
||||
async getSearchResultDescription(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<string> {
|
||||
async getSearchResultDescription(name: string, location: string = ''): Promise<string> {
|
||||
return this.getSearchResultNthLine(name, location, 1).getText();
|
||||
}
|
||||
|
||||
async getSearchResultModified(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<string> {
|
||||
async getSearchResultModified(name: string, location: string = ''): Promise<string> {
|
||||
return this.getSearchResultNthLine(name, location, 2).getText();
|
||||
}
|
||||
|
||||
async getSearchResultLocation(
|
||||
name: string,
|
||||
location: string = ''
|
||||
): Promise<string> {
|
||||
async getSearchResultLocation(name: string, location: string = ''): Promise<string> {
|
||||
return this.getSearchResultNthLine(name, location, 3).getText();
|
||||
}
|
||||
|
||||
private getSearchResultNameLink(
|
||||
itemName: string,
|
||||
location: string = ''
|
||||
): ElementFinder {
|
||||
private getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder {
|
||||
return this.getSearchResultsRowByName(itemName, location).$('.link');
|
||||
}
|
||||
|
||||
async hasLinkOnSearchResultName(
|
||||
itemName: string,
|
||||
location: string = ''
|
||||
): Promise<boolean> {
|
||||
async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise<boolean> {
|
||||
return this.getSearchResultNameLink(itemName, location).isPresent();
|
||||
}
|
||||
|
||||
async clickSearchResultNameLink(
|
||||
itemName: string,
|
||||
location: string = ''
|
||||
): Promise<void> {
|
||||
async clickSearchResultNameLink(itemName: string, location: string = ''): Promise<void> {
|
||||
await this.getSearchResultNameLink(itemName, location).click();
|
||||
}
|
||||
}
|
||||
|
@@ -25,8 +25,8 @@
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import * as moment from 'moment';
|
||||
import { isPresentAndDisplayed, waitForStaleness } from '../../utilities/utils';
|
||||
const moment = require('moment');
|
||||
|
||||
export class DateTimePicker extends Component {
|
||||
calendar = this.byCss('.mat-datetimepicker-popup', browser);
|
||||
@@ -55,11 +55,8 @@ export class DateTimePicker extends Component {
|
||||
const dayOfTomorrow = tomorrow.date();
|
||||
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}`)
|
||||
);
|
||||
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}`;
|
||||
}
|
||||
|
@@ -25,41 +25,18 @@
|
||||
|
||||
import { by, browser, protractor } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import {
|
||||
Utils,
|
||||
isPresentAndDisplayed,
|
||||
waitForStaleness,
|
||||
waitForPresence,
|
||||
isPresentAndEnabled,
|
||||
waitForClickable
|
||||
} 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 {
|
||||
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'
|
||||
)
|
||||
);
|
||||
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 = 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', 'My Libraries')
|
||||
);
|
||||
locationPersonalFiles = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'Personal Files'));
|
||||
locationFileLibraries = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'My Libraries'));
|
||||
|
||||
searchInput = this.rootElem.element(by.css('#searchInput'));
|
||||
toolbarTitle = this.rootElem.element(by.css('.adf-toolbar-title'));
|
||||
|
@@ -25,26 +25,15 @@
|
||||
|
||||
import { by } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import {
|
||||
isPresentAndDisplayed,
|
||||
waitForClickable,
|
||||
isPresentAndEnabled,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
import { isPresentAndDisplayed, waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
|
||||
|
||||
export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
createButton = this.childElement(
|
||||
by.cssContainingText('.mat-dialog-actions button', 'Create')
|
||||
);
|
||||
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')
|
||||
);
|
||||
updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update'));
|
||||
|
||||
nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
|
||||
descriptionTextArea = this.rootElem.element(
|
||||
by.css('textarea[placeholder="Description" i]')
|
||||
);
|
||||
descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]'));
|
||||
validationMessage = this.rootElem.element(by.css('.mat-hint span'));
|
||||
|
||||
constructor() {
|
||||
|
@@ -25,25 +25,15 @@
|
||||
|
||||
import { by } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import {
|
||||
isPresentAndDisplayed,
|
||||
isPresentAndEnabled,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils';
|
||||
|
||||
export class CreateFromTemplateDialog extends GenericDialog {
|
||||
createButton = this.childElement(
|
||||
by.cssContainingText('.mat-dialog-actions button', 'Create')
|
||||
);
|
||||
cancelButton = this.childElement(
|
||||
by.cssContainingText('.mat-dialog-actions button', 'CANCEL')
|
||||
);
|
||||
createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
|
||||
cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL'));
|
||||
|
||||
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]')
|
||||
);
|
||||
descriptionTextArea = this.childElement(by.css('textarea[placeholder="Description" i]'));
|
||||
validationMessage = this.childElement(by.css('.mat-error'));
|
||||
|
||||
constructor() {
|
||||
|
@@ -25,36 +25,18 @@
|
||||
|
||||
import { by, ElementFinder } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import {
|
||||
waitForClickable,
|
||||
isPresentAndEnabled,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
|
||||
|
||||
export class CreateLibraryDialog extends GenericDialog {
|
||||
createButton = this.childElement(
|
||||
by.cssContainingText('.mat-dialog-actions button', 'Create')
|
||||
);
|
||||
cancelButton = this.childElement(
|
||||
by.cssContainingText('.mat-dialog-actions button', 'Cancel')
|
||||
);
|
||||
createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
|
||||
cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel'));
|
||||
|
||||
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')
|
||||
);
|
||||
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'));
|
||||
|
||||
errorMessage = this.rootElem.element(by.css('.mat-error'));
|
||||
|
||||
@@ -100,9 +82,7 @@ export class CreateLibraryDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
private async isChecked(target: ElementFinder): Promise<boolean> {
|
||||
const elemClass = await target
|
||||
.element(by.xpath('..'))
|
||||
.getAttribute('class');
|
||||
const elemClass = await target.element(by.xpath('..')).getAttribute('class');
|
||||
return elemClass.includes('mat-radio-checked');
|
||||
}
|
||||
|
||||
|
@@ -24,12 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, Locator } from 'protractor';
|
||||
import {
|
||||
isPresentAndDisplayed,
|
||||
waitForPresence,
|
||||
waitForVisibility,
|
||||
waitForStaleness
|
||||
} from '../../utilities/utils';
|
||||
import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils';
|
||||
|
||||
export abstract class GenericDialog {
|
||||
constructor(private rootCssSelector?: string) {}
|
||||
|
@@ -25,19 +25,11 @@
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import {
|
||||
waitForClickable,
|
||||
isPresentAndEnabled,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
|
||||
|
||||
export class PasswordDialog extends GenericDialog {
|
||||
closeButton = this.childElement(
|
||||
by.css('[data-automation-id="adf-password-dialog-close"]')
|
||||
);
|
||||
submitButton = this.childElement(
|
||||
by.css('[data-automation-id="adf-password-dialog-submit"]')
|
||||
);
|
||||
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'));
|
||||
|
||||
@@ -79,10 +71,7 @@ export class PasswordDialog extends GenericDialog {
|
||||
async isErrorDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await this.waitForDialogToOpen();
|
||||
return (
|
||||
(await this.errorMessage.isPresent()) &&
|
||||
(await this.errorMessage.isDisplayed())
|
||||
);
|
||||
return (await this.errorMessage.isPresent()) && (await this.errorMessage.isDisplayed());
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -30,13 +30,8 @@ import { DataTable } from '../data-table/data-table';
|
||||
import { isPresentAndEnabled } from '../../utilities/utils';
|
||||
|
||||
export class SelectTemplateDialog extends GenericDialog {
|
||||
nextButton = this.childElement(
|
||||
by.css('[data-automation-id="content-node-selector-actions-choose"]')
|
||||
);
|
||||
|
||||
cancelButton = this.childElement(
|
||||
by.css('[data-automation-id="content-node-selector-actions-cancel"]')
|
||||
);
|
||||
nextButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-choose"]'));
|
||||
cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]'));
|
||||
|
||||
breadcrumb = new DropDownBreadcrumb();
|
||||
dataTable = new DataTable('.aca-template-node-selector-dialog');
|
||||
|
@@ -31,27 +31,17 @@ import { isPresentAndEnabled } from '../../utilities/utils';
|
||||
export class ShareDialog extends GenericDialog {
|
||||
dateTimePicker = new DateTimePicker();
|
||||
|
||||
dialogTitle = this.childElement(
|
||||
by.css(`[data-automation-id='adf-share-dialog-title']`)
|
||||
);
|
||||
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']`)
|
||||
);
|
||||
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']`)
|
||||
);
|
||||
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')
|
||||
);
|
||||
datetimePickerButton = this.childElement(by.css('.mat-datetimepicker-toggle'));
|
||||
|
||||
closeButton = this.childElement(
|
||||
by.css(`[data-automation-id='adf-share-dialog-close']`)
|
||||
);
|
||||
closeButton = this.childElement(by.css(`[data-automation-id='adf-share-dialog-close']`));
|
||||
|
||||
constructor() {
|
||||
super('.adf-share-dialog');
|
||||
|
@@ -28,18 +28,10 @@ import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { isPresentAndEnabled, typeText } from '../../utilities/utils';
|
||||
|
||||
export class UploadNewVersionDialog extends GenericDialog {
|
||||
cancelButton = this.childElement(
|
||||
by.cssContainingText('.mat-button-wrapper', 'Cancel')
|
||||
);
|
||||
uploadButton = this.childElement(
|
||||
by.cssContainingText('.mat-button-wrapper', 'Upload')
|
||||
);
|
||||
majorOption = this.childElement(
|
||||
by.cssContainingText(`.mat-radio-label`, 'major')
|
||||
);
|
||||
minorOption = this.childElement(
|
||||
by.cssContainingText(`.mat-radio-label`, 'minor')
|
||||
);
|
||||
cancelButton = this.childElement(by.cssContainingText('.mat-button-wrapper', 'Cancel'));
|
||||
uploadButton = this.childElement(by.cssContainingText('.mat-button-wrapper', '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() {
|
||||
|
@@ -64,18 +64,12 @@ export class CommentsTab extends Component {
|
||||
}
|
||||
|
||||
private async getCommentListItem() {
|
||||
return browser.wait(
|
||||
until.elementLocated(this.commentListItem),
|
||||
BROWSER_WAIT_TIMEOUT / 2
|
||||
);
|
||||
return browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2);
|
||||
}
|
||||
|
||||
async getCommentById(commentId?: string) {
|
||||
if (commentId) {
|
||||
return browser.wait(
|
||||
until.elementLocated(by.id(`adf-comment-${commentId}`)),
|
||||
BROWSER_WAIT_TIMEOUT / 2
|
||||
);
|
||||
return browser.wait(until.elementLocated(by.id(`adf-comment-${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
|
||||
}
|
||||
return this.getCommentListItem();
|
||||
}
|
||||
@@ -86,9 +80,7 @@ export class CommentsTab extends Component {
|
||||
|
||||
async isCommentUserAvatarDisplayed(commentId?: string) {
|
||||
const commentElement = await this.getCommentById(commentId);
|
||||
return browser.isElementPresent(
|
||||
commentElement.findElement(this.commentUserAvatar)
|
||||
);
|
||||
return browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
|
||||
}
|
||||
|
||||
async getCommentText(commentId?: string) {
|
||||
|
@@ -25,11 +25,7 @@
|
||||
|
||||
import { by, browser, ElementFinder } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
isPresentAndEnabled,
|
||||
isPresentAndDisplayed,
|
||||
waitForVisibility
|
||||
} from '../../utilities/utils';
|
||||
import { isPresentAndEnabled, isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils';
|
||||
|
||||
export class ContentMetadata extends Component {
|
||||
expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded');
|
||||
@@ -37,20 +33,10 @@ export class ContentMetadata extends Component {
|
||||
propertyListElements = this.allByCss('.adf-property');
|
||||
propertyValue = this.byCss('.adf-property-value');
|
||||
editPropertiesButton = this.byCss(`button[title='Edit']`);
|
||||
lessInfoButton = this.byCssText(
|
||||
`[data-automation-id='meta-data-card-toggle-expand']`,
|
||||
'Less information'
|
||||
);
|
||||
moreInfoButton = this.byCssText(
|
||||
`[data-automation-id='meta-data-card-toggle-expand']`,
|
||||
'More information'
|
||||
);
|
||||
imagePropertiesPanel = this.byCss(
|
||||
`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`
|
||||
);
|
||||
expandedImagePropertiesPanel = this.byCss(
|
||||
`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`
|
||||
);
|
||||
lessInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'Less information');
|
||||
moreInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'More information');
|
||||
imagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`);
|
||||
expandedImagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`);
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-content-metadata-card', ancestor);
|
||||
@@ -66,14 +52,14 @@ export class ContentMetadata extends Component {
|
||||
|
||||
async getVisiblePropertiesLabels(): Promise<string[]> {
|
||||
return this.allByCss('.adf-property-label')
|
||||
.filter(async elem => elem.isDisplayed())
|
||||
.map(async elem => elem.getText());
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => elem.getText());
|
||||
}
|
||||
|
||||
async getVisiblePropertiesValues() {
|
||||
return this.allByCss('.adf-property-value')
|
||||
.filter(async elem => elem.isDisplayed())
|
||||
.map(async elem => {
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
|
||||
return true;
|
||||
|
@@ -26,11 +26,7 @@
|
||||
import { by, browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
waitForPresence,
|
||||
waitForStaleness,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils';
|
||||
|
||||
export class LibraryMetadata extends Component {
|
||||
metadataTabContent = this.byCss('.mat-card-content');
|
||||
@@ -38,21 +34,9 @@ export class LibraryMetadata extends Component {
|
||||
fieldLabelWrapper = this.byCss('.mat-form-field-label-wrapper');
|
||||
fieldInput = this.byCss('.mat-input-element');
|
||||
visibilityDropDown = this.component.element(by.css('.mat-select'));
|
||||
visibilityPublic = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Public',
|
||||
browser
|
||||
);
|
||||
visibilityPrivate = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Private',
|
||||
browser
|
||||
);
|
||||
visibilityModerated = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Moderated',
|
||||
browser
|
||||
);
|
||||
visibilityPublic = this.byCssText('.mat-option .mat-option-text', 'Public', browser);
|
||||
visibilityPrivate = this.byCssText('.mat-option .mat-option-text', 'Private', browser);
|
||||
visibilityModerated = this.byCssText('.mat-option .mat-option-text', 'Moderated', browser);
|
||||
hint = this.byCss('.mat-hint');
|
||||
error = this.byCss('.mat-error');
|
||||
|
||||
@@ -66,9 +50,7 @@ export class LibraryMetadata extends Component {
|
||||
|
||||
private getFieldByName(fieldName: string) {
|
||||
const wrapper = this.getLabelWrapper(fieldName);
|
||||
return wrapper
|
||||
.element(by.xpath('..'))
|
||||
.element(by.css('.mat-input-element'));
|
||||
return wrapper.element(by.xpath('..')).element(by.css('.mat-input-element'));
|
||||
}
|
||||
|
||||
private async isFieldDisplayed(fieldName: string) {
|
||||
@@ -158,9 +140,7 @@ export class LibraryMetadata extends Component {
|
||||
|
||||
async isVisibilityEnabled() {
|
||||
const wrapper = this.getLabelWrapper('Visibility');
|
||||
const field = wrapper
|
||||
.element(by.xpath('..'))
|
||||
.element(by.css('.mat-select'));
|
||||
const field = wrapper.element(by.xpath('..')).element(by.css('.mat-select'));
|
||||
return field.isEnabled();
|
||||
}
|
||||
|
||||
|
@@ -29,11 +29,7 @@ import { Component } from '../component';
|
||||
import { CommentsTab } from './info-drawer-comments-tab';
|
||||
import { LibraryMetadata } from './info-drawer-metadata-library';
|
||||
import { ContentMetadata } from './info-drawer-metadata-content';
|
||||
import {
|
||||
waitForVisibility,
|
||||
waitForInvisibility,
|
||||
waitForPresence
|
||||
} from '../../utilities/utils';
|
||||
import { waitForVisibility, waitForInvisibility, waitForPresence } from '../../utilities/utils';
|
||||
|
||||
export class InfoDrawer extends Component {
|
||||
commentsTab = new CommentsTab('adf-info-drawer');
|
||||
@@ -44,15 +40,9 @@ export class InfoDrawer extends Component {
|
||||
tabLabel = this.byCss('.mat-tab-label-content');
|
||||
tabLabelsList = this.allByCss('.mat-tab-label-content');
|
||||
tabActiveLabel = this.byCss('.mat-tab-label-active');
|
||||
tabActiveContent = this.byCss(
|
||||
'.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab'
|
||||
);
|
||||
nextButton = this.byCss(
|
||||
'.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron'
|
||||
);
|
||||
previousButton = this.byCss(
|
||||
'.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
|
||||
);
|
||||
tabActiveContent = this.byCss('.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab');
|
||||
nextButton = this.byCss('.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron');
|
||||
previousButton = this.byCss('.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron');
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-info-drawer', ancestor);
|
||||
@@ -130,10 +120,7 @@ export class InfoDrawer extends Component {
|
||||
try {
|
||||
await this.getTabByTitle('Comments').click();
|
||||
await this.commentsTab.waitForCommentsContainer();
|
||||
await Promise.all([
|
||||
waitForVisibility(this.commentsTab.component),
|
||||
waitForInvisibility(this.propertiesTab.component)
|
||||
]);
|
||||
await Promise.all([waitForVisibility(this.commentsTab.component), waitForInvisibility(this.propertiesTab.component)]);
|
||||
} catch (error) {
|
||||
Logger.error('--- info-drawer clickCommentsTab catch error: ', error);
|
||||
}
|
||||
|
@@ -26,23 +26,14 @@
|
||||
import { ElementFinder, by, browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
Utils,
|
||||
isPresentAndEnabled,
|
||||
waitForPresence,
|
||||
waitForVisibility,
|
||||
waitForStaleness,
|
||||
waitForClickable
|
||||
} from '../../utilities/utils';
|
||||
import { Utils, isPresentAndEnabled, waitForPresence, waitForVisibility, waitForStaleness, waitForClickable } from '../../utilities/utils';
|
||||
|
||||
export class Menu extends Component {
|
||||
items = this.allByCss('.mat-menu-item');
|
||||
backdrop = this.byCss('.cdk-overlay-backdrop', browser);
|
||||
|
||||
uploadFilesInput = this.byId('app-upload-files', browser);
|
||||
submenus = browser.element.all(
|
||||
by.css('app-context-menu-item .mat-menu-item')
|
||||
);
|
||||
submenus = browser.element.all(by.css('app-context-menu-item .mat-menu-item'));
|
||||
|
||||
uploadFileAction = this.byId('app.create.uploadFile');
|
||||
uploadFolderAction = this.byId('app.create.uploadFolder');
|
||||
@@ -61,23 +52,14 @@ export class Menu extends Component {
|
||||
favoriteAction = this.byCss(`.mat-menu-item[id$='favorite.add']`);
|
||||
removeFavoriteAction = this.byCss(`.mat-menu-item[id$='favorite.remove']`);
|
||||
toggleFavoriteAction = this.byCssText('.mat-menu-item', 'Favorite');
|
||||
toggleRemoveFavoriteAction = this.byCssText(
|
||||
'.mat-menu-item',
|
||||
'Remove Favorite'
|
||||
);
|
||||
toggleRemoveFavoriteAction = this.byCssText('.mat-menu-item', 'Remove Favorite');
|
||||
joinAction = this.byCssText('.mat-menu-item', 'Join');
|
||||
leaveAction = this.byCssText('.mat-menu-item', 'Leave');
|
||||
managePermissionsAction = this.byCssText('.mat-menu-item', 'Permissions');
|
||||
manageVersionsAction = this.byCssText('.mat-menu-item', 'Manage Versions');
|
||||
uploadNewVersionAction = this.byCssText(
|
||||
'.mat-menu-item',
|
||||
'Upload New Version'
|
||||
);
|
||||
uploadNewVersionAction = this.byCssText('.mat-menu-item', 'Upload New Version');
|
||||
moveAction = this.byCssText('.mat-menu-item', 'Move');
|
||||
permanentDeleteAction = this.byCssText(
|
||||
'.mat-menu-item',
|
||||
'Permanently Delete'
|
||||
);
|
||||
permanentDeleteAction = this.byCssText('.mat-menu-item', 'Permanently Delete');
|
||||
restoreAction = this.byCssText('.mat-menu-item', 'Restore');
|
||||
shareAction = this.byCssText('.mat-menu-item', 'Share');
|
||||
shareEditAction = this.byCssText('.mat-menu-item', 'Shared Link Settings');
|
||||
@@ -89,16 +71,12 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async waitForMenuToOpen(): Promise<void> {
|
||||
await waitForPresence(
|
||||
browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))
|
||||
);
|
||||
await waitForPresence(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')));
|
||||
await waitForVisibility(this.items.get(0));
|
||||
}
|
||||
|
||||
async waitForMenuToClose(): Promise<void> {
|
||||
await waitForStaleness(
|
||||
browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))
|
||||
);
|
||||
await waitForStaleness(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')));
|
||||
}
|
||||
|
||||
async closeMenu(): Promise<void> {
|
||||
@@ -127,9 +105,7 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async getItemIconText(menuItem: string): Promise<string> {
|
||||
return this.getItemByLabel(menuItem)
|
||||
.element(by.css('.mat-icon'))
|
||||
.getText();
|
||||
return this.getItemByLabel(menuItem).element(by.css('.mat-icon')).getText();
|
||||
}
|
||||
|
||||
async getItemIdAttribute(menuItem: string): Promise<string> {
|
||||
@@ -141,7 +117,7 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async getMenuItems(): Promise<string[]> {
|
||||
const items: string[] = await this.items.map(async elem => {
|
||||
const items: string[] = await this.items.map(async (elem) => {
|
||||
const span = elem.element(by.css('span'));
|
||||
return span.getText();
|
||||
});
|
||||
@@ -152,14 +128,8 @@ export class Menu extends Component {
|
||||
try {
|
||||
const elem = this.getNthItem(nth);
|
||||
await waitForClickable(elem);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(elem)
|
||||
.perform();
|
||||
await browser
|
||||
.actions()
|
||||
.click()
|
||||
.perform();
|
||||
await browser.actions().mouseMove(elem).perform();
|
||||
await browser.actions().click().perform();
|
||||
await this.waitForMenuToClose();
|
||||
} catch (e) {
|
||||
Logger.error('____ click nth menu item catch ___', e);
|
||||
@@ -180,10 +150,7 @@ export class Menu extends Component {
|
||||
try {
|
||||
const elem = this.getItemByLabel(menuItem);
|
||||
await waitForClickable(elem);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(elem)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(elem).perform();
|
||||
await browser.sleep(500);
|
||||
} catch (error) {
|
||||
Logger.error('----- mouse over error: ', error);
|
||||
@@ -213,17 +180,11 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async isMenuItemPresent(title: string): Promise<boolean> {
|
||||
return browser
|
||||
.element(by.cssContainingText('.mat-menu-item', title))
|
||||
.isPresent();
|
||||
return browser.element(by.cssContainingText('.mat-menu-item', title)).isPresent();
|
||||
}
|
||||
|
||||
async isSubMenuItemPresent(title: string): Promise<boolean> {
|
||||
return browser
|
||||
.element(
|
||||
by.cssContainingText('app-context-menu-item .mat-menu-item', title)
|
||||
)
|
||||
.isPresent();
|
||||
return browser.element(by.cssContainingText('app-context-menu-item .mat-menu-item', title)).isPresent();
|
||||
}
|
||||
|
||||
async getSubmenuItemsCount(): Promise<number> {
|
||||
|
@@ -28,12 +28,8 @@ import { waitForPresence } from '../../utilities/utils';
|
||||
|
||||
export class MetadataCard extends Component {
|
||||
footer = this.byCss('.adf-content-metadata-card-footer');
|
||||
expandButton = this.byCss(
|
||||
'[data-automation-id="meta-data-card-toggle-expand"]'
|
||||
);
|
||||
expansionPanels = this.allByCss(
|
||||
'.adf-metadata-grouped-properties-container mat-expansion-panel'
|
||||
);
|
||||
expandButton = this.byCss('[data-automation-id="meta-data-card-toggle-expand"]');
|
||||
expansionPanels = this.allByCss('.adf-metadata-grouped-properties-container mat-expansion-panel');
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-content-metadata-card', ancestor);
|
||||
|
@@ -36,12 +36,8 @@ export class Pagination extends Component {
|
||||
totalPages = this.byCss('.adf-pagination__total-pages');
|
||||
previousButton = this.byCss('.adf-pagination__previous-button');
|
||||
nextButton = this.byCss('.adf-pagination__next-button');
|
||||
maxItemsButton = this.byCss(
|
||||
'.adf-pagination__max-items + button[mat-icon-button]'
|
||||
);
|
||||
pagesButton = this.byCss(
|
||||
'.adf-pagination__current-page + button[mat-icon-button]'
|
||||
);
|
||||
maxItemsButton = this.byCss('.adf-pagination__max-items + button[mat-icon-button]');
|
||||
pagesButton = this.byCss('.adf-pagination__current-page + button[mat-icon-button]');
|
||||
|
||||
menu: Menu = new Menu();
|
||||
|
||||
@@ -51,10 +47,7 @@ export class Pagination extends Component {
|
||||
|
||||
async openMaxItemsMenu() {
|
||||
try {
|
||||
await waitForClickable(
|
||||
this.maxItemsButton,
|
||||
'timeout waiting for maxItemsButton to be clickable'
|
||||
);
|
||||
await waitForClickable(this.maxItemsButton, 'timeout waiting for maxItemsButton to be clickable');
|
||||
await this.maxItemsButton.click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
} catch (error) {
|
||||
@@ -64,10 +57,7 @@ export class Pagination extends Component {
|
||||
|
||||
async openCurrentPageMenu() {
|
||||
try {
|
||||
await waitForClickable(
|
||||
this.pagesButton,
|
||||
'timeout waiting for pagesButton to be clickable'
|
||||
);
|
||||
await waitForClickable(this.pagesButton, 'timeout waiting for pagesButton to be clickable');
|
||||
await this.pagesButton.click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
} catch (error) {
|
||||
|
@@ -32,30 +32,14 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
super('Created date');
|
||||
}
|
||||
|
||||
fromField: ElementFinder = this.panelExpanded.element(
|
||||
by.cssContainingText('.adf-search-date-range .mat-form-field', 'From')
|
||||
);
|
||||
fromInput: ElementFinder = this.fromField.element(
|
||||
by.css(`[data-automation-id='date-range-from-input']`)
|
||||
);
|
||||
fromFieldError: ElementFinder = this.fromField.element(
|
||||
by.css(`[data-automation-id='date-range-from-error']`)
|
||||
);
|
||||
toField: ElementFinder = this.panelExpanded.element(
|
||||
by.cssContainingText('.adf-search-date-range .mat-form-field', 'To')
|
||||
);
|
||||
toInput: ElementFinder = this.toField.element(
|
||||
by.css(`[data-automation-id='date-range-to-input']`)
|
||||
);
|
||||
toFieldError: ElementFinder = this.toField.element(
|
||||
by.css(`[data-automation-id='date-range-to-error']`)
|
||||
);
|
||||
clearButton: ElementFinder = this.panel.element(
|
||||
by.css('.adf-facet-buttons [data-automation-id="date-range-clear-btn"]')
|
||||
);
|
||||
applyButton: ElementFinder = this.panel.element(
|
||||
by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]')
|
||||
);
|
||||
fromField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'From'));
|
||||
fromInput: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-input']`));
|
||||
fromFieldError: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-error']`));
|
||||
toField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'To'));
|
||||
toInput: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-input']`));
|
||||
toFieldError: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-error']`));
|
||||
clearButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-clear-btn"]'));
|
||||
applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]'));
|
||||
|
||||
async isFromFieldDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.fromField);
|
||||
|
@@ -42,9 +42,7 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
return this.panel.all(by.css(this.locators.checkboxChecked));
|
||||
}
|
||||
get clearButton(): ElementFinder {
|
||||
return this.panel.element(
|
||||
by.cssContainingText(this.locators.button, 'Clear all')
|
||||
);
|
||||
return this.panel.element(by.cssContainingText(this.locators.button, 'Clear all'));
|
||||
}
|
||||
get facetsFilter(): ElementFinder {
|
||||
return this.panelExpanded.element(by.css(this.locators.facetsFilter));
|
||||
@@ -54,14 +52,14 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async getFiltersValues(): Promise<string[]> {
|
||||
const list: string[] = await this.facets.map(option => {
|
||||
const list: string[] = await this.facets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async getFiltersCheckedValues(): Promise<string[]> {
|
||||
const list: string[] = await this.selectedFacets.map(option => {
|
||||
const list: string[] = await this.selectedFacets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
@@ -70,7 +68,7 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
async resetPanel(): Promise<void> {
|
||||
if ((await this.selectedFacets.count()) > 0) {
|
||||
await this.expandPanel();
|
||||
await this.selectedFacets.each(async elem => {
|
||||
await this.selectedFacets.each(async (elem) => {
|
||||
await elem.click();
|
||||
});
|
||||
}
|
||||
@@ -96,18 +94,10 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async checkCategory(name: string): Promise<void> {
|
||||
const option = this.facets
|
||||
.filter(async elem => (await elem.getText()).includes(name))
|
||||
.first();
|
||||
const option = this.facets.filter(async (elem) => (await elem.getText()).includes(name)).first();
|
||||
await browser.executeScript(`arguments[0].scrollIntoView();`, option);
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(option)
|
||||
.perform();
|
||||
await browser
|
||||
.actions()
|
||||
.click()
|
||||
.perform();
|
||||
await browser.actions().mouseMove(option).perform();
|
||||
await browser.actions().click().perform();
|
||||
}
|
||||
|
||||
async filterCategoriesBy(name: string): Promise<void> {
|
||||
|
@@ -42,14 +42,10 @@ export class GenericFilterPanel {
|
||||
};
|
||||
|
||||
get panel(): ElementFinder {
|
||||
return browser.element(
|
||||
by.cssContainingText(this.selectors.panel, this.filterName)
|
||||
);
|
||||
return browser.element(by.cssContainingText(this.selectors.panel, this.filterName));
|
||||
}
|
||||
get panelExpanded(): ElementFinder {
|
||||
return browser.element(
|
||||
by.cssContainingText(this.selectors.panelExpanded, this.filterName)
|
||||
);
|
||||
return browser.element(by.cssContainingText(this.selectors.panelExpanded, this.filterName));
|
||||
}
|
||||
get panelHeader(): ElementFinder {
|
||||
return this.panel.element(by.css(this.selectors.panelHeader));
|
||||
|
@@ -32,22 +32,18 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
facets: ElementArrayFinder = this.panelExpanded.all(by.css('.mat-checkbox'));
|
||||
selectedFacets: ElementArrayFinder = this.panel.all(
|
||||
by.css('.mat-checkbox.mat-checkbox-checked')
|
||||
);
|
||||
clearButton: ElementFinder = this.panel.element(
|
||||
by.cssContainingText('.adf-facet-buttons button', 'Clear all')
|
||||
);
|
||||
selectedFacets: ElementArrayFinder = this.panel.all(by.css('.mat-checkbox.mat-checkbox-checked'));
|
||||
clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all'));
|
||||
|
||||
async getFiltersValues(): Promise<string[]> {
|
||||
const list: string[] = await this.facets.map(option => {
|
||||
const list: string[] = await this.facets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async getFiltersCheckedValues(): Promise<string[]> {
|
||||
const list: string[] = await this.selectedFacets.map(option => {
|
||||
const list: string[] = await this.selectedFacets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
@@ -56,7 +52,7 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
async resetPanel(): Promise<void> {
|
||||
if ((await this.selectedFacets.count()) > 0) {
|
||||
await this.expandPanel();
|
||||
await this.selectedFacets.each(async elem => {
|
||||
await this.selectedFacets.each(async (elem) => {
|
||||
await elem.click();
|
||||
});
|
||||
}
|
||||
@@ -74,30 +70,22 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async checkSizeSmall(): Promise<void> {
|
||||
const small = this.facets
|
||||
.filter(async elem => (await elem.getText()) === 'Small')
|
||||
.first();
|
||||
const small = this.facets.filter(async (elem) => (await elem.getText()) === 'Small').first();
|
||||
await small.click();
|
||||
}
|
||||
|
||||
async checkSizeMedium(): Promise<void> {
|
||||
const medium = this.facets
|
||||
.filter(async elem => (await elem.getText()) === 'Medium')
|
||||
.first();
|
||||
const medium = this.facets.filter(async (elem) => (await elem.getText()) === 'Medium').first();
|
||||
await medium.click();
|
||||
}
|
||||
|
||||
async checkSizeLarge(): Promise<void> {
|
||||
const large = this.facets
|
||||
.filter(async elem => (await elem.getText()) === 'Large')
|
||||
.first();
|
||||
const large = this.facets.filter(async (elem) => (await elem.getText()) === 'Large').first();
|
||||
await large.click();
|
||||
}
|
||||
|
||||
async checkSizeHuge(): Promise<void> {
|
||||
const huge = this.facets
|
||||
.filter(async elem => (await elem.getText()) === 'Huge')
|
||||
.first();
|
||||
const huge = this.facets.filter(async (elem) => (await elem.getText()) === 'Huge').first();
|
||||
await huge.click();
|
||||
}
|
||||
}
|
||||
|
@@ -25,12 +25,7 @@
|
||||
|
||||
import { browser, by, protractor } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
Utils,
|
||||
waitForPresence,
|
||||
waitForClickable,
|
||||
waitElement
|
||||
} from '../../utilities/utils';
|
||||
import { Utils, waitForPresence, waitForClickable, waitElement } from '../../utilities/utils';
|
||||
|
||||
export class SearchInput extends Component {
|
||||
searchButton = this.component.element(by.css('.app-search-button'));
|
||||
@@ -38,15 +33,9 @@ export class SearchInput extends Component {
|
||||
searchControl = browser.element(by.css('.app-search-control'));
|
||||
searchInput = browser.element(by.css(`input[id='app-control-input']`));
|
||||
searchOptionsArea = browser.element(by.id('search-options'));
|
||||
searchFilesOption = this.searchOptionsArea.element(
|
||||
by.cssContainingText('.mat-checkbox', 'Files')
|
||||
);
|
||||
searchFoldersOption = this.searchOptionsArea.element(
|
||||
by.cssContainingText('.mat-checkbox', 'Folders')
|
||||
);
|
||||
searchLibrariesOption = this.searchOptionsArea.element(
|
||||
by.cssContainingText('.mat-checkbox', 'Libraries')
|
||||
);
|
||||
searchFilesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Files'));
|
||||
searchFoldersOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Folders'));
|
||||
searchLibrariesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Libraries'));
|
||||
clearSearchButton = this.searchContainer.$('.app-clear-icon');
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
|
@@ -25,40 +25,23 @@
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
isPresentAndDisplayed,
|
||||
waitForVisibility
|
||||
} from '../../utilities/utils';
|
||||
|
||||
export type SortByType =
|
||||
| 'Relevance'
|
||||
| 'Title'
|
||||
| 'Filename'
|
||||
| 'Modified date'
|
||||
| 'Modifier'
|
||||
| 'Created date'
|
||||
| 'Size'
|
||||
| 'Type';
|
||||
import { isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils';
|
||||
|
||||
export type SortByType = 'Relevance' | 'Title' | 'Filename' | 'Modified date' | 'Modifier' | 'Created date' | 'Size' | 'Type';
|
||||
export type SortOrderType = 'ASC' | 'DESC' | '';
|
||||
|
||||
export class SearchSortingPicker extends Component {
|
||||
sortOrderButton = this.byCss('button[mat-icon-button]');
|
||||
sortByDropdownCollapsed = this.byCss('.mat-select');
|
||||
sortByDropdownExpanded = browser.element(by.css('.mat-select-panel'));
|
||||
sortByList = this.sortByDropdownExpanded.all(
|
||||
by.css('.mat-option .mat-option-text')
|
||||
);
|
||||
sortByList = this.sortByDropdownExpanded.all(by.css('.mat-option .mat-option-text'));
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-search-sorting-picker', ancestor);
|
||||
}
|
||||
|
||||
async waitForSortByDropdownToExpand(): Promise<void> {
|
||||
await waitForVisibility(
|
||||
this.sortByDropdownExpanded,
|
||||
'Timeout waiting for sortBy dropdown to expand'
|
||||
);
|
||||
await waitForVisibility(this.sortByDropdownExpanded, 'Timeout waiting for sortBy dropdown to expand');
|
||||
}
|
||||
|
||||
async isSortOrderButtonDisplayed(): Promise<boolean> {
|
||||
@@ -95,7 +78,7 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async getSortByOptionsList(): Promise<string[]> {
|
||||
const list: string[] = await this.sortByList.map(async option => {
|
||||
const list: string[] = await this.sortByList.map(async (option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
@@ -105,9 +88,7 @@ export class SearchSortingPicker extends Component {
|
||||
if (!(await this.isSortByDropdownExpanded())) {
|
||||
await this.clickSortByDropdown();
|
||||
}
|
||||
const elem = browser.element(
|
||||
by.cssContainingText('.mat-option .mat-option-text', option)
|
||||
);
|
||||
const elem = browser.element(by.cssContainingText('.mat-option .mat-option-text', option));
|
||||
await elem.click();
|
||||
}
|
||||
|
||||
|
@@ -35,17 +35,9 @@ export class Sidenav extends Component {
|
||||
activeLink = this.byCss('.action-button--active');
|
||||
newButton = this.allByCss('[data-automation-id="create-button"]');
|
||||
personalFiles = this.byCss(`[data-automation-id='app.navbar.personalFiles']`);
|
||||
fileLibraries = this.byCss(
|
||||
`[data-automation-id='app.navbar.libraries.menu']`
|
||||
);
|
||||
myLibraries = this.byCss(
|
||||
`[data-automation-id='app.navbar.libraries.files']`,
|
||||
browser
|
||||
);
|
||||
favoriteLibraries = this.byCss(
|
||||
`[data-automation-id='app.navbar.libraries.favorite']`,
|
||||
browser
|
||||
);
|
||||
fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`);
|
||||
myLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.files']`, browser);
|
||||
favoriteLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.favorite']`, browser);
|
||||
shared = this.byCss(`[data-automation-id='app.navbar.shared']`);
|
||||
recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`);
|
||||
favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`);
|
||||
@@ -59,9 +51,7 @@ export class Sidenav extends Component {
|
||||
|
||||
private async expandMenu(name: string): Promise<void> {
|
||||
try {
|
||||
if (
|
||||
await element(by.cssContainingText('.mat-expanded', name)).isPresent()
|
||||
) {
|
||||
if (await element(by.cssContainingText('.mat-expanded', name)).isPresent()) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
const link = this.getLink(name);
|
||||
@@ -80,9 +70,7 @@ export class Sidenav extends Component {
|
||||
}
|
||||
|
||||
async closeNewMenu(): Promise<void> {
|
||||
await BrowserActions.click(
|
||||
element(by.css('button[data-automation-id="create-button"] span span'))
|
||||
);
|
||||
await BrowserActions.click(element(by.css('button[data-automation-id="create-button"] span span')));
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
@@ -112,9 +100,7 @@ export class Sidenav extends Component {
|
||||
}
|
||||
|
||||
async childIsActive(name: string): Promise<boolean> {
|
||||
const childClass = await this.getLinkLabel(name)
|
||||
.element(by.css('span'))
|
||||
.getAttribute('class');
|
||||
const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class');
|
||||
return childClass.includes('action-button--active');
|
||||
}
|
||||
|
||||
@@ -147,13 +133,9 @@ export class Sidenav extends Component {
|
||||
|
||||
async getLinkTooltip(name: string): Promise<string> {
|
||||
const link = this.getLinkLabel(name);
|
||||
const condition = () =>
|
||||
link.getAttribute('title').then(value => value && value.length > 0);
|
||||
const condition = () => link.getAttribute('title').then((value) => value && value.length > 0);
|
||||
|
||||
await browser
|
||||
.actions()
|
||||
.mouseMove(link)
|
||||
.perform();
|
||||
await browser.actions().mouseMove(link).perform();
|
||||
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||
|
||||
return link.getAttribute('title');
|
||||
@@ -170,9 +152,7 @@ export class Sidenav extends Component {
|
||||
}
|
||||
|
||||
async isFileLibrariesMenuExpanded(): Promise<boolean> {
|
||||
return element(
|
||||
by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
).isPresent();
|
||||
return element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent();
|
||||
}
|
||||
|
||||
async expandFileLibraries(): Promise<void> {
|
||||
|
@@ -34,25 +34,17 @@ export class Toolbar extends Component {
|
||||
|
||||
buttons = this.allByCss('button');
|
||||
shareButton = this.byCss(`.mat-icon-button[title='Share']`);
|
||||
shareEditButton = this.byCss(
|
||||
`.mat-icon-button[title='Shared Link Settings']`
|
||||
);
|
||||
shareEditButton = this.byCss(`.mat-icon-button[title='Shared Link Settings']`);
|
||||
viewButton = this.byCss(`.mat-icon-button[title='View']`);
|
||||
searchFiltersToggleButton = this.byCss(
|
||||
`.mat-icon-button[title='Toggle search filter']`
|
||||
);
|
||||
searchFiltersToggleButton = this.byCss(`.mat-icon-button[title='Toggle search filter']`);
|
||||
downloadButton = this.byCss(`.mat-icon-button[title='Download']`);
|
||||
editFolderButton = this.byId('app.toolbar.editFolder');
|
||||
viewDetailsButton = this.byCss(`.mat-icon-button[title='View Details']`);
|
||||
printButton = this.byCss(`.mat-icon-button[title='Print']`);
|
||||
fullScreenButton = this.byCss(
|
||||
`.mat-icon-button[title='Activate full-screen mode']`
|
||||
);
|
||||
fullScreenButton = this.byCss(`.mat-icon-button[title='Activate full-screen mode']`);
|
||||
joinButton = this.byCss(`.mat-icon-button[title='Join']`);
|
||||
leaveButton = this.byCss(`.mat-icon-button[title='Leave Library']`);
|
||||
permanentlyDeleteButton = this.byCss(
|
||||
`.mat-icon-button[title='Permanently Delete']`
|
||||
);
|
||||
permanentlyDeleteButton = this.byCss(`.mat-icon-button[title='Permanently Delete']`);
|
||||
restoreButton = this.byCss(`.mat-icon-button[title='Restore']`);
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
@@ -65,7 +57,7 @@ export class Toolbar extends Component {
|
||||
}
|
||||
|
||||
async getButtons(): Promise<string[]> {
|
||||
return this.buttons.map(async elem => {
|
||||
return this.buttons.map(async (elem) => {
|
||||
return elem.getAttribute('title');
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user