Optimize e2e framework (#1428)

* reduce breadcrumb page

* imrpove readability of code

* reduce data-table page size

* reduce datetime-picker code

* fix datatable page

* header and info drawer

* update datatable page

* toolbar cleanup

* more test components cleanup

* even move component cleanup

* move wait utils to the Utils

* unified waits

* cleanup menu page

* code fixes

* fix code

* code improvements

* rename api

* fix code

* fix code

* cleanup dialog pages

* more fixes and dead code removal

* code fixes

* try to fix the flaky teset

* fix code

* fix code

* update code

* fix lint

* unified text input

* fix lint

* add missing await

* reduce the wrapper method around clear text

* resolve element value

Co-authored-by: Cilibiu Bogdan <bogdan.cilibiu@ness.com>
This commit is contained in:
Denys Vuika 2020-04-29 08:40:55 +01:00 committed by GitHub
parent ebdaa39209
commit 5259f840a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 1521 additions and 2486 deletions

View File

@ -23,29 +23,14 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
export class Breadcrumb extends Component { export class Breadcrumb extends Component {
private static selectors = { items = this.allByCss('.adf-breadcrumb-item');
root: 'adf-breadcrumb', currentItem = this.byCss('.adf-breadcrumb-item-current');
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));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Breadcrumb.selectors.root, ancestor); super('adf-breadcrumb', ancestor);
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
async getItemsCount(): Promise<number> {
return this.items.count();
} }
async getAllItems(): Promise<string[]> { async getAllItems(): Promise<string[]> {
@ -56,20 +41,8 @@ export class Breadcrumb extends Component {
return items; return items;
} }
getCurrentItem(): ElementFinder {
return this.currentItem;
}
async getCurrentItemName(): Promise<string> {
return this.currentItem.getText();
}
async clickItem(name: string): Promise<void> { async clickItem(name: string): Promise<void> {
const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`)); const elem = this.byCss(`.adf-breadcrumb-item[title=${name}]`);
await elem.click(); await elem.click();
} }
async getNthItemTooltip(nth: number): Promise<string> {
return this.getNthItem(nth).getAttribute('title');
}
} }

View File

@ -23,39 +23,33 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { waitForPresence, waitForStaleness } from '../../utilities/utils';
export class DropDownBreadcrumb extends Component { export class DropDownBreadcrumb extends Component {
private static selectors = { pathOptionCss = '.adf-dropdown-breadcrumb-path-option .mat-option-text';
root: '.adf-dropdown-breadcrumb', trigger = this.byCss('.adf-dropdown-breadcrumb-trigger');
trigger: '.adf-dropdown-breadcrumb-trigger', pathItems = browser.$$(this.pathOptionCss);
pathItemsContainer = this.byCss('.mat-select-panel', browser);
currentFolder: '.adf-current-folder', currentFolder = this.byCss('.adf-current-folder');
pathOption: '.adf-dropdown-breadcrumb-path-option .mat-option-text'
};
trigger: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.trigger));
pathItems: ElementArrayFinder = browser.$$(DropDownBreadcrumb.selectors.pathOption);
pathItemsContainer: ElementFinder = browser.element(by.css('.mat-select-panel'));
currentFolder: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.currentFolder));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(DropDownBreadcrumb.selectors.root, ancestor); super('.adf-dropdown-breadcrumb', ancestor);
} }
async waitForPathListDropdownToOpen(): Promise<void> { async waitForPathListDropdownToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(this.pathItemsContainer), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to open'); return waitForPresence(
this.pathItemsContainer,
'Timeout waiting for breadcrumb dropdown to open'
);
} }
async waitForPathListDropdownToClose(): Promise<void> { async waitForPathListDropdownToClose(): Promise<void> {
await browser.wait(EC.stalenessOf(browser.$(DropDownBreadcrumb.selectors.pathOption)), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to close'); return waitForStaleness(
} browser.$(this.pathOptionCss),
'Timeout waiting for breadcrumb dropdown to close'
async getCurrentFolderName(): Promise<string> { );
return this.currentFolder.getText();
} }
async openPath(): Promise<void> { async openPath(): Promise<void> {
@ -64,7 +58,9 @@ export class DropDownBreadcrumb extends Component {
} }
async clickPathItem(name: string): Promise<void> { async clickPathItem(name: string): Promise<void> {
const elem = browser.element(by.cssContainingText(DropDownBreadcrumb.selectors.pathOption, name)); const elem = browser.element(
by.cssContainingText(this.pathOptionCss, name)
);
await elem.click(); await elem.click();
} }

View File

@ -23,21 +23,60 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor'; import {
import { BROWSER_WAIT_TIMEOUT } from '../configs'; ElementFinder,
browser,
by,
ElementArrayFinder,
ProtractorBrowser
} from 'protractor';
import { waitForPresence } from '../utilities/utils';
export abstract class Component { export abstract class Component {
component: ElementFinder; component: ElementFinder;
protected byCss(
css: string,
root: ElementFinder | ProtractorBrowser = this.component
): ElementFinder {
return root.element(by.css(css));
}
protected byCssText(
css: string,
text: string,
root: ElementFinder | ProtractorBrowser = this.component
): ElementFinder {
return root.element(by.cssContainingText(css, text));
}
protected byId(
css: string,
root: ElementFinder | ProtractorBrowser = this.component
): ElementFinder {
return root.element(by.id(css));
}
protected allByCss(
css: string,
root: ElementFinder | ProtractorBrowser = this.component
): ElementArrayFinder {
return root.all(by.css(css));
}
constructor(selector: string, ancestor?: string) { constructor(selector: string, ancestor?: string) {
const locator = selector; const locator = selector;
this.component = ancestor this.component = ancestor
? browser.$$(ancestor).first().$$(locator).first() ? browser
.$$(ancestor)
.first()
.$$(locator)
.first()
: browser.$$(locator).first(); : browser.$$(locator).first();
} }
async wait() { async wait() {
await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.component);
} }
} }

View File

@ -23,91 +23,61 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, browser, protractor } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Utils } from '../../utilities/utils'; import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils';
export class DataTable extends Component { export class DataTable extends Component {
private static selectors = { private static selectors = {
root: 'adf-datatable',
head: '.adf-datatable-header',
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: ` sortedColumnHeader: `
.adf-datatable__header--sorted-asc .adf-datatable-cell-value, .adf-datatable__header--sorted-asc .adf-datatable-cell-value,
.adf-datatable__header--sorted-desc .adf-datatable-cell-value .adf-datatable__header--sorted-desc .adf-datatable-cell-value
`, `,
body: '.adf-datatable-body',
row: '.adf-datatable-row[role]', row: '.adf-datatable-row[role]',
selectedRow: '.adf-datatable-row.adf-is-selected',
cell: '.adf-datatable-cell-container', cell: '.adf-datatable-cell-container',
locationLink: '.aca-location-link',
nameLink: '.adf-datatable-link',
libraryRole: 'adf-library-role-column',
selectedIcon: '.mat-icon[class*="selected"]',
lockIcon: 'img[src*="lock"]',
lockOwner: '.aca-locked-by', lockOwner: '.aca-locked-by',
emptyListContainer: 'div.adf-no-content-container',
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
emptyListTitle: '.adf-empty-content__title',
emptyListSubtitle: '.adf-empty-content__subtitle',
emptySearchText: '.empty-search__text',
searchResultsRow: 'aca-search-results-row', searchResultsRow: 'aca-search-results-row',
searchResultsRowLine: '.line', searchResultsRowLine: '.line',
searchResultsNameLink: '.link'
}; };
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head)); head = this.byCss('.adf-datatable-header');
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body)); body = this.byCss('.adf-datatable-body');
emptyList = this.byCss('div.adf-no-content-container');
emptyFolderDragAndDrop = this.byCss('.adf-empty-list_template .adf-empty-folder');
emptyListTitle = this.byCss('.adf-empty-content__title');
emptyListSubtitle = this.byCss('.adf-empty-content__subtitle');
emptySearchText = this.byCss('.empty-search__text');
selectedRow = this.byCss('.adf-datatable-row.adf-is-selected');
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer)); menu = new Menu();
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle));
emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText));
menu: Menu = new Menu();
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(DataTable.selectors.root, ancestor); super('adf-datatable', ancestor);
} }
// Wait methods (waits for elements)
async waitForHeader(): Promise<void> { async waitForHeader(): Promise<void> {
await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---'); return waitForPresence(this.head, '--- timeout waitForHeader ---');
} }
async waitForBody(): Promise<void> { async waitForBody(): Promise<void> {
await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---'); return waitForPresence(this.body, '--- timeout waitForBody ---');
} }
async waitForEmptyState(): Promise<void> { async waitForEmptyState(): Promise<void> {
await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT); return waitForPresence(this.emptyList);
} }
// Header/Column methods private getColumnHeaders(): ElementArrayFinder {
getColumnHeaders(): ElementArrayFinder {
const locator = by.css(DataTable.selectors.columnHeader); const locator = by.css(DataTable.selectors.columnHeader);
return this.head.all(locator); return this.head.all(locator);
} }
async getColumnHeadersText(): Promise<string> { async getColumnHeadersText(): Promise<string> {
const el = this.getColumnHeaders(); return this.getColumnHeaders().getText();
return el.getText();
}
getNthColumnHeader(nth: number): ElementFinder {
return this.getColumnHeaders().get(nth - 1);
} }
getColumnHeaderByLabel(label: string): ElementFinder { getColumnHeaderByLabel(label: string): ElementFinder {
@ -115,7 +85,7 @@ export class DataTable extends Component {
return this.head.element(locator); return this.head.element(locator);
} }
getSortedColumnHeader(): ElementFinder { private getSortedColumnHeader(): ElementFinder {
const locator = by.css(DataTable.selectors.sortedColumnHeader); const locator = by.css(DataTable.selectors.sortedColumnHeader);
return this.head.element(locator); return this.head.element(locator);
} }
@ -137,15 +107,7 @@ export class DataTable extends Component {
return 'none'; return 'none';
} }
async sortByColumn(columnName: string): Promise<void> { private getRows(): ElementArrayFinder {
const column = this.getColumnHeaderByLabel(columnName);
const click = browser.actions().mouseMove(column).click();
await click.perform();
}
// Rows methods
getRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.row)); return this.body.all(by.css(DataTable.selectors.row));
} }
@ -153,12 +115,8 @@ export class DataTable extends Component {
return this.getRows().count(); return this.getRows().count();
} }
async waitForRowToBeSelected(): Promise<void> { private getSelectedRows(): ElementArrayFinder {
await browser.wait(EC.presenceOf(this.component.element(by.css(DataTable.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for row to be selected'); return this.body.all(by.css('.adf-datatable-row.adf-is-selected'));
}
getSelectedRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.selectedRow));
} }
async getSelectedRowsNames(): Promise<string[]> { async getSelectedRowsNames(): Promise<string[]> {
@ -172,10 +130,6 @@ export class DataTable extends Component {
return this.getSelectedRows().count(); return this.getSelectedRows().count();
} }
getNthRow(nth: number): ElementFinder {
return this.getRows().get(nth - 1);
}
getRowByName(name: string, location: string = ''): ElementFinder { getRowByName(name: string, location: string = ''): ElementFinder {
if (location) { if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.row, name)) return this.body.all(by.cssContainingText(DataTable.selectors.row, name))
@ -193,15 +147,15 @@ export class DataTable extends Component {
return this.getRowCells(itemName).count(); return this.getRowCells(itemName).count();
} }
getRowFirstCell(name: string, location: string = ''): ElementFinder { private getRowFirstCell(name: string, location: string = ''): ElementFinder {
return this.getRowCells(name, location).get(0); return this.getRowCells(name, location).get(0);
} }
getRowNameCell(name: string, location: string = ''): ElementFinder { private getRowNameCell(name: string, location: string = ''): ElementFinder {
return this.getRowCells(name, location).get(1); return this.getRowCells(name, location).get(1);
} }
getRowNameCellSpan(name: string, location: string = ''): ElementFinder { private getRowNameCellSpan(name: string, location: string = ''): ElementFinder {
return this.getRowNameCell(name, location).$('span'); return this.getRowNameCell(name, location).$('span');
} }
@ -210,17 +164,17 @@ export class DataTable extends Component {
} }
async hasCheckMarkIcon(itemName: string, location: string = ''): Promise<boolean> { async hasCheckMarkIcon(itemName: string, location: string = ''): Promise<boolean> {
const row: ElementFinder = this.getRowByName(itemName, location); const row = this.getRowByName(itemName, location);
return row.element(by.css(DataTable.selectors.selectedIcon)).isPresent(); return row.element(by.css('.mat-icon[class*="selected"]')).isPresent();
} }
async hasLockIcon(itemName: string, location: string = ''): Promise<boolean> { async hasLockIcon(itemName: string, location: string = ''): Promise<boolean> {
const row: ElementFinder = this.getRowByName(itemName, location); const row = this.getRowByName(itemName, location);
return row.element(by.css(DataTable.selectors.lockIcon)).isPresent(); return row.element(by.css('img[src*="lock"]')).isPresent();
} }
async hasLockOwnerInfo(itemName: string, location: string = ''): Promise<boolean> { private async hasLockOwnerInfo(itemName: string, location: string = ''): Promise<boolean> {
const row: ElementFinder = this.getRowByName(itemName, location); const row = this.getRowByName(itemName, location);
return row.element(by.css(DataTable.selectors.lockOwner)).isPresent(); return row.element(by.css(DataTable.selectors.lockOwner)).isPresent();
} }
@ -232,19 +186,18 @@ export class DataTable extends Component {
return ''; return '';
} }
getNameLink(itemName: string): ElementFinder { private getNameLink(itemName: string): ElementFinder {
return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink); return this.getRowNameCell(itemName).$('.adf-datatable-link');
} }
async hasLinkOnName(itemName: string): Promise<boolean> { async hasLinkOnName(itemName: string): Promise<boolean> {
return this.getNameLink(itemName).isPresent(); return this.getNameLink(itemName).isPresent();
} }
// Navigation/selection methods
async doubleClickOnRowByName(name: string, location: string = ''): Promise<void> { async doubleClickOnRowByName(name: string, location: string = ''): Promise<void> {
try { try {
const item = this.getRowFirstCell(name, location); const item = this.getRowFirstCell(name, location);
await Utils.waitUntilElementClickable(item); await waitForClickable(item);
await browser.actions().mouseMove(item).perform(); await browser.actions().mouseMove(item).perform();
await browser.actions().doubleClick().perform(); await browser.actions().doubleClick().perform();
} catch (error) { } catch (error) {
@ -320,8 +273,8 @@ export class DataTable extends Component {
await browser.actions().click(protractor.Button.RIGHT).perform(); await browser.actions().click(protractor.Button.RIGHT).perform();
} }
getItemLocationEl(name: string): ElementFinder { private getItemLocationEl(name: string): ElementFinder {
return this.getRowByName(name).element(by.css(DataTable.selectors.locationLink)); return this.getRowByName(name).element(by.css('.aca-location-link'));
} }
async getItemLocation(name: string): Promise<string> { async getItemLocation(name: string): Promise<string> {
@ -342,17 +295,12 @@ export class DataTable extends Component {
await this.getItemLocationEl(name).click(); await this.getItemLocationEl(name).click();
} }
// empty state methods
async isEmpty(): Promise<boolean> { async isEmpty(): Promise<boolean> {
return this.emptyList.isPresent(); return this.emptyList.isPresent();
} }
async isEmptyWithDragAndDrop(): Promise<boolean> {
return this.emptyFolderDragAndDrop.isDisplayed();
}
async getEmptyDragAndDropText(): Promise<string> { async getEmptyDragAndDropText(): Promise<string> {
const isEmpty = await this.isEmptyWithDragAndDrop(); const isEmpty = await this.emptyFolderDragAndDrop.isDisplayed();
if (isEmpty) { if (isEmpty) {
return this.emptyFolderDragAndDrop.getText(); return this.emptyFolderDragAndDrop.getText();
} }
@ -378,17 +326,13 @@ export class DataTable extends Component {
async getEmptyListText(): Promise<string> { async getEmptyListText(): Promise<string> {
const isEmpty = await this.isEmpty(); const isEmpty = await this.isEmpty();
if (isEmpty) { if (isEmpty) {
return this.component.element(by.css('adf-custom-empty-content-template')).getText(); return this.byCss('adf-custom-empty-content-template').getText();
} }
return ''; return '';
} }
async getEmptySearchResultsText(): Promise<string> {
return this.emptySearchText.getText();
}
async getCellsContainingName(name: string): Promise<string[]> { async getCellsContainingName(name: string): Promise<string[]> {
const rows: ElementArrayFinder = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
const cellsText: string[] = await rows.map(async cell => { const cellsText: string[] = await rows.map(async cell => {
return cell.getText(); return cell.getText();
}); });
@ -401,14 +345,14 @@ export class DataTable extends Component {
} }
async getLibraryRole(name: string): Promise<string> { async getLibraryRole(name: string): Promise<string> {
return this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText(); return this.getRowByName(name).element(by.css('adf-library-role-column')).getText();
} }
async isItemPresent(name: string, location? : string): Promise<boolean> { async isItemPresent(name: string, location? : string): Promise<boolean> {
return this.getRowByName(name, location).isPresent(); return this.getRowByName(name, location).isPresent();
} }
async getEntireDataTableText(): Promise<string[]> { private async getEntireDataTableText(): Promise<string[]> {
const text: string[] = await this.getRows().map((row) => { const text: string[] = await this.getRows().map((row) => {
return row.all(by.css(DataTable.selectors.cell)).map(async cell => { return row.all(by.css(DataTable.selectors.cell)).map(async cell => {
return cell.getText(); return cell.getText();
@ -433,7 +377,7 @@ export class DataTable extends Component {
}, {}); }, {});
} }
getSearchResultsRows(): ElementArrayFinder { private getSearchResultsRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.searchResultsRow)); return this.body.all(by.css(DataTable.selectors.searchResultsRow));
} }
@ -441,7 +385,7 @@ export class DataTable extends Component {
return this.getSearchResultsRows().get(nth - 1); return this.getSearchResultsRows().get(nth - 1);
} }
getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { private getSearchResultsRowByName(name: string, location: string = ''): ElementFinder {
if (location) { if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name)) 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))))
@ -450,7 +394,7 @@ export class DataTable extends Component {
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name)); return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
} }
getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder { private getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder {
return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine)); return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine));
} }
@ -458,7 +402,7 @@ export class DataTable extends Component {
return this.getSearchResultRowLines(name, location).count(); return this.getSearchResultRowLines(name, location).count();
} }
getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder { private getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder {
return this.getSearchResultRowLines(name, location).get(index); return this.getSearchResultRowLines(name, location).get(index);
} }
@ -478,8 +422,8 @@ export class DataTable extends Component {
return this.getSearchResultNthLine(name, location, 3).getText(); return this.getSearchResultNthLine(name, location, 3).getText();
} }
getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder { private getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder {
return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink); return this.getSearchResultsRowByName(itemName, location).$('.link');
} }
async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise<boolean> { async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise<boolean> {

View File

@ -23,44 +23,24 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import * as moment from 'moment'; import * as moment from 'moment';
import { isPresentAndDisplayed } from '../../utilities/utils'; import { isPresentAndDisplayed, waitForStaleness } from '../../utilities/utils';
export class DateTimePicker extends Component { export class DateTimePicker extends Component {
private static selectors = { calendar = this.byCss('.mat-datetimepicker-popup', browser);
root: '.mat-datetimepicker-popup', headerDate = this.byCss('.mat-datetimepicker-calendar-header-date');
headerYear = this.byCss('.mat-datetimepicker-calendar-header-year');
header: '.mat-datetimepicker-calendar-header', dayPicker = this.byCss('mat-datetimepicker-month-view');
year: '.mat-datetimepicker-calendar-header-year', rootElemLocator = by.css('.mat-datetimepicker-popup');
date: '.mat-datetimepicker-calendar-header-date',
content: '.mat-datetimepicker-calendar-content',
dayPicker: 'mat-datetimepicker-month-view',
today: '.mat-datetimepicker-calendar-body-today',
firstActiveDay: '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content',
};
calendar: ElementFinder = browser.element(by.css(DateTimePicker.selectors.root));
headerDate: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.date));
headerYear: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.year));
dayPicker: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.dayPicker));
rootElemLocator = by.css(DateTimePicker.selectors.root);
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(DateTimePicker.selectors.root, ancestor); super('.mat-datetimepicker-popup', ancestor);
}
async waitForDateTimePickerToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(this.calendar), BROWSER_WAIT_TIMEOUT);
} }
async waitForDateTimePickerToClose(): Promise<void> { async waitForDateTimePickerToClose(): Promise<void> {
await browser.wait(EC.stalenessOf(this.calendar), BROWSER_WAIT_TIMEOUT); return waitForStaleness(this.calendar);
} }
async isCalendarOpen(): Promise<boolean> { async isCalendarOpen(): Promise<boolean> {
@ -69,21 +49,14 @@ export class DateTimePicker extends Component {
return isPresentAndDisplayed(element); return isPresentAndDisplayed(element);
} }
async getDate(): Promise<string> {
return this.headerDate.getText();
}
async getYear(): Promise<string> {
return this.headerYear.getText();
}
async setDefaultDay(): Promise<string> { async setDefaultDay(): Promise<string> {
const today = moment(); const today = moment();
const tomorrow = today.add(1, 'day'); const tomorrow = today.add(1, 'day');
const dayOfTomorrow = tomorrow.date(); const dayOfTomorrow = tomorrow.date();
const date = await this.getDate(); const date = await this.headerDate.getText();
const year = await this.getYear(); const year = await this.headerYear.getText();
const elem = this.dayPicker.element(by.cssContainingText(DateTimePicker.selectors.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(); await elem.click();
return `${date} ${year}`; return `${date} ${year}`;
} }

View File

@ -25,20 +25,17 @@
import { by } from 'protractor'; import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled } from '../../utilities/utils';
export class ConfirmDialog extends GenericDialog { export class ConfirmDialog extends GenericDialog {
private static selectors = { okButton = this.childElement(by.buttonText('OK'));
root: 'adf-confirm-dialog', cancelButton = this.childElement(by.buttonText('Cancel'));
keepButton = this.childElement(by.buttonText('Keep'));
okButton: by.buttonText('OK'), deleteButton = this.childElement(by.buttonText('Delete'));
cancelButton: by.buttonText('Cancel'), removeButton = this.childElement(by.buttonText('Remove'));
keepButton: by.buttonText('Keep'),
deleteButton: by.buttonText('Delete'),
removeButton: by.buttonText('Remove')
}
constructor() { constructor() {
super(ConfirmDialog.selectors.root); super('adf-confirm-dialog');
} }
async getText(): Promise<string> { async getText(): Promise<string> {
@ -46,43 +43,22 @@ export class ConfirmDialog extends GenericDialog {
} }
async isOkEnabled(): Promise<boolean> { async isOkEnabled(): Promise<boolean> {
return this.isButtonEnabled(ConfirmDialog.selectors.okButton); return isPresentAndEnabled(this.okButton);
} }
async isCancelEnabled(): Promise<boolean> { async isCancelEnabled(): Promise<boolean> {
return this.isButtonEnabled(ConfirmDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
} }
async isKeepEnabled(): Promise<boolean> { async isKeepEnabled(): Promise<boolean> {
return this.isButtonEnabled(ConfirmDialog.selectors.keepButton); return isPresentAndEnabled(this.keepButton);
} }
async isDeleteEnabled(): Promise<boolean> { async isDeleteEnabled(): Promise<boolean> {
return this.isButtonEnabled(ConfirmDialog.selectors.deleteButton); return isPresentAndEnabled(this.deleteButton);
} }
async isRemoveEnabled(): Promise<boolean> { async isRemoveEnabled(): Promise<boolean> {
return this.isButtonEnabled(ConfirmDialog.selectors.removeButton); return isPresentAndEnabled(this.removeButton);
} }
async clickOk(): Promise<void> {
await this.clickButton(ConfirmDialog.selectors.okButton);
}
async clickCancel(): Promise<void> {
await this.clickButton(ConfirmDialog.selectors.cancelButton);
}
async clickKeep(): Promise<void> {
await this.clickButton(ConfirmDialog.selectors.keepButton);
}
async clickDelete(): Promise<void> {
await this.clickButton(ConfirmDialog.selectors.deleteButton);
}
async clickRemove(): Promise<void> {
await this.clickButton(ConfirmDialog.selectors.removeButton);
}
} }

View File

@ -23,73 +23,38 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; import { by, browser, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { Utils, isPresentAndDisplayed } from '../../utilities/utils'; import { Utils, isPresentAndDisplayed, waitForStaleness, waitForPresence, isPresentAndEnabled, waitForClickable } from '../../utilities/utils';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table'; import { DataTable } from '../data-table/data-table';
export class ContentNodeSelectorDialog extends GenericDialog { export class ContentNodeSelectorDialog extends GenericDialog {
private static selectors = { cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]'));
root: '.adf-content-node-selector-dialog', copyButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy'));
moveButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move'));
locationDropDown: 'site-dropdown-container', locationDropDown = this.rootElem.element(by.id('site-dropdown-container'));
locationOption: '.mat-option .mat-option-text', locationPersonalFiles = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'Personal Files'));
locationFileLibraries = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'File Libraries'));
dataTable: '.adf-datatable-body', searchInput = this.rootElem.element(by.css('#searchInput'));
selectedRow: '.adf-is-selected', toolbarTitle = this.rootElem.element(by.css('.adf-toolbar-title'));
searchInput: '#searchInput', breadcrumb = new DropDownBreadcrumb();
toolbarTitle: '.adf-toolbar-title', dataTable = new DataTable('.adf-content-node-selector-dialog');
cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]'),
copyButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy'),
moveButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move')
};
locationDropDown: ElementFinder = this.rootElem.element(by.id(ContentNodeSelectorDialog.selectors.locationDropDown));
locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'Personal Files'));
locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'File Libraries'));
searchInput: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.searchInput));
toolbarTitle: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.toolbarTitle));
breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb();
dataTable: DataTable = new DataTable(ContentNodeSelectorDialog.selectors.root);
constructor() { constructor() {
super(ContentNodeSelectorDialog.selectors.root); super('.adf-content-node-selector-dialog');
}
async waitForDropDownToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT);
} }
async waitForDropDownToClose(): Promise<void> { async waitForDropDownToClose(): Promise<void> {
await browser.wait(EC.stalenessOf(browser.$(ContentNodeSelectorDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT); await waitForStaleness(browser.$('.mat-option .mat-option-text'))
}
async waitForRowToBeSelected(): Promise<void> {
await browser.wait(EC.presenceOf(browser.element(by.css(ContentNodeSelectorDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT);
}
async clickCancel(): Promise<void> {
await this.clickButton(ContentNodeSelectorDialog.selectors.cancelButton);
await this.waitForDialogToClose();
}
async clickCopy(): Promise<void> {
await this.clickButton(ContentNodeSelectorDialog.selectors.copyButton);
}
async clickMove(): Promise<void> {
await this.clickButton(ContentNodeSelectorDialog.selectors.moveButton);
} }
async selectLocation(location: 'Personal Files' | 'File Libraries'): Promise<void> { async selectLocation(location: 'Personal Files' | 'File Libraries'): Promise<void> {
await this.locationDropDown.click(); await this.locationDropDown.click();
await this.waitForDropDownToOpen(); await waitForPresence(this.locationPersonalFiles);
if (location === 'Personal Files') { if (location === 'Personal Files') {
await this.locationPersonalFiles.click(); await this.locationPersonalFiles.click();
@ -102,13 +67,9 @@ export class ContentNodeSelectorDialog extends GenericDialog {
async selectDestination(folderName: string): Promise<void> { async selectDestination(folderName: string): Promise<void> {
const row = this.dataTable.getRowByName(folderName); const row = this.dataTable.getRowByName(folderName);
await Utils.waitUntilElementClickable(row); await waitForClickable(row);
await row.click(); await row.click();
await this.waitForRowToBeSelected(); await waitForPresence(browser.element(by.css('.adf-is-selected')));
}
async isSearchInputPresent(): Promise<boolean> {
return this.searchInput.isPresent();
} }
async isSelectLocationDropdownDisplayed(): Promise<boolean> { async isSelectLocationDropdownDisplayed(): Promise<boolean> {
@ -116,11 +77,11 @@ export class ContentNodeSelectorDialog extends GenericDialog {
} }
async isCopyButtonEnabled(): Promise<boolean> { async isCopyButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.copyButton); return isPresentAndEnabled(this.copyButton);
} }
async isCancelButtonEnabled(): Promise<boolean> { async isCancelButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
} }
async searchFor(text: string): Promise<void> { async searchFor(text: string): Promise<void> {

View File

@ -23,64 +23,42 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor'; import { by } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndDisplayed } from '../../utilities/utils'; import { isPresentAndDisplayed, waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateOrEditFolderDialog extends GenericDialog { export class CreateOrEditFolderDialog extends GenericDialog {
private static selectors = { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
root: 'adf-folder-dialog', cancelButton = this.childElement(by.id('adf-folder-cancel-button'));
updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update'));
nameInput: 'input[placeholder="Name" i]', nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
descriptionTextArea: 'textarea[placeholder="Description" i]', descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]'));
validationMessage = this.rootElem.element(by.css('.mat-hint span'));
validationMessage: '.mat-hint span',
createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
cancelButton: by.id('adf-folder-cancel-button'),
updateButton: by.cssContainingText('.mat-dialog-actions button', 'Update')
};
nameInput: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
validationMessage: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
constructor() { constructor() {
super(CreateOrEditFolderDialog.selectors.root); super('adf-folder-dialog');
} }
async waitForDialogToOpen() { async waitForDialogToOpen() {
await super.waitForDialogToOpen(); await super.waitForDialogToOpen();
await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---'); await waitForClickable(this.nameInput);
}
async isValidationMessageDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.validationMessage);
} }
async isUpdateButtonEnabled(): Promise<boolean> { async isUpdateButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.updateButton); return isPresentAndEnabled(this.updateButton);
} }
async isCreateButtonEnabled(): Promise<boolean> { async isCreateButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.createButton); return isPresentAndEnabled(this.createButton);
} }
async isCancelButtonEnabled(): Promise<boolean> { async isCancelButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
}
async isNameDisplayed(): Promise<boolean> {
return this.nameInput.isDisplayed();
}
async isDescriptionDisplayed(): Promise<boolean> {
return this.descriptionTextArea.isDisplayed();
} }
async getValidationMessage(): Promise<string> { async getValidationMessage(): Promise<string> {
if (await this.isValidationMessageDisplayed()) { if (await isPresentAndDisplayed(this.validationMessage)) {
return this.validationMessage.getText(); return this.validationMessage.getText();
} else { } else {
return ''; return '';
@ -96,31 +74,15 @@ export class CreateOrEditFolderDialog extends GenericDialog {
} }
async enterName(name: string): Promise<void> { async enterName(name: string): Promise<void> {
await this.nameInput.clear(); await typeText(this.nameInput, name);
await this.nameInput.sendKeys(name);
} }
async enterDescription(description: string): Promise<void> { async enterDescription(description: string): Promise<void> {
await this.descriptionTextArea.clear(); await typeText(this.descriptionTextArea, description);
await this.descriptionTextArea.sendKeys(description);
}
async deleteNameWithBackspace(): Promise<void> {
await this.nameInput.clear();
await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
async clickCreate(): Promise<void> {
await this.clickButton(CreateOrEditFolderDialog.selectors.createButton);
} }
async clickCancel(): Promise<void> { async clickCancel(): Promise<void> {
await this.clickButton(CreateOrEditFolderDialog.selectors.cancelButton); await this.cancelButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
async clickUpdate(): Promise<void> {
await this.clickButton(CreateOrEditFolderDialog.selectors.updateButton);
}
} }

View File

@ -23,30 +23,21 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, protractor } from 'protractor'; import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndDisplayed } from '../../utilities/utils'; import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateFromTemplateDialog extends GenericDialog { export class CreateFromTemplateDialog extends GenericDialog {
private static selectors = { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
root: '.aca-create-from-template-dialog', cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL'));
nameInput: 'input[placeholder="Name" i]', nameInput = this.childElement(by.css('input[placeholder="Name" i]'));
titleInput: 'input[placeholder="Title" i]', titleInput = this.childElement(by.css('input[placeholder="Title" i]'));
descriptionTextArea: 'textarea[placeholder="Description" i]', descriptionTextArea = this.childElement(by.css('textarea[placeholder="Description" i]'));
validationMessage: '.mat-error', validationMessage = this.childElement(by.css('.mat-error'));
createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
cancelButton: by.cssContainingText('.mat-dialog-actions button', 'CANCEL')
};
nameInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.nameInput));
titleInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.titleInput));
descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.descriptionTextArea));
validationMessage: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.validationMessage));
constructor() { constructor() {
super(CreateFromTemplateDialog.selectors.root); super('.aca-create-from-template-dialog');
} }
async isValidationMessageDisplayed(): Promise<boolean> { async isValidationMessageDisplayed(): Promise<boolean> {
@ -54,23 +45,11 @@ export class CreateFromTemplateDialog extends GenericDialog {
} }
async isCreateButtonEnabled(): Promise<boolean> { async isCreateButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateFromTemplateDialog.selectors.createButton); return isPresentAndEnabled(this.createButton);
} }
async isCancelButtonEnabled(): Promise<boolean> { async isCancelButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateFromTemplateDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
}
async isNameFieldDisplayed(): Promise<boolean> {
return this.nameInput.isDisplayed();
}
async isTitleFieldDisplayed(): Promise<boolean> {
return this.titleInput.isDisplayed();
}
async isDescriptionFieldDisplayed(): Promise<boolean> {
return this.descriptionTextArea.isDisplayed();
} }
async getValidationMessage(): Promise<string> { async getValidationMessage(): Promise<string> {
@ -90,32 +69,19 @@ export class CreateFromTemplateDialog extends GenericDialog {
} }
async enterName(name: string): Promise<void> { async enterName(name: string): Promise<void> {
await this.nameInput.clear(); await typeText(this.nameInput, name);
await this.nameInput.sendKeys(name);
} }
async enterTitle(title: string): Promise<void> { async enterTitle(title: string): Promise<void> {
await this.titleInput.clear(); await typeText(this.titleInput, title);
await this.titleInput.sendKeys(title);
} }
async enterDescription(description: string): Promise<void> { async enterDescription(description: string): Promise<void> {
await this.descriptionTextArea.clear(); await typeText(this.descriptionTextArea, description);
await this.descriptionTextArea.sendKeys(description);
}
async deleteNameWithBackspace(): Promise<void> {
await this.nameInput.clear();
await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
async clickCreate(): Promise<void> {
await this.clickButton(CreateFromTemplateDialog.selectors.createButton);
} }
async clickCancel(): Promise<void> { async clickCancel(): Promise<void> {
await this.clickButton(CreateFromTemplateDialog.selectors.cancelButton); await this.cancelButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
} }

View File

@ -23,140 +23,78 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor'; import { by, ElementFinder } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class CreateLibraryDialog extends GenericDialog { export class CreateLibraryDialog extends GenericDialog {
private static selectors = { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create'));
root: 'adf-library-dialog', cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel'));
nameInput: 'input[placeholder="Name" i]', nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
libraryIdInput: 'input[placeholder="Library ID" i]', libraryIdInput = this.rootElem.element(by.css('input[placeholder="Library ID" i]'));
descriptionTextArea: 'textarea[placeholder="Description" i]', descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]'));
visibilityPublic = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Public'));
visibilityModerated = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Moderated'));
visibilityPrivate = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Private'));
radioButton: '.mat-radio-label', errorMessage = this.rootElem.element(by.css('.mat-error'));
radioChecked: 'mat-radio-checked',
errorMessage: '.mat-error',
createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'),
cancelButton: by.cssContainingText('.mat-dialog-actions button', 'Cancel')
};
nameInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.nameInput));
libraryIdInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.libraryIdInput));
descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.descriptionTextArea));
visibilityPublic: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Public'));
visibilityModerated: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Moderated'));
visibilityPrivate: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Private'));
errorMessage: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.errorMessage));
constructor() { constructor() {
super(CreateLibraryDialog.selectors.root); super('adf-library-dialog');
} }
async waitForDialogToOpen(): Promise<void> { async waitForDialogToOpen(): Promise<void> {
await super.waitForDialogToOpen(); await super.waitForDialogToOpen();
await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---'); await waitForClickable(this.nameInput);
}
async isErrorMessageDisplayed(): Promise<boolean> {
return this.errorMessage.isDisplayed();
} }
async getErrorMessage(): Promise<string> { async getErrorMessage(): Promise<string> {
if (await this.isErrorMessageDisplayed()) { if (await this.errorMessage.isDisplayed()) {
return this.errorMessage.getText(); return this.errorMessage.getText();
} }
return ''; return '';
} }
async isNameDisplayed(): Promise<boolean> {
return this.nameInput.isDisplayed();
}
async isLibraryIdDisplayed(): Promise<boolean> {
return this.libraryIdInput.isDisplayed();
}
async isDescriptionDisplayed(): Promise<boolean> {
return this.descriptionTextArea.isDisplayed();
}
async isPublicDisplayed(): Promise<boolean> {
return this.visibilityPublic.isDisplayed();
}
async isModeratedDisplayed(): Promise<boolean> {
return this.visibilityModerated.isDisplayed();
}
async isPrivateDisplayed(): Promise<boolean> {
return this.visibilityPrivate.isDisplayed();
}
async enterName(name: string): Promise<void> { async enterName(name: string): Promise<void> {
await this.nameInput.clear(); await typeText(this.nameInput, name);
await this.nameInput.sendKeys(name);
} }
async enterLibraryId(id: string): Promise<void> { async enterLibraryId(id: string): Promise<void> {
await this.libraryIdInput.clear(); await typeText(this.libraryIdInput, id);
await this.libraryIdInput.sendKeys(id);
} }
async enterDescription(description: string): Promise<void> { async enterDescription(description: string): Promise<void> {
await this.descriptionTextArea.clear(); await typeText(this.descriptionTextArea, description);
await this.descriptionTextArea.sendKeys(description);
}
async deleteNameWithBackspace(): Promise<void> {
await this.nameInput.clear();
await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
} }
async isCreateEnabled(): Promise<boolean> { async isCreateEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateLibraryDialog.selectors.createButton); return isPresentAndEnabled(this.createButton);
} }
async isCancelEnabled(): Promise<boolean> { async isCancelEnabled(): Promise<boolean> {
return this.isButtonEnabled(CreateLibraryDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
}
async clickCreate(): Promise<void> {
await this.clickButton(CreateLibraryDialog.selectors.createButton);
} }
async clickCancel(): Promise<void> { async clickCancel(): Promise<void> {
await this.clickButton(CreateLibraryDialog.selectors.cancelButton); await this.cancelButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
private async isChecked(target: ElementFinder): Promise<boolean> {
const elemClass = await target.element(by.xpath('..')).getAttribute('class');
return elemClass.includes('mat-radio-checked');
}
async isPublicChecked(): Promise<boolean> { async isPublicChecked(): Promise<boolean> {
const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class'); return this.isChecked(this.visibilityPublic);
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
} }
async isModeratedChecked(): Promise<boolean> { async isModeratedChecked(): Promise<boolean> {
const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class'); return this.isChecked(this.visibilityModerated);
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
} }
async isPrivateChecked(): Promise<boolean> { async isPrivateChecked(): Promise<boolean> {
const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class'); return this.isChecked(this.visibilityPrivate);
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
}
async selectPublic(): Promise<void> {
await this.visibilityPublic.click();
}
async selectModerated(): Promise<void> {
await this.visibilityModerated.click();
}
async selectPrivate(): Promise<void> {
await this.visibilityPrivate.click();
} }
} }

View File

@ -23,32 +23,23 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor'; import { ElementFinder, by, browser, Locator } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils';
import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils';
export abstract class GenericDialog { export abstract class GenericDialog {
private static locators = {
title: '.mat-dialog-title',
content: '.mat-dialog-content'
};
private rootCssSelector: string; constructor(private rootCssSelector?: string) {}
constructor(selector?: string) {
this.rootCssSelector = selector;
}
get rootElem(): ElementFinder { get rootElem(): ElementFinder {
return browser.element(by.css(this.rootCssSelector)); return browser.element(by.css(this.rootCssSelector));
} }
get title(): ElementFinder { get title(): ElementFinder {
return this.rootElem.element(by.css(GenericDialog.locators.title)); return this.rootElem.element(by.css('.mat-dialog-title'));
} }
get content(): ElementFinder { get content(): ElementFinder {
return this.rootElem.element(by.css(GenericDialog.locators.content)); return this.rootElem.element(by.css('.mat-dialog-content'));
} }
async getText(): Promise<string> { async getText(): Promise<string> {
@ -56,13 +47,13 @@ export abstract class GenericDialog {
} }
async waitForDialogToOpen(): Promise<void> { async waitForDialogToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(this.rootElem), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.rootElem);
await browser.wait(EC.visibilityOf(this.content), BROWSER_WAIT_TIMEOUT); await waitForVisibility(this.content);
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT); await waitForPresence(browser.element(by.css('.cdk-overlay-backdrop')));
} }
async waitForDialogToClose(): Promise<void> { async waitForDialogToClose(): Promise<void> {
await browser.wait(EC.stalenessOf(this.content), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for dialog to close ----'); await waitForStaleness(this.content);
} }
async isDialogOpen(): Promise<boolean> { async isDialogOpen(): Promise<boolean> {
@ -73,15 +64,7 @@ export abstract class GenericDialog {
return this.title.getText(); return this.title.getText();
} }
getActionButton(selector: Locator): ElementFinder { protected childElement(selector: Locator): ElementFinder {
return this.rootElem.element(selector); return this.rootElem.element(selector);
} }
async isButtonEnabled(selector: Locator): Promise<boolean> {
return isPresentAndEnabled(this.getActionButton(selector));
}
async clickButton(selector: Locator): Promise<void> {
await this.getActionButton(selector).click();
}
} }

View File

@ -27,18 +27,14 @@ import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
export class ManageVersionsDialog extends GenericDialog { export class ManageVersionsDialog extends GenericDialog {
private static selectors = { closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close'));
root: '.aca-node-versions-dialog',
closeButton: by.cssContainingText('.mat-button', 'Close')
};
constructor() { constructor() {
super(ManageVersionsDialog.selectors.root); super('.aca-node-versions-dialog');
} }
async clickClose(): Promise<void> { async clickClose(): Promise<void> {
await this.clickButton(ManageVersionsDialog.selectors.closeButton); await this.closeButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
} }

View File

@ -23,35 +23,23 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils';
export class PasswordDialog extends GenericDialog { export class PasswordDialog extends GenericDialog {
private static selectors = { closeButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-close"]'));
root: 'adf-pdf-viewer-password-dialog', submitButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-submit"]'));
passwordInput = this.childElement(by.css('input[type="Password"]'));
passwordInput: 'input[type="Password"]', errorMessage = this.childElement(by.css('.mat-error'));
errorMessage: '.mat-error',
closeButton: by.css('[data-automation-id="adf-password-dialog-close"]'),
submitButton: by.css('[data-automation-id="adf-password-dialog-submit"]')
};
passwordInput: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.passwordInput));
errorMessage: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.errorMessage));
constructor() { constructor() {
super(PasswordDialog.selectors.root); super('adf-pdf-viewer-password-dialog');
}
async waitForPasswordInputToBeInteractive() {
await browser.wait(EC.elementToBeClickable(this.passwordInput), BROWSER_WAIT_TIMEOUT, '--- timeout wait for passwordInput ---');
} }
async waitForDialogToOpen(): Promise<void> { async waitForDialogToOpen(): Promise<void> {
await super.waitForDialogToOpen(); await super.waitForDialogToOpen();
await this.waitForPasswordInputToBeInteractive(); await waitForClickable(this.passwordInput);
} }
async isDialogOpen(): Promise<boolean> { async isDialogOpen(): Promise<boolean> {
@ -64,19 +52,11 @@ export class PasswordDialog extends GenericDialog {
} }
async isCloseEnabled(): Promise<boolean> { async isCloseEnabled(): Promise<boolean> {
return this.isButtonEnabled(PasswordDialog.selectors.closeButton); return isPresentAndEnabled(this.closeButton);
} }
async isSubmitEnabled(): Promise<boolean> { async isSubmitEnabled(): Promise<boolean> {
return this.isButtonEnabled(PasswordDialog.selectors.submitButton); return isPresentAndEnabled(this.submitButton);
}
async clickClose(): Promise<void> {
await this.clickButton(PasswordDialog.selectors.closeButton);
}
async clickSubmit(): Promise<void> {
await this.clickButton(PasswordDialog.selectors.submitButton);
} }
async isPasswordInputDisplayed(): Promise<boolean> { async isPasswordInputDisplayed(): Promise<boolean> {
@ -106,7 +86,6 @@ export class PasswordDialog extends GenericDialog {
} }
async enterPassword(password: string): Promise<void> { async enterPassword(password: string): Promise<void> {
await this.passwordInput.clear(); await typeText(this.passwordInput, password);
await this.passwordInput.sendKeys(password);
} }
} }

View File

@ -27,37 +27,39 @@ import { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table'; import { DataTable } from '../data-table/data-table';
import { isPresentAndEnabled } from '../../utilities/utils';
export class SelectTemplateDialog extends GenericDialog { export class SelectTemplateDialog extends GenericDialog {
private static selectors = { nextButton = this.childElement(
root: '.aca-template-node-selector-dialog', by.css('[data-automation-id="content-node-selector-actions-choose"]')
);
nextButton: by.css('[data-automation-id="content-node-selector-actions-choose"]'), cancelButton = this.childElement(
cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]') by.css('[data-automation-id="content-node-selector-actions-cancel"]')
}; );
breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb(); breadcrumb = new DropDownBreadcrumb();
dataTable: DataTable = new DataTable(SelectTemplateDialog.selectors.root); dataTable = new DataTable('.aca-template-node-selector-dialog');
constructor() { constructor() {
super(SelectTemplateDialog.selectors.root); super('.aca-template-node-selector-dialog');
} }
async isCancelButtonEnabled(): Promise<boolean> { async isCancelButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(SelectTemplateDialog.selectors.cancelButton); return isPresentAndEnabled(this.cancelButton);
} }
async isNextButtonEnabled(): Promise<boolean> { async isNextButtonEnabled(): Promise<boolean> {
return this.isButtonEnabled(SelectTemplateDialog.selectors.nextButton); return isPresentAndEnabled(this.nextButton);
} }
async clickCancel(): Promise<void> { async clickCancel(): Promise<void> {
await this.clickButton(SelectTemplateDialog.selectors.cancelButton); await this.cancelButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
async clickNext(): Promise<void> { async clickNext(): Promise<void> {
await this.clickButton(SelectTemplateDialog.selectors.nextButton); await this.nextButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
} }

View File

@ -23,41 +23,28 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by } from 'protractor'; import { by } from 'protractor';
import { DateTimePicker } from '../../components/datetime-picker/datetime-picker'; import { DateTimePicker } from '../../components/datetime-picker/datetime-picker';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled } from '../../utilities/utils';
export class ShareDialog extends GenericDialog { export class ShareDialog extends GenericDialog {
private static selectors = {
root: '.adf-share-dialog',
dialogTitle: `[data-automation-id='adf-share-dialog-title']`,
info: '.adf-share-link__info',
label: '.adf-share-link__label',
shareToggle: `[data-automation-id='adf-share-toggle']`,
linkUrl: `[data-automation-id='adf-share-link']`,
inputAction: '.adf-input-action',
expireToggle: `[data-automation-id='adf-expire-toggle']`,
datetimePickerButton: '.mat-datetimepicker-toggle',
expirationInput: 'input[formcontrolname="time"]',
closeButton: by.css(`[data-automation-id='adf-share-dialog-close']`)
};
dateTimePicker = new DateTimePicker(); dateTimePicker = new DateTimePicker();
dialogTitle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.dialogTitle)); dialogTitle = this.childElement(by.css(`[data-automation-id='adf-share-dialog-title']`));
infoText: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.info)); infoText = this.childElement(by.css('.adf-share-link__info'));
labels: ElementArrayFinder = this.rootElem.all(by.css(ShareDialog.selectors.label)); labels = this.rootElem.all(by.css('.adf-share-link__label'));
shareToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.shareToggle)); shareToggle = this.childElement(by.css(`[data-automation-id='adf-share-toggle']`));
url: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.linkUrl)); url = this.childElement(by.css(`[data-automation-id='adf-share-link']`));
urlAction: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.inputAction)); urlAction = this.childElement(by.css('.adf-input-action'));
expireToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expireToggle)); expireToggle = this.childElement(by.css(`[data-automation-id='adf-expire-toggle']`));
expireInput: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expirationInput)); expireInput = this.childElement(by.css('input[formcontrolname="time"]'));
datetimePickerButton: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.datetimePickerButton)); datetimePickerButton = this.childElement(by.css('.mat-datetimepicker-toggle'));
closeButton = this.childElement(by.css(`[data-automation-id='adf-share-dialog-close']`));
constructor() { constructor() {
super(ShareDialog.selectors.root); super('.adf-share-dialog');
} }
async getTitle(): Promise<string> { async getTitle(): Promise<string> {
@ -68,10 +55,6 @@ export class ShareDialog extends GenericDialog {
return this.infoText.getText(); return this.infoText.getText();
} }
getLabels(): ElementArrayFinder {
return this.labels;
}
async getLinkUrl(): Promise<string> { async getLinkUrl(): Promise<string> {
return this.url.getAttribute('value'); return this.url.getAttribute('value');
} }
@ -82,49 +65,29 @@ export class ShareDialog extends GenericDialog {
} }
async isCloseEnabled(): Promise<boolean> { async isCloseEnabled(): Promise<boolean> {
return this.isButtonEnabled(ShareDialog.selectors.closeButton); return isPresentAndEnabled(this.closeButton);
} }
async clickClose(): Promise<void> { async clickClose(): Promise<void> {
await this.clickButton(ShareDialog.selectors.closeButton); await this.closeButton.click();
await this.waitForDialogToClose(); await this.waitForDialogToClose();
} }
getShareToggle(): ElementFinder {
return this.shareToggle;
}
getExpireToggle(): ElementFinder {
return this.expireToggle;
}
getExpireInput(): ElementFinder {
return this.expireInput;
}
async isShareToggleChecked(): Promise<boolean> { async isShareToggleChecked(): Promise<boolean> {
const toggleClass = await this.getShareToggle().getAttribute('class'); const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('checked'); return toggleClass.includes('checked');
} }
async isShareToggleDisabled(): Promise<boolean> { async isShareToggleDisabled(): Promise<boolean> {
const toggleClass = await this.getShareToggle().getAttribute('class'); const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('mat-disabled'); return toggleClass.includes('mat-disabled');
} }
async isExpireToggleEnabled(): Promise<boolean> { async isExpireToggleEnabled(): Promise<boolean> {
const toggleClass = await this.getExpireToggle().getAttribute('class'); const toggleClass = await this.expireToggle.getAttribute('class');
return toggleClass.includes('checked'); return toggleClass.includes('checked');
} }
async copyUrl(): Promise<void> {
await this.urlAction.click();
}
async openDatetimePicker(): Promise<void> {
await this.datetimePickerButton.click();
}
async closeDatetimePicker(): Promise<void> { async closeDatetimePicker(): Promise<void> {
if (await this.dateTimePicker.isCalendarOpen()) { if (await this.dateTimePicker.isCalendarOpen()) {
await this.datetimePickerButton.click(); await this.datetimePickerButton.click();
@ -132,14 +95,6 @@ export class ShareDialog extends GenericDialog {
} }
async getExpireDate(): Promise<string> { async getExpireDate(): Promise<string> {
return this.getExpireInput().getAttribute('value'); return this.expireInput.getAttribute('value');
}
async clickExpirationToggle(): Promise<void> {
await this.expireToggle.click();
}
async clickShareToggle(): Promise<void> {
await this.shareToggle.click();
} }
} }

View File

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

View File

@ -23,71 +23,54 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, until } from 'protractor'; import { by, browser } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { UserInfo } from './user-info'; import { UserInfo } from './user-info';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Toolbar } from './../toolbar/toolbar'; import { Toolbar } from './../toolbar/toolbar';
import { SearchInput } from '../search/search-input'; import { SearchInput } from '../search/search-input';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { waitElement } from '../../utilities/utils';
export class Header extends Component { export class Header extends Component {
private static selectors = { logoLink = this.byCss('.app-menu__title');
root: 'app-header', moreActions = browser.element(by.id('app.header.more'));
logoLink: by.css('.app-menu__title'), sidenavToggle = this.byCss(`[id='adf-sidebar-toggle-start']`);
userInfo: by.css('aca-current-user'),
moreActions: by.id('app.header.more'),
sidenavToggle: `[id='adf-sidebar-toggle-start']`, userInfo = new UserInfo();
expandedSidenav: by.css(`[data-automation-id='expanded']`), menu = new Menu();
collapsedSidenav: by.css(`[data-automation-id='collapsed']`) toolbar = new Toolbar();
}; searchInput = new SearchInput();
logoLink: ElementFinder = this.component.element(Header.selectors.logoLink);
moreActions: ElementFinder = browser.element(Header.selectors.moreActions);
sidenavToggle: ElementFinder = this.component.element(by.css(Header.selectors.sidenavToggle));
userInfo: UserInfo = new UserInfo();
menu: Menu = new Menu();
toolbar: Toolbar = new Toolbar();
searchInput: SearchInput = new SearchInput();
constructor(ancestor?: string) { constructor(ancestor?: string) {
super('adf-layout-header', ancestor); super('adf-layout-header', ancestor);
} }
async openMoreMenu() { async openMoreMenu(): Promise<void> {
await this.moreActions.click(); await this.moreActions.click();
await this.menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
} }
async isSignOutDisplayed() { async isSignOutDisplayed(): Promise<boolean> {
return this.userInfo.menu.isMenuItemPresent('Sign out'); return this.userInfo.menu.isMenuItemPresent('Sign out');
} }
async clickSidenavToggle() { async isSidenavExpanded(): Promise<boolean> {
await this.sidenavToggle.click(); return browser.isElementPresent(by.css(`[data-automation-id='expanded']`));
} }
async isSidenavExpanded() { async expandSideNav(): Promise<void> {
return browser.isElementPresent(Header.selectors.expandedSidenav);
}
async expandSideNav() {
const expanded = await this.isSidenavExpanded(); const expanded = await this.isSidenavExpanded();
if ( !expanded ) { if (!expanded) {
await this.clickSidenavToggle(); await this.sidenavToggle.click();
await browser.wait(until.elementLocated(Header.selectors.expandedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for expanded sidenav' ); await waitElement(`[data-automation-id='expanded']`);
} }
} }
async collapseSideNav() { async collapseSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded(); const expanded = await this.isSidenavExpanded();
if ( expanded ) { if (expanded) {
await this.clickSidenavToggle(); await this.sidenavToggle.click();
await browser.wait(until.elementLocated(Header.selectors.collapsedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for collapsed sidenav') await waitElement(`[data-automation-id='collapsed']`);
} }
} }
} }

View File

@ -23,39 +23,27 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
export class UserInfo extends Component { export class UserInfo extends Component {
private static selectors = { fullName = this.byCss('.current-user__full-name');
avatar: by.css('.current-user__avatar'), avatar = this.byCss('.current-user__avatar');
fullName: by.css('.current-user__full-name'),
menuItems: by.css('[mat-menu-item]')
};
fullName: ElementFinder = this.component.element(UserInfo.selectors.fullName); menu = new Menu();
avatar: ElementFinder = this.component.element(UserInfo.selectors.avatar);
menu: Menu = new Menu();
constructor(ancestor?: string) { constructor(ancestor?: string) {
super('aca-current-user', ancestor); super('aca-current-user', ancestor);
} }
async openMenu() { async openMenu(): Promise<Menu> {
const { menu, avatar } = this; await this.avatar.click();
await this.menu.wait();
await avatar.click(); return this.menu;
await menu.wait();
return menu;
} }
getName() { async signOut(): Promise<void> {
return this.fullName.getText();
}
async signOut() {
const menu = await this.openMenu(); const menu = await this.openMenu();
await menu.clickMenuItem('Sign out'); await menu.clickMenuItem('Sign out');
} }

View File

@ -23,58 +23,39 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } from 'protractor'; import { by, browser, until } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { waitForVisibility, typeText } from '../../utilities/utils';
export class CommentsTab extends Component { export class CommentsTab extends Component {
private static selectors = { commentsContainer = this.byCss('.adf-comments-container');
root: 'adf-comments', commentsHeader = this.byCss('.adf-comments-header');
commentTextarea = this.byCss('.adf-comments-input-container textarea');
commentsContainer: '.adf-comments-container', addCommentButton = this.byCss('button.adf-comments-input-add');
commentsHeader: '.adf-comments-header', commentListItem = by.css('.adf-comment-list-item');
commentsTextArea: '.adf-comments-input-container textarea', commentUserAvatar = by.id('comment-user-icon');
addCommentButton: 'button.adf-comments-input-add', commentUser = by.id('comment-user')
commentsList: '.adf-comment-list', commentText = by.id('comment-message');
commentsListItem: '.adf-comment-list-item', commentTime = by.id('comment-time');
commentById: `adf-comment-`,
commentUserName: 'comment-user',
commentUserAvatar: 'comment-user-icon',
commentMessage: 'comment-message',
commentTime: 'comment-time'
};
commentsContainer: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsContainer));
commentsHeader: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsHeader));
commentTextarea: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsTextArea));
addCommentButton: ElementFinder = this.component.element(by.css(CommentsTab.selectors.addCommentButton));
commentsList: ElementArrayFinder = this.component.all(by.css(CommentsTab.selectors.commentsListItem));
commentListItem = by.css(CommentsTab.selectors.commentsListItem);
commentUserAvatar = by.id(CommentsTab.selectors.commentUserAvatar);
commentUser = by.id(CommentsTab.selectors.commentUserName)
commentText = by.id(CommentsTab.selectors.commentMessage);
commentTime = by.id(CommentsTab.selectors.commentTime);
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(CommentsTab.selectors.root, ancestor); super('adf-comments', ancestor);
} }
async waitForCommentsContainer() { async waitForCommentsContainer() {
await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT); await waitForVisibility(this.commentsContainer);
} }
async getCommentsTabHeaderText() { async getCommentsTabHeaderText(): Promise<string> {
return this.commentsHeader.getText(); return this.commentsHeader.getText();
} }
async isCommentTextAreaDisplayed() { async isCommentTextAreaDisplayed(): Promise<boolean> {
return browser.isElementPresent(this.commentTextarea); return browser.isElementPresent(this.commentTextarea);
} }
async isAddCommentButtonEnabled() { async isAddCommentButtonEnabled(): Promise<boolean> {
const present = await browser.isElementPresent(this.addCommentButton); const present = await browser.isElementPresent(this.addCommentButton);
if (present) { if (present) {
return this.addCommentButton.isEnabled(); return this.addCommentButton.isEnabled();
@ -82,13 +63,13 @@ export class CommentsTab extends Component {
return false; return false;
} }
async getCommentListItem() { 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) { async getCommentById(commentId?: string) {
if (commentId) { if (commentId) {
return browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2); return browser.wait(until.elementLocated(by.id(`adf-comment-${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
} }
return this.getCommentListItem(); return this.getCommentListItem();
} }
@ -108,31 +89,32 @@ export class CommentsTab extends Component {
return message.getText(); return message.getText();
} }
async getCommentUserName(commentId?: string) { async getCommentUserName(commentId?: string): Promise<string> {
const commentElement = await this.getCommentById(commentId); const commentElement = await this.getCommentById(commentId);
const user = await commentElement.findElement(this.commentUser); const user = await commentElement.findElement(this.commentUser);
return user.getText(); return user.getText();
} }
async getCommentTime(commentId?: string) { async getCommentTime(commentId?: string): Promise<string> {
const commentElement = await this.getCommentById(commentId); const commentElement = await this.getCommentById(commentId);
const time = await commentElement.findElement(this.commentTime); const time = await commentElement.findElement(this.commentTime);
return time.getText(); return time.getText();
} }
async getNthCommentId(index: number) { async getNthCommentId(index: number): Promise<string> {
return this.commentsList.get(index - 1).getAttribute('id'); const list = this.allByCss('.adf-comment-list-item');
return list.get(index - 1).getAttribute('id');
} }
async typeComment(text: string) { async typeComment(text: string): Promise<void> {
await this.commentTextarea.sendKeys(text); await typeText(this.commentTextarea, text);
} }
async clickAddButton() { async clickAddButton(): Promise<void> {
await this.addCommentButton.click(); await this.addCommentButton.click();
} }
async getCommentTextFromTextArea() { async getCommentTextFromTextArea(): Promise<string> {
return this.commentTextarea.getAttribute('value'); return this.commentTextarea.getAttribute('value');
} }

View File

@ -23,57 +23,41 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser, ElementFinder } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { isPresentAndEnabled, isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils';
import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils';
export class ContentMetadata extends Component { export class ContentMetadata extends Component {
private static selectors = { expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded');
root: 'adf-content-metadata-card', propertyList = this.byCss('.adf-property-list');
propertyListElements = this.allByCss('.adf-property');
expandedPanel: '.mat-expansion-panel.mat-expanded', propertyValue = this.byCss('.adf-property-value');
propertyList: '.adf-property-list', editPropertiesButton = this.byCss(`button[title='Edit']`);
property: '.adf-property', lessInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'Less information');
propertyLabel: '.adf-property-label', moreInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'More information');
propertyValue: '.adf-property-value', imagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`);
editProperties: `button[title='Edit']`, expandedImagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`);
editProperty: `.mat-icon[title='Edit']`,
editDateItem: `.adf-dateitem-editable`,
moreLessInformation: `[data-automation-id='meta-data-card-toggle-expand']`
};
expandedPanel: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.expandedPanel));
propertyList: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyList));
propertyListElements: ElementArrayFinder = this.component.all(by.css(ContentMetadata.selectors.property));
propertyValue: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyValue));
editPropertiesButton: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.editProperties));
lessInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'Less information'));
moreInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'More information'));
imagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`));
expandedImagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(ContentMetadata.selectors.root, ancestor); super('adf-content-metadata-card', ancestor);
} }
async isPropertiesListExpanded() { async isPropertiesListExpanded(): Promise<boolean> {
return browser.isElementPresent(this.expandedPanel); return browser.isElementPresent(this.expandedPanel);
} }
async waitForImagePropertiesPanelToExpand() { async waitForImagePropertiesPanelToExpand(): Promise<void> {
await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT); await waitForVisibility(this.expandedImagePropertiesPanel);
} }
async getVisiblePropertiesLabels() { async getVisiblePropertiesLabels(): Promise<string[]> {
return this.component.all(by.css(ContentMetadata.selectors.propertyLabel)) return this.allByCss('.adf-property-label')
.filter(async (elem) => elem.isDisplayed()) .filter(async (elem) => elem.isDisplayed())
.map(async (elem) => elem.getText()); .map(async (elem) => elem.getText());
} }
async getVisiblePropertiesValues() { async getVisiblePropertiesValues() {
return this.component.all(by.css(ContentMetadata.selectors.propertyValue)) return this.allByCss('.adf-property-value')
.filter(async (elem) => elem.isDisplayed()) .filter(async (elem) => elem.isDisplayed())
.map(async (elem) => { .map(async (elem) => {
if (await elem.isElementPresent(by.css('.mat-checkbox'))) { if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
@ -82,7 +66,8 @@ export class ContentMetadata extends Component {
} }
return false return false
} }
return elem.getText();
return this.getElementValue(elem);
}); });
} }
@ -98,29 +83,22 @@ export class ContentMetadata extends Component {
return isPresentAndEnabled(this.moreInfoButton); return isPresentAndEnabled(this.moreInfoButton);
} }
async isLessInfoButtonDisplayed() {
return browser.isElementPresent(this.lessInfoButton);
}
async isMoreInfoButtonDisplayed(): Promise<boolean> { async isMoreInfoButtonDisplayed(): Promise<boolean> {
return browser.isElementPresent(this.moreInfoButton); return browser.isElementPresent(this.moreInfoButton);
} }
async clickLessInformationButton() {
await this.lessInfoButton.click();
}
async clickMoreInformationButton() {
await this.moreInfoButton.click();
}
async isImagePropertiesPanelDisplayed(): Promise<boolean> { async isImagePropertiesPanelDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.imagePropertiesPanel); return isPresentAndDisplayed(this.imagePropertiesPanel);
} }
async clickImagePropertiesPanel() { private async getElementValue(elem: ElementFinder): Promise<string> {
await this.imagePropertiesPanel.click(); const tagName = await elem.getTagName();
}
if (tagName === 'input' || tagName === 'textarea') {
return elem.getAttribute('value');
}
return elem.getText();
}
} }

View File

@ -23,96 +23,85 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils';
export class LibraryMetadata extends Component { export class LibraryMetadata extends Component {
private static selectors = { metadataTabContent = this.byCss('.mat-card-content');
root: 'app-library-metadata-form', metadataTabAction = this.byCss('.mat-card-actions .mat-button');
fieldLabelWrapper = this.byCss('.mat-form-field-label-wrapper');
metadataTabContent: '.mat-card-content', fieldInput = this.byCss('.mat-input-element');
metadataTabAction: '.mat-card-actions .mat-button', visibilityDropDown = this.component.element(by.css('.mat-select'));
field: '.mat-form-field', visibilityPublic = this.byCssText(
fieldLabelWrapper: '.mat-form-field-label-wrapper', '.mat-option .mat-option-text',
fieldInput: '.mat-input-element', 'Public',
dropDown: '.mat-select', browser
);
visibilityOption: '.mat-option .mat-option-text', visibilityPrivate = this.byCssText(
'.mat-option .mat-option-text',
hint: '.mat-hint', 'Private',
error: '.mat-error' browser
}; );
visibilityModerated = this.byCssText(
metadataTabContent: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabContent)); '.mat-option .mat-option-text',
metadataTabAction: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabAction)); 'Moderated',
fieldLabelWrapper: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldLabelWrapper)); browser
fieldInput: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldInput)); );
hint = this.byCss('.mat-hint');
visibilityDropDown: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.dropDown)); error = this.byCss('.mat-error');
visibilityPublic: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Public'));
visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Private'));
visibilityModerated: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Moderated'));
hint: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.hint));
error: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.error));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(LibraryMetadata.selectors.root, ancestor); super('app-library-metadata-form', ancestor);
} }
getLabelWrapper(label: string) { private getLabelWrapper(label: string) {
return this.component.element(by.cssContainingText(LibraryMetadata.selectors.fieldLabelWrapper, label)); return this.byCssText('.mat-form-field-label-wrapper', label);
} }
getFieldByName(fieldName: string) { private getFieldByName(fieldName: string) {
const wrapper = this.getLabelWrapper(fieldName); const wrapper = this.getLabelWrapper(fieldName);
return wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.fieldInput)); return wrapper
.element(by.xpath('..'))
.element(by.css('.mat-input-element'));
} }
async isFieldDisplayed(fieldName: string) { private async isFieldDisplayed(fieldName: string) {
return browser.isElementPresent(this.getFieldByName(fieldName)); return browser.isElementPresent(this.getFieldByName(fieldName));
} }
async isInputEnabled(fieldName: string) { private async isInputEnabled(fieldName: string) {
return this.getFieldByName(fieldName).isEnabled(); return this.getFieldByName(fieldName).isEnabled();
} }
async getValueOfField(fieldName: string) { private async getValueOfField(fieldName: string) {
return this.getFieldByName(fieldName).getText(); return this.getFieldByName(fieldName).getText();
} }
async enterTextInInput(fieldName: string, text: string) { private async enterTextInInput(fieldName: string, text: string) {
const input = this.getFieldByName(fieldName); const input = this.getFieldByName(fieldName);
await input.clear(); await typeText(input, text);
await input.sendKeys(text);
} }
private getButton(button: string) {
getButton(button: string) { return this.byCssText('.mat-card-actions .mat-button', button);
return this.component.element(by.cssContainingText(LibraryMetadata.selectors.metadataTabAction, button));
} }
async isButtonDisplayed(button: string) { private async isButtonDisplayed(button: string) {
return browser.isElementPresent(this.getButton(button)); return browser.isElementPresent(this.getButton(button));
} }
async isButtonEnabled(button: string) { private async isButtonEnabled(button: string) {
return this.getButton(button).isEnabled(); return this.getButton(button).isEnabled();
} }
async clickButton(button: string) { private async clickButton(button: string) {
await this.getButton(button).click(); await this.getButton(button).click();
} }
async waitForVisibilityDropDownToOpen() {
await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT);
}
async waitForVisibilityDropDownToClose() { async waitForVisibilityDropDownToClose() {
await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT); await waitForStaleness(browser.$('.mat-option .mat-option-text'));
} }
async isMessageDisplayed() { async isMessageDisplayed() {
@ -131,7 +120,6 @@ export class LibraryMetadata extends Component {
return this.error.getText(); return this.error.getText();
} }
async isNameDisplayed() { async isNameDisplayed() {
return this.isFieldDisplayed('Name'); return this.isFieldDisplayed('Name');
} }
@ -140,15 +128,14 @@ export class LibraryMetadata extends Component {
return this.isInputEnabled('Name'); return this.isInputEnabled('Name');
} }
async getName() { async getName(): Promise<string> {
return this.getValueOfField('Name'); return this.getValueOfField('Name');
} }
async enterName(name: string) { async enterName(name: string): Promise<void> {
await this.enterTextInInput('Name', name); await this.enterTextInInput('Name', name);
} }
async isDescriptionDisplayed() { async isDescriptionDisplayed() {
return this.isFieldDisplayed('Description'); return this.isFieldDisplayed('Description');
} }
@ -157,7 +144,7 @@ export class LibraryMetadata extends Component {
return this.isInputEnabled('Description'); return this.isInputEnabled('Description');
} }
async getDescription() { async getDescription(): Promise<string> {
return this.getValueOfField('Description'); return this.getValueOfField('Description');
} }
@ -165,10 +152,11 @@ export class LibraryMetadata extends Component {
await this.enterTextInInput('Description', desc); await this.enterTextInInput('Description', desc);
} }
async isVisibilityEnabled() { async isVisibilityEnabled() {
const wrapper = this.getLabelWrapper('Visibility'); const wrapper = this.getLabelWrapper('Visibility');
const field = wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.dropDown)); const field = wrapper
.element(by.xpath('..'))
.element(by.css('.mat-select'));
return field.isEnabled(); return field.isEnabled();
} }
@ -176,7 +164,7 @@ export class LibraryMetadata extends Component {
return this.isFieldDisplayed('Visibility'); return this.isFieldDisplayed('Visibility');
} }
async getVisibility() { async getVisibility(): Promise<string> {
return this.getValueOfField('Visibility'); return this.getValueOfField('Visibility');
} }
@ -184,7 +172,7 @@ export class LibraryMetadata extends Component {
const val = visibility.toLowerCase(); const val = visibility.toLowerCase();
await this.visibilityDropDown.click(); await this.visibilityDropDown.click();
await this.waitForVisibilityDropDownToOpen(); await waitForPresence(this.visibilityDropDown);
if (val === 'public') { if (val === 'public') {
await this.visibilityPublic.click(); await this.visibilityPublic.click();
@ -199,7 +187,6 @@ export class LibraryMetadata extends Component {
await this.waitForVisibilityDropDownToClose(); await this.waitForVisibilityDropDownToClose();
} }
async isLibraryIdDisplayed() { async isLibraryIdDisplayed() {
return this.isFieldDisplayed('Library ID'); return this.isFieldDisplayed('Library ID');
} }
@ -212,7 +199,6 @@ export class LibraryMetadata extends Component {
return this.getValueOfField('Library ID'); return this.getValueOfField('Library ID');
} }
async isEditLibraryPropertiesEnabled() { async isEditLibraryPropertiesEnabled() {
return this.isButtonEnabled('Edit'); return this.isButtonEnabled('Edit');
} }
@ -225,7 +211,6 @@ export class LibraryMetadata extends Component {
await this.clickButton('Edit'); await this.clickButton('Edit');
} }
async isUpdateEnabled() { async isUpdateEnabled() {
return this.isButtonEnabled('Update'); return this.isButtonEnabled('Update');
} }
@ -238,7 +223,6 @@ export class LibraryMetadata extends Component {
await this.clickButton('Update'); await this.clickButton('Update');
} }
async isCancelEnabled() { async isCancelEnabled() {
return this.isButtonEnabled('Cancel'); return this.isButtonEnabled('Cancel');
} }
@ -250,6 +234,4 @@ export class LibraryMetadata extends Component {
async clickCancel() { async clickCancel() {
await this.clickButton('Cancel'); await this.clickButton('Cancel');
} }
} }

View File

@ -23,54 +23,33 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { by, browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { CommentsTab } from './info-drawer-comments-tab'; import { CommentsTab } from './info-drawer-comments-tab';
import { LibraryMetadata } from './info-drawer-metadata-library'; import { LibraryMetadata } from './info-drawer-metadata-library';
import { ContentMetadata } from './info-drawer-metadata-content'; import { ContentMetadata } from './info-drawer-metadata-content';
import { waitForVisibility, waitForInvisibility, waitForPresence } from '../../utilities/utils';
export class InfoDrawer extends Component { export class InfoDrawer extends Component {
private static selectors = { commentsTab = new CommentsTab('adf-info-drawer');
root: 'adf-info-drawer', aboutTab = new LibraryMetadata('adf-info-drawer');
propertiesTab = new ContentMetadata('adf-info-drawer');
header: '.adf-info-drawer-layout-header', header = this.byCss('.adf-info-drawer-layout-header');
content: '.adf-info-drawer-layout-content', headerTitle = this.byCss('.adf-info-drawer-layout-header-title');
tabLabel = this.byCss('.mat-tab-label-content');
tabs: '.adf-info-drawer-tabs', tabLabelsList = this.allByCss('.mat-tab-label-content');
tabLabel: '.mat-tab-label-content', tabActiveLabel = this.byCss('.mat-tab-label-active');
tabActiveLabel: '.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');
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab', previousButton = this.byCss('.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron');
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron',
headerTitle: '.adf-info-drawer-layout-header-title'
};
commentsTab = new CommentsTab(InfoDrawer.selectors.root);
aboutTab = new LibraryMetadata(InfoDrawer.selectors.root);
propertiesTab = new ContentMetadata(InfoDrawer.selectors.root);
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle));
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));
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(InfoDrawer.selectors.root, ancestor); super('adf-info-drawer', ancestor);
} }
async waitForInfoDrawerToOpen() { async waitForInfoDrawerToOpen() {
await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.header);
} }
async isOpen() { async isOpen() {
@ -78,15 +57,15 @@ export class InfoDrawer extends Component {
} }
async isEmpty() { async isEmpty() {
return !(await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))); return !(await browser.isElementPresent(by.css('.adf-info-drawer-tabs')));
} }
getTabByTitle(title: string) { getTabByTitle(title: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title)); return this.byCssText('.mat-tab-label-content', title);
} }
async getTabsCount() { async getTabsCount(): Promise<number> {
return this.component.all(by.css(InfoDrawer.selectors.tabLabel)).count(); return this.allByCss('.mat-tab-label-content').count();
} }
async isTabPresent(title: string) { async isTabPresent(title: string) {
@ -101,11 +80,11 @@ export class InfoDrawer extends Component {
return false; return false;
} }
async getTabTitle(index: number) { async getTabTitle(index: number): Promise<string> {
return this.tabLabelsList.get(index - 1).getAttribute('innerText'); return this.tabLabelsList.get(index - 1).getAttribute('innerText');
} }
async getActiveTabTitle() { async getActiveTabTitle(): Promise<string> {
return this.tabActiveLabel.getText(); return this.tabActiveLabel.getText();
} }
@ -113,11 +92,11 @@ export class InfoDrawer extends Component {
await this.getTabByTitle(title).click(); await this.getTabByTitle(title).click();
} }
async getComponentIdOfTab() { async getComponentIdOfTab(): Promise<string> {
return this.tabActiveContent.getAttribute('data-automation-id'); return this.tabActiveContent.getAttribute('data-automation-id');
} }
async getHeaderTitle() { async getHeaderTitle(): Promise<string> {
return this.headerTitle.getText(); return this.headerTitle.getText();
} }
@ -142,8 +121,8 @@ export class InfoDrawer extends Component {
await this.getTabByTitle('Comments').click(); await this.getTabByTitle('Comments').click();
await this.commentsTab.waitForCommentsContainer(); await this.commentsTab.waitForCommentsContainer();
await Promise.all([ await Promise.all([
browser.wait(EC.visibilityOf(this.commentsTab.component), BROWSER_WAIT_TIMEOUT), waitForVisibility(this.commentsTab.component),
browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT) waitForInvisibility(this.propertiesTab.component)
]); ]);
} catch (error) { } catch (error) {
Logger.error('--- info-drawer clickCommentsTab catch error: ', error); Logger.error('--- info-drawer clickCommentsTab catch error: ', error);

View File

@ -23,71 +23,37 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { by, ElementFinder } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { typeText } from '../../utilities/utils';
export class LoginComponent extends Component { export class LoginComponent extends Component {
private static selectors = { usernameInput = this.byCss('input#username');
root: 'adf-login', passwordInput = this.byCss('input#password');
submitButton = this.byCss('button#login-button');
usernameInput: by.css('input#username'), errorMessage = this.byCss('.adf-login-error-message');
passwordInput: by.css('input#password'), copyright = this.byCss('.adf-copyright');
passwordVisibility: by.css('.adf-login-password-icon'), passwordVisibility = this.byCss('.adf-login-password-icon');
submitButton: by.css('button#login-button'),
errorMessage: by.css('.adf-login-error-message'),
copyright: by.css('.adf-copyright')
};
usernameInput: ElementFinder = this.component.element(LoginComponent.selectors.usernameInput);
passwordInput: ElementFinder = this.component.element(LoginComponent.selectors.passwordInput);
submitButton: ElementFinder = this.component.element(LoginComponent.selectors.submitButton);
errorMessage: ElementFinder = this.component.element(LoginComponent.selectors.errorMessage);
copyright: ElementFinder = this.component.element(LoginComponent.selectors.copyright);
passwordVisibility: ElementFinder = this.component.element(LoginComponent.selectors.passwordVisibility);
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(LoginComponent.selectors.root, ancestor); super('adf-login', ancestor);
} }
async enterUsername(username: string) { async enterUsername(username: string): Promise<void> {
const { usernameInput } = this; await typeText(this.usernameInput, username);
await usernameInput.clear();
await usernameInput.sendKeys(username);
} }
async enterPassword(password: string) { async enterPassword(password: string): Promise<void> {
const { passwordInput } = this; await typeText(this.passwordInput, password);
await passwordInput.clear();
await passwordInput.sendKeys(password);
} }
async enterCredentials(username: string, password: string) { async enterCredentials(username: string, password: string): Promise<void> {
await this.enterUsername(username); await this.enterUsername(username);
await this.enterPassword(password); await this.enterPassword(password);
} }
async submit() { private async getPasswordVisibility(): Promise<boolean> {
await this.submitButton.click();
}
async clickPasswordVisibility() {
await this.passwordVisibility.click();
}
async getPasswordVisibility(): Promise<boolean> {
const text = await this.passwordVisibility.getText(); const text = await this.passwordVisibility.getText();
if (text.endsWith('visibility_off')) { return text.endsWith('visibility');
return false;
}
else {
if (text.endsWith('visibility')) {
return true;
}
}
return false;
} }
async isPasswordDisplayed(): Promise<boolean> { async isPasswordDisplayed(): Promise<boolean> {
@ -104,18 +70,6 @@ export class LoginComponent extends Component {
return false; return false;
} }
async isUsernameEnabled() {
return this.usernameInput.isEnabled();
}
async isPasswordEnabled() {
return this.passwordInput.isEnabled();
}
async isSubmitEnabled() {
return this.submitButton.isEnabled();
}
async isPasswordHidden() { async isPasswordHidden() {
return !(await this.getPasswordVisibility()); return !(await this.getPasswordVisibility());
} }

View File

@ -23,84 +23,60 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, by, browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Utils, isPresentAndEnabled } from '../../utilities/utils' import { Utils, isPresentAndEnabled, waitForPresence, waitForVisibility, waitForStaleness, waitForClickable } from '../../utilities/utils'
export class Menu extends Component { export class Menu extends Component {
private static selectors = { items = this.allByCss('.mat-menu-item');
root: '.mat-menu-panel', backdrop = this.byCss('.cdk-overlay-backdrop', browser);
item: '.mat-menu-item',
icon: '.mat-icon',
uploadFilesInput: 'app-upload-files', uploadFilesInput = this.byId('app-upload-files', browser);
submenus = browser.element.all(by.css('app-context-menu-item .mat-menu-item'));
uploadFile: 'app.create.uploadFile', uploadFileAction = this.byId('app.create.uploadFile');
uploadFolder: 'app.create.uploadFolder', uploadFolderAction = this.byId('app.create.uploadFolder');
createFolder: 'app.create.folder', createFolderAction = this.byId('app.create.folder');
createLibrary: 'app.create.library', createLibraryAction = this.byId('app.create.library');
createFileFromTemplate: 'app.create.fileFromTemplate', createFileFromTemplateAction = this.byId('app.create.fileFromTemplate');
createFolderFromTemplate: 'app.create.folderFromTemplate', createFolderFromTemplateAction = this.byId('app.create.folderFromTemplate');
submenu: 'app-context-menu-item .mat-menu-item', cancelEditingAction = this.byCss(`.mat-menu-item[title='Cancel Editing']`);
cancelJoinAction = this.byCssText('.mat-menu-item', 'Cancel Join');
editFolder: `.mat-menu-item[id$='editFolder']`, copyAction = this.byCssText('.mat-menu-item', 'Copy');
favoriteAction: `.mat-menu-item[id$='favorite.add']`, deleteAction = this.byCssText('.mat-menu-item', 'Delete');
removeFavoriteAction: `.mat-menu-item[id$='favorite.remove']`, downloadAction = this.byCssText('.mat-menu-item', 'Download');
editOffline: `.mat-menu-item[title='Edit Offline']`, editFolderAction = this.byCss(`.mat-menu-item[id$='editFolder']`);
cancelEditing: `.mat-menu-item[title='Cancel Editing']` editOfflineAction = this.byCss(`.mat-menu-item[title='Edit Offline']`);
}; favoriteAction = this.byCss(`.mat-menu-item[id$='favorite.add']`);
removeFavoriteAction = this.byCss(`.mat-menu-item[id$='favorite.remove']`);
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item)); toggleFavoriteAction = this.byCssText('.mat-menu-item', 'Favorite');
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop')); toggleRemoveFavoriteAction = this.byCssText('.mat-menu-item', 'Remove Favorite');
joinAction = this.byCssText('.mat-menu-item', 'Join');
uploadFilesInput: ElementFinder = browser.element(by.id(Menu.selectors.uploadFilesInput)); leaveAction = this.byCssText('.mat-menu-item', 'Leave');
submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu)); managePermissionsAction = this.byCssText('.mat-menu-item', 'Permissions');
manageVersionsAction = this.byCssText('.mat-menu-item', 'Manage Versions');
uploadFileAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFile)); uploadNewVersionAction = this.byCssText('.mat-menu-item', 'Upload New Version');
uploadFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFolder)); moveAction = this.byCssText('.mat-menu-item', 'Move');
createFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolder)); permanentDeleteAction = this.byCssText('.mat-menu-item', 'Permanently Delete');
createLibraryAction: ElementFinder = this.component.element(by.id(Menu.selectors.createLibrary)); restoreAction = this.byCssText('.mat-menu-item', 'Restore');
createFileFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFileFromTemplate)); shareAction = this.byCssText('.mat-menu-item', 'Share');
createFolderFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolderFromTemplate)); shareEditAction = this.byCssText('.mat-menu-item', 'Shared Link Settings');
viewAction = this.byCssText('.mat-menu-item', 'View');
cancelEditingAction: ElementFinder = this.component.element(by.css(Menu.selectors.cancelEditing)); viewDetailsAction = this.byCssText('.mat-menu-item', 'View Details');
cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel Join'));
copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy'));
deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete'));
downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download'));
editFolderAction: ElementFinder = this.component.element(by.css(Menu.selectors.editFolder));
editOfflineAction: ElementFinder = this.component.element(by.css(Menu.selectors.editOffline));
favoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.favoriteAction));
removeFavoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.removeFavoriteAction));
toggleFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Favorite'));
toggleRemoveFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Remove Favorite'));
joinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Join'));
leaveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Leave'));
managePermissionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permissions'));
manageVersionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Manage Versions'));
uploadNewVersionAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload New Version'));
moveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Move'));
permanentDeleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permanently Delete'));
restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore'));
shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share'));
shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared Link Settings'));
viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View'));
viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View Details'));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Menu.selectors.root, ancestor); super('.mat-menu-panel', ancestor);
} }
async waitForMenuToOpen(): Promise<void> { async waitForMenuToOpen(): Promise<void> {
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))), BROWSER_WAIT_TIMEOUT); await waitForPresence(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')));
await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT); await waitForVisibility(this.items.get(0));
} }
async waitForMenuToClose(): Promise<void> { async waitForMenuToClose(): Promise<void> {
await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')))), BROWSER_WAIT_TIMEOUT); await waitForStaleness(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')));
} }
async closeMenu(): Promise<void> { async closeMenu(): Promise<void> {
@ -112,44 +88,24 @@ export class Menu extends Component {
return this.items.get(nth - 1); return this.items.get(nth - 1);
} }
getItemByLabel(menuItem: string): ElementFinder { private getItemByLabel(menuItem: string): ElementFinder {
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem)); return this.byCssText('.mat-menu-item', menuItem);
} }
getSubItemByLabel(subMenuItem: string): ElementFinder { private getSubItemByLabel(subMenuItem: string): ElementFinder {
return this.component.element(by.cssContainingText(Menu.selectors.submenu, subMenuItem)); return this.byCssText('app-context-menu-item .mat-menu-item', subMenuItem);
} }
getItemById(id: string): ElementFinder { getItemById(id: string): ElementFinder {
return this.component.element(by.id(id)); return this.byId(id);
} }
async getItemTooltip(menuItem: string): Promise<string> { async getItemTooltip(menuItem: string): Promise<string> {
return this.getItemByLabel(menuItem).getAttribute('title'); return this.getItemByLabel(menuItem).getAttribute('title');
} }
async getTooltipForUploadFile(): Promise<string> {
return this.getItemTooltip('Upload File');
}
async getTooltipForUploadFolder(): Promise<string> {
return this.getItemTooltip('Upload Folder');
}
async getTooltipForCreateFolder(): Promise<string> {
return this.getItemTooltip('Create Folder');
}
async getTooltipForCreateLibrary(): Promise<string> {
return this.getItemTooltip('Create Library');
}
async getTooltipForCreateFileFromTemplate(): Promise<string> {
return this.getItemTooltip('Create file from template');
}
async getItemIconText(menuItem: string): Promise<string> { async getItemIconText(menuItem: string): Promise<string> {
return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText(); return this.getItemByLabel(menuItem).element(by.css('.mat-icon')).getText();
} }
async getItemIdAttribute(menuItem: string): Promise<string> { async getItemIdAttribute(menuItem: string): Promise<string> {
@ -162,7 +118,7 @@ export class Menu extends Component {
async getMenuItems(): Promise<string[]> { async getMenuItems(): Promise<string[]> {
const items: string[] = await this.items.map(async (elem) => { const items: string[] = await this.items.map(async (elem) => {
const span: ElementFinder = elem.element(by.css('span')); const span = elem.element(by.css('span'));
return span.getText(); return span.getText();
}); });
return items; return items;
@ -171,7 +127,7 @@ export class Menu extends Component {
async clickNthItem(nth: number): Promise<void> { async clickNthItem(nth: number): Promise<void> {
try { try {
const elem = this.getNthItem(nth); const elem = this.getNthItem(nth);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); await waitForClickable(elem);
await browser.actions().mouseMove(elem).perform(); await browser.actions().mouseMove(elem).perform();
await browser.actions().click().perform(); await browser.actions().click().perform();
await this.waitForMenuToClose(); await this.waitForMenuToClose();
@ -183,7 +139,7 @@ export class Menu extends Component {
async clickMenuItem(menuItem: string): Promise<void> { async clickMenuItem(menuItem: string): Promise<void> {
try { try {
const elem = this.getItemByLabel(menuItem); const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); await waitForClickable(elem);
await elem.click(); await elem.click();
} catch (e) { } catch (e) {
Logger.error('___click menu item catch___', e); Logger.error('___click menu item catch___', e);
@ -193,7 +149,7 @@ export class Menu extends Component {
async mouseOverMenuItem(menuItem: string): Promise<void> { async mouseOverMenuItem(menuItem: string): Promise<void> {
try { try {
const elem = this.getItemByLabel(menuItem); const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); await waitForClickable(elem);
await browser.actions().mouseMove(elem).perform(); await browser.actions().mouseMove(elem).perform();
await browser.sleep(500); await browser.sleep(500);
} catch (error) { } catch (error) {
@ -204,7 +160,7 @@ export class Menu extends Component {
async hasSubMenu(menuItem: string): Promise<boolean> { async hasSubMenu(menuItem: string): Promise<boolean> {
try { try {
const elem = this.getItemByLabel(menuItem); const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); await waitForClickable(elem);
const elemClass = await elem.getAttribute('class'); const elemClass = await elem.getAttribute('class');
return elemClass.includes('mat-menu-item-submenu-trigger'); return elemClass.includes('mat-menu-item-submenu-trigger');
} catch (error) { } catch (error) {
@ -216,7 +172,7 @@ export class Menu extends Component {
async clickSubMenuItem(subMenuItem: string): Promise<void> { async clickSubMenuItem(subMenuItem: string): Promise<void> {
try { try {
const elem = this.getSubItemByLabel(subMenuItem); const elem = this.getSubItemByLabel(subMenuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); await waitForClickable(elem);
await elem.click(); await elem.click();
} catch (e) { } catch (e) {
Logger.error('___click submenu item catch___', e); Logger.error('___click submenu item catch___', e);
@ -224,11 +180,11 @@ export class Menu extends Component {
} }
async isMenuItemPresent(title: string): Promise<boolean> { async isMenuItemPresent(title: string): Promise<boolean> {
return browser.element(by.cssContainingText(Menu.selectors.item, title)).isPresent(); return browser.element(by.cssContainingText('.mat-menu-item', title)).isPresent();
} }
async isSubMenuItemPresent(title: string): Promise<boolean> { async isSubMenuItemPresent(title: string): Promise<boolean> {
return browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent(); return browser.element(by.cssContainingText('app-context-menu-item .mat-menu-item', title)).isPresent();
} }
async getSubmenuItemsCount(): Promise<number> { async getSubmenuItemsCount(): Promise<number> {
@ -246,116 +202,6 @@ export class Menu extends Component {
} }
} }
uploadFile(): ElementFinder {
return this.uploadFilesInput;
}
async clickEditFolder(): Promise<void> {
await this.editFolderAction.click();
}
async clickShare(): Promise<void> {
const action = this.shareAction;
await action.click();
}
async clickSharedLinkSettings(): Promise<void> {
const action = this.shareEditAction;
await action.click();
}
async isViewPresent(): Promise<boolean> {
return this.viewAction.isPresent();
}
async isDownloadPresent(): Promise<boolean> {
return this.downloadAction.isPresent();
}
async isEditFolderPresent(): Promise<boolean> {
return this.editFolderAction.isPresent();
}
async isEditOfflinePresent(): Promise<boolean> {
return this.editOfflineAction.isPresent();
}
async isCancelEditingPresent(): Promise<boolean> {
return this.cancelEditingAction.isPresent();
}
async isCopyPresent(): Promise<boolean> {
return this.copyAction.isPresent();
}
async isMovePresent(): Promise<boolean> {
return this.moveAction.isPresent();
}
async isDeletePresent(): Promise<boolean> {
return this.deleteAction.isPresent();
}
async isManagePermissionsPresent(): Promise<boolean> {
return this.managePermissionsAction.isPresent();
}
async isManageVersionsPresent(): Promise<boolean> {
return this.manageVersionsAction.isPresent();
}
async isUploadNewVersionPresent(): Promise<boolean> {
return this.uploadNewVersionAction.isPresent();
}
async isFavoritePresent(): Promise<boolean> {
return this.favoriteAction.isPresent();
}
async isRemoveFavoritePresent(): Promise<boolean> {
return this.removeFavoriteAction.isPresent();
}
async isToggleFavoritePresent(): Promise<boolean> {
return this.toggleFavoriteAction.isPresent();
}
async isToggleRemoveFavoritePresent(): Promise<boolean> {
return this.toggleRemoveFavoriteAction.isPresent();
}
async isJoinLibraryPresent(): Promise<boolean> {
return this.joinAction.isPresent();
}
async isCancelJoinPresent(): Promise<boolean> {
return this.cancelJoinAction.isPresent();
}
async isLeaveLibraryPresent(): Promise<boolean> {
return this.leaveAction.isPresent();
}
async isPermanentDeletePresent(): Promise<boolean> {
return this.permanentDeleteAction.isPresent();
}
async isRestorePresent(): Promise<boolean> {
return this.restoreAction.isPresent();
}
async isSharePresent(): Promise<boolean> {
return this.shareAction.isPresent();
}
async isSharedLinkSettingsPresent(): Promise<boolean> {
return this.shareEditAction.isPresent();
}
async isViewDetailsPresent(): Promise<boolean> {
return this.viewDetailsAction.isPresent();
}
async isCreateFolderEnabled(): Promise<boolean> { async isCreateFolderEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.createFolderAction); return isPresentAndEnabled(this.createFolderAction);
} }
@ -379,24 +225,4 @@ export class Menu extends Component {
async isCreateFolderFromTemplateEnabled(): Promise<boolean> { async isCreateFolderFromTemplateEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.createFolderFromTemplateAction); return isPresentAndEnabled(this.createFolderFromTemplateAction);
} }
async clickCreateFolder(): Promise<void> {
const action = this.createFolderAction;
await action.click();
}
async clickCreateLibrary(): Promise<void> {
const action = this.createLibraryAction;
await action.click();
}
async clickCreateFileFromTemplate(): Promise<void> {
const action = this.createFileFromTemplateAction;
await action.click();
}
async clickCreateFolderFromTemplate(): Promise<void> {
const action = this.createFolderFromTemplateAction;
await action.click();
}
} }

View File

@ -23,43 +23,31 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { waitForPresence } from '../../utilities/utils';
export class MetadataCard extends Component { export class MetadataCard extends Component {
private static selectors = { footer = this.byCss('.adf-content-metadata-card-footer');
root: 'adf-content-metadata-card', expandButton = this.byCss('[data-automation-id="meta-data-card-toggle-expand"]');
footer: '.adf-content-metadata-card-footer', expansionPanels = this.allByCss('.adf-metadata-grouped-properties-container mat-expansion-panel');
expandButton: '[data-automation-id="meta-data-card-toggle-expand"]',
expansionPanel: '.adf-metadata-grouped-properties-container mat-expansion-panel'
};
footer: ElementFinder = this.component.element(by.css(MetadataCard.selectors.footer));
expandButton: ElementFinder = this.component.element(by.css(MetadataCard.selectors.expandButton));
expansionPanels: ElementArrayFinder = this.component.all(by.css(MetadataCard.selectors.expansionPanel));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(MetadataCard.selectors.root, ancestor); super('adf-content-metadata-card', ancestor);
} }
async isExpandPresent() { async isExpandPresent() {
return this.expandButton.isPresent(); return this.expandButton.isPresent();
} }
async clickExpandButton() {
await this.expandButton.click();
}
async waitForFirstExpansionPanel() { async waitForFirstExpansionPanel() {
await browser.wait(EC.presenceOf(this.expansionPanels.get(0)), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.expansionPanels.get(0));
} }
async isExpansionPanelPresent(index) { async isExpansionPanelPresent(index: number) {
return this.expansionPanels.get(index).isPresent(); return this.expansionPanels.get(index).isPresent();
} }
async getComponentIdOfPanel(index) { async getComponentIdOfPanel(index: number) {
return this.expansionPanels.get(index).getAttribute('data-automation-id'); return this.expansionPanels.get(index).getAttribute('data-automation-id');
} }
} }

View File

@ -23,60 +23,43 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { waitForClickable } from '../../utilities/utils';
export class Pagination extends Component { export class Pagination extends Component {
private static selectors = { range = this.byCss('.adf-pagination__range');
root: 'adf-pagination', maxItems = this.byCss('.adf-pagination__max-items');
range: '.adf-pagination__range', currentPage = this.byCss('.adf-pagination__current-page');
maxItems: '.adf-pagination__max-items', totalPages = this.byCss('.adf-pagination__total-pages');
currentPage: '.adf-pagination__current-page', previousButton = this.byCss('.adf-pagination__previous-button');
totalPages: '.adf-pagination__total-pages', nextButton = this.byCss('.adf-pagination__next-button');
maxItemsButton = this.byCss('.adf-pagination__max-items + button[mat-icon-button]');
previousButton: '.adf-pagination__previous-button', pagesButton = this.byCss('.adf-pagination__current-page + button[mat-icon-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));
menu: Menu = new Menu(); menu: Menu = new Menu();
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Pagination.selectors.root, ancestor); super('adf-pagination', ancestor);
} }
async openMaxItemsMenu() { async openMaxItemsMenu() {
const { menu, maxItemsButton } = this;
try { try {
await browser.wait(EC.elementToBeClickable(maxItemsButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for maxItemsButton to be clickable'); await waitForClickable(this.maxItemsButton, 'timeout waiting for maxItemsButton to be clickable');
await maxItemsButton.click(); await this.maxItemsButton.click();
await menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
} catch (error) { } catch (error) {
Logger.error('____ open max items catch ___', error); Logger.error('____ open max items catch ___', error);
} }
} }
async openCurrentPageMenu() { async openCurrentPageMenu() {
const { menu, pagesButton } = this;
try { try {
await browser.wait(EC.elementToBeClickable(pagesButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for pagesButton to be clickable'); await waitForClickable(this.pagesButton, 'timeout waiting for pagesButton to be clickable');
await pagesButton.click(); await this.pagesButton.click();
await menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
} catch (error) { } catch (error) {
Logger.error('____ open current page menu ___', error); Logger.error('____ open current page menu ___', error);
} }

View File

@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser } from 'protractor'; import { by, browser } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { SizeFilter } from './filters/size-filter'; import { SizeFilter } from './filters/size-filter';
import { CreatedDateFilter } from './filters/created-date-filter'; import { CreatedDateFilter } from './filters/created-date-filter';
@ -31,12 +31,8 @@ import { FacetFilter } from './filters/facet-filter';
import { isPresentAndDisplayed } from '../../utilities/utils'; import { isPresentAndDisplayed } from '../../utilities/utils';
export class SearchFilters extends Component { export class SearchFilters extends Component {
private static selectors = { mainPanel = browser.element(by.css('adf-search-filter'));
root: 'adf-search-filter', resetAllButton = this.byCssText('.mat-button', 'Reset all');
};
mainPanel: ElementFinder = browser.element(by.css(SearchFilters.selectors.root));
resetAllButton: ElementFinder = this.component.element(by.cssContainingText('.mat-button', 'Reset all'));
size = new SizeFilter(); size = new SizeFilter();
createdDate = new CreatedDateFilter(); createdDate = new CreatedDateFilter();
@ -47,15 +43,10 @@ export class SearchFilters extends Component {
modifiedDate = new FacetFilter('Modified date'); modifiedDate = new FacetFilter('Modified date');
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(SearchFilters.selectors.root, ancestor); super('adf-search-filter', ancestor);
} }
async isSearchFiltersPanelDisplayed(): Promise<boolean> { async isSearchFiltersPanelDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.mainPanel); return isPresentAndDisplayed(this.mainPanel);
} }
async clickResetAllButton(): Promise<void> {
await this.resetAllButton.click();
}
} }

View File

@ -23,43 +23,31 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, browser, by, until, protractor, ExpectedConditions as EC } from 'protractor'; import { browser, by, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils'; import { Utils, waitForPresence, waitForClickable, waitElement } from '../../utilities/utils';
export class SearchInput extends Component { export class SearchInput extends Component {
private static selectors = { searchButton = this.component.element(by.css('.app-search-button'));
root: 'aca-search-input', searchContainer = browser.element(by.css('.app-search-container'));
searchContainer: '.app-search-container', searchControl = browser.element(by.css('.app-search-control'));
searchButton: '.app-search-button', searchInput = browser.element(by.css(`input[id='app-control-input']`));
searchControl: '.app-search-control', searchOptionsArea = browser.element(by.id('search-options'));
searchInput: `input[id='app-control-input']`, searchFilesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Files'));
searchOptionsArea: 'search-options', searchFoldersOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Folders'));
optionCheckbox: '.mat-checkbox', searchLibrariesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Libraries'));
clearButton: '.app-clear-icon' clearSearchButton = this.searchContainer.$('.app-clear-icon');
};
searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton));
searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer));
searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl));
searchInput: ElementFinder = browser.element(by.css(SearchInput.selectors.searchInput));
searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea));
searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files'));
searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders'));
searchLibrariesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Libraries'));
clearSearchButton: ElementFinder = this.searchContainer.$(SearchInput.selectors.clearButton);
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(SearchInput.selectors.root, ancestor); super('aca-search-input', ancestor);
} }
async waitForSearchControl() { async waitForSearchControl() {
await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); await waitForPresence(this.searchControl);
} }
async waitForSearchInputToBeInteractive() { async waitForSearchInputToBeInteractive() {
await browser.wait(EC.elementToBeClickable(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); waitForClickable(this.searchControl);
} }
async isSearchContainerDisplayed() { async isSearchContainerDisplayed() {
@ -70,28 +58,28 @@ export class SearchInput extends Component {
} }
async clickSearchButton() { async clickSearchButton() {
await Utils.waitUntilElementClickable(this.searchButton); await waitForClickable(this.searchButton);
await this.searchButton.click(); await this.searchButton.click();
await this.waitForSearchControl(); await this.waitForSearchControl();
} }
async isOptionsAreaDisplayed() { async isOptionsAreaDisplayed() {
await browser.wait(until.elementLocated(by.css(SearchInput.selectors.searchControl)), BROWSER_WAIT_TIMEOUT); await waitElement('.app-search-control');
return browser.isElementPresent(this.searchOptionsArea); return browser.isElementPresent(this.searchOptionsArea);
} }
async clickFilesOption() { async clickFilesOption() {
await browser.wait(EC.elementToBeClickable(this.searchFilesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Files to be clickable'); await waitForClickable(this.searchFilesOption);
await this.searchFilesOption.click(); await this.searchFilesOption.click();
} }
async clickFoldersOption() { async clickFoldersOption() {
await browser.wait(EC.elementToBeClickable(this.searchFoldersOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Folders to be clickable'); await waitForClickable(this.searchFoldersOption);
await this.searchFoldersOption.click(); await this.searchFoldersOption.click();
} }
async clickLibrariesOption() { async clickLibrariesOption() {
await browser.wait(EC.elementToBeClickable(this.searchLibrariesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Libraries to be clickable'); await waitForClickable(this.searchLibrariesOption);
await this.searchLibrariesOption.click(); await this.searchLibrariesOption.click();
} }

View File

@ -23,45 +23,53 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; import { by, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { isPresentAndDisplayed } from '../../utilities/utils'; 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 { export class SearchSortingPicker extends Component {
private static selectors = { sortOrderButton = this.byCss('button[mat-icon-button]');
root: 'adf-search-sorting-picker', sortByDropdownCollapsed = this.byCss('.mat-select');
sortByDropdownExpanded = browser.element(by.css('.mat-select-panel'));
sortByOption: '.mat-option .mat-option-text' sortByList = this.sortByDropdownExpanded.all(by.css('.mat-option .mat-option-text'));
};
sortOrderButton: ElementFinder = this.component.element(by.css('button[mat-icon-button]'));
sortByDropdownCollapsed: ElementFinder = this.component.element(by.css('.mat-select'));
sortByDropdownExpanded: ElementFinder = browser.element(by.css('.mat-select-panel'));
sortByList: ElementArrayFinder = this.sortByDropdownExpanded.all(by.css(SearchSortingPicker.selectors.sortByOption));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(SearchSortingPicker.selectors.root, ancestor); super('adf-search-sorting-picker', ancestor);
} }
async waitForSortByDropdownToExpand(): Promise<void> { async waitForSortByDropdownToExpand(): Promise<void> {
await browser.wait(EC.visibilityOf(this.sortByDropdownExpanded), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for sortBy dropdown to expand'); await waitForVisibility(this.sortByDropdownExpanded, 'Timeout waiting for sortBy dropdown to expand');
} }
async isSortOrderButtonDisplayed(): Promise<boolean> { async isSortOrderButtonDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.sortOrderButton); return isPresentAndDisplayed(this.sortOrderButton);
} }
async getSortOrder(): Promise<'ASC' | 'DESC' | ''> { async getSortOrder(): Promise<SortOrderType> {
const orderArrow = await this.sortOrderButton.getText(); const orderArrow = await this.sortOrderButton.getText();
if ( orderArrow.includes('upward') ) { if ( orderArrow.includes('upward') ) {
return 'ASC' return 'ASC'
} else if ( orderArrow.includes('downward') ) { } else if ( orderArrow.includes('downward') ) {
return 'DESC' return 'DESC'
} else { } else {
return ''; return '';
} }
} }
async isSortByOptionDisplayed(): Promise<boolean> { async isSortByOptionDisplayed(): Promise<boolean> {
@ -88,46 +96,14 @@ export class SearchSortingPicker extends Component {
return list; return list;
} }
async sortByOption(option: string): Promise<void> { async sortBy(option: SortByType): Promise<void> {
if ( !(await this.isSortByDropdownExpanded()) ) { if ( !(await this.isSortByDropdownExpanded()) ) {
await this.clickSortByDropdown(); await this.clickSortByDropdown();
} }
const elem = browser.element(by.cssContainingText(SearchSortingPicker.selectors.sortByOption, option)); const elem = browser.element(by.cssContainingText('.mat-option .mat-option-text', option));
await elem.click(); await elem.click();
} }
async sortByName(): Promise<void> {
await this.sortByOption('Filename');
}
async sortByRelevance(): Promise<void> {
await this.sortByOption('Relevance');
}
async sortByTitle(): Promise<void> {
await this.sortByOption('Title');
}
async sortByModifiedDate(): Promise<void> {
await this.sortByOption('Modified date');
}
async sortByModifier(): Promise<void> {
await this.sortByOption('Modifier');
}
async sortByCreatedDate(): Promise<void> {
await this.sortByOption('Created date');
}
async sortBySize(): Promise<void> {
await this.sortByOption('Size');
}
async sortByType(): Promise<void> {
await this.sortByOption('Type');
}
async setSortOrderASC(): Promise<void> { async setSortOrderASC(): Promise<void> {
if ( (await this.getSortOrder()) !== 'ASC' ) { if ( (await this.getSortOrder()) !== 'ASC' ) {
await this.sortOrderButton.click(); await this.sortOrderButton.click();

View File

@ -23,55 +23,30 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, element, browser } from 'protractor'; import { ElementFinder, by, element, browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs'; import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils'; import { waitForClickable } from '../../utilities/utils';
export class Sidenav extends Component { export class Sidenav extends Component {
private static selectors = { links = this.component.all(by.css('.item'));
root: 'app-sidenav', activeLink = this.byCss('.action-button--active');
link: '.item', newButton = this.allByCss('[data-automation-id="create-button"]');
label: '.action-button__label', personalFiles = this.byCss(`[data-automation-id='app.navbar.personalFiles']`);
expansion_panel: ".mat-expansion-panel-header", fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`);
expansion_panel_content: ".mat-expansion-panel-body", myLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.files']`, browser);
active: 'mat-accent', favoriteLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.favorite']`, browser);
activeClass: '.action-button--active', shared = this.byCss(`[data-automation-id='app.navbar.shared']`);
activeClassName: 'action-button--active', recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`);
activeChild: 'action-button--active', favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`);
trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`);
newButton: '[data-automation-id="create-button"]',
personalFiles: `[data-automation-id='app.navbar.personalFiles']`,
fileLibraries: `[data-automation-id='app.navbar.libraries.menu']`,
myLibraries: `[data-automation-id='app.navbar.libraries.files']`,
favoriteLibraries: `[data-automation-id='app.navbar.libraries.favorite']`,
shared: `[data-automation-id='app.navbar.shared']`,
recentFiles: `[data-automation-id='app.navbar.recentFiles']`,
favorites: `[data-automation-id='app.navbar.favorites']`,
trash: `[data-automation-id='app.navbar.trashcan']`
};
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeClass));
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
personalFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.personalFiles));
fileLibraries: ElementFinder = this.component.element(by.css(Sidenav.selectors.fileLibraries));
myLibraries: ElementFinder = browser.element(by.css(Sidenav.selectors.myLibraries));
favoriteLibraries: ElementFinder = browser.element(by.css(Sidenav.selectors.favoriteLibraries));
shared: ElementFinder = this.component.element(by.css(Sidenav.selectors.shared));
recentFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.recentFiles));
favorites: ElementFinder = this.component.element(by.css(Sidenav.selectors.favorites));
trash: ElementFinder = this.component.element(by.css(Sidenav.selectors.trash));
menu: Menu = new Menu(); menu: Menu = new Menu();
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Sidenav.selectors.root, ancestor); super('app-sidenav', ancestor);
} }
private async expandMenu(name: string): Promise<void> { private async expandMenu(name: string): Promise<void> {
@ -81,9 +56,9 @@ export class Sidenav extends Component {
return Promise.resolve(); return Promise.resolve();
} else { } else {
const link = this.getLink(name); const link = this.getLink(name);
await Utils.waitUntilElementClickable(link); await waitForClickable(link);
await link.click(); await link.click();
await element(by.css(Sidenav.selectors.expansion_panel_content)).isPresent(); await element(by.css('.mat-expansion-panel-body')).isPresent();
} }
} catch (e) { } catch (e) {
@ -98,38 +73,39 @@ export class Sidenav extends Component {
async openCreateFolderDialog(): Promise<void> { async openCreateFolderDialog(): Promise<void> {
await this.openNewMenu(); await this.openNewMenu();
await this.menu.clickCreateFolder(); await this.menu.createFolderAction.click();
} }
async openCreateLibraryDialog(): Promise<void> { async openCreateLibraryDialog(): Promise<void> {
await this.openNewMenu(); await this.openNewMenu();
await this.menu.clickCreateLibrary(); await this.menu.createLibraryAction.click();
} }
async openCreateFileFromTemplateDialog(): Promise<void> { async openCreateFileFromTemplateDialog(): Promise<void> {
await this.openNewMenu(); await this.openNewMenu();
await this.menu.clickCreateFileFromTemplate(); await this.menu.createFileFromTemplateAction.click();
} }
async openCreateFolderFromTemplateDialog(): Promise<void> { async openCreateFolderFromTemplateDialog(): Promise<void> {
await this.openNewMenu(); await this.openNewMenu();
await this.menu.clickCreateFolderFromTemplate(); await this.menu.createFolderFromTemplateAction.click();
} }
async isActive(name: string): Promise<boolean> { async isActive(name: string): Promise<boolean> {
return (await this.getLinkLabel(name).getAttribute('class')).includes(Sidenav.selectors.activeClassName); const cssClass = await this.getLinkLabel(name).getAttribute('class');
return cssClass.includes('action-button--active');
} }
async childIsActive(name: string): Promise<boolean> { 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(Sidenav.selectors.activeChild); return childClass.includes('action-button--active');
} }
getLink(name: string): ElementFinder { getLink(name: string): ElementFinder {
return this.getLinkLabel(name).element(by.xpath('..')); return this.getLinkLabel(name).element(by.xpath('..'));
} }
getLinkLabel(name: string): ElementFinder { private getLinkLabel(name: string): ElementFinder {
switch (name) { switch (name) {
case 'Personal Files': return this.personalFiles; case 'Personal Files': return this.personalFiles;
case 'File Libraries': return this.fileLibraries; case 'File Libraries': return this.fileLibraries;
@ -143,10 +119,6 @@ export class Sidenav extends Component {
} }
} }
getActiveLink(): ElementFinder {
return this.activeLink;
}
async getLinkTooltip(name: string): Promise<string> { async getLinkTooltip(name: string): Promise<string> {
const link = this.getLinkLabel(name); 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);
@ -160,7 +132,7 @@ export class Sidenav extends Component {
async clickLink(name: string): Promise<void> { async clickLink(name: string): Promise<void> {
try{ try{
const link = this.getLinkLabel(name); const link = this.getLinkLabel(name);
await Utils.waitUntilElementClickable(link); await waitForClickable(link);
await link.click(); await link.click();
} catch (error) { } catch (error) {
Logger.error('---- sidebar navigation clickLink catch error: ', error); Logger.error('---- sidebar navigation clickLink catch error: ', error);

View File

@ -23,60 +23,38 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor'; import { ElementFinder, by, browser } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
export class Toolbar extends Component { export class Toolbar extends Component {
private static selectors = { menu = new Menu();
root: '.adf-toolbar',
button: 'button',
share: `.mat-icon-button[title='Share']`, buttons = this.allByCss('button');
shareEdit: `.mat-icon-button[title='Shared Link Settings']`, shareButton = this.byCss(`.mat-icon-button[title='Share']`);
view: `.mat-icon-button[title='View']`, shareEditButton = this.byCss(`.mat-icon-button[title='Shared Link Settings']`);
searchFilterToggle: `.mat-icon-button[title='Toggle search filter']`, viewButton = this.byCss(`.mat-icon-button[title='View']`);
download: `.mat-icon-button[title='Download']`, searchFiltersToggleButton = this.byCss(`.mat-icon-button[title='Toggle search filter']`);
editFolder: 'app.toolbar.editFolder', downloadButton = this.byCss(`.mat-icon-button[title='Download']`);
viewDetails: `.mat-icon-button[title='View Details']`, editFolderButton = this.byId('app.toolbar.editFolder');
print: `.mat-icon-button[title='Print']`, viewDetailsButton = this.byCss(`.mat-icon-button[title='View Details']`);
fullScreen: `.mat-icon-button[title='Activate full-screen mode']`, printButton = this.byCss(`.mat-icon-button[title='Print']`);
joinLibrary: `.mat-icon-button[title='Join']`, fullScreenButton = this.byCss(`.mat-icon-button[title='Activate full-screen mode']`);
leaveLibrary: `.mat-icon-button[title='Leave Library']`, joinButton = this.byCss(`.mat-icon-button[title='Join']`);
permanentlyDelete: `.mat-icon-button[title='Permanently Delete']`, leaveButton = this.byCss(`.mat-icon-button[title='Leave Library']`);
restore: `.mat-icon-button[title='Restore']` permanentlyDeleteButton = this.byCss(`.mat-icon-button[title='Permanently Delete']`);
}; restoreButton = this.byCss(`.mat-icon-button[title='Restore']`);
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
shareButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.share));
shareEditButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.shareEdit));
viewButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.view));
searchFiltersToggleButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.searchFilterToggle));
downloadButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.download));
editFolderButton: ElementFinder = this.component.element(by.id(Toolbar.selectors.editFolder));
viewDetailsButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.viewDetails));
printButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.print));
fullScreenButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.fullScreen));
joinButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.joinLibrary));
leaveButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.leaveLibrary));
permanentlyDeleteButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.permanentlyDelete));
restoreButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.restore));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Toolbar.selectors.root, ancestor); super('.adf-toolbar', ancestor);
} }
async isEmpty() { async isEmpty(): Promise<boolean> {
const count = await this.buttons.count(); const count = await this.buttons.count();
return count === 0; return count === 0;
} }
async numberOfAvailableActions() {
return this.buttons.count();
}
async getButtons(): Promise<string[]> { async getButtons(): Promise<string[]> {
return this.buttons.map(async elem => { return this.buttons.map(async elem => {
return elem.getAttribute('title'); return elem.getAttribute('title');
@ -84,26 +62,24 @@ export class Toolbar extends Component {
} }
async isButtonPresent(title: string) { async isButtonPresent(title: string) {
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)); const element = this.byCss(`button[title="${title}"]`);
return elem.isPresent(); return element.isPresent();
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
} }
getButtonByTitleAttribute(title: string) { getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)); return this.byCss(`button[title="${title}"]`);
} }
getButtonById(id: string) { getButtonById(id: string) {
return this.component.element(by.id(id)); return this.component.element(by.id(id));
} }
async openMoreMenu() { async openMoreMenu(): Promise<void> {
await this.isButtonPresent('More Actions'); await this.isButtonPresent('More Actions');
const moreMenu = this.getButtonByTitleAttribute('More Actions'); const moreMenu = this.getButtonByTitleAttribute('More Actions');
await moreMenu.click(); await moreMenu.click();
await this.menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
} }
@ -111,150 +87,61 @@ export class Toolbar extends Component {
await Utils.pressEscape(); await Utils.pressEscape();
} }
async getButtonTooltip(button: ElementFinder) { async getButtonTooltip(button: ElementFinder): Promise<string> {
return button.getAttribute('title'); return button.getAttribute('title');
} }
async clickButton(title: string) { async clickButton(title: string): Promise<void> {
const btn = this.getButtonByTitleAttribute(title); await this.getButtonByTitleAttribute(title).click();
await btn.click();
}
async isSharedLinkSettingsPresent() {
return browser.isElementPresent(this.shareEditButton);
}
async isSharePresent() {
return browser.isElementPresent(this.shareButton);
}
async isViewPresent() {
return browser.isElementPresent(this.viewButton);
}
async isToggleSearchFiltersPresent() {
return browser.isElementPresent(this.searchFiltersToggleButton);
}
async isDownloadPresent() {
return browser.isElementPresent(this.downloadButton);
}
async isPermanentlyDeletePresent() {
return browser.isElementPresent(this.permanentlyDeleteButton);
}
async isRestorePresent() {
return browser.isElementPresent(this.restoreButton);
}
async isEditFolderPresent() {
return browser.isElementPresent(this.editFolderButton);
}
async isViewDetailsPresent() {
return browser.isElementPresent(this.viewDetailsButton);
} }
async isPrintPresent() { async isPrintPresent() {
return browser.isElementPresent(this.printButton); return browser.isElementPresent(this.printButton);
} }
async isFullScreenPresent() { async clickMoreActionsFavorite(): Promise<void> {
return browser.isElementPresent(this.fullScreenButton);
}
async clickShare() {
const btn = this.shareButton;
await btn.click();
}
async clickSharedLinkSettings() {
const btn = this.shareEditButton;
await btn.click();
}
async clickView() {
await this.viewButton.click();
}
async clickEditFolder() {
await this.editFolderButton.click();
}
async clickViewDetails() {
await this.viewDetailsButton.click();
}
async clickDownload() {
await this.downloadButton.click();
}
async clickJoin() {
await this.joinButton.click();
}
async clickLeave() {
await this.leaveButton.click();
}
async clickPermanentlyDelete() {
await this.permanentlyDeleteButton.click();
}
async clickRestore() {
await this.restoreButton.click();
}
async clickMoreActionsFavorite() {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Favorite'); await this.menu.clickMenuItem('Favorite');
} }
async clickMoreActionsRemoveFavorite() { async clickMoreActionsRemoveFavorite(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Remove Favorite'); await this.menu.clickMenuItem('Remove Favorite');
} }
async clickMoreActionsDelete() { async clickMoreActionsDelete(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Delete'); await this.menu.clickMenuItem('Delete');
} }
async clickMoreActionsManageVersions() { async clickMoreActionsManageVersions(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Manage Versions'); await this.menu.clickMenuItem('Manage Versions');
} }
async clickMoreActionsMove() { async clickMoreActionsMove(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Move'); await this.menu.clickMenuItem('Move');
} }
async clickMoreActionsCopy() { async clickMoreActionsCopy(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Copy'); await this.menu.clickMenuItem('Copy');
} }
async clickMoreActionsEditOffline() { async clickMoreActionsEditOffline(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Edit Offline'); await this.menu.clickMenuItem('Edit Offline');
} }
async clickMoreActionsCancelEditing() { async clickMoreActionsCancelEditing(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Cancel Editing'); await this.menu.clickMenuItem('Cancel Editing');
} }
async clickMoreActionsUploadNewVersion() { async clickMoreActionsUploadNewVersion(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Upload New Version'); await this.menu.clickMenuItem('Upload New Version');
} }
async clickFullScreen() {
await this.fullScreenButton.click();
}
} }

View File

@ -23,44 +23,31 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; import { browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Toolbar } from '../toolbar/toolbar'; import { Toolbar } from '../toolbar/toolbar';
import { waitForPresence } from '../../utilities/utils';
export class Viewer extends Component { export class Viewer extends Component {
private static selectors = { root = browser.$('adf-viewer');
root: 'adf-viewer', viewerLayout = this.byCss('.adf-viewer-layout-content');
viewerContainer = this.byCss('.adf-viewer-content-container');
closeButton = this.byCss('.adf-viewer-close-button');
fileTitle = this.byCss('.adf-viewer__file-title');
viewerExtensionContent = this.byCss('adf-preview-extension');
pdfViewerContentPages = this.allByCss('.adf-pdf-viewer__content .page');
layout: '.adf-viewer-layout-content', toolbar = new Toolbar('adf-viewer');
contentContainer: '.adf-viewer-content-container',
closeBtn: '.adf-viewer-close-button',
fileTitle: '.adf-viewer__file-title',
viewerExtensionContent: 'adf-preview-extension',
pdfViewerContentPage: '.adf-pdf-viewer__content .page'
};
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));
pdfViewerContentPages: ElementArrayFinder = this.component.all(by.css(Viewer.selectors.pdfViewerContentPage));
toolbar = new Toolbar(Viewer.selectors.root);
constructor(ancestor?: string) { constructor(ancestor?: string) {
super(Viewer.selectors.root, ancestor); super('adf-viewer', ancestor);
} }
async waitForViewerToOpen() { async waitForViewerToOpen() {
try { try {
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.viewerContainer);
await browser.wait(EC.presenceOf(this.viewerLayout), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.viewerLayout);
} catch (error) { } catch (error) {
Logger.error('\n-----> catch waitForViewerToOpen <-----\n', error) Logger.error('\n-----> catch waitForViewerToOpen <-----\n', error)
} }
@ -70,10 +57,6 @@ export class Viewer extends Component {
return browser.isElementPresent(this.viewerLayout); return browser.isElementPresent(this.viewerLayout);
} }
async isViewerContentDisplayed() {
return browser.isElementPresent(this.viewerContainer);
}
async isViewerToolbarDisplayed() { async isViewerToolbarDisplayed() {
return browser.isElementPresent(this.toolbar.component); return browser.isElementPresent(this.toolbar.component);
} }
@ -86,15 +69,11 @@ export class Viewer extends Component {
return browser.isElementPresent(this.fileTitle); return browser.isElementPresent(this.fileTitle);
} }
async clickClose() { async getCloseButtonTooltip(): Promise<string> {
await this.closeButton.click();
}
async getCloseButtonTooltip() {
return this.toolbar.getButtonTooltip(this.closeButton); return this.toolbar.getButtonTooltip(this.closeButton);
} }
async getFileTitle() { async getFileTitle(): Promise<string> {
return this.fileTitle.getText(); return this.fileTitle.getText();
} }
@ -110,7 +89,7 @@ export class Viewer extends Component {
return ''; return '';
} }
async isPdfViewerContentDisplayed() { async isPdfViewerContentDisplayed(): Promise<boolean> {
const count = await this.pdfViewerContentPages.count(); const count = await this.pdfViewerContentPages.count();
return count > 0; return count > 0;
} }

View File

@ -35,97 +35,84 @@ export class BrowsingPage extends Page {
dataTable = new DataTable(this.appRoot); dataTable = new DataTable(this.appRoot);
pagination = new Pagination(this.appRoot); pagination = new Pagination(this.appRoot);
async signOut() { async signOut(): Promise<void> {
await this.header.userInfo.signOut(); await this.header.userInfo.signOut();
} }
async isSnackBarPresent() { async clickPersonalFiles(): Promise<void> {
return this.snackBar.isPresent();
}
// helper methods
async clickPersonalFiles() {
await this.sidenav.clickLink(SIDEBAR_LABELS.PERSONAL_FILES); await this.sidenav.clickLink(SIDEBAR_LABELS.PERSONAL_FILES);
} }
async clickPersonalFilesAndWait() { async clickPersonalFilesAndWait(): Promise<void> {
await this.clickPersonalFiles(); await this.clickPersonalFiles();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async clickFileLibraries(): Promise<void> {
async clickFileLibraries() {
await this.sidenav.clickLink(SIDEBAR_LABELS.FILE_LIBRARIES); await this.sidenav.clickLink(SIDEBAR_LABELS.FILE_LIBRARIES);
} }
async clickFileLibrariesAndWait() { async clickFileLibrariesAndWait(): Promise<void> {
await this.clickFileLibraries(); await this.clickFileLibraries();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async goToFavoriteLibraries(): Promise<void> {
async goToFavoriteLibraries() {
if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) { if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) {
await this.sidenav.expandFileLibraries(); await this.sidenav.expandFileLibraries();
} }
await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES); await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES);
} }
async goToFavoriteLibrariesAndWait() { async goToFavoriteLibrariesAndWait(): Promise<void> {
await this.goToFavoriteLibraries(); await this.goToFavoriteLibraries();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async goToMyLibraries(): Promise<void> {
async goToMyLibraries() {
if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) { if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) {
await this.sidenav.expandFileLibraries(); await this.sidenav.expandFileLibraries();
} }
await this.sidenav.clickLink(SIDEBAR_LABELS.MY_LIBRARIES); await this.sidenav.clickLink(SIDEBAR_LABELS.MY_LIBRARIES);
} }
async goToMyLibrariesAndWait() { async goToMyLibrariesAndWait(): Promise<void> {
await this.goToMyLibraries(); await this.goToMyLibraries();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async clickRecentFiles(): Promise<void> {
async clickRecentFiles() {
await this.sidenav.clickLink(SIDEBAR_LABELS.RECENT_FILES); await this.sidenav.clickLink(SIDEBAR_LABELS.RECENT_FILES);
} }
async clickRecentFilesAndWait() { async clickRecentFilesAndWait(): Promise<void> {
await this.clickRecentFiles(); await this.clickRecentFiles();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async clickSharedFiles(): Promise<void> {
async clickSharedFiles() {
await this.sidenav.clickLink(SIDEBAR_LABELS.SHARED_FILES); await this.sidenav.clickLink(SIDEBAR_LABELS.SHARED_FILES);
} }
async clickSharedFilesAndWait() { async clickSharedFilesAndWait(): Promise<void> {
await this.clickSharedFiles(); await this.clickSharedFiles();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async clickFavorites(): Promise<void> {
async clickFavorites() {
await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITES); await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITES);
} }
async clickFavoritesAndWait() { async clickFavoritesAndWait(): Promise<void> {
await this.clickFavorites(); await this.clickFavorites();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }
async clickTrash(): Promise<void> {
async clickTrash() {
await this.sidenav.clickLink(SIDEBAR_LABELS.TRASH); await this.sidenav.clickLink(SIDEBAR_LABELS.TRASH);
} }
async clickTrashAndWait() { async clickTrashAndWait(): Promise<void> {
await this.clickTrash(); await this.clickTrash();
await this.dataTable.waitForHeader(); await this.dataTable.waitForHeader();
} }

View File

@ -22,33 +22,30 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, ExpectedConditions as EC } from 'protractor'; import { browser } from 'protractor';
import { LoginComponent } from '../components/components'; import { LoginComponent } from '../components/components';
import { Page } from './page'; import { Page } from './page';
import { BROWSER_WAIT_TIMEOUT, APP_ROUTES } from '../configs'; import { APP_ROUTES } from '../configs';
import { waitForPresence } from '../utilities/utils';
export class LoginPage extends Page { export class LoginPage extends Page {
login: LoginComponent = new LoginComponent(this.appRoot); login = new LoginComponent(this.appRoot);
/** @override */
constructor() { constructor() {
super(APP_ROUTES.LOGIN); super(APP_ROUTES.LOGIN);
} }
/** @override */
async load() { async load() {
await super.load(); await super.load();
const { submitButton } = this.login; await waitForPresence(this.login.submitButton);
const hasSubmitButton = EC.presenceOf(submitButton);
return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT);
} }
async loginWith(username: string, password?: string) { async loginWith(username: string, password?: string) {
const pass = password || username; const pass = password || username;
await this.load(); await this.load();
await this.login.enterCredentials(username, pass) await this.login.enterCredentials(username, pass)
await this.login.submit(); await this.login.submitButton.click();
return super.waitForApp(); return super.waitForApp();
} }
@ -61,7 +58,7 @@ export class LoginPage extends Page {
const pass = password || username; const pass = password || username;
await this.load(); await this.load();
await this.login.enterCredentials(username, pass); await this.login.enterCredentials(username, pass);
await this.login.submit(); await this.login.submitButton.click();
return browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.login.errorMessage);
} }
} }

View File

@ -23,43 +23,28 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, by, ElementFinder, ExpectedConditions as EC, until } from 'protractor'; import { browser, by, ElementFinder } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs'; import { USE_HASH_STRATEGY } from './../configs';
import { Utils } from '../utilities/utils'; import { Utils, waitElement, waitForPresence, waitForVisibility } from '../utilities/utils';
export abstract class Page { export abstract class Page {
protected static locators = { appRoot = 'app-root';
root: 'app-root',
layout: 'app-layout',
overlay: '.cdk-overlay-container',
dialogContainer: '.mat-dialog-container',
snackBarContainer: '.mat-snack-bar-container',
snackBar: '.mat-simple-snackbar',
snackBarAction: '.mat-simple-snackbar-action button',
genericError: 'aca-generic-error', layout = this.byCss('app-layout');
genericErrorIcon: 'aca-generic-error .mat-icon', overlay = this.byCss('.cdk-overlay-container');
genericErrorTitle: '.generic-error__title' snackBar = this.byCss('.mat-simple-snackbar-action button');
}; dialogContainer = this.byCss('.mat-dialog-container');
snackBarContainer = this.byCss('.mat-snack-bar-container');
appRoot: string = Page.locators.root; snackBarAction = this.byCss('.mat-simple-snackbar-action button');
genericError = this.byCss('aca-generic-error');
layout: ElementFinder = browser.element(by.css(Page.locators.layout)); genericErrorIcon = this.byCss('aca-generic-error .mat-icon');
overlay: ElementFinder = browser.element(by.css(Page.locators.overlay)); genericErrorTitle = this.byCss('.generic-error__title');
snackBar: ElementFinder = browser.element(by.css(Page.locators.snackBar));
dialogContainer: ElementFinder = browser.element(by.css(Page.locators.dialogContainer));
snackBarContainer: ElementFinder = browser.element(by.css(Page.locators.snackBarContainer));
snackBarAction: ElementFinder = browser.element(by.css(Page.locators.snackBarAction));
genericError: ElementFinder = browser.element(by.css(Page.locators.genericError));
genericErrorIcon: ElementFinder = browser.element(by.css(Page.locators.genericErrorIcon));
genericErrorTitle: ElementFinder = browser.element(by.css(Page.locators.genericErrorTitle));
constructor(public url: string = '') {} constructor(public url: string = '') {}
async getTitle() { protected byCss(css: string): ElementFinder {
return browser.getTitle(); return browser.element(by.css(css));
} }
async load(relativeUrl: string = '') { async load(relativeUrl: string = '') {
@ -69,19 +54,11 @@ export abstract class Page {
} }
async waitForApp() { async waitForApp() {
await browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT); await waitForPresence(this.layout);
}
async waitForSnackBarToAppear() {
return browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear');
}
async waitForSnackBarToClose() {
await browser.wait(EC.not(EC.visibilityOf(this.snackBarContainer)), BROWSER_WAIT_TIMEOUT);
} }
async waitForDialog() { async waitForDialog() {
await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT); await waitForVisibility(this.dialogContainer);
} }
async isDialogOpen() { async isDialogOpen() {
@ -94,36 +71,22 @@ export abstract class Page {
} }
} }
async refresh() { async refresh(): Promise<void> {
await browser.refresh(); await browser.refresh();
await this.waitForApp(); await this.waitForApp();
} }
async getSnackBarMessage() { async getSnackBarMessage(): Promise<string> {
const elem = await this.waitForSnackBarToAppear(); const elem = await waitElement('.mat-snack-bar-container');
return elem.getAttribute('innerText'); return elem.getAttribute('innerText');
} }
async clickSnackBarAction() { async clickSnackBarAction(): Promise<void> {
try { try {
const action = await browser.wait(until.elementLocated(by.css('.mat-simple-snackbar-action button')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snack action to appear'); const action = await waitElement('.mat-simple-snackbar-action button');
await action.click(); await action.click();
} catch (e) { } catch (e) {
Logger.error(e, '.......failed on click snack bar action.........'); Logger.error(e, '.......failed on click snack bar action.........');
} }
} }
async isGenericErrorDisplayed() {
return this.genericError.isDisplayed();
}
async getGenericErrorTitle() {
return this.genericErrorTitle.getText();
}
async isUndoActionPresent() {
const message = await this.snackBar.getAttribute('innerText');
return message.includes('Undo');
}
} }

View File

@ -23,44 +23,29 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, by, By, ElementFinder, ElementArrayFinder } from 'protractor'; import { browser, by, By } from 'protractor';
import { BrowsingPage } from './browsing-page'; import { BrowsingPage } from './browsing-page';
import { SearchSortingPicker } from '../components/search/search-sorting-picker'; import { SearchSortingPicker } from '../components/search/search-sorting-picker';
import { SearchFilters } from '../components/search/search-filters'; import { SearchFilters } from '../components/search/search-filters';
export class SearchResultsPage extends BrowsingPage { export class SearchResultsPage extends BrowsingPage {
root = this.byCss('aca-search-results');
chipList = this.root.element(by.css('.adf-search-chip-list'));
infoText = this.root.element(by.css('.adf-search-results--info-text'));
private static selectors = { sortingPicker = new SearchSortingPicker('aca-search-results');
root: 'aca-search-results', filters = new SearchFilters('aca-search-results');
resultsContentHeader: '.adf-search-results__content-header',
infoText: '.adf-search-results--info-text',
chipList: '.adf-search-chip-list',
chip: '.mat-chip',
chipCloseIcon: '.mat-chip-remove'
};
root: ElementFinder = browser.element(by.css(SearchResultsPage.selectors.root));
chipList: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.chipList));
infoText: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.infoText));
sortingPicker = new SearchSortingPicker(SearchResultsPage.selectors.root);
filters = new SearchFilters(SearchResultsPage.selectors.root);
async waitForResults(): Promise<void> { async waitForResults(): Promise<void> {
await this.dataTable.waitForBody(); await this.dataTable.waitForBody();
} }
async getResultsHeader(): Promise<string> {
return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
}
async getResultsFoundText(): Promise<string> { async getResultsFoundText(): Promise<string> {
return this.infoText.getText(); return this.infoText.getText();
} }
async getResultsChipsValues(): Promise<string[]> { async getResultsChipsValues(): Promise<string[]> {
const chips: ElementArrayFinder = this.chipList.all(by.css(SearchResultsPage.selectors.chip)); const chips = this.chipList.all(by.css('.mat-chip'));
const chipsValues: string[] = await chips.map(async elem => { const chipsValues: string[] = await chips.map(async elem => {
return (await elem.getText()).replace(`\ncancel`, ''); return (await elem.getText()).replace(`\ncancel`, '');
}); });
@ -68,8 +53,8 @@ export class SearchResultsPage extends BrowsingPage {
} }
async removeChip(chipName: string): Promise<void> { async removeChip(chipName: string): Promise<void> {
const chip: ElementFinder = browser.element(By.cssContainingText(SearchResultsPage.selectors.chip, chipName)); const chip = browser.element(By.cssContainingText('.mat-chip', chipName));
const closeChip: ElementFinder = chip.element(by.css(SearchResultsPage.selectors.chipCloseIcon)); const closeChip = chip.element(by.css('.mat-chip-remove'));
await closeChip.click(); await closeChip.click();
} }
} }

View File

@ -112,7 +112,7 @@ describe('Generic tests : ', () => {
it('[C280619] Context menu closes when clicking away from it', async () => { it('[C280619] Context menu closes when clicking away from it', async () => {
await dataTable.rightClickOnItem(file1); await dataTable.rightClickOnItem(file1);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
await page.breadcrumb.getCurrentItem().click(); await page.breadcrumb.currentItem.click();
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed');
}); });
}); });
@ -183,7 +183,7 @@ describe('Generic tests : ', () => {
expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`); expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`);
expect(await dataTable.getSelectedRowsCount()).toEqual(1, 'incorrect number of selected rows'); expect(await dataTable.getSelectedRowsCount()).toEqual(1, 'incorrect number of selected rows');
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); expect(await contextMenu.editFolderAction.isPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`); expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`); expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`);
expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`); expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`);

View File

@ -106,7 +106,7 @@ export async function checkMultipleSelToolbarActions(items: string[], expectedTo
export async function checkViewerActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise<void> { export async function checkViewerActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise<void> {
await dataTable.selectItem(item); await dataTable.selectItem(item);
await toolbar.clickView(); await toolbar.viewButton.click();
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
let actualPrimaryActions = await viewerToolbar.getButtons(); let actualPrimaryActions = await viewerToolbar.getButtons();

View File

@ -430,7 +430,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -450,7 +450,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -474,7 +474,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 2 items'); expect(msg).toContain('Copied 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -496,7 +496,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -516,7 +516,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -542,7 +542,7 @@ describe('Copy content', () => {
await copyDialog.dataTable.doubleClickOnRowByName(siteName); await copyDialog.dataTable.doubleClickOnRowByName(siteName);
await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`Copied ${noOfItems} ${ noOfItems === 1 ? 'item' : 'items'}`); expect(msg).toContain(`Copied ${noOfItems} ${ noOfItems === 1 ? 'item' : 'items'}`);
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -570,7 +570,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -593,7 +593,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -619,7 +619,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -642,7 +642,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -667,7 +667,7 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.dataTable.doubleClickOnRowByName(source); await copyDialog.dataTable.doubleClickOnRowByName(source);
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -693,7 +693,7 @@ describe('Copy content', () => {
await toolbar.clickMoreActionsCopy(); await toolbar.clickMoreActionsCopy();
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.dataTable.doubleClickOnRowByName(destination); await copyDialog.dataTable.doubleClickOnRowByName(destination);
await copyDialog.clickCopy(); await copyDialog.copyButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');

View File

@ -31,7 +31,6 @@ import { AdminActions } from '../../../utilities/admin-actions';
describe('Destination picker dialog : ', () => { describe('Destination picker dialog : ', () => {
const random = Utils.random(); const random = Utils.random();
const username = `user-${random}`; const username = `user-${random}`;
const consumer = `consumer-${random}`; const consumer = `consumer-${random}`;
@ -72,8 +71,10 @@ describe('Destination picker dialog : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const contentNodeSelector = new ContentNodeSelectorDialog(); const dialog = new ContentNodeSelectorDialog();
const breadcrumb = dialog.breadcrumb;
const dataTable = dialog.dataTable;
beforeAll(async () => { beforeAll(async () => {
await adminApiActions.createUser({ username }); await adminApiActions.createUser({ username });
@ -133,53 +134,56 @@ describe('Destination picker dialog : ', () => {
}); });
beforeEach(async () => { beforeEach(async () => {
await dataTable.selectItem(file); await page.dataTable.selectItem(file);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
}); });
it('[C263875] Dialog UI', async () => { it('[C263875] Dialog UI', async () => {
expect(await contentNodeSelector.getTitle()).toEqual(`Copy '${file}' to...`); expect(await dialog.getTitle()).toEqual(`Copy '${file}' to...`);
expect(await contentNodeSelector.isSearchInputPresent()).toBe(true, 'Search input is not displayed'); expect(await dialog.searchInput.isPresent()).toBe(true, 'Search input is not displayed');
expect(await contentNodeSelector.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed'); expect(await dialog.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed');
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); expect(await breadcrumb.currentFolder.getText()).toEqual('Personal Files');
expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'Personal Files content not displayed'); expect(await dataTable.isItemPresent(destination)).toBe(true, 'Personal Files content not displayed');
expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy button is not disabled'); expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy button is not disabled');
expect(await contentNodeSelector.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await dialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
it('[C263880] Files are not displayed', async () => { it('[C263880] Files are not displayed', async () => {
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'destination folder not displayed'); expect(await dataTable.isItemPresent(destination)).toBe(true, 'destination folder not displayed');
await contentNodeSelector.dataTable.doubleClickOnRowByName(destination);
expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, 'folder is not displayed'); await dataTable.doubleClickOnRowByName(destination);
expect(await contentNodeSelector.dataTable.isItemPresent(fileInDestination)).toBe(false, 'file is displayed'); expect(await dataTable.isItemPresent(folderInDestination)).toBe(true, 'folder is not displayed');
expect(await dataTable.isItemPresent(fileInDestination)).toBe(false, 'file is displayed');
}); });
it('[C263881] Folder links are not displayed', async() => { it('[C263881] Folder links are not displayed', async() => {
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, `${folderInDestination} is not displayed`); expect(await dataTable.isItemPresent(folderInDestination)).toBe(true, `${folderInDestination} is not displayed`);
expect(await contentNodeSelector.dataTable.isItemPresent(folder2InDestination)).toBe(true, `${folder2InDestination} is not displayed`); expect(await dataTable.isItemPresent(folder2InDestination)).toBe(true, `${folder2InDestination} is not displayed`);
expect(await contentNodeSelector.dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed'); expect(await dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed');
}); });
it('[C263885] User can see his Libraries', async () => { it('[C263885] User can see his Libraries', async () => {
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
expect(await contentNodeSelector.dataTable.isItemPresent(site)).toBe(true, 'user site is not displayed'); expect(await dataTable.isItemPresent(site)).toBe(true, 'user site is not displayed');
}); });
it('[C263889] Search - No results displayed', async () => { it('[C263889] Search - No results displayed', async () => {
await contentNodeSelector.searchFor('nonexistent-folder'); await dialog.searchFor('nonexistent-folder');
expect(await contentNodeSelector.dataTable.isEmpty()).toBe(true, 'datatable not empty');
expect(await contentNodeSelector.dataTable.getEmptyListText()).toEqual('No results found'); expect(await dataTable.isEmpty()).toBe(true, 'datatable not empty');
expect(await dataTable.getEmptyListText()).toEqual('No results found');
}); });
it('[C263888] Search - results found', async () => { it('[C263888] Search - results found', async () => {
await contentNodeSelector.searchFor(searchFolder); await dialog.searchFor(searchFolder);
expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, username)).toBe(true, 'folder from Personal Files not displayed');
expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, site)).toBe(true, 'folder from site not displayed'); expect(await dataTable.isItemPresent(searchFolder, username)).toBe(true, 'folder from Personal Files not displayed');
expect(await dataTable.isItemPresent(searchFolder, site)).toBe(true, 'folder from site not displayed');
}); });
}); });
@ -189,13 +193,13 @@ describe('Destination picker dialog : ', () => {
}); });
beforeEach(async () => { beforeEach(async () => {
await dataTable.selectMultipleItems([file, destination]); await page.dataTable.selectMultipleItems([file, destination]);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
}); });
it('[C263879] Dialog title - multiple selection', async () => { it('[C263879] Dialog title - multiple selection', async () => {
expect(await contentNodeSelector.getTitle()).toEqual(`Copy 2 items to...`); expect(await dialog.getTitle()).toEqual(`Copy 2 items to...`);
}); });
}); });
@ -205,73 +209,80 @@ describe('Destination picker dialog : ', () => {
}); });
beforeEach(async () => { beforeEach(async () => {
await dataTable.selectItem(file); await page.dataTable.selectItem(file);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
}); });
it('[C263890] Personal Files breadcrumb - main node', async () => { it('[C263890] Personal Files breadcrumb - main node', async () => {
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); expect(await breadcrumb.currentFolder.getText()).toEqual('Personal Files');
}); });
it('[C263891] File Libraries breadcrumb - main node', async () => { it('[C263891] File Libraries breadcrumb - main node', async () => {
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('File Libraries'); expect(await breadcrumb.currentFolder.getText()).toEqual('File Libraries');
}); });
it('[C263899] Search results breadcrumb', async () => { it('[C263899] Search results breadcrumb', async () => {
await contentNodeSelector.searchFor(searchFolder); await dialog.searchFor(searchFolder);
expect(await contentNodeSelector.getToolbarTitle()).toEqual('Search results'); expect(await dialog.getToolbarTitle()).toEqual('Search results');
}); });
it('[C263900] Search results breadcrumb when selecting a folder', async () => { it('[C263900] Search results breadcrumb when selecting a folder', async () => {
await contentNodeSelector.searchFor(searchFolder); await dialog.searchFor(searchFolder);
await contentNodeSelector.dataTable.selectItem(searchFolder, site); await dataTable.selectItem(searchFolder, site);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder);
}); });
it('[C263897] Personal Files breadcrumb - folder structure', async () => { it('[C263897] Personal Files breadcrumb - folder structure', async () => {
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); expect(await breadcrumb.currentFolder.getText()).toEqual(destination);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); await dataTable.doubleClickOnRowByName(searchFolder);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); await dataTable.doubleClickOnRowByName(searchSubFolder1);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder1);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2); await dataTable.doubleClickOnRowByName(searchSubFolder2);
await contentNodeSelector.breadcrumb.openPath(); expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder2);
expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, destination, 'Personal Files']); await breadcrumb.openPath();
expect(await breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, destination, 'Personal Files']);
}); });
it('[C263898] File Libraries breadcrumb - folder structure', async () => { it('[C263898] File Libraries breadcrumb - folder structure', async () => {
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
await contentNodeSelector.dataTable.doubleClickOnRowByName(site);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site); await dataTable.doubleClickOnRowByName(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); expect(await breadcrumb.currentFolder.getText()).toEqual(site);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); await dataTable.doubleClickOnRowByName('documentLibrary');
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); expect(await breadcrumb.currentFolder.getText()).toEqual(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); await dataTable.doubleClickOnRowByName(searchFolder);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2);
await contentNodeSelector.breadcrumb.openPath(); await dataTable.doubleClickOnRowByName(searchSubFolder1);
expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, site, 'File Libraries']); expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder1);
await dataTable.doubleClickOnRowByName(searchSubFolder2);
expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder2);
await breadcrumb.openPath();
expect(await breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, site, 'File Libraries']);
}); });
it('[C263895] Select a node from the breadcrumb path', async () => { it('[C263895] Select a node from the breadcrumb path', async () => {
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); await dataTable.doubleClickOnRowByName(searchFolder);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); await dataTable.doubleClickOnRowByName(searchSubFolder1);
await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); await dataTable.doubleClickOnRowByName(searchSubFolder2);
await contentNodeSelector.breadcrumb.openPath(); await breadcrumb.openPath();
await contentNodeSelector.breadcrumb.clickPathItem(destination); await breadcrumb.clickPathItem(destination);
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination); expect(await breadcrumb.currentFolder.getText()).toEqual(destination);
expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder)).toBe(true, 'folder not displayed'); expect(await dataTable.isItemPresent(searchFolder)).toBe(true, 'folder not displayed');
}); });
}); });
@ -279,54 +290,54 @@ describe('Destination picker dialog : ', () => {
it('[C263876] Consumer user cannot select the folder as destination', async () => { it('[C263876] Consumer user cannot select the folder as destination', async () => {
await loginPage.loginWith(consumer); await loginPage.loginWith(consumer);
await dataTable.selectItem(file); await page.dataTable.selectItem(file);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
await contentNodeSelector.dataTable.doubleClickOnRowByName(site); await dataTable.doubleClickOnRowByName(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); await dataTable.doubleClickOnRowByName('documentLibrary');
await contentNodeSelector.dataTable.selectItem(searchFolder); await dataTable.selectItem(searchFolder);
expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(false, 'Copy should be disabled'); expect(await dialog.isCopyButtonEnabled()).toBe(false, 'Copy should be disabled');
}); });
it('[C263877] Contributor user can select the folder as destination', async () => { it('[C263877] Contributor user can select the folder as destination', async () => {
await loginPage.loginWith(contributor); await loginPage.loginWith(contributor);
await dataTable.selectItem(file); await page.dataTable.selectItem(file);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
await contentNodeSelector.dataTable.doubleClickOnRowByName(site); await dataTable.doubleClickOnRowByName(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); await dataTable.doubleClickOnRowByName('documentLibrary');
await contentNodeSelector.dataTable.selectItem(searchFolder); await dataTable.selectItem(searchFolder);
expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled');
}); });
it('[C263878] Collaborator user can select the folder as destination', async () => { it('[C263878] Collaborator user can select the folder as destination', async () => {
await loginPage.loginWith(collaborator); await loginPage.loginWith(collaborator);
await dataTable.selectItem(file); await page.dataTable.selectItem(file);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
await contentNodeSelector.selectLocation('File Libraries'); await dialog.selectLocation('File Libraries');
await contentNodeSelector.dataTable.doubleClickOnRowByName(site); await dataTable.doubleClickOnRowByName(site);
await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); await dataTable.doubleClickOnRowByName('documentLibrary');
await contentNodeSelector.dataTable.selectItem(searchFolder); await dataTable.selectItem(searchFolder);
expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled');
}); });
it('[C263892] Admin user - Personal Files breadcrumb main node', async () => { it('[C263892] Admin user - Personal Files breadcrumb main node', async () => {
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
await dataTable.selectItem(adminFolder); await page.dataTable.selectItem(adminFolder);
await toolbar.clickMoreActionsCopy(); await page.toolbar.clickMoreActionsCopy();
await contentNodeSelector.waitForDialogToOpen(); await dialog.waitForDialogToOpen();
await contentNodeSelector.selectLocation('Personal Files'); await dialog.selectLocation('Personal Files');
expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Company Home'); expect(await breadcrumb.currentFolder.getText()).toEqual('Company Home');
}); });
}); });
}); });

View File

@ -155,7 +155,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -173,7 +173,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -195,7 +195,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -215,7 +215,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo'); expect(msg).not.toContain('Undo');
@ -234,7 +234,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -257,7 +257,7 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName(siteName);
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSitePF); await moveDialog.selectDestination(folderSitePF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -314,7 +314,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -333,7 +333,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -355,7 +355,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo'); expect(msg).not.toContain('Undo');
@ -377,7 +377,7 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName(siteName);
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteRF); await moveDialog.selectDestination(folderSiteRF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -436,7 +436,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -455,7 +455,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -477,7 +477,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo'); expect(msg).not.toContain('Undo');
@ -499,7 +499,7 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName(siteName);
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteSF); await moveDialog.selectDestination(folderSiteSF);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -581,7 +581,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -600,7 +600,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -623,7 +623,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -645,7 +645,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo'); expect(msg).not.toContain('Undo');
@ -665,7 +665,7 @@ describe('Move content', () => {
await toolbar.clickMoreActionsMove(); await toolbar.clickMoreActionsMove();
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');
@ -689,7 +689,7 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName(siteName);
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteFav); await moveDialog.selectDestination(folderSiteFav);
await moveDialog.clickMove(); await moveDialog.moveButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo'); expect(msg).toContain('Undo');

View File

@ -26,7 +26,7 @@
import { LoginPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, BrowsingPage } from '../../pages/pages';
import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog';
import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog';
import { Utils } from '../../utilities/utils'; import { Utils, clearTextWithBackspace } from '../../utilities/utils';
import { AdminActions } from '../../utilities/admin-actions'; import { AdminActions } from '../../utilities/admin-actions';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
@ -110,7 +110,7 @@ describe('Create file from template', () => {
expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template');
expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'Datatable is not empty'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'Datatable is not empty');
expect(await selectTemplateDialog.dataTable.getEmptyListText()).toEqual('No results found'); expect(await selectTemplateDialog.dataTable.getEmptyListText()).toEqual('No results found');
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Node Templates');
expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled');
expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
@ -159,7 +159,7 @@ describe('Create file from template', () => {
expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(true, 'template not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(true, 'template not displayed');
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Node Templates');
expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled');
expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
@ -177,11 +177,11 @@ describe('Create file from template', () => {
expect(await selectTemplateDialog.dataTable.isItemPresent(template1InFolder2)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template1InFolder2)).toBe(true, 'template not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(false, 'template is displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(false, 'template is displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(false, 'template is displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(false, 'template is displayed');
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesFolder2); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templatesFolder2);
await selectTemplateDialog.dataTable.doubleClickOnRowByName(templatesSubFolder); await selectTemplateDialog.dataTable.doubleClickOnRowByName(templatesSubFolder);
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesSubFolder); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templatesSubFolder);
expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty');
await selectTemplateDialog.breadcrumb.openPath(); await selectTemplateDialog.breadcrumb.openPath();
@ -236,16 +236,16 @@ describe('Create file from template', () => {
it('[C325020] Create file from template - dialog UI', async () => { it('[C325020] Create file from template - dialog UI', async () => {
expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new document from '${template1InRootFolder}'`); expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new document from '${template1InRootFolder}'`);
expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed');
expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed');
expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed');
expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled');
}); });
it('[C325031] File name is required', async () => { it('[C325031] File name is required', async () => {
expect(await createFromTemplateDialog.getName()).toEqual(template1InRootFolder); expect(await createFromTemplateDialog.getName()).toEqual(template1InRootFolder);
await createFromTemplateDialog.deleteNameWithBackspace(); await clearTextWithBackspace(createFromTemplateDialog.nameInput);
expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required');
expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
@ -305,7 +305,7 @@ describe('Create file from template', () => {
it('[C325030] Create a file from a template - with a new Name', async () => { it('[C325030] Create a file from a template - with a new Name', async () => {
await createFromTemplateDialog.enterName(file1.name); await createFromTemplateDialog.enterName(file1.name);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -316,7 +316,7 @@ describe('Create file from template', () => {
await createFromTemplateDialog.enterName(file2.name); await createFromTemplateDialog.enterName(file2.name);
await createFromTemplateDialog.enterTitle(file2.title); await createFromTemplateDialog.enterTitle(file2.title);
await createFromTemplateDialog.enterDescription(file2.description); await createFromTemplateDialog.enterDescription(file2.description);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -329,7 +329,7 @@ describe('Create file from template', () => {
it('[C325028] Create a file with a duplicate name', async () => { it('[C325028] Create a file with a duplicate name', async () => {
await createFromTemplateDialog.enterName(duplicateFileName); await createFromTemplateDialog.enterName(duplicateFileName);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -345,7 +345,7 @@ describe('Create file from template', () => {
it('[C325042] Trim spaces from file Name', async () => { it('[C325042] Trim spaces from file Name', async () => {
await createFromTemplateDialog.enterName(nameWithSpaces); await createFromTemplateDialog.enterName(nameWithSpaces);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -370,7 +370,7 @@ describe('Create file from template', () => {
await createFromTemplateDialog.enterName(fileSite.name); await createFromTemplateDialog.enterName(fileSite.name);
await createFromTemplateDialog.enterTitle(fileSite.title); await createFromTemplateDialog.enterTitle(fileSite.title);
await createFromTemplateDialog.enterDescription(fileSite.description); await createFromTemplateDialog.enterDescription(fileSite.description);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -391,7 +391,7 @@ describe('Create file from template', () => {
it('[C325025] Create a file with a duplicate name', async () => { it('[C325025] Create a file with a duplicate name', async () => {
await createFromTemplateDialog.enterName(duplicateFileSite); await createFromTemplateDialog.enterName(duplicateFileSite);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');

View File

@ -26,7 +26,7 @@
import { LoginPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, BrowsingPage } from '../../pages/pages';
import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog';
import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog';
import { Utils } from '../../utilities/utils'; import { Utils, clearTextWithBackspace } from '../../utilities/utils';
import { AdminActions } from '../../utilities/admin-actions'; import { AdminActions } from '../../utilities/admin-actions';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
@ -146,7 +146,7 @@ describe('Create folder from template', () => {
expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(true, 'template folder not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(fileInRootFolder)).toBe(true, 'file not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(fileInRootFolder)).toBe(true, 'file not displayed');
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Space Templates'); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Space Templates');
expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled');
expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
@ -163,11 +163,11 @@ describe('Create folder from template', () => {
expect(await selectTemplateDialog.dataTable.isItemPresent(templateSubFolder)).toBe(true, 'template sub-folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateSubFolder)).toBe(true, 'template sub-folder not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(fileInFolder2)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(fileInFolder2)).toBe(true, 'template not displayed');
expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(false, 'template folder is displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(false, 'template folder is displayed');
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateFolder2); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templateFolder2);
await selectTemplateDialog.dataTable.doubleClickOnRowByName(templateSubFolder); await selectTemplateDialog.dataTable.doubleClickOnRowByName(templateSubFolder);
expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateSubFolder); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templateSubFolder);
expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty');
await selectTemplateDialog.breadcrumb.openPath(); await selectTemplateDialog.breadcrumb.openPath();
@ -222,16 +222,16 @@ describe('Create folder from template', () => {
it('[C325142] Create folder from template - dialog UI', async () => { it('[C325142] Create folder from template - dialog UI', async () => {
expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new folder from '${templateFolder1}'`); expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new folder from '${templateFolder1}'`);
expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed');
expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed');
expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed');
expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled');
}); });
it('[C325143] Folder name is required', async () => { it('[C325143] Folder name is required', async () => {
expect(await createFromTemplateDialog.getName()).toEqual(templateFolder1); expect(await createFromTemplateDialog.getName()).toEqual(templateFolder1);
await createFromTemplateDialog.deleteNameWithBackspace(); await clearTextWithBackspace(createFromTemplateDialog.nameInput);
expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required');
expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
@ -291,7 +291,7 @@ describe('Create folder from template', () => {
it('[C325157] Create a folder from a template - with a new Name', async () => { it('[C325157] Create a folder from a template - with a new Name', async () => {
await createFromTemplateDialog.enterName(folder1.name); await createFromTemplateDialog.enterName(folder1.name);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -302,7 +302,7 @@ describe('Create folder from template', () => {
await createFromTemplateDialog.enterName(folder2.name); await createFromTemplateDialog.enterName(folder2.name);
await createFromTemplateDialog.enterTitle(folder2.title); await createFromTemplateDialog.enterTitle(folder2.title);
await createFromTemplateDialog.enterDescription(folder2.description); await createFromTemplateDialog.enterDescription(folder2.description);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -315,7 +315,7 @@ describe('Create folder from template', () => {
it('[C325156] Create a folder with a duplicate name', async () => { it('[C325156] Create a folder with a duplicate name', async () => {
await createFromTemplateDialog.enterName(duplicateFolderName); await createFromTemplateDialog.enterName(duplicateFolderName);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -331,7 +331,7 @@ describe('Create folder from template', () => {
it('[C325158] Trim spaces from folder Name', async () => { it('[C325158] Trim spaces from folder Name', async () => {
await createFromTemplateDialog.enterName(nameWithSpaces); await createFromTemplateDialog.enterName(nameWithSpaces);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -356,7 +356,7 @@ describe('Create folder from template', () => {
await createFromTemplateDialog.enterName(folderSite.name); await createFromTemplateDialog.enterName(folderSite.name);
await createFromTemplateDialog.enterTitle(folderSite.title); await createFromTemplateDialog.enterTitle(folderSite.title);
await createFromTemplateDialog.enterDescription(folderSite.description); await createFromTemplateDialog.enterDescription(folderSite.description);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
await createFromTemplateDialog.waitForDialogToClose(); await createFromTemplateDialog.waitForDialogToClose();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
@ -377,7 +377,7 @@ describe('Create folder from template', () => {
it('[C325163] Create a folder with a duplicate name', async () => { it('[C325163] Create a folder with a duplicate name', async () => {
await createFromTemplateDialog.enterName(duplicateFolderSite); await createFromTemplateDialog.enterName(duplicateFolderSite);
await createFromTemplateDialog.clickCreate(); await createFromTemplateDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');

View File

@ -25,7 +25,7 @@
import { LoginPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, BrowsingPage } from '../../pages/pages';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Utils } from '../../utilities/utils'; import { Utils, clearTextWithBackspace } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Create folder', () => { describe('Create folder', () => {
@ -90,7 +90,7 @@ describe('Create folder', () => {
await page.sidenav.openCreateFolderDialog(); await page.sidenav.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(folderName1); await createDialog.enterName(folderName1);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -103,7 +103,7 @@ describe('Create folder', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(folderName2); await createDialog.enterName(folderName2);
await createDialog.enterDescription(folderDescription); await createDialog.enterDescription(folderDescription);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -119,8 +119,8 @@ describe('Create folder', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
expect(await createDialog.getTitle()).toMatch('Create new folder'); expect(await createDialog.getTitle()).toMatch('Create new folder');
expect(await createDialog.isNameDisplayed()).toBe(true, 'Name input is not displayed'); expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed');
expect(await createDialog.isDescriptionDisplayed()).toBe(true, 'Description field is not displayed'); expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed');
expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
expect(await createDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
@ -129,7 +129,7 @@ describe('Create folder', () => {
await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(parent);
await page.sidenav.openCreateFolderDialog(); await page.sidenav.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.deleteNameWithBackspace(); await clearTextWithBackspace(createDialog.nameInput);
expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is enabled'); expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is enabled');
expect(await createDialog.getValidationMessage()).toMatch('Folder name is required'); expect(await createDialog.getValidationMessage()).toMatch('Folder name is required');
@ -185,7 +185,7 @@ describe('Create folder', () => {
await page.sidenav.openCreateFolderDialog(); await page.sidenav.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(duplicateFolderName); await createDialog.enterName(duplicateFolderName);
await createDialog.clickCreate(); await createDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -196,7 +196,7 @@ describe('Create folder', () => {
await page.sidenav.openCreateFolderDialog(); await page.sidenav.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(nameWithSpaces); await createDialog.enterName(nameWithSpaces);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -223,7 +223,7 @@ describe('Create folder', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(folderSite); await createDialog.enterName(folderSite);
await createDialog.enterDescription(folderDescription); await createDialog.enterDescription(folderDescription);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -248,7 +248,7 @@ describe('Create folder', () => {
await page.sidenav.openCreateFolderDialog(); await page.sidenav.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(duplicateFolderSite); await createDialog.enterName(duplicateFolderSite);
await createDialog.clickCreate(); await createDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present');

View File

@ -87,12 +87,12 @@ describe('Create library', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
expect(await createDialog.getTitle()).toMatch('Create Library'); expect(await createDialog.getTitle()).toMatch('Create Library');
expect(await createDialog.isNameDisplayed()).toBe(true, 'Name input is not displayed'); expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed');
expect(await createDialog.isLibraryIdDisplayed()).toBe(true, 'Library ID input is not displayed'); expect(await createDialog.libraryIdInput.isDisplayed()).toBe(true, 'Library ID input is not displayed');
expect(await createDialog.isDescriptionDisplayed()).toBe(true, 'Description field is not displayed'); expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed');
expect(await createDialog.isPublicDisplayed()).toBe(true, 'Public option is not displayed'); expect(await createDialog.visibilityPublic.isDisplayed()).toBe(true, 'Public option is not displayed');
expect(await createDialog.isModeratedDisplayed()).toBe(true, 'Moderated option is not displayed'); expect(await createDialog.visibilityModerated.isDisplayed()).toBe(true, 'Moderated option is not displayed');
expect(await createDialog.isPrivateDisplayed()).toBe(true, 'Private option is not displayed'); expect(await createDialog.visibilityPrivate.isDisplayed()).toBe(true, 'Private option is not displayed');
expect(await createDialog.isPublicChecked()).toBe(true, 'Public option not checked'); expect(await createDialog.isPublicChecked()).toBe(true, 'Public option not checked');
expect(await createDialog.isCreateEnabled()).toBe(false, 'Create button is not disabled'); expect(await createDialog.isCreateEnabled()).toBe(false, 'Create button is not disabled');
expect(await createDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled');
@ -102,10 +102,10 @@ describe('Create library', () => {
await page.sidenav.openCreateLibraryDialog(); await page.sidenav.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site1Name); await createDialog.enterName(site1Name);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(site1Name, `Not navigated into ${site1Name}`); expect(await page.breadcrumb.currentItem.getText()).toEqual(site1Name, `Not navigated into ${site1Name}`);
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await dataTable.isItemPresent(site1Name)).toBe(true, `${site1Name} not in the list`); expect(await dataTable.isItemPresent(site1Name)).toBe(true, `${site1Name} not in the list`);
expect(await apis.user.sites.getVisibility(site1Name)).toEqual(SITE_VISIBILITY.PUBLIC); expect(await apis.user.sites.getVisibility(site1Name)).toEqual(SITE_VISIBILITY.PUBLIC);
@ -115,11 +115,11 @@ describe('Create library', () => {
await page.sidenav.openCreateLibraryDialog(); await page.sidenav.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site2Name); await createDialog.enterName(site2Name);
await createDialog.selectModerated(); await createDialog.visibilityModerated.click();
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(site2Name, `Not navigated into ${site2Name}`); expect(await page.breadcrumb.currentItem.getText()).toEqual(site2Name, `Not navigated into ${site2Name}`);
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await dataTable.isItemPresent(site2Name)).toBe(true, `${site2Name} not in the list`); expect(await dataTable.isItemPresent(site2Name)).toBe(true, `${site2Name} not in the list`);
expect(await apis.user.sites.getVisibility(site2Name)).toEqual(SITE_VISIBILITY.MODERATED); expect(await apis.user.sites.getVisibility(site2Name)).toEqual(SITE_VISIBILITY.MODERATED);
@ -129,11 +129,11 @@ describe('Create library', () => {
await page.sidenav.openCreateLibraryDialog(); await page.sidenav.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site3Name); await createDialog.enterName(site3Name);
await createDialog.selectPrivate(); await createDialog.visibilityPrivate.click();
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(site3Name, `Not navigated into ${site3Name}`); expect(await page.breadcrumb.currentItem.getText()).toEqual(site3Name, `Not navigated into ${site3Name}`);
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await dataTable.isItemPresent(site3Name)).toBe(true, `${site3Name} not in the list`); expect(await dataTable.isItemPresent(site3Name)).toBe(true, `${site3Name} not in the list`);
expect(await apis.user.sites.getVisibility(site3Name)).toEqual(SITE_VISIBILITY.PRIVATE); expect(await apis.user.sites.getVisibility(site3Name)).toEqual(SITE_VISIBILITY.PRIVATE);
@ -145,11 +145,11 @@ describe('Create library', () => {
await createDialog.enterName(site4.name); await createDialog.enterName(site4.name);
await createDialog.enterLibraryId(site4.id); await createDialog.enterLibraryId(site4.id);
await createDialog.enterDescription(site4.description); await createDialog.enterDescription(site4.description);
await createDialog.selectPublic(); await createDialog.visibilityPublic.click();
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(site4.name, `Not navigated into ${site4.name}`); expect(await page.breadcrumb.currentItem.getText()).toEqual(site4.name, `Not navigated into ${site4.name}`);
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await dataTable.isItemPresent(site4.name)).toBe(true, `${site4.name} not in the list`); expect(await dataTable.isItemPresent(site4.name)).toBe(true, `${site4.name} not in the list`);
expect(await apis.user.sites.getVisibility(site4.id)).toEqual(SITE_VISIBILITY.PUBLIC); expect(await apis.user.sites.getVisibility(site4.id)).toEqual(SITE_VISIBILITY.PUBLIC);
@ -171,7 +171,7 @@ describe('Create library', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(siteInTrash.name); await createDialog.enterName(siteInTrash.name);
await createDialog.enterLibraryId(siteInTrash.id); await createDialog.enterLibraryId(siteInTrash.id);
await createDialog.clickCreate(); await createDialog.createButton.click();
expect(await createDialog.getErrorMessage()).toEqual(`This Library ID is already used. Check the trashcan.`); expect(await createDialog.getErrorMessage()).toEqual(`This Library ID is already used. Check the trashcan.`);
}); });
@ -205,10 +205,10 @@ describe('Create library', () => {
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(duplicateSite.name); await createDialog.enterName(duplicateSite.name);
await createDialog.enterLibraryId(`${duplicateSite.id}-2`); await createDialog.enterLibraryId(`${duplicateSite.id}-2`);
await createDialog.clickCreate(); await createDialog.createButton.click();
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(duplicateSite.name, `Not navigated into ${duplicateSite.name}`); expect(await page.breadcrumb.currentItem.getText()).toEqual(duplicateSite.name, `Not navigated into ${duplicateSite.name}`);
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await dataTable.isItemPresent(`${duplicateSite.name} (${duplicateSite.id}-2)`)).toBe(true, `${duplicateSite.name} not in the list`); expect(await dataTable.isItemPresent(`${duplicateSite.name} (${duplicateSite.id}-2)`)).toBe(true, `${duplicateSite.name} not in the list`);
expect(await apis.user.sites.getTitle(`${duplicateSite.id}-2`)).toEqual(duplicateSite.name); expect(await apis.user.sites.getTitle(`${duplicateSite.id}-2`)).toEqual(duplicateSite.name);

View File

@ -121,14 +121,14 @@ describe('Download', () => {
it('[C213179] Download a file', async () => { it('[C213179] Download a file', async () => {
await dataTable.selectItem(filePersonal); await dataTable.selectItem(filePersonal);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(filePersonal)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(filePersonal)).toBe(true, 'File not found in download location');
}); });
it('[C216352] Download a folder', async () => { it('[C216352] Download a folder', async () => {
await dataTable.selectItem(folderPersonal); await dataTable.selectItem(folderPersonal);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
const folderZip = `${folderPersonal}.zip`; const folderZip = `${folderPersonal}.zip`;
@ -141,7 +141,7 @@ describe('Download', () => {
it('[C216353] Download multiple items', async () => { it('[C216353] Download multiple items', async () => {
await dataTable.selectMultipleItems([filePersonal, folderPersonal]); await dataTable.selectMultipleItems([filePersonal, folderPersonal]);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location');
@ -168,14 +168,14 @@ describe('Download', () => {
it('[C280173] Download a file', async () => { it('[C280173] Download a file', async () => {
await dataTable.selectItem(fileFavorites); await dataTable.selectItem(fileFavorites);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(fileFavorites)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(fileFavorites)).toBe(true, 'File not found in download location');
}); });
it('[C280188] Download a folder', async () => { it('[C280188] Download a folder', async () => {
await dataTable.selectItem(folderFavorites); await dataTable.selectItem(folderFavorites);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
const folderZip = `${folderFavorites}.zip`; const folderZip = `${folderFavorites}.zip`;
@ -188,7 +188,7 @@ describe('Download', () => {
it('[C280189] Download multiple items', async () => { it('[C280189] Download multiple items', async () => {
await dataTable.selectMultipleItems([fileFavorites, folderFavorites]); await dataTable.selectMultipleItems([fileFavorites, folderFavorites]);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location');
@ -215,14 +215,14 @@ describe('Download', () => {
it('[C280170] Download a file', async () => { it('[C280170] Download a file', async () => {
await dataTable.selectItem(fileShared1); await dataTable.selectItem(fileShared1);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(fileShared1)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(fileShared1)).toBe(true, 'File not found in download location');
}); });
it('[C280183] Download multiple items', async () => { it('[C280183] Download multiple items', async () => {
await dataTable.selectMultipleItems([fileShared1, fileShared2]); await dataTable.selectMultipleItems([fileShared1, fileShared2]);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location');
@ -248,14 +248,14 @@ describe('Download', () => {
it('[C280167] Download a file', async () => { it('[C280167] Download a file', async () => {
await dataTable.selectItem(fileRecent1); await dataTable.selectItem(fileRecent1);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(fileRecent1)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(fileRecent1)).toBe(true, 'File not found in download location');
}); });
it('[C280177] Download multiple items', async () => { it('[C280177] Download multiple items', async () => {
await dataTable.selectMultipleItems([fileRecent1, fileRecent2]); await dataTable.selectMultipleItems([fileRecent1, fileRecent2]);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location');
@ -279,14 +279,14 @@ describe('Download', () => {
it('[C279164] Download a file', async () => { it('[C279164] Download a file', async () => {
await dataTable.selectItem(fileSearch, parent); await dataTable.selectItem(fileSearch, parent);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(fileSearch)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(fileSearch)).toBe(true, 'File not found in download location');
}); });
it('[C297694] Download a folder', async () => { it('[C297694] Download a folder', async () => {
await dataTable.selectItem(folderSearch, parent); await dataTable.selectItem(folderSearch, parent);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
const folderZip = `${folderSearch}.zip`; const folderZip = `${folderSearch}.zip`;
@ -299,7 +299,7 @@ describe('Download', () => {
it('[C297695] Download multiple items', async () => { it('[C297695] Download multiple items', async () => {
await dataTable.selectMultipleItems([fileSearch, folderSearch], parent); await dataTable.selectMultipleItems([fileSearch, folderSearch], parent);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location');

View File

@ -27,7 +27,7 @@ import { LoginPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Utils } from '../../utilities/utils'; import { Utils, clearTextWithBackspace } from '../../utilities/utils';
describe('Edit folder', () => { describe('Edit folder', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
@ -122,7 +122,7 @@ describe('Edit folder', () => {
await dataTable.doubleClickOnRowByName(parent); await dataTable.doubleClickOnRowByName(parent);
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
expect(await editDialog.getTitle()).toEqual('Edit folder'); expect(await editDialog.getTitle()).toEqual('Edit folder');
expect(await editDialog.getName()).toBe(folderName); expect(await editDialog.getName()).toBe(folderName);
@ -142,11 +142,11 @@ describe('Edit folder', () => {
it('[C216335] properties are modified when pressing OK', async (done) => { it('[C216335] properties are modified when pressing OK', async (done) => {
await dataTable.selectItem(folderNameToEdit); await dataTable.selectItem(folderNameToEdit);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterDescription(folderDescriptionEdited);
await editDialog.enterName(folderNameEdited); await editDialog.enterName(folderNameEdited);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
await editDialog.waitForDialogToClose(); await editDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -159,8 +159,8 @@ describe('Edit folder', () => {
it('[C216332] with empty folder name', async () => { it('[C216332] with empty folder name', async () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.deleteNameWithBackspace(); await clearTextWithBackspace(editDialog.nameInput);
expect(await editDialog.isUpdateButtonEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.isUpdateButtonEnabled()).toBe(false, 'upload button is not enabled');
expect(await editDialog.getValidationMessage()).toMatch('Folder name is required'); expect(await editDialog.getValidationMessage()).toMatch('Folder name is required');
@ -171,7 +171,7 @@ describe('Edit folder', () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
for (const name of namesWithSpecialChars) { for (const name of namesWithSpecialChars) {
await editDialog.enterName(name); await editDialog.enterName(name);
@ -183,7 +183,7 @@ describe('Edit folder', () => {
it('[C216334] with name ending with a dot', async () => { it('[C216334] with name ending with a dot', async () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.nameInput.sendKeys('.'); await editDialog.nameInput.sendKeys('.');
@ -194,7 +194,7 @@ describe('Edit folder', () => {
it('[C216336] Cancel button', async () => { it('[C216336] Cancel button', async () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.clickCancel(); await editDialog.clickCancel();
@ -204,10 +204,10 @@ describe('Edit folder', () => {
it('[C216337] with duplicate folder name', async () => { it('[C216337] with duplicate folder name', async () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterName(duplicateFolderName); await editDialog.enterName(duplicateFolderName);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -216,12 +216,12 @@ describe('Edit folder', () => {
it('[C216338] trim ending spaces', async () => { it('[C216338] trim ending spaces', async () => {
await dataTable.selectItem(folderName); await dataTable.selectItem(folderName);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.nameInput.sendKeys(' '); await editDialog.nameInput.sendKeys(' ');
await editDialog.clickUpdate(); await editDialog.updateButton.click();
await editDialog.waitForDialogToClose(); await editDialog.waitForDialogToClose();
expect(await page.isSnackBarPresent()).not.toBe(true, 'notification appears'); expect(await page.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(await dataTable.isItemPresent(folderName)).toBe(true, 'Folder not displayed in list view'); expect(await dataTable.isItemPresent(folderName)).toBe(true, 'Folder not displayed in list view');
}); });
}); });
@ -235,11 +235,11 @@ describe('Edit folder', () => {
it('[C280384] properties are modified when pressing OK', async (done) => { it('[C280384] properties are modified when pressing OK', async (done) => {
await dataTable.selectItem(folderFavoriteToEdit); await dataTable.selectItem(folderFavoriteToEdit);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterDescription(folderDescriptionEdited);
await editDialog.enterName(folderNameEdited); await editDialog.enterName(folderNameEdited);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
await editDialog.waitForDialogToClose(); await editDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -252,10 +252,10 @@ describe('Edit folder', () => {
it('[C280386] with duplicate folder name', async () => { it('[C280386] with duplicate folder name', async () => {
await dataTable.selectItem(folderFavorite); await dataTable.selectItem(folderFavorite);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterName(folderFavoriteDuplicate); await editDialog.enterName(folderFavoriteDuplicate);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -272,11 +272,11 @@ describe('Edit folder', () => {
it('[C280509] properties are modified when pressing OK', async (done) => { it('[C280509] properties are modified when pressing OK', async (done) => {
await dataTable.selectItem(folderSiteToEdit); await dataTable.selectItem(folderSiteToEdit);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterDescription(folderDescriptionEdited);
await editDialog.enterName(folderNameEdited); await editDialog.enterName(folderNameEdited);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
await editDialog.waitForDialogToClose(); await editDialog.waitForDialogToClose();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@ -289,10 +289,10 @@ describe('Edit folder', () => {
it('[C280511] with duplicate folder name', async () => { it('[C280511] with duplicate folder name', async () => {
await dataTable.selectItem(folderSite); await dataTable.selectItem(folderSite);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterName(duplicateFolderSite); await editDialog.enterName(duplicateFolderSite);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');
@ -314,11 +314,11 @@ describe('Edit folder', () => {
await dataTable.selectItem(folderSearchToEdit); await dataTable.selectItem(folderSearchToEdit);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterDescription(folderDescriptionEdited);
await editDialog.enterName(folderNameEdited2); await editDialog.enterName(folderNameEdited2);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
await editDialog.waitForDialogToClose(); await editDialog.waitForDialogToClose();
await page.refresh(); await page.refresh();
@ -336,10 +336,10 @@ describe('Edit folder', () => {
await dataTable.selectItem(folderSearch); await dataTable.selectItem(folderSearch);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder(); await toolbar.menu.editFolderAction.click();
await editDialog.waitForDialogToOpen(); await editDialog.waitForDialogToOpen();
await editDialog.enterName(folderSearchDuplicate); await editDialog.enterName(folderSearchDuplicate);
await editDialog.clickUpdate(); await editDialog.updateButton.click();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');

View File

@ -128,7 +128,7 @@ describe('Library actions', () => {
it('[C290105] from Favorite Libraries', async () => { it('[C290105] from Favorite Libraries', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(sitePublic1Admin); await dataTable.selectItem(sitePublic1Admin);
await toolbar.clickJoin(); await toolbar.joinButton.click();
expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual('Consumer'); expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual('Consumer');
}); });
@ -140,7 +140,7 @@ describe('Library actions', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic1Admin); await dataTable.selectItem(siteSearchPublic1Admin);
await toolbar.clickJoin(); await toolbar.joinButton.click();
expect(await dataTable.getLibraryRole(siteSearchPublic1Admin)).toEqual('Consumer'); expect(await dataTable.getLibraryRole(siteSearchPublic1Admin)).toEqual('Consumer');
}); });
@ -159,7 +159,7 @@ describe('Library actions', () => {
it('[C290109] from Favorite Libraries', async () => { it('[C290109] from Favorite Libraries', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(siteModerated1Admin); await dataTable.selectItem(siteModerated1Admin);
await toolbar.clickJoin(); await toolbar.joinButton.click();
expect(await dataTable.getLibraryRole(siteModerated1Admin)).toEqual(''); expect(await dataTable.getLibraryRole(siteModerated1Admin)).toEqual('');
const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteModerated1Admin); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteModerated1Admin);
@ -173,7 +173,7 @@ describe('Library actions', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchModerated1Admin); await dataTable.selectItem(siteSearchModerated1Admin);
await toolbar.clickJoin(); await toolbar.joinButton.click();
expect(await dataTable.getLibraryRole(siteSearchModerated1Admin)).toEqual(''); expect(await dataTable.getLibraryRole(siteSearchModerated1Admin)).toEqual('');
const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated1Admin); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated1Admin);
@ -203,9 +203,9 @@ describe('Library actions', () => {
it('[C290106] from My Libraries', async () => { it('[C290106] from My Libraries', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic2Admin); await dataTable.selectItem(sitePublic2Admin);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickOk(); await confirmDialog.okButton.click();
expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`);
expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`); expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`);
@ -214,9 +214,9 @@ describe('Library actions', () => {
it('[C290110] from Favorite Libraries', async () => { it('[C290110] from Favorite Libraries', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(sitePublic3Admin); await dataTable.selectItem(sitePublic3Admin);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickOk(); await confirmDialog.okButton.click();
expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`);
expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`); expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`);
@ -229,9 +229,9 @@ describe('Library actions', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic2Admin); await dataTable.selectItem(siteSearchPublic2Admin);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickOk(); await confirmDialog.okButton.click();
expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`);
expect(await dataTable.isItemPresent(siteSearchPublic2Admin)).toBe(true, `${siteSearchPublic2Admin} is not displayed`); expect(await dataTable.isItemPresent(siteSearchPublic2Admin)).toBe(true, `${siteSearchPublic2Admin} is not displayed`);
@ -240,7 +240,7 @@ describe('Library actions', () => {
it('[C290136] Confirmation dialog UI', async () => { it('[C290136] Confirmation dialog UI', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic4Admin); await dataTable.selectItem(sitePublic4Admin);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open');
@ -253,20 +253,20 @@ describe('Library actions', () => {
it('[C290111] Cancel Leave Library', async () => { it('[C290111] Cancel Leave Library', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic5Admin); await dataTable.selectItem(sitePublic5Admin);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled');
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
expect(await dataTable.isItemPresent(sitePublic5Admin)).toBe(true, `${sitePublic5Admin} was deleted`); expect(await dataTable.isItemPresent(sitePublic5Admin)).toBe(true, `${sitePublic5Admin} was deleted`);
}); });
it('[C290107] Leave a library - failure notification', async () => { it('[C290107] Leave a library - failure notification', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublicUser); await dataTable.selectItem(sitePublicUser);
await toolbar.clickLeave(); await toolbar.leaveButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickOk(); await confirmDialog.okButton.click();
expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`); expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`);
}); });

View File

@ -116,19 +116,19 @@ describe('New menu', () => {
let tooltip: string; let tooltip: string;
tooltip = await menu.getTooltipForUploadFile(); tooltip = await menu.getItemTooltip('Upload File');
expect(tooltip).toContain('Select files to upload'); expect(tooltip).toContain('Select files to upload');
tooltip = await menu.getTooltipForUploadFolder(); tooltip = await menu.getItemTooltip('Upload Folder');
expect(tooltip).toContain('Select folders to upload'); expect(tooltip).toContain('Select folders to upload');
tooltip = await menu.getTooltipForCreateFolder(); tooltip = await menu.getItemTooltip('Create Folder');
expect(tooltip).toContain('Create new folder'); expect(tooltip).toContain('Create new folder');
tooltip = await menu.getTooltipForCreateLibrary(); tooltip = await menu.getItemTooltip('Create Library');
expect(tooltip).toContain('Create a new File Library'); expect(tooltip).toContain('Create a new File Library');
tooltip = await menu.getTooltipForCreateFileFromTemplate(); tooltip = await menu.getItemTooltip('Create file from template');
expect(tooltip).toContain('Create file from template'); expect(tooltip).toContain('Create file from template');
}); });
@ -139,16 +139,16 @@ describe('New menu', () => {
let tooltip: string; let tooltip: string;
tooltip = await menu.getTooltipForUploadFile(); tooltip = await menu.getItemTooltip('Upload File');
expect(tooltip).toContain('Files cannot be uploaded whilst viewing the current items'); expect(tooltip).toContain('Files cannot be uploaded whilst viewing the current items');
tooltip = await menu.getTooltipForUploadFolder(); tooltip = await menu.getItemTooltip('Upload Folder');
expect(tooltip).toContain('Folders cannot be uploaded whilst viewing the current items'); expect(tooltip).toContain('Folders cannot be uploaded whilst viewing the current items');
tooltip = await menu.getTooltipForCreateFolder(); tooltip = await menu.getItemTooltip('Create Folder');
expect(tooltip).toContain('Folders cannot be created whilst viewing the current items'); expect(tooltip).toContain('Folders cannot be created whilst viewing the current items');
tooltip = await menu.getTooltipForCreateFileFromTemplate(); tooltip = await menu.getItemTooltip('Create file from template');
expect(tooltip).toContain('Files cannot be created whilst viewing the current items'); expect(tooltip).toContain('Files cannot be created whilst viewing the current items');
}); });

View File

@ -79,9 +79,9 @@ describe('Permanently delete from Trash', () => {
it('[C217091] delete a file', async () => { it('[C217091] delete a file', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickDelete(); await confirmDialog.deleteButton.click();
expect(await page.getSnackBarMessage()).toEqual(`${file1} deleted`); expect(await page.getSnackBarMessage()).toEqual(`${file1} deleted`);
expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not deleted'); expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not deleted');
@ -89,9 +89,9 @@ describe('Permanently delete from Trash', () => {
it('[C280416] delete a folder', async () => { it('[C280416] delete a folder', async () => {
await dataTable.selectItem(folder1); await dataTable.selectItem(folder1);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickDelete(); await confirmDialog.deleteButton.click();
expect(await page.getSnackBarMessage()).toEqual(`${folder1} deleted`); expect(await page.getSnackBarMessage()).toEqual(`${folder1} deleted`);
expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not deleted'); expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not deleted');
@ -99,9 +99,9 @@ describe('Permanently delete from Trash', () => {
it('[C290103] delete a library', async () => { it('[C290103] delete a library', async () => {
await dataTable.selectItem(site); await dataTable.selectItem(site);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickDelete(); await confirmDialog.deleteButton.click();
expect(await page.getSnackBarMessage()).toEqual(`${site} deleted`); expect(await page.getSnackBarMessage()).toEqual(`${site} deleted`);
expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not deleted`); expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not deleted`);
@ -109,9 +109,9 @@ describe('Permanently delete from Trash', () => {
it('[C280417] delete multiple items', async () => { it('[C280417] delete multiple items', async () => {
await dataTable.selectMultipleItems([ file2, folder2 ]); await dataTable.selectMultipleItems([ file2, folder2 ]);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
await confirmDialog.clickDelete(); await confirmDialog.deleteButton.click();
expect(await page.getSnackBarMessage()).toEqual(`2 items deleted`); expect(await page.getSnackBarMessage()).toEqual(`2 items deleted`);
expect(await dataTable.isItemPresent(file2)).toBe(false, 'Item was not deleted'); expect(await dataTable.isItemPresent(file2)).toBe(false, 'Item was not deleted');
@ -120,7 +120,7 @@ describe('Permanently delete from Trash', () => {
it('[C269113] Confirmation dialog UI', async () => { it('[C269113] Confirmation dialog UI', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open');
@ -135,11 +135,11 @@ describe('Permanently delete from Trash', () => {
it('[C269115] Keep action cancels the deletion', async () => { it('[C269115] Keep action cancels the deletion', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickPermanentlyDelete(); await toolbar.permanentlyDeleteButton.click();
await page.waitForDialog(); await page.waitForDialog();
expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled'); expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled');
await confirmDialog.clickKeep(); await confirmDialog.keepButton.click();
expect(await dataTable.isItemPresent(file3)).toBe(true, 'Item was deleted'); expect(await dataTable.isItemPresent(file3)).toBe(true, 'Item was deleted');
}); });
}); });

View File

@ -79,7 +79,7 @@ describe('Restore from Trash', () => {
it('[C217177] restore file', async () => { it('[C217177] restore file', async () => {
await dataTable.selectItem(file); await dataTable.selectItem(file);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${file} restored`); expect(text).toContain(`${file} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
@ -92,7 +92,7 @@ describe('Restore from Trash', () => {
it('[C280438] restore folder', async () => { it('[C280438] restore folder', async () => {
await dataTable.selectItem(folder); await dataTable.selectItem(folder);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${folder} restored`); expect(text).toContain(`${folder} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
@ -105,7 +105,7 @@ describe('Restore from Trash', () => {
it('[C290104] restore library', async () => { it('[C290104] restore library', async () => {
await dataTable.selectItem(site); await dataTable.selectItem(site);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${site} restored`); expect(text).toContain(`${site} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
@ -116,7 +116,7 @@ describe('Restore from Trash', () => {
it('[C217182] restore multiple items', async () => { it('[C217182] restore multiple items', async () => {
await dataTable.selectMultipleItems([file, folder]); await dataTable.selectMultipleItems([file, folder]);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`); expect(text).not.toContain(`View`);
@ -131,7 +131,7 @@ describe('Restore from Trash', () => {
it('[C217181] View from notification', async () => { it('[C217181] View from notification', async () => {
await dataTable.selectItem(file); await dataTable.selectItem(file);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
await page.clickSnackBarAction(); await page.clickSnackBarAction();
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
@ -182,14 +182,14 @@ describe('Restore from Trash', () => {
it('[C217178] Restore a file when another file with same name exists on the restore location', async () => { it('[C217178] Restore a file when another file with same name exists on the restore location', async () => {
await page.clickTrashAndWait(); await page.clickTrashAndWait();
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`); expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`);
}); });
it('[C217179] Restore a file when original location no longer exists', async () => { it('[C217179] Restore a file when original location no longer exists', async () => {
await page.clickTrashAndWait(); await page.clickTrashAndWait();
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`);
}); });
}); });
@ -250,13 +250,13 @@ describe('Restore from Trash', () => {
it('[C217183] one failure', async () => { it('[C217183] one failure', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file1}, the original location no longer exists`); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file1}, the original location no longer exists`);
}); });
it('[C217184] multiple failures', async () => { it('[C217184] multiple failures', async () => {
await dataTable.selectMultipleItems([file3, file4, file5]); await dataTable.selectMultipleItems([file3, file4, file5]);
await toolbar.clickRestore(); await toolbar.restoreButton.click();
expect(await page.getSnackBarMessage()).toEqual('2 items not restored because of issues with the restore location'); expect(await page.getSnackBarMessage()).toEqual('2 items not restored because of issues with the restore location');
}); });
}); });

View File

@ -88,7 +88,7 @@ describe('Share a file', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).toEqual(file6); expect(await viewer.getFileTitle()).toEqual(file6);
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location');
}); });
}) })
@ -152,23 +152,23 @@ describe('Share a file', () => {
it('[C286327] Share dialog default values', async () => { it('[C286327] Share dialog default values', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
it('[C286328] Close dialog', async () => { it('[C286328] Close dialog', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
@ -178,7 +178,7 @@ describe('Share a file', () => {
it('[C286329] Share a file', async () => { it('[C286329] Share a file', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -190,12 +190,12 @@ describe('Share a file', () => {
it('[C286330] Copy shared file URL', async () => { it('[C286330] Copy shared file URL', async () => {
await dataTable.selectItem(file4); await dataTable.selectItem(file4);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain(shareLinkPreUrl); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.urlAction.click();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
await browser.get(url); await browser.get(url);
@ -207,12 +207,12 @@ describe('Share a file', () => {
it('[C286332] Share a file with expiration date', async () => { it('[C286332] Share a file with expiration date', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
await shareDialog.openDatetimePicker(); await shareDialog.datetimePickerButton.click();
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay(); const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
@ -229,7 +229,7 @@ describe('Share a file', () => {
it('[C286337] Expire date is displayed correctly', async () => { it('[C286337] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
@ -240,13 +240,13 @@ describe('Share a file', () => {
it('[C286333] Disable the share link expiration', async () => { it('[C286333] Disable the share link expiration', async () => {
await dataTable.selectItem(file7); await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -256,7 +256,7 @@ describe('Share a file', () => {
it('[C286335] Shared file URL is not changed when Share dialog is closed and opened again', async () => { it('[C286335] Shared file URL is not changed when Share dialog is closed and opened again', async () => {
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl(); const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose(); await shareDialog.clickClose();
@ -264,7 +264,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection(); await page.dataTable.clearSelection();
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl(); const url2 = await shareDialog.getLinkUrl();
@ -274,7 +274,7 @@ describe('Share a file', () => {
it('[C286345] Share a file from the context menu', async () => { it('[C286345] Share a file from the context menu', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.shareAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -333,23 +333,23 @@ describe('Share a file', () => {
it('[C286639] Share dialog default values', async () => { it('[C286639] Share dialog default values', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
it('[C286640] Close dialog', async () => { it('[C286640] Close dialog', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
@ -359,7 +359,7 @@ describe('Share a file', () => {
it('[C286641] Share a file', async () => { it('[C286641] Share a file', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -371,12 +371,12 @@ describe('Share a file', () => {
it('[C286642] Copy shared file URL', async () => { it('[C286642] Copy shared file URL', async () => {
await dataTable.selectItem(file4); await dataTable.selectItem(file4);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain(shareLinkPreUrl); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.urlAction.click();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
await browser.get(url); await browser.get(url);
@ -388,12 +388,12 @@ describe('Share a file', () => {
it('[C286643] Share a file with expiration date', async () => { it('[C286643] Share a file with expiration date', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
await shareDialog.openDatetimePicker(); await shareDialog.datetimePickerButton.click();
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay(); const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
@ -410,7 +410,7 @@ describe('Share a file', () => {
it('[C286644] Expire date is displayed correctly', async () => { it('[C286644] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
@ -421,13 +421,13 @@ describe('Share a file', () => {
it('[C286645] Disable the share link expiration', async () => { it('[C286645] Disable the share link expiration', async () => {
await dataTable.selectItem(file7); await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -437,7 +437,7 @@ describe('Share a file', () => {
it('[C286646] Shared file URL is not changed when Share dialog is closed and opened again', async () => { it('[C286646] Shared file URL is not changed when Share dialog is closed and opened again', async () => {
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl(); const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose(); await shareDialog.clickClose();
@ -445,7 +445,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection(); await page.dataTable.clearSelection();
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl(); const url2 = await shareDialog.getLinkUrl();
@ -455,7 +455,7 @@ describe('Share a file', () => {
it('[C286647] Share a file from the context menu', async () => { it('[C286647] Share a file from the context menu', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.shareAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -511,23 +511,23 @@ describe('Share a file', () => {
it('[C286657] Share dialog default values', async () => { it('[C286657] Share dialog default values', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
it('[C286658] Close dialog', async () => { it('[C286658] Close dialog', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
@ -537,7 +537,7 @@ describe('Share a file', () => {
it('[C286659] Share a file', async () => { it('[C286659] Share a file', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -549,12 +549,12 @@ describe('Share a file', () => {
it('[C286660] Copy shared file URL', async () => { it('[C286660] Copy shared file URL', async () => {
await dataTable.selectItem(file4); await dataTable.selectItem(file4);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain(shareLinkPreUrl); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.urlAction.click();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
await browser.get(url); await browser.get(url);
@ -566,12 +566,12 @@ describe('Share a file', () => {
it('[C286661] Share a file with expiration date', async () => { it('[C286661] Share a file with expiration date', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
await shareDialog.openDatetimePicker(); await shareDialog.datetimePickerButton.click();
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay(); const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
@ -588,7 +588,7 @@ describe('Share a file', () => {
it('[C286662] Expire date is displayed correctly', async () => { it('[C286662] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
@ -599,13 +599,13 @@ describe('Share a file', () => {
it('[C286663] Disable the share link expiration', async () => { it('[C286663] Disable the share link expiration', async () => {
await dataTable.selectItem(file7); await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -615,7 +615,7 @@ describe('Share a file', () => {
it('[C286664] Shared file URL is not changed when Share dialog is closed and opened again', async () => { it('[C286664] Shared file URL is not changed when Share dialog is closed and opened again', async () => {
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl(); const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose(); await shareDialog.clickClose();
@ -623,7 +623,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection(); await page.dataTable.clearSelection();
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl(); const url2 = await shareDialog.getLinkUrl();
@ -633,7 +633,7 @@ describe('Share a file', () => {
it('[C286665] Share a file from the context menu', async () => { it('[C286665] Share a file from the context menu', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.shareAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -691,23 +691,23 @@ describe('Share a file', () => {
it('[C286648] Share dialog default values', async () => { it('[C286648] Share dialog default values', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
it('[C286649] Close dialog', async () => { it('[C286649] Close dialog', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
@ -717,12 +717,12 @@ describe('Share a file', () => {
it('[C286651] Copy shared file URL', async () => { it('[C286651] Copy shared file URL', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain(shareLinkPreUrl); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.urlAction.click();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
await browser.get(url); await browser.get(url);
@ -734,7 +734,7 @@ describe('Share a file', () => {
it('[C286653] Expire date is displayed correctly', async () => { it('[C286653] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file4); await dataTable.selectItem(file4);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file4Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file4Id);
@ -745,13 +745,13 @@ describe('Share a file', () => {
it('[C286654] Disable the share link expiration', async () => { it('[C286654] Disable the share link expiration', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -761,7 +761,7 @@ describe('Share a file', () => {
it('[C286655] Shared file URL is not changed when Share dialog is closed and opened again', async () => { it('[C286655] Shared file URL is not changed when Share dialog is closed and opened again', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl(); const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose(); await shareDialog.clickClose();
@ -769,7 +769,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection(); await page.dataTable.clearSelection();
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl(); const url2 = await shareDialog.getLinkUrl();
@ -779,16 +779,16 @@ describe('Share a file', () => {
it('[C286656] Open Share dialog from context menu', async () => { it('[C286656] Open Share dialog from context menu', async () => {
await dataTable.rightClickOnItem(file7); await dataTable.rightClickOnItem(file7);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
@ -851,23 +851,23 @@ describe('Share a file', () => {
it('[C286666] Share dialog default values', async () => { it('[C286666] Share dialog default values', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on');
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked');
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
}); });
it('[C286667] Close dialog', async () => { it('[C286667] Close dialog', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled');
@ -877,7 +877,7 @@ describe('Share a file', () => {
it('[C286668] Share a file', async () => { it('[C286668] Share a file', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -889,12 +889,12 @@ describe('Share a file', () => {
it('[C286669] Copy shared file URL', async () => { it('[C286669] Copy shared file URL', async () => {
await dataTable.selectItem(file4); await dataTable.selectItem(file4);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain(shareLinkPreUrl); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.urlAction.click();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
await browser.get(url); await browser.get(url);
@ -906,12 +906,12 @@ describe('Share a file', () => {
it('[C286670] Share a file with expiration date', async () => { it('[C286670] Share a file with expiration date', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
await shareDialog.openDatetimePicker(); await shareDialog.datetimePickerButton.click();
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay(); const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
@ -928,7 +928,7 @@ describe('Share a file', () => {
it('[C286671] Expire date is displayed correctly', async () => { it('[C286671] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
@ -939,13 +939,13 @@ describe('Share a file', () => {
it('[C286672] Disable the share link expiration', async () => { it('[C286672] Disable the share link expiration', async () => {
await dataTable.selectItem(file7); await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -955,7 +955,7 @@ describe('Share a file', () => {
it('[C286673] Shared file URL is not changed when Share dialog is closed and opened again', async () => { it('[C286673] Shared file URL is not changed when Share dialog is closed and opened again', async () => {
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl(); const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose(); await shareDialog.clickClose();
@ -963,7 +963,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection(); await page.dataTable.clearSelection();
await dataTable.selectItem(file8); await dataTable.selectItem(file8);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl(); const url2 = await shareDialog.getLinkUrl();
@ -973,7 +973,7 @@ describe('Share a file', () => {
it('[C286674] Share a file from the context menu', async () => { it('[C286674] Share a file from the context menu', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.shareAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -1031,7 +1031,7 @@ describe('Share a file', () => {
it('[C306975] Share a file', async () => { it('[C306975] Share a file', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
@ -1043,12 +1043,12 @@ describe('Share a file', () => {
it('[C306977] Share a file with expiration date', async () => { it('[C306977] Share a file with expiration date', async () => {
await dataTable.selectItem(file5); await dataTable.selectItem(file5);
await toolbar.clickShare(); await toolbar.shareButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
await shareDialog.openDatetimePicker(); await shareDialog.datetimePickerButton.click();
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay(); const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
@ -1065,7 +1065,7 @@ describe('Share a file', () => {
it('[C306978] Expire date is displayed correctly', async () => { it('[C306978] Expire date is displayed correctly', async () => {
await dataTable.selectItem(file6); await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
@ -1076,13 +1076,13 @@ describe('Share a file', () => {
it('[C306979] Disable the share link expiration', async () => { it('[C306979] Disable the share link expiration', async () => {
await dataTable.selectItem(file7); await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle(); await shareDialog.expireToggle.click();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
@ -1093,7 +1093,7 @@ describe('Share a file', () => {
it('[C306981] Share a file from the context menu', async () => { it('[C306981] Share a file from the context menu', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.shareAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();

View File

@ -112,11 +112,11 @@ describe('Unshare a file from Search Results', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -132,12 +132,12 @@ describe('Unshare a file from Search Results', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -157,13 +157,13 @@ describe('Unshare a file from Search Results', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -180,12 +180,12 @@ describe('Unshare a file from Search Results', () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.waitForMenuToOpen(); await contextMenu.waitForMenuToOpen();
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -204,13 +204,13 @@ describe('Unshare a file from Search Results', () => {
await searchInput.searchFor(fileSite1); await searchInput.searchFor(fileSite1);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(fileSite1); await dataTable.selectItem(fileSite1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`); expect(msg).toContain(`You don't have permission to unshare this file`);
@ -222,13 +222,13 @@ describe('Unshare a file from Search Results', () => {
await searchInput.searchFor(fileSite2); await searchInput.searchFor(fileSite2);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(fileSite2); await dataTable.selectItem(fileSite2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();

View File

@ -106,11 +106,11 @@ describe('Unshare a file', () => {
it('[C286339] Unshare dialog UI', async () => { it('[C286339] Unshare dialog UI', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -121,12 +121,12 @@ describe('Unshare a file', () => {
it('[C286340] Unshare a file', async () => { it('[C286340] Unshare a file', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -141,13 +141,13 @@ describe('Unshare a file', () => {
it('[C286341] Cancel the Unshare action', async () => { it('[C286341] Cancel the Unshare action', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -158,12 +158,12 @@ describe('Unshare a file', () => {
it('[C286359] Unshare a file from the context menu', async () => { it('[C286359] Unshare a file from the context menu', async () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -227,11 +227,11 @@ describe('Unshare a file', () => {
it('[C286679] Unshare dialog UI', async () => { it('[C286679] Unshare dialog UI', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -242,12 +242,12 @@ describe('Unshare a file', () => {
it('[C286680] Unshare a file', async () => { it('[C286680] Unshare a file', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -262,13 +262,13 @@ describe('Unshare a file', () => {
it('[C286681] Cancel the Unshare action', async () => { it('[C286681] Cancel the Unshare action', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -279,12 +279,12 @@ describe('Unshare a file', () => {
it('[C286683] Unshare a file from the context menu', async () => { it('[C286683] Unshare a file from the context menu', async () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -340,11 +340,11 @@ describe('Unshare a file', () => {
it('[C286689] Unshare dialog UI', async () => { it('[C286689] Unshare dialog UI', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -355,12 +355,12 @@ describe('Unshare a file', () => {
it('[C286690] Unshare a file', async () => { it('[C286690] Unshare a file', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -375,13 +375,13 @@ describe('Unshare a file', () => {
it('[C286691] Cancel the Unshare action', async () => { it('[C286691] Cancel the Unshare action', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -392,12 +392,12 @@ describe('Unshare a file', () => {
it('[C286693] Unshare a file from the context menu', async () => { it('[C286693] Unshare a file from the context menu', async () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -453,11 +453,11 @@ describe('Unshare a file', () => {
it('[C286684] Unshare dialog UI', async () => { it('[C286684] Unshare dialog UI', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -468,12 +468,12 @@ describe('Unshare a file', () => {
it('[C286685] Unshare a file', async () => { it('[C286685] Unshare a file', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -488,13 +488,13 @@ describe('Unshare a file', () => {
it('[C286686] Cancel the Unshare action', async () => { it('[C286686] Cancel the Unshare action', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -505,12 +505,12 @@ describe('Unshare a file', () => {
it('[C286688] Unshare a file from the context menu', async () => { it('[C286688] Unshare a file from the context menu', async () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -573,11 +573,11 @@ describe('Unshare a file', () => {
it('[C286694] Unshare dialog UI', async () => { it('[C286694] Unshare dialog UI', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
@ -588,12 +588,12 @@ describe('Unshare a file', () => {
it('[C286695] Unshare a file', async () => { it('[C286695] Unshare a file', async () => {
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -608,13 +608,13 @@ describe('Unshare a file', () => {
it('[C286696] Cancel the Unshare action', async () => { it('[C286696] Cancel the Unshare action', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl(); const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickCancel(); await confirmDialog.cancelButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
@ -625,12 +625,12 @@ describe('Unshare a file', () => {
it('[C286698] Unshare a file from the context menu', async () => { it('[C286698] Unshare a file from the context menu', async () => {
await dataTable.rightClickOnItem(file4); await dataTable.rightClickOnItem(file4);
await contextMenu.clickSharedLinkSettings(); await contextMenu.shareEditAction.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
@ -700,13 +700,13 @@ describe('Unshare a file', () => {
await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.selectItem(file1FileLib); await dataTable.selectItem(file1FileLib);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`); expect(msg).toContain(`You don't have permission to unshare this file`);
@ -717,13 +717,13 @@ describe('Unshare a file', () => {
await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.selectItem(file2FileLib); await dataTable.selectItem(file2FileLib);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
@ -734,13 +734,13 @@ describe('Unshare a file', () => {
it('[C286687] on Shared Files - file shared by other user', async () => { it('[C286687] on Shared Files - file shared by other user', async () => {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
await dataTable.selectItem(file1Shared); await dataTable.selectItem(file1Shared);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`); expect(msg).toContain(`You don't have permission to unshare this file`);
@ -749,13 +749,13 @@ describe('Unshare a file', () => {
it('[C286702] on Shared Files - file shared by the user', async () => { it('[C286702] on Shared Files - file shared by the user', async () => {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
await dataTable.selectItem(file2Shared); await dataTable.selectItem(file2Shared);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();
@ -766,13 +766,13 @@ describe('Unshare a file', () => {
it('[C286697] on Favorites - file shared by other user', async () => { it('[C286697] on Favorites - file shared by other user', async () => {
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
await dataTable.selectItem(file1Fav); await dataTable.selectItem(file1Fav);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`); expect(msg).toContain(`You don't have permission to unshare this file`);
@ -781,13 +781,13 @@ describe('Unshare a file', () => {
it('[C286703] on Favorites - file shared by the user', async () => { it('[C286703] on Favorites - file shared by the user', async () => {
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
await dataTable.selectItem(file2Fav); await dataTable.selectItem(file2Fav);
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle(); await shareDialog.shareToggle.click();
await confirmDialog.clickRemove(); await confirmDialog.removeButton.click();
await confirmDialog.waitForDialogToClose(); await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose();

View File

@ -62,7 +62,7 @@ describe('Upload files', () => {
it('Upload a file', async () => { it('Upload a file', async () => {
await dataTable.doubleClickOnRowByName(folder1); await dataTable.doubleClickOnRowByName(folder1);
await page.sidenav.openNewMenu(); await page.sidenav.openNewMenu();
await page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`); await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/create-folder.test.ts`);
expect(await dataTable.isItemPresent('create-folder.test.ts')).toBe(true, 'file not uploaded'); expect(await dataTable.isItemPresent('create-folder.test.ts')).toBe(true, 'file not uploaded');
}); });

View File

@ -132,9 +132,9 @@ describe('Upload new version', () => {
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
}); });
@ -146,9 +146,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload1); await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated');
@ -163,9 +163,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload2); await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description'); await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated');
@ -180,7 +180,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload3); await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -196,9 +196,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(file); await Utils.uploadFileNewVersion(file);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage); expect(message).toContain(nameConflictMessage);
@ -215,9 +215,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload4); await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed');
@ -233,7 +233,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload5); await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -283,9 +283,9 @@ describe('Upload new version', () => {
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
}); });
@ -297,9 +297,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload1); await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated');
@ -314,9 +314,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload2); await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description'); await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated');
@ -331,7 +331,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload3); await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -347,9 +347,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(file); await Utils.uploadFileNewVersion(file);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage); expect(message).toContain(nameConflictMessage);
@ -366,9 +366,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload4); await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed');
@ -384,7 +384,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload5); await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -433,9 +433,9 @@ describe('Upload new version', () => {
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
}); });
@ -447,9 +447,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload1); await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload1, parentRF)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload1, parentRF)).toBe(true, 'File not updated');
@ -464,9 +464,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload2); await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description'); await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload2, parentRF)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload2, parentRF)).toBe(true, 'File not updated');
@ -481,7 +481,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload3); await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -497,9 +497,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(file); await Utils.uploadFileNewVersion(file);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage); expect(message).toContain(nameConflictMessage);
@ -516,9 +516,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload4); await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload4, parentRF)).toBe(true, 'File name was not changed'); expect(await dataTable.isItemPresent(fileToUpload4, parentRF)).toBe(true, 'File name was not changed');
@ -534,7 +534,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload5); await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -584,9 +584,9 @@ describe('Upload new version', () => {
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
}); });
@ -598,9 +598,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload1); await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated');
@ -615,9 +615,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload2); await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description'); await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated');
@ -632,7 +632,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload3); await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -648,9 +648,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(file); await Utils.uploadFileNewVersion(file);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage); expect(message).toContain(nameConflictMessage);
@ -667,9 +667,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload4); await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed');
@ -685,7 +685,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload5); await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -735,9 +735,9 @@ describe('Upload new version', () => {
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
}); });
@ -753,9 +753,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload1); await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed // TODO: enable when ACA-2329 is fixed
@ -775,9 +775,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload2); await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description'); await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed // TODO: enable when ACA-2329 is fixed
@ -797,7 +797,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload3); await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();
@ -817,9 +817,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(file); await Utils.uploadFileNewVersion(file);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage); expect(message).toContain(nameConflictMessage);
@ -840,9 +840,9 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload4); await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose(); await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed // TODO: enable when ACA-2329 is fixed
@ -863,7 +863,7 @@ describe('Upload new version', () => {
await Utils.uploadFileNewVersion(fileToUpload5); await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMinor(); await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel(); await uploadNewVersionDialog.clickCancel();

View File

@ -59,7 +59,7 @@ describe('General', () => {
await authApi.logout(); await authApi.logout();
await createDialog.clickCreate(); await createDialog.createButton.click();
expect(await page.getSnackBarMessage()).toEqual('The action was unsuccessful. Try again or contact your IT Team.'); expect(await page.getSnackBarMessage()).toEqual('The action was unsuccessful. Try again or contact your IT Team.');

View File

@ -81,16 +81,16 @@ describe('Login', () => {
}); });
it('[C213089] login page layout', async () => { it('[C213089] login page layout', async () => {
expect(await login.isUsernameEnabled()).toBe(true, 'username input is not enabled'); expect(await login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled');
expect(await login.isPasswordEnabled()).toBe(true, 'password input is not enabled'); expect(await login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled');
expect(await login.isSubmitEnabled()).toBe(false, 'SIGN IN button is enabled'); expect(await login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled');
expect(await login.isPasswordHidden()).toBe(true, 'Password is not hidden by default'); expect(await login.isPasswordHidden()).toBe(true, 'Password is not hidden by default');
}); });
it('[C213091] change password visibility', async () => { it('[C213091] change password visibility', async () => {
await login.enterPassword('some password'); await login.enterPassword('some password');
expect(await login.isPasswordDisplayed()).toBe(false, 'password is visible'); expect(await login.isPasswordDisplayed()).toBe(false, 'password is visible');
await login.clickPasswordVisibility(); await login.passwordVisibility.click();
expect(await login.isPasswordHidden()).toBe(false, 'Password visibility not changed'); expect(await login.isPasswordHidden()).toBe(false, 'Password visibility not changed');
expect(await login.isPasswordDisplayed()).toBe(true, 'password is not visible'); expect(await login.isPasswordDisplayed()).toBe(true, 'password is not visible');
}); });
@ -109,7 +109,7 @@ describe('Login', () => {
const { username, firstName, lastName } = johnDoe; const { username, firstName, lastName } = johnDoe;
await loginPage.loginWith(username); await loginPage.loginWith(username);
expect(await userInfo.getName()).toEqual(`${firstName} ${lastName}`); expect(await userInfo.fullName.getText()).toEqual(`${firstName} ${lastName}`);
}); });
it(`[C213096] logs in with user having username containing "@"`, async () => { it(`[C213096] logs in with user having username containing "@"`, async () => {

View File

@ -94,7 +94,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284646] Add a new tab with icon and title', async () => { it('[C284646] Add a new tab with icon and title', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
const val = await infoDrawer.getTabTitle(custom_tab.order); const val = await infoDrawer.getTabTitle(custom_tab.order);
@ -104,7 +104,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284647] Remove existing tab', async () => { it('[C284647] Remove existing tab', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`); expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
@ -112,7 +112,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284648] Change tab title', async () => { it('[C284648] Change tab title', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`); expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`);
@ -121,7 +121,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284649] Tab with icon and no title', async () => { it('[C284649] Tab with icon and no title', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`); expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`);
@ -130,7 +130,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284651] Insert new component in tab', async () => { it('[C284651] Insert new component in tab', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`); expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`);
@ -150,7 +150,7 @@ describe('Extensions - Info Drawer', () => {
it('[C284650] Remove all tabs', async () => { it('[C284650] Remove all tabs', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty'); expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');

View File

@ -83,11 +83,11 @@ describe('Extensions - Metadata presets', () => {
await page.refresh(); await page.refresh();
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickTab(properties_tab.title); await infoDrawer.clickTab(properties_tab.title);
await metadataCard.clickExpandButton(); await metadataCard.expandButton.click();
await metadataCard.waitForFirstExpansionPanel(); await metadataCard.waitForFirstExpansionPanel();
done(); done();

View File

@ -109,7 +109,7 @@ describe('Extensions - Viewer', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present'); expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component); expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component);
await viewer.clickClose(); await viewer.closeButton.click();
await page.dataTable.doubleClickOnRowByName(docxFile.file_name); await page.dataTable.doubleClickOnRowByName(docxFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@ -167,7 +167,7 @@ describe('Extensions - Viewer', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
expect(await toolbar.menu.isManagePermissionsPresent()).toBe(false, 'Action is still displayed'); expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed');
}); });
}); });
}); });

View File

@ -108,7 +108,7 @@ describe('Comments', () => {
it('[C299173] Comments tab default fields', async () => { it('[C299173] Comments tab default fields', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -120,7 +120,7 @@ describe('Comments', () => {
it('[C280583] Comments are displayed ordered by created date in descending order', async () => { it('[C280583] Comments are displayed ordered by created date in descending order', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -130,7 +130,7 @@ describe('Comments', () => {
it('[C280585] Total number of comments is displayed', async () => { it('[C280585] Total number of comments is displayed', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -139,7 +139,7 @@ describe('Comments', () => {
it('[C280589] Add button is enabled when typing in the comment field', async () => { it('[C280589] Add button is enabled when typing in the comment field', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -153,7 +153,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Personal); await dataTable.selectItem(file2Personal);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -168,7 +168,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(folder1); await dataTable.selectItem(folder1);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -181,7 +181,7 @@ describe('Comments', () => {
it('[C280591] Escape key clears the text when focus is on the textarea', async () => { it('[C280591] Escape key clears the text when focus is on the textarea', async () => {
await dataTable.selectItem(file2Personal); await dataTable.selectItem(file2Personal);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment('myComment'); await commentsTab.typeComment('myComment');
@ -207,7 +207,7 @@ describe('Comments', () => {
it('[C299197] Comments are displayed ordered by created date in descending order', async () => { it('[C299197] Comments are displayed ordered by created date in descending order', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -217,7 +217,7 @@ describe('Comments', () => {
it('[C299198] Total number of comments is displayed', async () => { it('[C299198] Total number of comments is displayed', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -228,7 +228,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Favorites); await dataTable.selectItem(file2Favorites);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -243,7 +243,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(folder2); await dataTable.selectItem(folder2);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -268,7 +268,7 @@ describe('Comments', () => {
it('[C299189] Comments are displayed ordered by created date in descending order', async () => { it('[C299189] Comments are displayed ordered by created date in descending order', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -278,7 +278,7 @@ describe('Comments', () => {
it('[C299190] Total number of comments is displayed', async () => { it('[C299190] Total number of comments is displayed', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -289,7 +289,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Shared); await dataTable.selectItem(file2Shared);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -314,7 +314,7 @@ describe('Comments', () => {
it('[C299193] Comments are displayed ordered by created date in descending order', async () => { it('[C299193] Comments are displayed ordered by created date in descending order', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -324,7 +324,7 @@ describe('Comments', () => {
it('[C299194] Total number of comments is displayed', async () => { it('[C299194] Total number of comments is displayed', async () => {
await dataTable.selectItem(fileWith2Comments); await dataTable.selectItem(fileWith2Comments);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -335,7 +335,7 @@ describe('Comments', () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Recent); await dataTable.selectItem(file2Recent);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment); await commentsTab.typeComment(myComment);
@ -363,7 +363,7 @@ describe('Comments', () => {
await dataTable.doubleClickOnRowByName(parent); await dataTable.doubleClickOnRowByName(parent);
await dataTable.selectItem(fileWith1Comment); await dataTable.selectItem(fileWith1Comment);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -382,7 +382,7 @@ describe('Comments', () => {
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
await dataTable.selectItem(fileWith1Comment); await dataTable.selectItem(fileWith1Comment);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -401,7 +401,7 @@ describe('Comments', () => {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
await dataTable.selectItem(fileWith1Comment); await dataTable.selectItem(fileWith1Comment);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
@ -420,7 +420,7 @@ describe('Comments', () => {
await page.clickRecentFilesAndWait(); await page.clickRecentFilesAndWait();
await dataTable.selectItem(fileWith1Comment); await dataTable.selectItem(fileWith1Comment);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();

View File

@ -96,7 +96,7 @@ describe('File / Folder properties', () => {
describe('View properties', () => { describe('View properties', () => {
it('[C299162] Default tabs', async () => { it('[C299162] Default tabs', async () => {
await dataTable.selectItem(file1.name); await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
@ -134,7 +134,7 @@ describe('File / Folder properties', () => {
]; ];
await dataTable.selectItem(file1.name); await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
@ -168,7 +168,7 @@ describe('File / Folder properties', () => {
]; ];
await dataTable.selectItem(folder1.name); await dataTable.selectItem(folder1.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
@ -179,19 +179,19 @@ describe('File / Folder properties', () => {
it('[C269004] Less / More information buttons', async () => { it('[C269004] Less / More information buttons', async () => {
await dataTable.selectItem(file1.name); await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
await propertiesTab.clickMoreInformationButton(); await propertiesTab.moreInfoButton.click();
expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed'); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded');
await propertiesTab.clickLessInformationButton(); await propertiesTab.lessInfoButton.click();
expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(true, 'More information button not displayed'); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(true, 'More information button not displayed');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(false, 'Less information button enabled'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(false, 'Less information button enabled');
@ -200,6 +200,7 @@ describe('File / Folder properties', () => {
it('[C269007] Image properties', async () => { it('[C269007] Image properties', async () => {
const apiProps = await apis.user.nodes.getNodeById(image1Id); const apiProps = await apis.user.nodes.getNodeById(image1Id);
const properties = apiProps.entry.properties;
const expectedPropLabels = [ const expectedPropLabels = [
'Image Width', 'Image Width',
@ -216,26 +217,26 @@ describe('File / Folder properties', () => {
'Camera Software' 'Camera Software'
]; ];
const expectedPropValues = [ const expectedPropValues = [
apiProps.entry.properties['exif:pixelXDimension'].toString(), properties['exif:pixelXDimension'].toString(),
apiProps.entry.properties['exif:pixelYDimension'].toString(), properties['exif:pixelYDimension'].toString(),
moment(apiProps.entry.properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT), moment(properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT),
apiProps.entry.properties['exif:exposureTime'].toString(), properties['exif:exposureTime'].toString(),
apiProps.entry.properties['exif:fNumber'].toString(), properties['exif:fNumber'].toString(),
apiProps.entry.properties['exif:flash'], properties['exif:flash'],
apiProps.entry.properties['exif:focalLength'].toString(), properties['exif:focalLength'].toString(),
apiProps.entry.properties['exif:isoSpeedRatings'], properties['exif:isoSpeedRatings'],
(apiProps.entry.properties['exif:orientation']).toString(), (properties['exif:orientation']).toString(),
apiProps.entry.properties['exif:manufacturer'], properties['exif:manufacturer'],
apiProps.entry.properties['exif:model'], properties['exif:model'],
apiProps.entry.properties['exif:software'] properties['exif:software']
]; ];
await dataTable.selectItem(image1.name); await dataTable.selectItem(image1.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await propertiesTab.clickMoreInformationButton(); await propertiesTab.moreInfoButton.click();
await propertiesTab.clickImagePropertiesPanel(); await propertiesTab.imagePropertiesPanel.click();
await propertiesTab.waitForImagePropertiesPanelToExpand(); await propertiesTab.waitForImagePropertiesPanelToExpand();
expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed'); expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed');

View File

@ -71,14 +71,14 @@ describe('General', () => {
afterEach(async (done) => { afterEach(async (done) => {
if (await infoDrawer.isOpen()) { if (await infoDrawer.isOpen()) {
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
} }
done(); done();
}); });
it('[C268999] Info drawer closes on page refresh', async () => { it('[C268999] Info drawer closes on page refresh', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open');
await page.refresh(); await page.refresh();

View File

@ -97,14 +97,14 @@ describe('Library properties', () => {
afterEach(async done => { afterEach(async done => {
if (await infoDrawer.isOpen()) { if (await infoDrawer.isOpen()) {
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
} }
done(); done();
}); });
it('[C289336] Info drawer opens for a library', async () => { it('[C289336] Info drawer opens for a library', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
@ -124,7 +124,7 @@ describe('Library properties', () => {
it('[C289338] Editable properties', async () => { it('[C289338] Editable properties', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
@ -143,7 +143,7 @@ describe('Library properties', () => {
it('[C289339] Edit site details', async () => { it('[C289339] Edit site details', async () => {
await dataTable.selectItem(siteForUpdate.name); await dataTable.selectItem(siteForUpdate.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
@ -170,7 +170,7 @@ describe('Library properties', () => {
const newDesc = `new desc ${Utils.random}`; const newDesc = `new desc ${Utils.random}`;
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
@ -191,7 +191,7 @@ describe('Library properties', () => {
await apis.user.queries.waitForSites(site.name, { expect: 1 }); await apis.user.queries.waitForSites(site.name, { expect: 1 });
await dataTable.selectItem(siteDup); await dataTable.selectItem(siteDup);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await aboutTab.clickEditLibraryProperties(); await aboutTab.clickEditLibraryProperties();
@ -202,7 +202,7 @@ describe('Library properties', () => {
it('[C289342] Site name too long', async () => { it('[C289342] Site name too long', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await aboutTab.clickEditLibraryProperties(); await aboutTab.clickEditLibraryProperties();
@ -215,7 +215,7 @@ describe('Library properties', () => {
it('[C289343] Site description too long', async () => { it('[C289343] Site description too long', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await aboutTab.clickEditLibraryProperties(); await aboutTab.clickEditLibraryProperties();
@ -237,7 +237,7 @@ describe('Library properties', () => {
await page.clickFileLibrariesAndWait(); await page.clickFileLibrariesAndWait();
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed'); expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed');
}); });
@ -247,7 +247,7 @@ describe('Library properties', () => {
await page.clickFileLibrariesAndWait(); await page.clickFileLibrariesAndWait();
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await aboutTab.clickEditLibraryProperties(); await aboutTab.clickEditLibraryProperties();

View File

@ -198,7 +198,7 @@ describe('Empty list views', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results');
}); });
it('[C290031] Empty Search results - Files / Folders', async () => { it('[C290031] Empty Search results - Files / Folders', async () => {
@ -209,6 +209,6 @@ describe('Empty list views', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results');
}); });
}); });

View File

@ -139,6 +139,6 @@ describe('Favorites', () => {
it('[C213230] Navigate into folder from Favorites', async () => { it('[C213230] Navigate into folder from Favorites', async () => {
await dataTable.doubleClickOnRowByName(favFolderName); await dataTable.doubleClickOnRowByName(favFolderName);
await dataTable.waitForEmptyState(); await dataTable.waitForEmptyState();
expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName); expect(await breadcrumb.currentItem.getText()).toBe(favFolderName);
}); });
}); });

View File

@ -71,15 +71,15 @@ describe('Generic errors', () => {
await apis.user.nodes.deleteNodeById(file1Id, false); await apis.user.nodes.deleteNodeById(file1Id, false);
await browser.get(URL); await browser.get(URL);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
}); });
it('[C217315] Invalid URL', async () => { it('[C217315] Invalid URL', async () => {
await page.load('/invalid page'); await page.load('/invalid page');
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
}); });
@ -91,8 +91,8 @@ describe('Generic errors', () => {
await loginPage.loginWith(username2); await loginPage.loginWith(username2);
await browser.get(URL); await browser.get(URL);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
await loginPage.loginWith(username); await loginPage.loginWith(username);
}); });

View File

@ -85,44 +85,44 @@ describe('Breadcrumb', () => {
it('[C260964] Personal Files breadcrumb main node', async () => { it('[C260964] Personal Files breadcrumb main node', async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Personal Files'); expect(await breadcrumb.currentItem.getText()).toBe('Personal Files');
}); });
it('[C260966] My Libraries breadcrumb main node', async () => { it('[C260966] My Libraries breadcrumb main node', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('My Libraries'); expect(await breadcrumb.currentItem.getText()).toBe('My Libraries');
}); });
it('[C289891] Favorite Libraries breadcrumb main node', async () => { it('[C289891] Favorite Libraries breadcrumb main node', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Favorite Libraries'); expect(await breadcrumb.currentItem.getText()).toBe('Favorite Libraries');
}); });
it('[C260971] Recent Files breadcrumb main node', async () => { it('[C260971] Recent Files breadcrumb main node', async () => {
await page.clickRecentFiles(); await page.clickRecentFiles();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Recent Files'); expect(await breadcrumb.currentItem.getText()).toBe('Recent Files');
}); });
it('[C260972] Shared Files breadcrumb main node', async () => { it('[C260972] Shared Files breadcrumb main node', async () => {
await page.clickSharedFiles(); await page.clickSharedFiles();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Shared Files'); expect(await breadcrumb.currentItem.getText()).toBe('Shared Files');
}); });
it('[C260973] Favorites breadcrumb main node', async () => { it('[C260973] Favorites breadcrumb main node', async () => {
await page.clickFavorites(); await page.clickFavorites();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Favorites'); expect(await breadcrumb.currentItem.getText()).toBe('Favorites');
}); });
it('[C260974] Trash breadcrumb main node', async () => { it('[C260974] Trash breadcrumb main node', async () => {
await page.clickTrash(); await page.clickTrash();
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(await breadcrumb.getCurrentItemName()).toBe('Trash'); expect(await breadcrumb.currentItem.getText()).toBe('Trash');
}); });
it('[C260965] Personal Files breadcrumb for a folder hierarchy', async () => { it('[C260965] Personal Files breadcrumb for a folder hierarchy', async () => {
@ -159,7 +159,11 @@ describe('Breadcrumb', () => {
await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(parent);
await page.dataTable.doubleClickOnRowByName(subFolder1); await page.dataTable.doubleClickOnRowByName(subFolder1);
await page.dataTable.doubleClickOnRowByName(subFolder2); await page.dataTable.doubleClickOnRowByName(subFolder2);
expect(await breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1);
const item = breadcrumb.items.get(2);
const title = await item.getAttribute('title');
expect(title).toEqual(subFolder1);
}); });
it('[C213238] Breadcrumb updates correctly when folder is renamed', async () => { it('[C213238] Breadcrumb updates correctly when folder is renamed', async () => {
@ -170,7 +174,7 @@ describe('Breadcrumb', () => {
await apis.user.nodes.renameNode(folder1Id, folder1Renamed) await apis.user.nodes.renameNode(folder1Id, folder1Renamed)
await page.refresh(); await page.refresh();
await page.dataTable.wait(); await page.dataTable.wait();
expect(await breadcrumb.getCurrentItemName()).toEqual(folder1Renamed); expect(await breadcrumb.currentItem.getText()).toEqual(folder1Renamed);
}); });
it('[C213240] Browser back navigates to previous location regardless of breadcrumb steps', async () => { it('[C213240] Browser back navigates to previous location regardless of breadcrumb steps', async () => {

View File

@ -112,7 +112,7 @@ describe('Single click on item name', () => {
it('[C280034] Navigate inside the folder when clicking the hyperlink', async () => { it('[C280034] Navigate inside the folder when clicking the hyperlink', async () => {
await dataTable.clickNameLink(folder1); await dataTable.clickNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1); expect(await breadcrumb.currentItem.getText()).toBe(folder1);
}); });
}); });
@ -129,7 +129,7 @@ describe('Single click on item name', () => {
it('[C284902] Navigate inside the library when clicking the hyperlink', async () => { it('[C284902] Navigate inside the library when clicking the hyperlink', async () => {
await dataTable.clickNameLink(siteName); await dataTable.clickNameLink(siteName);
expect(await breadcrumb.getCurrentItemName()).toBe(siteName); expect(await breadcrumb.currentItem.getText()).toBe(siteName);
expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`);
}); });
}); });
@ -193,7 +193,7 @@ describe('Single click on item name', () => {
it('[C284911] Navigate inside the folder when clicking the hyperlink', async () => { it('[C284911] Navigate inside the folder when clicking the hyperlink', async () => {
await dataTable.clickNameLink(folder1); await dataTable.clickNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1); expect(await breadcrumb.currentItem.getText()).toBe(folder1);
}); });
}); });
@ -232,7 +232,7 @@ describe('Single click on item name', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.clickSearchResultNameLink(folder1); await dataTable.clickSearchResultNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1); expect(await breadcrumb.currentItem.getText()).toBe(folder1);
}); });
}); });

View File

@ -287,7 +287,7 @@ describe('Search filters', () => {
describe('Filter by File type', () => { describe('Filter by File type', () => {
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
done(); done();
}); });
@ -341,7 +341,7 @@ describe('Search filters', () => {
describe('Filter by Creator', () => { describe('Filter by Creator', () => {
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
done(); done();
}); });
@ -396,7 +396,7 @@ describe('Search filters', () => {
describe('Filter by Modifier', () => { describe('Filter by Modifier', () => {
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
done(); done();
}); });
@ -451,7 +451,7 @@ describe('Search filters', () => {
describe('Filter by Location', () => { describe('Filter by Location', () => {
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
done(); done();
}); });
@ -508,7 +508,7 @@ describe('Search filters', () => {
const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)']; const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)'];
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
done(); done();
}); });
@ -562,7 +562,7 @@ describe('Search filters', () => {
describe('Multiple filters', () => { describe('Multiple filters', () => {
afterEach(async (done) => { afterEach(async (done) => {
await filters.clickResetAllButton(); await filters.resetAllButton.click();
await sizeFilter.resetPanel(); await sizeFilter.resetPanel();
await createdDateFilter.resetPanel(); await createdDateFilter.resetPanel();
done(); done();

View File

@ -94,7 +94,7 @@ describe('Search results - files and folders', () => {
await searchInput.searchFor('test-'); await searchInput.searchFor('test-');
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await page.breadcrumb.getCurrentItemName()).toEqual('Search Results'); expect(await page.breadcrumb.currentItem.getText()).toEqual('Search Results');
}); });
it('[C279183] File information', async () => { it('[C279183] File information', async () => {

View File

@ -163,7 +163,7 @@ describe('Search results - libraries', () => {
await searchInput.searchFor('lib'); await searchInput.searchFor('lib');
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await page.breadcrumb.getCurrentItemName()).toEqual('Libraries found...'); expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...');
}); });
it('[C290016] Results page columns', async () => { it('[C290016] Results page columns', async () => {

View File

@ -103,13 +103,13 @@ describe('Search sorting', () => {
}); });
it('[C277728] Sort by Name', async () => { it('[C277728] Sort by Name', async () => {
await page.sortingPicker.sortByName(); await page.sortingPicker.sortBy('Filename');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortByName(); await page.sortingPicker.sortBy('Filename');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
@ -117,13 +117,13 @@ describe('Search sorting', () => {
}); });
it('[C277740] Sort by Type', async () => { it('[C277740] Sort by Type', async () => {
await page.sortingPicker.sortByType(); await page.sortingPicker.sortBy('Type');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortByType(); await page.sortingPicker.sortBy('Type');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
@ -131,13 +131,13 @@ describe('Search sorting', () => {
}); });
it('[C277738] Sort by Size', async () => { it('[C277738] Sort by Size', async () => {
await page.sortingPicker.sortBySize(); await page.sortingPicker.sortBy('Size');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortBySize(); await page.sortingPicker.sortBy('Size');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
@ -145,13 +145,13 @@ describe('Search sorting', () => {
}); });
it('[C277734] Sort by Created date', async () => { it('[C277734] Sort by Created date', async () => {
await page.sortingPicker.sortByCreatedDate(); await page.sortingPicker.sortBy('Created date');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortByCreatedDate(); await page.sortingPicker.sortBy('Created date');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
@ -159,13 +159,13 @@ describe('Search sorting', () => {
}); });
it('[C277736] Sort by Modified date', async () => { it('[C277736] Sort by Modified date', async () => {
await page.sortingPicker.sortByModifiedDate(); await page.sortingPicker.sortBy('Modified date');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortByModifiedDate(); await page.sortingPicker.sortBy('Modified date');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
@ -173,13 +173,13 @@ describe('Search sorting', () => {
}); });
it('[C277727] Sort by Relevance', async () => { it('[C277727] Sort by Relevance', async () => {
await page.sortingPicker.sortByRelevance(); await page.sortingPicker.sortBy('Relevance');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortByRelevance(); await page.sortingPicker.sortBy('Relevance');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
@ -187,13 +187,13 @@ describe('Search sorting', () => {
}); });
it('[C277732] Sort by Modifier', async () => { it('[C277732] Sort by Modifier', async () => {
await page.sortingPicker.sortByModifier(); await page.sortingPicker.sortBy('Modifier');
await page.sortingPicker.setSortOrderASC(); await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortByModifier(); await page.sortingPicker.sortBy('Modifier');
await page.sortingPicker.setSortOrderDESC(); await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);

View File

@ -123,7 +123,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles); await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location');
}); });
@ -136,9 +136,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickCopy(); await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -155,9 +155,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickMove(); await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxPersonalFiles)).toBe(false, 'Item was not moved'); expect(await dataTable.isItemPresent(xlsxPersonalFiles)).toBe(false, 'Item was not moved');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -169,7 +169,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsFavorite(); await toolbar.clickMoreActionsFavorite();
await viewer.clickClose(); await viewer.closeButton.click();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not present in Favorites list'); expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not present in Favorites list');
@ -214,9 +214,9 @@ describe('Viewer actions', () => {
await Utils.uploadFileNewVersion(docxFile2); await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2); expect(await viewer.getFileTitle()).toContain(docxFile2);
@ -229,18 +229,18 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `'Cancel Editing' button should be shown`); expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(true, `'Cancel Editing' button should be shown`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `'Edit Offline' shouldn't be shown`); expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(false, `'Edit Offline' shouldn't be shown`);
await toolbar.menu.clickMenuItem('Upload New Version'); await toolbar.menu.clickMenuItem('Upload New Version');
await Utils.uploadFileNewVersion(docxFile); await Utils.uploadFileNewVersion(docxFile);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `'Edit Offline' should be shown`); expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`);
}); });
it('[C279282] Full screen action', async () => { it('[C279282] Full screen action', async () => {
@ -248,7 +248,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await Utils.getBrowserLog(); await Utils.getBrowserLog();
await toolbar.clickFullScreen(); await toolbar.fullScreenButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen');
const browserLogAfter = await Utils.getBrowserLog(); const browserLogAfter = await Utils.getBrowserLog();
@ -259,7 +259,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles); await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickShare(); await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose(); await shareDialog.clickClose();
}); });
@ -278,7 +278,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles); await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickShare(); await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await Utils.pressEscape(); await Utils.pressEscape();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open');
@ -345,7 +345,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries); await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxLibraries)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(docxLibraries)).toBe(true, 'File not found in download location');
}); });
@ -357,9 +357,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickCopy(); await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -377,9 +377,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickMove(); await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(false, 'Item was not moved'); expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(false, 'Item was not moved');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -391,7 +391,7 @@ describe('Viewer actions', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsFavorite(); await toolbar.clickMoreActionsFavorite();
await viewer.clickClose(); await viewer.closeButton.click();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, `${docxLibraries} is not favorite`); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, `${docxLibraries} is not favorite`);
expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, `${docxLibraries} is not present in Favorites list`); expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, `${docxLibraries} is not present in Favorites list`);
@ -436,9 +436,9 @@ describe('Viewer actions', () => {
await Utils.uploadFileNewVersion(docxFile2); await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2); expect(await viewer.getFileTitle()).toContain(docxFile2);
@ -450,7 +450,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries); await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickShare(); await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose(); await shareDialog.clickClose();
}); });
@ -526,7 +526,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles); await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxRecentFiles)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(docxRecentFiles)).toBe(true, 'File not found in download location');
}); });
@ -538,9 +538,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickCopy(); await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -558,9 +558,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickMove(); await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxRecentFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(xlsxRecentFiles)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxRecentFiles)).toContain(destination, 'Item was not moved'); expect(await dataTable.getItemLocationTooltip(xlsxRecentFiles)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
@ -573,7 +573,7 @@ describe('Viewer actions', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsFavorite(); await toolbar.clickMoreActionsFavorite();
await viewer.clickClose(); await viewer.closeButton.click();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not present in Favorites list'); expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not present in Favorites list');
@ -618,9 +618,9 @@ describe('Viewer actions', () => {
await Utils.uploadFileNewVersion(docxFile2); await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2); expect(await viewer.getFileTitle()).toContain(docxFile2);
@ -632,7 +632,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles); await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickShare(); await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose(); await shareDialog.clickClose();
}); });
@ -706,7 +706,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles); await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxSharedFiles)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(docxSharedFiles)).toBe(true, 'File not found in download location');
}); });
@ -718,9 +718,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickCopy(); await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -737,9 +737,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickMove(); await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxSharedFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(xlsxSharedFiles)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxSharedFiles)).toContain(destination, 'Item was not moved'); expect(await dataTable.getItemLocationTooltip(xlsxSharedFiles)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
@ -752,7 +752,7 @@ describe('Viewer actions', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsFavorite(); await toolbar.clickMoreActionsFavorite();
await viewer.clickClose(); await viewer.closeButton.click();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not present in Favorites list'); expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not present in Favorites list');
@ -797,9 +797,9 @@ describe('Viewer actions', () => {
await Utils.uploadFileNewVersion(docxFile2); await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2); expect(await viewer.getFileTitle()).toContain(docxFile2);
@ -811,7 +811,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles); await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickSharedLinkSettings(); await toolbar.shareEditButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose(); await shareDialog.clickClose();
}); });
@ -887,7 +887,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites); await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickDownload(); await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxFavorites)).toBe(true, 'File not found in download location'); expect(await Utils.fileExistsOnOS(docxFavorites)).toBe(true, 'File not found in download location');
}); });
@ -899,9 +899,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickCopy(); await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxFavorites)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(docxFavorites)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination); await dataTable.doubleClickOnRowByName(destination);
@ -919,9 +919,9 @@ describe('Viewer actions', () => {
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination); await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.clickMove(); await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(true, 'Item is not in the list'); expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxFavorites)).toContain(destination, 'Item was not moved'); expect(await dataTable.getItemLocationTooltip(xlsxFavorites)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
@ -934,7 +934,7 @@ describe('Viewer actions', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsRemoveFavorite(); await toolbar.clickMoreActionsRemoveFavorite();
await viewer.clickClose(); await viewer.closeButton.click();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite'); expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite');
expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(false, 'Item is still present in Favorites list'); expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(false, 'Item is still present in Favorites list');
@ -979,9 +979,9 @@ describe('Viewer actions', () => {
await Utils.uploadFileNewVersion(docxFile2); await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog(); await page.waitForDialog();
await uploadNewVersionDialog.clickMajor(); await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description'); await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload(); await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2); expect(await viewer.getFileTitle()).toContain(docxFile2);
@ -993,7 +993,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites); await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickShare(); await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose(); await shareDialog.clickClose();
}); });

View File

@ -103,7 +103,7 @@ describe('Viewer general', () => {
it('[C279270] Viewer opens when clicking the View action for a file', async () => { it('[C279270] Viewer opens when clicking the View action for a file', async () => {
await dataTable.selectItem(xlsxFile); await dataTable.selectItem(xlsxFile);
await page.toolbar.clickView(); await page.toolbar.viewButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
}); });
@ -118,7 +118,7 @@ describe('Viewer general', () => {
it('[C279271] Close the viewer', async () => { it('[C279271] Close the viewer', async () => {
await dataTable.doubleClickOnRowByName(xlsxFile); await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await viewer.clickClose(); await viewer.closeButton.click();
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close'); expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close');
}); });

View File

@ -87,7 +87,7 @@ describe('Viewer - password protected file', () => {
await passwordDialog.enterPassword(protectedFile.password); await passwordDialog.enterPassword(protectedFile.password);
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
await passwordDialog.clickSubmit(); await passwordDialog.submitButton.click();
await passwordDialog.waitForDialogToClose(); await passwordDialog.waitForDialogToClose();
expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed'); expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed');
@ -96,7 +96,7 @@ describe('Viewer - password protected file', () => {
it('[C268960] Error appears when entering an incorrect password', async () => { it('[C268960] Error appears when entering an incorrect password', async () => {
await passwordDialog.enterPassword('incorrect'); await passwordDialog.enterPassword('incorrect');
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
await passwordDialog.clickSubmit(); await passwordDialog.submitButton.click();
expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong'); expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong');
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed'); expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');

View File

@ -23,14 +23,87 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging } from 'protractor'; import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging, until } from 'protractor';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs'; import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH } from '../configs';
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const StreamZip = require('node-stream-zip'); const StreamZip = require('node-stream-zip');
export async function typeText(element: ElementFinder, text: string) {
await element.clear();
await element.sendKeys(text);
}
export async function clearTextWithBackspace(element: ElementFinder) {
await element.clear();
await element.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
export async function waitElement(css: string, errorMessage?: string): Promise<any> {
return browser.wait(
until.elementLocated(by.css(css)),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting for element'
);
}
export async function waitForClickable(
element: ElementFinder,
errorMessage?: string
): Promise<void> {
return browser.wait(
EC.elementToBeClickable(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting for element to be clickable'
);
}
export async function waitForVisibility(
element: ElementFinder,
errorMessage?: string
): Promise<void> {
return browser.wait(
EC.visibilityOf(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting for element visibility'
);
}
export async function waitForInvisibility(
element: ElementFinder,
errorMessage?: string
): Promise<void> {
return browser.wait(
EC.invisibilityOf(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting for element visibility'
);
}
export async function waitForPresence(
element: ElementFinder,
errorMessage?: string
): Promise<void> {
return browser.wait(
EC.presenceOf(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting for element presence'
);
}
export async function waitForStaleness(
element: ElementFinder,
errorMessage?: string
): Promise<void> {
return browser.wait(
EC.stalenessOf(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || 'Timeout waiting element staleness'
);
}
export const isPresentAndEnabled = async (element: ElementFinder): Promise<boolean> => { export const isPresentAndEnabled = async (element: ElementFinder): Promise<boolean> => {
const isPresent = await element.isPresent(); const isPresent = await element.isPresent();
@ -60,25 +133,14 @@ export class Utils {
extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \ extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \
lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live'; lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live';
// generate a random value
static random(): string { static random(): string {
return Math.random().toString(36).substring(5, 10).toLowerCase(); return Math.random().toString(36).substring(5, 10).toLowerCase();
} }
// local storage
static async clearLocalStorage(): Promise<void> { static async clearLocalStorage(): Promise<void> {
await browser.executeScript('window.localStorage.clear();'); await browser.executeScript('window.localStorage.clear();');
} }
// session storage
static async clearSessionStorage(): Promise<void> {
await browser.executeScript('window.sessionStorage.clear();');
}
static async getSessionStorage(): Promise<any> {
return browser.executeScript('return window.sessionStorage.getItem("app.extension.config");');
}
static async setSessionStorageFromConfig(configFileName: string): Promise<void> { static async setSessionStorageFromConfig(configFileName: string): Promise<void> {
const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`; const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`;
const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' })); const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' }));
@ -86,12 +148,6 @@ export class Utils {
await browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`); await browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`);
} }
static async resetExtensionConfig(): Promise<void> {
const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`;
await this.setSessionStorageFromConfig(defConfig);
}
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> { static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
const pause = duration => new Promise(res => setTimeout(res, duration)); const pause = duration => new Promise(res => setTimeout(res, duration));
@ -102,18 +158,6 @@ export class Utils {
return run(retry); return run(retry);
} }
static async waitUntilElementClickable(element: ElementFinder): Promise<void> {
await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
}
static async typeInField(elem: ElementFinder, value: string): Promise<void> {
for (let i = 0; i < value.length; i++) {
const c = value.charAt(i);
await elem.sendKeys(c);
await browser.sleep(100);
}
}
static async clearFieldWithBackspace(elem: ElementFinder): Promise<void> { static async clearFieldWithBackspace(elem: ElementFinder): Promise<void> {
const text = await elem.getAttribute('value'); const text = await elem.getAttribute('value');
for (let i = 0; i < text.length; i++) { for (let i = 0; i < text.length; i++) {