[ACA-1628] async await (#693)

* async / await on login component and utils

* more async / awaits

* remove fdescribe

* expect for exact totalItems in waitForApi methods
other async / awaits

* pagination tests

* more tries

* disable selenium promise manager

* try to fix shared-links tests

* re-enable selenium_promise_manager and some more fixes

* add target es2017 to e2e

* set target to es2017 on tsconfig.spec.json

* other tries

* forgotten console.log

* disable pagination tests

* some fixes for pagination

* temporary fix viewer actions tests

* fix some actions tests

* fix some tests for actions

* fix some tests for undo action

* try to fix some more tests

* fixes for toolbar actions

* fix NoSuchElementError for openMoreMenu

* fix NoSuchElementError for rightClickOnMultipleSelection

* fixes for mark as favourite

* more fixes

* more fixes

* change order of some expects

* forgot describe
This commit is contained in:
Adina Parpalita 2018-10-08 11:21:02 +03:00 committed by Denys Vuika
parent 0d4795bfa8
commit 7d73ae309c
53 changed files with 1553 additions and 1662 deletions

View File

@ -27,56 +27,60 @@ import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
import { Component } from '../component';
export class Breadcrumb extends Component {
private static selectors = {
root: 'adf-breadcrumb',
item: '.adf-breadcrumb-item',
currentItem: '.adf-breadcrumb-item-current'
};
private static selectors = {
root: 'adf-breadcrumb',
item: '.adf-breadcrumb-item',
currentItem: '.adf-breadcrumb-item-current'
};
items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item));
currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem));
items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item));
currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem));
constructor(ancestor?: ElementFinder) {
super(Breadcrumb.selectors.root, ancestor);
}
constructor(ancestor?: ElementFinder) {
super(Breadcrumb.selectors.root, ancestor);
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getNthItemName(nth: number) {
return this.getNthItem(nth).getText();
}
async getNthItemName(nth: number) {
return await this.getNthItem(nth).getText();
}
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
async getItemsCount() {
return await this.items.count();
}
getAllItems() {
return this.items.map(elem => elem.getText().then(str => str.split('\nchevron_right')[0]));
}
async getAllItems() {
return this.items.map(async elem => {
const str = await elem.getText();
return str.split('\nchevron_right')[0];
});
}
getFirstItemName(): promise.Promise<string> {
return this.items.get(0).getText();
}
async getFirstItemName() {
return await this.items.get(0).getText();
}
getCurrentItem() {
return this.currentItem;
}
getCurrentItem() {
return this.currentItem;
}
getCurrentItemName(): promise.Promise<string> {
return this.currentItem.getText();
}
async getCurrentItemName() {
return await this.currentItem.getText();
}
clickItem(name: string) {
return this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`)).click();
}
async clickItem(name: string) {
const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`));
await elem.click();
}
clickNthItem(nth: number) {
return this.getNthItem(nth).click();
}
async clickNthItem(nth: number) {
await this.getNthItem(nth).click();
}
getNthItemTooltip(nth: number) {
return this.getNthItem(nth).getAttribute('title');
}
async getNthItemTooltip(nth: number) {
return await this.getNthItem(nth).getAttribute('title');
}
}

View File

@ -23,21 +23,21 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, element, by, ExpectedConditions as EC, browser } from 'protractor';
import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../configs';
export abstract class Component {
component: ElementFinder;
component: ElementFinder;
constructor(selector: string, ancestor?: ElementFinder) {
const locator = selector;
constructor(selector: string, ancestor?: ElementFinder) {
const locator = selector;
this.component = ancestor
? ancestor.$$(locator).first()
: browser.$$(locator).first();
}
this.component = ancestor
? ancestor.$$(locator).first()
: browser.$$(locator).first();
}
wait() {
return browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
}
async wait() {
await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
}
}

View File

@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, promise, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
import { Menu } from '../menu/menu';
@ -76,252 +76,243 @@ export class DataTable extends Component {
// Wait methods (waits for elements)
waitForHeader() {
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
try {
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
} catch (error) {
console.log('----- wait for header catch : ', error);
}
}
waitForEmptyState() {
return browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
async waitForEmptyState() {
await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
}
// Header/Column methods
getColumnHeaders(): ElementArrayFinder {
getColumnHeaders() {
const locator = by.css(DataTable.selectors.columnHeader);
return this.head.all(locator);
}
getNthColumnHeader(nth: number): ElementFinder {
async getHeaderText() {
const el = this.getColumnHeaders();
return await el.getText();
}
getNthColumnHeader(nth: number) {
return this.getColumnHeaders().get(nth - 1);
}
getColumnHeaderByLabel(label: string): ElementFinder {
getColumnHeaderByLabel(label: string) {
const locator = by.cssContainingText(DataTable.selectors.columnHeader, label);
return this.head.element(locator);
}
getSortedColumnHeader(): ElementFinder {
getSortedColumnHeader() {
const locator = by.css(DataTable.selectors.sortedColumnHeader);
return this.head.element(locator);
}
getSortingOrder() {
return this.getSortedColumnHeader()
.getAttribute('class')
.then(str => {
if (str.includes('asc')) {
return 'asc';
} else {
if (str.includes('desc')) {
return 'desc';
}
}
});
async getSortedColumnHeaderText() {
return await this.getSortedColumnHeader().getText();
}
sortByColumn(columnName: string): promise.Promise<void> {
const column = this.getColumnHeaderByLabel(columnName);
const click = browser
.actions()
.mouseMove(column)
.click();
async getSortingOrder() {
const str = await this.getSortedColumnHeader().getAttribute('class');
if (str.includes('asc')) {
return 'asc';
}
else {
if (str.includes('desc')) {
return 'desc';
}
}
}
return click.perform();
async sortByColumn(columnName: string) {
const column = this.getColumnHeaderByLabel(columnName);
const click = browser.actions().mouseMove(column).click();
await click.perform();
}
// Rows methods
getRows(): ElementArrayFinder {
getRows() {
return this.body.all(by.css(DataTable.selectors.row));
}
countRows(): promise.Promise<number> {
return this.getRows().count();
async countRows() {
return await this.getRows().count();
}
getSelectedRows(): ElementArrayFinder {
getSelectedRows() {
return this.body.all(by.css(DataTable.selectors.selectedRow));
}
countSelectedRows(): promise.Promise<number> {
return this.getSelectedRows().count();
async countSelectedRows() {
return await this.getSelectedRows().count();
}
getNthRow(nth: number): ElementFinder {
getNthRow(nth: number) {
return this.getRows().get(nth - 1);
}
getRowByName(name: string): ElementFinder {
getRowByName(name: string) {
return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
}
getRowFirstCell(name: string) {
return this.getRowByName(name)
.all(by.css(DataTable.selectors.cell))
.get(0);
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(0);
}
getRowNameCell(name: string) {
return this.getRowByName(name)
.all(by.css(DataTable.selectors.cell))
.get(1);
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1);
}
getRowNameCellText(name: string) {
return this.getRowNameCell(name).$('span');
}
getItemNameTooltip(name: string): promise.Promise<string> {
return this.getRowNameCellText(name).getAttribute('title');
async getItemNameTooltip(name: string) {
return await this.getRowNameCellText(name).getAttribute('title');
}
hasCheckMarkIcon(itemName: string) {
return this.getRowByName(itemName)
.element(by.css(DataTable.selectors.selectedIcon))
.isPresent();
async hasCheckMarkIcon(itemName: string) {
return await this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent();
}
getNameLink(itemName: string) {
return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink);
}
hasLinkOnName(itemName: string) {
return this.getNameLink(itemName).isPresent();
async hasLinkOnName(itemName: string) {
return await this.getNameLink(itemName).isPresent();
}
// Navigation/selection methods
doubleClickOnRowByName(name: string): promise.Promise<any> {
async doubleClickOnRowByName(name: string) {
const item = this.getRowFirstCell(name);
return Utils.waitUntilElementClickable(item).then(() =>
browser
.actions()
.mouseMove(item)
.click()
.click()
.perform()
);
await Utils.waitUntilElementClickable(item);
await browser.actions().mouseMove(item).perform();
await browser.actions().click().click().perform();
}
selectItem(name: string): promise.Promise<any> {
const item = this.getRowFirstCell(name);
return Utils.waitUntilElementClickable(item).then(() => item.click());
async selectItem(name: string) {
try{
const item = this.getRowFirstCell(name);
// await Utils.waitUntilElementClickable(item);
await item.click();
} catch (e) {
console.log('--- select item catch : ', e);
}
}
clickNameLink(itemName: string) {
return this.getNameLink(itemName).click();
async clickNameLink(itemName: string) {
await this.getNameLink(itemName).click();
}
selectMultipleItems(names: string[]): promise.Promise<void> {
return this.clearSelection()
.then(() =>
browser
.actions()
.sendKeys(protractor.Key.COMMAND)
.perform()
)
.then(() => {
names.forEach(name => {
this.selectItem(name);
});
})
.then(() =>
browser
.actions()
.sendKeys(protractor.Key.NULL)
.perform()
);
async selectMultipleItems(names: string[]) {
await this.clearSelection();
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
for (const name of names) {
await this.selectItem(name);
}
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
clearSelection(): promise.Promise<void> {
return this.getSelectedRows()
.count()
.then(count => {
if (count !== 0) {
browser.refresh().then(() => this.waitForHeader());
}
});
async clearSelection() {
try {
const count = await this.countSelectedRows();
if (count !== 0) {
await browser.refresh();
await this.waitForHeader();
}
} catch (error) {
console.log('------ clearSelection catch : ', error);
}
}
async rightClickOnItem(itemName: string) {
const item = this.getRowFirstCell(itemName);
await browser
.actions()
.click(item, protractor.Button.RIGHT)
.perform();
await browser.actions().click(item, protractor.Button.RIGHT).perform();
}
async rightClickOnMultipleSelection() {
await this.waitForHeader();
const itemFromSelection = this.getSelectedRows().get(0);
await browser
.actions()
.click(itemFromSelection, protractor.Button.RIGHT)
.perform();
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
}
getItemLocation(name: string) {
getItemLocationEl(name: string) {
return this.getRowByName(name).element(this.locationLink);
}
getItemLocationTooltip(name: string): promise.Promise<string> {
return this.getItemLocation(name)
.$('a')
.getAttribute('title');
async getItemLocation(name: string) {
return await this.getItemLocationEl(name).getText();
}
getItemLocationTileAttr(name: string) {
const location = this.getItemLocation(name).$('a');
async getItemLocationTooltip(name: string) {
return await this.getItemLocationEl(name).$('a').getAttribute('title');
}
async getItemLocationTileAttr(name: string) {
const location = this.getItemLocationEl(name).$('a');
const condition = () => location.getAttribute('title').then(value => value && value.length > 0);
browser
.actions()
.mouseMove(location)
.perform();
await browser.actions().mouseMove(location).perform();
browser.wait(condition, BROWSER_WAIT_TIMEOUT);
return location.getAttribute('title');
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
return await location.getAttribute('title');
}
clickItemLocation(name: string) {
return this.getItemLocation(name).click();
async clickItemLocation(name: string) {
await this.getItemLocationEl(name).click();
}
// empty state methods
isEmptyList(): promise.Promise<boolean> {
return this.emptyList.isPresent();
async isEmptyList() {
return await this.emptyList.isPresent();
}
isEmptyWithDragAndDrop(): promise.Promise<boolean> {
return this.emptyFolderDragAndDrop.isDisplayed();
async isEmptyWithDragAndDrop() {
return await this.emptyFolderDragAndDrop.isDisplayed();
}
getEmptyDragAndDropText(): promise.Promise<string> {
return this.isEmptyWithDragAndDrop().then(() => {
return this.emptyFolderDragAndDrop.getText();
});
async getEmptyDragAndDropText() {
const isEmpty = await this.isEmptyWithDragAndDrop();
if (isEmpty) {
return await this.emptyFolderDragAndDrop.getText();
}
}
getEmptyStateTitle(): promise.Promise<string> {
return this.isEmptyList().then(() => {
return this.emptyListTitle.getText();
});
async getEmptyStateTitle() {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListTitle.getText();
}
}
getEmptyStateSubtitle(): promise.Promise<string> {
return this.isEmptyList().then(() => {
return this.emptyListSubtitle.getText();
});
async getEmptyStateSubtitle() {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListSubtitle.getText();
}
}
getEmptyStateText(): promise.Promise<string> {
return this.isEmptyList().then(() => {
return this.emptyListText.getText();
});
async getEmptyStateText() {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListText.getText();
}
}
getCellsContainingName(name: string) {
return this.getRows()
.all(by.cssContainingText(DataTable.selectors.cell, name))
.map(cell => cell.getText());
async getCellsContainingName(name: string) {
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
return rows.map(async cell => await cell.getText());
}
async hasContextMenu() {
return (await this.menu.getItemsCount()) > 0;
const count = await this.menu.getItemsCount();
return count > 0;
}
}

View File

@ -28,42 +28,42 @@ import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
export class ConfirmDialog extends Component {
private static selectors = {
root: 'adf-confirm-dialog',
private static selectors = {
root: 'adf-confirm-dialog',
title: '.mat-dialog-title',
content: '.mat-dialog-content',
delete: 'adf-confirm-accept',
keep: 'adf-confirm-cancel'
};
title: '.mat-dialog-title',
content: '.mat-dialog-content',
delete: 'adf-confirm-accept',
keep: 'adf-confirm-cancel'
};
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete));
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep));
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete));
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep));
constructor(ancestor?: ElementFinder) {
super(ConfirmDialog.selectors.root, ancestor);
}
constructor(ancestor?: ElementFinder) {
super(ConfirmDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async waitForDialogToClose() {
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async getTitle() {
return await this.title.getText();
}
async getTitle() {
return await this.title.getText();
}
async getText() {
return await this.content.getText();
}
async getText() {
return await this.content.getText();
}
async clickDelete() {
await this.deleteButton.click();
}
async clickDelete() {
await this.deleteButton.click();
}
async clickKeep() {
await this.keepButton.click();
await this.waitForDialogToClose();
}
async clickKeep() {
await this.keepButton.click();
await this.waitForDialogToClose();
}
}

View File

@ -29,80 +29,75 @@ import { Component } from '../component';
import { Utils } from '../../utilities/utils';
export class CreateOrEditFolderDialog extends Component {
private static selectors = {
root: 'adf-folder-dialog',
private static selectors = {
root: 'adf-folder-dialog',
title: '.mat-dialog-title',
nameInput: 'input[placeholder="Name" i]',
descriptionTextArea: 'textarea[placeholder="Description" i]',
button: '.mat-dialog-actions button',
validationMessage: '.mat-hint span'
};
title: '.mat-dialog-title',
nameInput: 'input[placeholder="Name" i]',
descriptionTextArea: 'textarea[placeholder="Description" i]',
button: '.mat-dialog-actions button',
validationMessage: '.mat-hint span'
};
title: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.title));
nameInput: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
descriptionTextArea: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
createButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Create'));
cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Cancel'));
updateButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Update'));
validationMessage: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
title: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.title));
nameInput: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.nameInput));
descriptionTextArea: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea));
createButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Create'));
cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Cancel'));
updateButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Update'));
validationMessage: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage));
constructor(ancestor?: ElementFinder) {
super(CreateOrEditFolderDialog.selectors.root, ancestor);
}
constructor(ancestor?: ElementFinder) {
super(CreateOrEditFolderDialog.selectors.root, ancestor);
}
waitForDialogToOpen() {
return browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT)
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT));
async waitForDialogToOpen() {
await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
}
}
async waitForDialogToClose() {
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
waitForDialogToClose() {
return browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async getTitle() {
return await this.title.getText();
}
getTitle(): promise.Promise<string> {
return this.title.getText();
}
async isValidationMessageDisplayed() {
return await this.validationMessage.isDisplayed();
}
isValidationMessageDisplayed(): promise.Promise<boolean> {
return this.validationMessage.isDisplayed();
}
async getValidationMessage() {
await this.isValidationMessageDisplayed();
return await this.validationMessage.getText();
}
getValidationMessage(): promise.Promise<string> {
return this.isValidationMessageDisplayed()
.then(() => this.validationMessage.getText());
}
async enterName(name: string) {
await this.nameInput.clear();
await Utils.typeInField(this.nameInput, name);
}
enterName(name: string) {
return this.nameInput.clear()
// .then(() => this.nameInput.sendKeys(name));
.then(() => Utils.typeInField(this.nameInput, name));
}
async enterDescription(description: string) {
await this.descriptionTextArea.clear();
await Utils.typeInField(this.descriptionTextArea, description);
}
enterDescription(description: string) {
return this.descriptionTextArea.clear()
// .then(() => this.descriptionTextArea.sendKeys(description));
.then(() => Utils.typeInField(this.descriptionTextArea, description));
}
async deleteNameWithBackspace() {
await this.nameInput.clear();
await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
deleteNameWithBackspace(): promise.Promise<void> {
return this.nameInput.clear()
.then(() => {
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
});
}
async clickCreate() {
await this.createButton.click();
}
clickCreate() {
return this.createButton.click();
}
async clickCancel() {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
clickCancel() {
return this.cancelButton.click()
.then(() => this.waitForDialogToClose());
}
clickUpdate() {
return this.updateButton.click();
}
async clickUpdate() {
await this.updateButton.click();
}
}

View File

@ -45,7 +45,7 @@ export class ShareDialog extends Component {
}
async waitForDialogToClose() {
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async isDialogOpen() {

View File

@ -30,34 +30,34 @@ import { protractor } from 'protractor';
import { Utils } from '../../utilities/utils';
export class Header extends Component {
private locators = {
logoLink: by.css('.app-menu__title'),
userInfo: by.css('aca-current-user'),
searchButton: by.css('#adf-search-button'),
searchBar: by.css('#adf-control-input')
};
private locators = {
logoLink: by.css('.app-menu__title'),
userInfo: by.css('aca-current-user'),
searchButton: by.css('#adf-search-button'),
searchBar: by.css('#adf-control-input')
};
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
userInfo: UserInfo = new UserInfo(this.component);
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
userInfo: UserInfo = new UserInfo(this.component);
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
constructor(ancestor?: ElementFinder) {
super('adf-layout-header', ancestor);
}
constructor(ancestor?: ElementFinder) {
super('adf-layout-header', ancestor);
}
searchForText(text: string) {
return this.searchBar.clear()
.then(() => this.searchBar.sendKeys(text))
.then(() => this.searchBar.sendKeys(protractor.Key.ENTER));
}
async searchForText(text: string) {
await this.searchBar.clear();
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
async waitForSearchButton() {
return await Utils.waitUntilElementClickable(this.searchButton);
}
async waitForSearchButton() {
await Utils.waitUntilElementClickable(this.searchButton);
}
async waitForSearchBar() {
return await Utils.waitUntilElementClickable(this.searchBar);
}
async waitForSearchBar() {
await Utils.waitUntilElementClickable(this.searchBar);
}
}

View File

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

View File

@ -23,73 +23,73 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class InfoDrawer extends Component {
private static selectors = {
root: 'aca-info-drawer',
private static selectors = {
root: 'aca-info-drawer',
header: '.adf-info-drawer-layout-header',
content: '.adf-info-drawer-layout-content',
header: '.adf-info-drawer-layout-header',
content: '.adf-info-drawer-layout-content',
tabs: '.adf-info-drawer-tabs',
tabLabel: '.mat-tab-label-content',
tabActiveLabel: '.mat-tab-label-active',
tabs: '.adf-info-drawer-tabs',
tabLabel: '.mat-tab-label-content',
tabActiveLabel: '.mat-tab-label-active',
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
};
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
};
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
constructor(ancestor?: ElementFinder) {
super(InfoDrawer.selectors.root, ancestor);
constructor(ancestor?: ElementFinder) {
super(InfoDrawer.selectors.root, ancestor);
}
async waitForInfoDrawerToOpen() {
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
}
async isEmpty() {
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
return false;
}
return true;
}
async waitForInfoDrawerToOpen() {
return browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
}
getTabByTitle(title: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
}
async isEmpty() {
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
return false;
}
return true;
}
async isTabPresent(title: string) {
return await this.getTabByTitle(title).isPresent();
}
getTabByTitle(title: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
}
async isTabDisplayed(title: string) {
return await this.getTabByTitle(title).isDisplayed();
}
async isTabPresent(title: string) {
return await this.getTabByTitle(title).isPresent();
}
async getTabTitle(index: number) {
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
}
async isTabDisplayed(title: string) {
return await this.getTabByTitle(title).isDisplayed();
}
async clickTab(title: string) {
await this.getTabByTitle(title).click();
}
async getTabTitle(index: number) {
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
}
async clickTab(title: string) {
return await this.getTabByTitle(title).click();
}
async getComponentIdOfTab(title: string) {
return await this.tabActiveContent.getAttribute('data-automation-id');
}
async getComponentIdOfTab(title: string) {
return await this.tabActiveContent.getAttribute('data-automation-id');
}
}

View File

@ -23,83 +23,76 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { by, ElementFinder, promise } from 'protractor';
import { by, ElementFinder } from 'protractor';
import { Component } from '../component';
export class LoginComponent extends Component {
static selector = 'adf-login';
static selector = 'adf-login';
private locators = {
usernameInput: by.css('input#username'),
passwordInput: by.css('input#password'),
passwordVisibility: by.css('.adf-login-password-icon'),
submitButton: by.css('button#login-button'),
errorMessage: by.css('.login-error-message'),
copyright: by.css('.copyright')
};
private locators = {
usernameInput: by.css('input#username'),
passwordInput: by.css('input#password'),
passwordVisibility: by.css('.adf-login-password-icon'),
submitButton: by.css('button#login-button'),
errorMessage: by.css('.login-error-message'),
copyright: by.css('.copyright')
};
usernameInput: ElementFinder = this.component.element(this.locators.usernameInput);
passwordInput: ElementFinder = this.component.element(this.locators.passwordInput);
submitButton: ElementFinder = this.component.element(this.locators.submitButton);
errorMessage: ElementFinder = this.component.element(this.locators.errorMessage);
copyright: ElementFinder = this.component.element(this.locators.copyright);
passwordVisibility: ElementFinder = this.component.element(this.locators.passwordVisibility);
usernameInput: ElementFinder = this.component.element(this.locators.usernameInput);
passwordInput: ElementFinder = this.component.element(this.locators.passwordInput);
submitButton: ElementFinder = this.component.element(this.locators.submitButton);
errorMessage: ElementFinder = this.component.element(this.locators.errorMessage);
copyright: ElementFinder = this.component.element(this.locators.copyright);
passwordVisibility: ElementFinder = this.component.element(this.locators.passwordVisibility);
constructor(ancestor?: ElementFinder) {
super(LoginComponent.selector, ancestor);
constructor(ancestor?: ElementFinder) {
super(LoginComponent.selector, ancestor);
}
async enterUsername(username: string) {
const { usernameInput } = this;
await usernameInput.clear();
await usernameInput.sendKeys(username);
}
async enterPassword(password: string) {
const { passwordInput } = this;
await passwordInput.clear();
await passwordInput.sendKeys(password);
}
async enterCredentials(username: string, password: string) {
await this.enterUsername(username);
await this.enterPassword(password);
}
submit() {
return this.submitButton.click();
}
async getPasswordVisibility() {
const text = await this.passwordVisibility.getText();
if (text.endsWith('visibility_off')) {
return false;
}
enterUsername(username: string): LoginComponent {
const { usernameInput } = this;
usernameInput.clear();
usernameInput.sendKeys(username);
return this;
else {
if (text.endsWith('visibility')) {
return true;
}
}
}
enterPassword(password: string): LoginComponent {
const { passwordInput } = this;
passwordInput.clear();
passwordInput.sendKeys(password);
return this;
async isPasswordShown() {
const type = await this.passwordInput.getAttribute('type');
if (type === 'text') {
return true;
}
enterCredentials(username: string, password: string) {
this.enterUsername(username).enterPassword(password);
return this;
}
submit(): promise.Promise<void> {
return this.submitButton.click();
}
getPasswordVisibility() {
return this.passwordVisibility.getText()
.then(text => {
if (text.endsWith('visibility_off')) {
return false;
} else {
if (text.endsWith('visibility')) {
return true;
}
}
});
}
isPasswordShown() {
return this.passwordInput.getAttribute('type')
.then(type => {
if (type === 'text') {
return true;
} else {
if (type === 'password') {
return false;
}
}
});
else {
if (type === 'password') {
return false;
}
}
}
}

View File

@ -23,92 +23,96 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, promise } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
import { Utils } from '../../utilities/utils'
export class Menu extends Component {
private static selectors = {
root: '.mat-menu-panel',
item: '.mat-menu-item',
icon: '.mat-icon',
uploadFiles: 'app-upload-files'
};
private static selectors = {
root: '.mat-menu-panel',
item: '.mat-menu-item',
icon: '.mat-icon',
uploadFiles: 'app-upload-files'
};
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor);
constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor);
}
async waitForMenuToOpen() {
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT);
}
async waitForMenuToClose() {
await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
}
async closeMenu() {
// if (await this.backdrop.isPresent()) {
// return await this.backdrop.click();
// } else {
// return await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
// }
return Utils.pressEscape();
}
getNthItem(nth: number) {
return this.items.get(nth - 1);
}
getItemByLabel(menuItem: string) {
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem));
}
getItemById(id: string) {
return this.component.element(by.id(id));
}
async getItemTooltip(menuItem: string) {
return await this.getItemByLabel(menuItem).getAttribute('title');
}
async getItemIconText(menuItem: string) {
return await this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
}
async getItemIdAttribute(menuItem: string) {
return await this.getItemByLabel(menuItem).getAttribute('id');
}
async getItemsCount() {
return await this.items.count();
}
async clickNthItem(nth: number) {
const elem = this.getNthItem(nth);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await browser.actions().mouseMove(elem).click().perform();
await this.waitForMenuToClose();
}
async clickMenuItem(menuItem: string) {
try {
const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await elem.click();
} catch (e) {
console.log('___click menu item catch___', e);
}
}
waitForMenuToOpen() {
return browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT)
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT))
.then(() => browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT));
}
async isMenuItemPresent(title: string) {
return await this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
}
waitForMenuToClose() {
return browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
}
closeMenu() {
if (this.backdrop.isPresent()) {
return this.backdrop.click();
} else {
return browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
}
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getItemByLabel(menuItem: string): ElementFinder {
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem));
}
getItemById(id: string) {
return this.component.element(by.id(id));
}
getItemTooltip(menuItem: string): promise.Promise<string> {
return this.getItemByLabel(menuItem).getAttribute('title');
}
getItemIconText(menuItem: string) {
return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
}
getItemIdAttribute(menuItem: string) {
return this.getItemByLabel(menuItem).getAttribute('id');
}
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
clickNthItem(nth: number): promise.Promise<any> {
const elem = this.getNthItem(nth);
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT)
.then(() => browser.actions().mouseMove(elem).click().perform())
.then(() => this.waitForMenuToClose());
}
clickMenuItem(menuItem: string): promise.Promise<any> {
const elem = this.getItemByLabel(menuItem);
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT)
.then(() => elem.click())
.then(() => this.waitForMenuToClose());
}
isMenuItemPresent(title: string): promise.Promise<boolean> {
return this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
}
uploadFile() {
return this.uploadFiles;
}
uploadFile() {
return this.uploadFiles;
}
}

View File

@ -23,76 +23,76 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, promise, by } from 'protractor';
import { ElementFinder, by } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
export class Pagination extends Component {
private static selectors = {
root: 'adf-pagination',
range: '.adf-pagination__range',
maxItems: '.adf-pagination__max-items',
currentPage: '.adf-pagination__current-page',
totalPages: '.adf-pagination__total-pages',
private static selectors = {
root: 'adf-pagination',
range: '.adf-pagination__range',
maxItems: '.adf-pagination__max-items',
currentPage: '.adf-pagination__current-page',
totalPages: '.adf-pagination__total-pages',
previousButton: '.adf-pagination__previous-button',
nextButton: '.adf-pagination__next-button',
maxItemsButton: '.adf-pagination__max-items + button[mat-icon-button]',
pagesButton: '.adf-pagination__current-page + button[mat-icon-button]'
};
previousButton: '.adf-pagination__previous-button',
nextButton: '.adf-pagination__next-button',
maxItemsButton: '.adf-pagination__max-items + button[mat-icon-button]',
pagesButton: '.adf-pagination__current-page + button[mat-icon-button]'
};
range: ElementFinder = this.component.element(by.css(Pagination.selectors.range));
maxItems: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItems));
currentPage: ElementFinder = this.component.element(by.css(Pagination.selectors.currentPage));
totalPages: ElementFinder = this.component.element(by.css(Pagination.selectors.totalPages));
previousButton: ElementFinder = this.component.element(by.css(Pagination.selectors.previousButton));
nextButton: ElementFinder = this.component.element(by.css(Pagination.selectors.nextButton));
maxItemsButton: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItemsButton));
pagesButton: ElementFinder = this.component.element(by.css(Pagination.selectors.pagesButton));
range: ElementFinder = this.component.element(by.css(Pagination.selectors.range));
maxItems: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItems));
currentPage: ElementFinder = this.component.element(by.css(Pagination.selectors.currentPage));
totalPages: ElementFinder = this.component.element(by.css(Pagination.selectors.totalPages));
previousButton: ElementFinder = this.component.element(by.css(Pagination.selectors.previousButton));
nextButton: ElementFinder = this.component.element(by.css(Pagination.selectors.nextButton));
maxItemsButton: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItemsButton));
pagesButton: ElementFinder = this.component.element(by.css(Pagination.selectors.pagesButton));
menu: Menu = new Menu();
menu: Menu = new Menu();
constructor(ancestor?: ElementFinder) {
super(Pagination.selectors.root, ancestor);
}
constructor(ancestor?: ElementFinder) {
super(Pagination.selectors.root, ancestor);
}
openMaxItemsMenu(): promise.Promise<Menu> {
const { menu, maxItemsButton } = this;
async openMaxItemsMenu() {
const { menu, maxItemsButton } = this;
return maxItemsButton.click()
.then(() => menu.waitForMenuToOpen())
.then(() => menu);
}
await maxItemsButton.click();
await menu.waitForMenuToOpen();
// return menu;
}
openCurrentPageMenu(): promise.Promise<Menu> {
const { menu, pagesButton } = this;
async openCurrentPageMenu() {
const { menu, pagesButton } = this;
return pagesButton.click()
.then(() => menu.waitForMenuToOpen())
.then(() => menu);
}
await pagesButton.click();
await menu.waitForMenuToOpen();
// return menu;
}
getText(elem: ElementFinder) {
return elem.getText();
}
async getText(elem: ElementFinder) {
return await elem.getText();
}
resetToDefaultPageSize(): promise.Promise<any> {
return this.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => this.menu.waitForMenuToClose());
}
async resetToDefaultPageSize() {
await this.openMaxItemsMenu();
await this.menu.clickMenuItem('25');
await this.menu.waitForMenuToClose();
}
resetToDefaultPageNumber(): promise.Promise<any> {
return this.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => this.menu.waitForMenuToClose());
}
async resetToDefaultPageNumber() {
await this.openCurrentPageMenu();
await this.menu.clickMenuItem('1');
await this.menu.waitForMenuToClose();
}
clickNext(): promise.Promise<any> {
return this.nextButton.click();
}
async clickNext() {
await this.nextButton.click();
}
clickPrevious(): promise.Promise<any> {
return this.previousButton.click();
}
async clickPrevious() {
await this.previousButton.click();
}
}

View File

@ -23,60 +23,68 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
import { Utils } from '../../utilities/utils';
export class Sidenav extends Component {
private static selectors = {
root: 'app-sidenav',
link: '.sidenav-menu__item',
label: '.menu__item--label',
activeLink: '.menu__item--active',
newButton: '[data-automation-id="create-button"]'
};
private static selectors = {
root: 'app-sidenav',
link: '.sidenav-menu__item',
label: '.menu__item--label',
activeLink: '.menu__item--active',
newButton: '[data-automation-id="create-button"]'
};
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeLink));
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeLink));
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
menu: Menu = new Menu();
menu: Menu = new Menu();
constructor(ancestor?: ElementFinder) {
super(Sidenav.selectors.root, ancestor);
}
openNewMenu(): promise.Promise<Menu> {
const { menu, newButton } = this;
return newButton.click()
.then(() => menu.waitForMenuToOpen())
.then(() => menu);
}
openCreateDialog(): any {
return this.openNewMenu()
.then(() => this.menu.clickMenuItem('Create folder'));
}
isActiveByLabel(label: string): promise.Promise<boolean> {
return this.getLinkByLabel(label).getAttribute('class')
.then(className => className.includes(Sidenav.selectors.activeLink.replace('.', '')));
}
getLink(label: string): ElementFinder {
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
}
getLinkByLabel(label: string): ElementFinder {
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
}
getLinkTooltip(label: string): promise.Promise<string> {
return this.getLink(label).getAttribute('title');
}
navigateToLinkByLabel(label: string): promise.Promise<any> {
return this.getLinkByLabel(label).click();
constructor(ancestor?: ElementFinder) {
super(Sidenav.selectors.root, ancestor);
}
async openNewMenu() {
const { menu, newButton } = this;
await newButton.click();
await menu.waitForMenuToOpen();
}
async openCreateDialog() {
await this.openNewMenu();
await this.menu.clickMenuItem('Create folder');
}
async isActiveByLabel(label: string) {
const className = await this.getLinkByLabel(label).getAttribute('class');
return className.includes(Sidenav.selectors.activeLink.replace('.', ''));
}
getLink(label: string) {
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
}
getLinkByLabel(label: string) {
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
// return browser.element(by.xpath(`.//*[.="${label}" and class="${Sidenav.selectors.label}"]`))
}
async getLinkTooltip(label: string) {
return await this.getLink(label).getAttribute('title');
}
async navigateToLinkByLabel(label: string) {
try{
const link = this.getLinkByLabel(label);
await Utils.waitUntilElementClickable(link);
return await link.click();
} catch (e){
console.log('---- sidebar navigation catch : ', e);
}
}
}

View File

@ -28,54 +28,58 @@ import { Menu } from '../menu/menu';
import { Component } from '../component';
export class Toolbar extends Component {
private static selectors = {
root: '.adf-toolbar',
button: '.mat-icon-button'
};
private static selectors = {
root: '.adf-toolbar',
button: '.mat-icon-button'
};
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
constructor(ancestor?: ElementFinder) {
super(Toolbar.selectors.root, ancestor);
}
constructor(ancestor?: ElementFinder) {
super(Toolbar.selectors.root, ancestor);
}
async isEmpty() {
return await this.buttons.count() === 0;
}
async isEmpty() {
const count = await this.buttons.count();
return count === 0;
}
async isButtonPresent(title: string) {
return await this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)).isPresent();
}
async isButtonPresent(title: string) {
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
return await elem.isPresent();
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
}
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
}
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
}
getButtonById(id: string) {
return this.component.element(by.id(id));
}
getButtonById(id: string) {
return this.component.element(by.id(id));
}
async openMoreMenu() {
await this.getButtonByTitleAttribute('More actions').click();
await this.menu.waitForMenuToOpen();
return this.menu;
}
async openMoreMenu() {
await this.isButtonPresent('More actions');
const moreMenu = this.getButtonByTitleAttribute('More actions');
await moreMenu.click();
await this.menu.waitForMenuToOpen();
// return this.menu;
}
async closeMoreMenu() {
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async closeMoreMenu() {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
async clickButton(title: string) {
const btn = this.getButtonByTitleAttribute(title);
await btn.click();
}
async clickButton(title: string) {
const btn = this.getButtonByTitleAttribute(title);
await btn.click();
}
}

View File

@ -29,74 +29,74 @@ import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Toolbar } from '../toolbar/toolbar';
export class Viewer extends Component {
private static selectors = {
root: 'adf-viewer',
private static selectors = {
root: 'adf-viewer',
layout: '.adf-viewer-layout-content',
contentContainer: '.adf-viewer-content-container',
closeBtn: '.adf-viewer-close-button',
fileTitle: '.adf-viewer__file-title',
layout: '.adf-viewer-layout-content',
contentContainer: '.adf-viewer-content-container',
closeBtn: '.adf-viewer-close-button',
fileTitle: '.adf-viewer__file-title',
viewerExtensionContent: 'app-preview-extension'
};
viewerExtensionContent: 'app-preview-extension'
};
root: ElementFinder = browser.$(Viewer.selectors.root);
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
root: ElementFinder = browser.$(Viewer.selectors.root);
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
toolbar = new Toolbar(this.component);
toolbar = new Toolbar(this.component);
constructor(ancestor?: ElementFinder) {
super(Viewer.selectors.root, ancestor);
}
async waitForViewerToOpen() {
return await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT)
.catch(err => err);
}
async isViewerOpened() {
return await browser.isElementPresent(this.viewerLayout);
}
async isViewerContentDisplayed() {
return await browser.isElementPresent(this.viewerContainer);
}
async isViewerToolbarDisplayed() {
return await browser.isElementPresent(this.toolbar.component);
}
async isCloseButtonDisplayed() {
return await browser.isElementPresent(this.closeButton);
}
async isFileTitleDisplayed() {
return await browser.isElementPresent(this.fileTitle);
}
async clickClose() {
return await this.closeButton.click();
}
async getCloseButtonTooltip() {
return await this.toolbar.getButtonTooltip(this.closeButton);
}
async getFileTitle() {
return await this.fileTitle.getText();
}
async isCustomContentPresent() {
return await browser.isElementPresent(this.viewerExtensionContent);
}
async getComponentIdOfView() {
if (await this.isCustomContentPresent()) {
return await this.viewerExtensionContent.getAttribute('data-automation-id');
}
constructor(ancestor?: ElementFinder) {
super(Viewer.selectors.root, ancestor);
}
async waitForViewerToOpen() {
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
}
async isViewerOpened() {
return await browser.isElementPresent(this.viewerLayout);
// return await this.viewerLayout.isPresent();
}
async isViewerContentDisplayed() {
return await browser.isElementPresent(this.viewerContainer);
}
async isViewerToolbarDisplayed() {
return await browser.isElementPresent(this.toolbar.component);
}
async isCloseButtonDisplayed() {
return await browser.isElementPresent(this.closeButton);
}
async isFileTitleDisplayed() {
return await browser.isElementPresent(this.fileTitle);
}
async clickClose() {
await this.closeButton.click();
}
async getCloseButtonTooltip() {
return await this.toolbar.getButtonTooltip(this.closeButton);
}
async getFileTitle() {
return await this.fileTitle.getText();
}
async isCustomContentPresent() {
return await browser.isElementPresent(this.viewerExtensionContent);
}
async getComponentIdOfView() {
if (await this.isCustomContentPresent()) {
return await this.viewerExtensionContent.getAttribute('data-automation-id');
}
}
}

View File

@ -28,14 +28,14 @@ import { Header, DataTable, Pagination, Toolbar, Breadcrumb, Sidenav } from '../
import { Page } from './page';
export class BrowsingPage extends Page {
header = new Header(this.app);
sidenav = new Sidenav(this.app);
toolbar = new Toolbar(this.app);
breadcrumb = new Breadcrumb(this.app);
dataTable = new DataTable(this.app);
pagination = new Pagination(this.app);
header = new Header(this.app);
sidenav = new Sidenav(this.app);
toolbar = new Toolbar(this.app);
breadcrumb = new Breadcrumb(this.app);
dataTable = new DataTable(this.app);
pagination = new Pagination(this.app);
signOut(): promise.Promise<void> {
return this.header.userInfo.signOut();
}
async signOut() {
await this.header.userInfo.signOut();
}
}

View File

@ -22,54 +22,47 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, ExpectedConditions as EC, promise } from 'protractor';
import { browser, ExpectedConditions as EC } from 'protractor';
import { LoginComponent } from '../components/components';
import { Page } from './page';
import { Utils } from '../utilities/utils';
import {
ADMIN_USERNAME,
ADMIN_PASSWORD,
BROWSER_WAIT_TIMEOUT,
APP_ROUTES
} from '../configs';
import { ADMIN_USERNAME, ADMIN_PASSWORD, BROWSER_WAIT_TIMEOUT, APP_ROUTES } from '../configs';
export class LoginPage extends Page {
login: LoginComponent = new LoginComponent(this.app);
login: LoginComponent = new LoginComponent(this.app);
/** @override */
constructor() {
super(APP_ROUTES.LOGIN);
}
/** @override */
constructor() {
super(APP_ROUTES.LOGIN);
}
/** @override */
load(): promise.Promise<any> {
return super.load().then(() => {
const { submitButton } = this.login;
const hasSubmitButton = EC.presenceOf(submitButton);
/** @override */
async load() {
await super.load();
const { submitButton } = this.login;
const hasSubmitButton = EC.presenceOf(submitButton);
return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT);
}
return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT)
.then(() => Utils.clearLocalStorage())
.then(() => browser.manage().deleteAllCookies());
});
}
async loginWith(username: string, password?: string) {
const pass = password || username;
await this.load();
await this.login.enterCredentials(username, pass)
await this.login.submit();
return super.waitForApp();
}
loginWith(username: string, password?: string): promise.Promise<any> {
const pass = password || username;
return this.load()
.then(() => this.login.enterCredentials(username, pass).submit())
.then(() => super.waitForApp());
}
async loginWithAdmin() {
await this.load();
return this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD);
}
loginWithAdmin(): promise.Promise<any> {
return this.load()
.then(() => this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD));
}
tryLoginWith(username: string, password?: string): promise.Promise<void> {
const pass = password || username;
return this.load()
.then(() => this.login.enterCredentials(username, pass).submit())
.then(() => browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT));
}
async tryLoginWith(username: string, password?: string) {
const pass = password || username;
await this.load();
await this.login.enterCredentials(username, pass);
await this.login.submit();
return browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT);
}
}

View File

@ -23,21 +23,20 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { promise } from 'protractor';
import { Page } from './page';
import { APP_ROUTES } from '../configs';
import { Utils } from '../utilities/utils';
export class LogoutPage extends Page {
/** @override */
constructor() {
super(APP_ROUTES.LOGIN);
}
/** @override */
constructor() {
super(APP_ROUTES.LOGIN);
}
/** @override */
load(): promise.Promise<any> {
return Utils.clearLocalStorage()
.then(() => Utils.clearSessionStorage())
.then(() => super.load());
}
/** @override */
load() {
// await Utils.clearLocalStorage();
// await Utils.clearSessionStorage();
return super.load();
}
}

View File

@ -28,7 +28,6 @@ import {
element,
by,
ElementFinder,
promise,
ExpectedConditions as EC
} from 'protractor';
import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs';
@ -62,14 +61,13 @@ export abstract class Page {
constructor(public url: string = '') {}
get title(): promise.Promise<string> {
getTitle() {
return browser.getTitle();
}
load(relativeUrl: string = ''): promise.Promise<void> {
load(relativeUrl: string = '') {
const hash = USE_HASH_STRATEGY ? '/#' : '';
const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`;
return browser.get(path);
}
@ -78,68 +76,58 @@ export abstract class Page {
}
waitForSnackBarToAppear() {
return browser.wait(
EC.visibilityOf(this.snackBarContainer),
BROWSER_WAIT_TIMEOUT
);
return browser.wait(EC.visibilityOf(this.snackBarContainer), BROWSER_WAIT_TIMEOUT);
}
waitForSnackBarToClose() {
return browser.wait(
EC.not(EC.visibilityOf(this.snackBarContainer)),
BROWSER_WAIT_TIMEOUT
);
async waitForSnackBarToClose() {
await browser.wait(EC.not(EC.visibilityOf(this.snackBarContainer)), BROWSER_WAIT_TIMEOUT);
}
waitForDialog() {
return browser.wait(
EC.visibilityOf(this.dialogContainer),
BROWSER_WAIT_TIMEOUT
);
async waitForDialog() {
await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT);
}
waitForDialogToClose() {
return browser.wait(
EC.not(EC.visibilityOf(this.dialogContainer)),
BROWSER_WAIT_TIMEOUT
);
async waitForDialogToClose() {
await browser.wait(EC.not(EC.visibilityOf(this.dialogContainer)), BROWSER_WAIT_TIMEOUT);
}
refresh(): promise.Promise<void> {
return browser.refresh();
async refresh() {
await browser.refresh();
await this.waitForApp();
}
getDialogActionByLabel(label) {
return element(by.cssContainingText('.mat-button-wrapper', label));
}
isSnackBarDisplayed(): promise.Promise<boolean> {
return this.snackBar.isDisplayed();
async isSnackBarDisplayed() {
return await this.snackBar.isDisplayed();
}
getSnackBarMessage(): promise.Promise<string> {
return this.waitForSnackBarToAppear().then(() =>
this.snackBar.getAttribute('innerText')
);
async getSnackBarMessage() {
// await this.waitForSnackBarToAppear();
return await this.snackBar.getAttribute('innerText');
}
getSnackBarAction() {
return this.waitForSnackBarToAppear().then(() => this.snackBarAction);
async clickSnackBarAction() {
try {
// await this.waitForSnackBarToAppear();
// return browser.executeScript(function (elem) {
// elem.click();
// }, this.snackBarAction);
return await this.snackBarAction.click();
} catch (e) {
console.log(e, '.......failed on click snack bar action.........');
}
}
clickSnackBarAction() {
return this.waitForSnackBarToAppear().then(() => {
return browser.executeScript(function(elem) {
elem.click();
}, this.snackBarAction);
});
async isGenericErrorDisplayed() {
return await this.genericError.isDisplayed();
}
isGenericErrorDisplayed() {
return this.genericError.isDisplayed();
}
getGenericErrorTitle() {
return this.genericErrorTitle.getText();
async getGenericErrorTitle() {
return await this.genericErrorTitle.getText();
}
}

View File

@ -23,7 +23,6 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
@ -79,7 +78,7 @@ describe('Context menu actions - multiple selection : ', () => {
await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ]);
await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]);
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.favorites.waitForApi({ expect: 4 + 1 });
fileInTrash1Id = (await apis.user.nodes.createFile(fileInTrash1)).entry.id;
fileInTrash2Id = (await apis.user.nodes.createFile(fileInTrash2)).entry.id;
@ -92,12 +91,10 @@ describe('Context menu actions - multiple selection : ', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]),
apis.user.sites.deleteSite(siteName),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -105,7 +102,7 @@ describe('Context menu actions - multiple selection : ', () => {
describe('Generic tests', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
@ -133,6 +130,7 @@ describe('Context menu actions - multiple selection : ', () => {
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
@ -180,12 +178,12 @@ describe('Context menu actions - multiple selection : ', () => {
describe('on File Libraries', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -231,10 +229,10 @@ describe('Context menu actions - multiple selection : ', () => {
describe('on Shared Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -254,10 +252,10 @@ describe('Context menu actions - multiple selection : ', () => {
describe('Recent Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -277,10 +275,10 @@ describe('Context menu actions - multiple selection : ', () => {
describe('Favorites', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -329,10 +327,10 @@ describe('Context menu actions - multiple selection : ', () => {
describe('Trash', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});

View File

@ -73,20 +73,18 @@ describe('Context menu actions - single selection : ', () => {
await apis.user.favorites.addFavoriteById('file', fileUserId);
await apis.user.favorites.addFavoriteById('folder', folderUserId);
await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.favorites.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(fileUserId),
apis.user.nodes.deleteNodeById(folderUserId),
apis.user.sites.deleteSite(siteName),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(fileUserId);
await apis.user.nodes.deleteNodeById(folderUserId);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -94,7 +92,7 @@ describe('Context menu actions - single selection : ', () => {
describe('Generic tests', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
@ -142,10 +140,10 @@ describe('Context menu actions - single selection : ', () => {
describe('on Personal Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -181,7 +179,7 @@ describe('Context menu actions - single selection : ', () => {
describe('File Libraries', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
@ -221,7 +219,7 @@ describe('Context menu actions - single selection : ', () => {
describe('Shared Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
@ -246,7 +244,7 @@ describe('Context menu actions - single selection : ', () => {
describe('Recent Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
@ -270,7 +268,7 @@ describe('Context menu actions - single selection : ', () => {
describe('Favorites', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
@ -310,7 +308,7 @@ describe('Context menu actions - single selection : ', () => {
describe('Trash', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
done();

View File

@ -28,6 +28,7 @@ import { browser } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Menu } from '../../components/menu/menu';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
@ -53,6 +54,7 @@ describe('Create folder', () => {
const personalFilesPage = new BrowsingPage();
const createDialog = new CreateOrEditFolderDialog();
const { dataTable } = personalFilesPage;
const menu = new Menu();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
@ -67,11 +69,9 @@ describe('Create folder', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(parentId),
logoutPage.load()
]);
await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(parentId);
await logoutPage.load();
done();
});
@ -83,13 +83,13 @@ describe('Create folder', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});
it('option is enabled when having enough permissions - [C216339]', async () => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
const menu = await personalFilesPage.sidenav.openNewMenu();
await personalFilesPage.sidenav.openNewMenu();
const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(true, 'Create folder is not enabled');
});
@ -123,7 +123,7 @@ describe('Create folder', () => {
it('enabled option tooltip - [C216342]', async () => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
const menu = await personalFilesPage.sidenav.openNewMenu();
await personalFilesPage.sidenav.openNewMenu();
await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
expect(await menu.getItemTooltip('Create folder')).toContain('Create new folder');
});
@ -239,14 +239,14 @@ describe('Create folder', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});
it('option is disabled when not enough permissions - [C280397]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
const menu = await fileLibrariesPage.sidenav.openNewMenu();
await fileLibrariesPage.sidenav.openNewMenu();
const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled');
});
@ -254,7 +254,7 @@ describe('Create folder', () => {
it('disabled option tooltip - [C280398]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
const menu = await fileLibrariesPage.sidenav.openNewMenu();
await fileLibrariesPage.sidenav.openNewMenu();
await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
const tooltip = await menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`);

View File

@ -23,9 +23,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser } from 'protractor';
import { browser, ExpectedConditions as EC } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS } from '../../configs';
import { BROWSER_WAIT_TIMEOUT, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
@ -91,14 +91,10 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.unlockFile(file4Id),
apis.user.nodes.unlockFile(fileLocked1Id)
]);
await Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([file1Id, file2Id, folder1Id, folder2Id, fileLocked1Id])
]);
await apis.user.nodes.unlockFile(file4Id);
await apis.user.nodes.unlockFile(fileLocked1Id);
await logoutPage.load();
await apis.user.nodes.deleteNodesById([file1Id, file2Id, folder1Id, folder2Id, fileLocked1Id]);
await apis.user.search.waitForApi(username, {expect: 0});
done();
});
@ -209,7 +205,9 @@ describe('Delete and undo delete', () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction();
expect(await dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item was not restored');
expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
@ -271,10 +269,8 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
await Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id])
]);
await logoutPage.load();
await apis.user.nodes.deleteNodesById([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id]);
await apis.user.search.waitForApi(username, {expect: 0});
done();
});
@ -383,15 +379,11 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.unlockFile(favoriteFile4Id),
apis.user.nodes.unlockFile(favoriteFileLocked1Id)
]);
await Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([
favoriteFile1Id, favoriteFile2Id, favoriteFolder1Id, favoriteFolder2Id, favoriteFileLocked1Id
])
await apis.user.nodes.unlockFile(favoriteFile4Id);
await apis.user.nodes.unlockFile(favoriteFileLocked1Id);
await logoutPage.load();
await apis.user.nodes.deleteNodesById([
favoriteFile1Id, favoriteFile2Id, favoriteFolder1Id, favoriteFolder2Id, favoriteFileLocked1Id
]);
await apis.user.search.waitForApi(username, {expect: 0});
done();
@ -555,6 +547,7 @@ describe('Delete and undo delete', () => {
if (empty) {
await browser.sleep(6000);
await browser.refresh();
await page.waitForApp();
}
done();
});
@ -571,10 +564,8 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
await Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([recentFile1Id, recentFile2Id, recentFile3Id, recentFile4Id])
]);
await logoutPage.load();
await apis.user.nodes.deleteNodesById([recentFile1Id, recentFile2Id, recentFile3Id, recentFile4Id]);
done();
});

View File

@ -27,22 +27,22 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
import { browser } from 'protractor';
describe('Mark items as favorites', () => {
const username = `user-${Utils.random()}`;
const file1NotFav = `file-${Utils.random()}.txt`;
const file2NotFav = `file-${Utils.random()}.txt`;
const file3Fav = `file-${Utils.random()}.txt`;
const file4Fav = `file-${Utils.random()}.txt`;
const file1NotFav = `file1-${Utils.random()}.txt`;
const file2NotFav = `file2-${Utils.random()}.txt`;
const file3Fav = `file3-${Utils.random()}.txt`;
const file4Fav = `file4-${Utils.random()}.txt`;
const folder1 = `folder-${Utils.random()}`;
const siteName = `site-public-${Utils.random()}`;
const fileSiteNotFav1 = `file-site${Utils.random()}.txt`;
const fileSiteNotFav2 = `file-site${Utils.random()}.txt`;
const folderSite = `folder-${Utils.random()}`;
const fileSiteFav1 = `file-${Utils.random()}.txt`;
const fileSiteFav2 = `file-${Utils.random()}.txt`;
const fileSiteNotFav1 = `file1-site-${Utils.random()}.txt`;
const fileSiteNotFav2 = `file2-site-${Utils.random()}.txt`;
const folderSite = `folder-site-${Utils.random()}`;
const fileSiteFav1 = `file3-${Utils.random()}.txt`;
const fileSiteFav2 = `file4-${Utils.random()}.txt`;
let file1Id, file2Id, file3Id, file4Id, folder1Id, fileSiteNotFav1Id, fileSiteNotFav2Id, folderSiteId, fileSiteFav1Id, fileSiteFav2Id;
@ -67,8 +67,21 @@ describe('Mark items as favorites', () => {
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.search.waitForApi(username, { expect: 4 });
await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ]);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;
fileSiteNotFav2Id = (await apis.user.nodes.createFile(fileSiteNotFav2, folderSiteId)).entry.id;
fileSiteFav2Id = (await apis.user.nodes.createFile(fileSiteFav2, folderSiteId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
await apis.user.search.waitForApi(username, { expect: 8 });
await apis.user.shared.waitForApi({ expect: 4 });
await loginPage.loginWith(username);
done();
@ -86,17 +99,13 @@ describe('Mark items as favorites', () => {
xit('');
describe('on Personal Files', () => {
beforeAll(async (done) => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
beforeEach(async (done) => {
await toolbar.closeMoreMenu();
done();
});
it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', async () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
@ -119,288 +128,279 @@ describe('Mark items as favorites', () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite a folder - [C280390]', async () => {
await dataTable.selectItem(folder1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(folder1Id);
expect(isFavorite).toBe(true, `${folder1} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(folder1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C217190]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 1 });
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C217192]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C217194]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C217193]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ])
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await browser.sleep(2000);
const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]);
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Recent Files', () => {
beforeAll(async (done) => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
beforeEach(async (done) => {
await toolbar.closeMoreMenu();
done();
});
it('favorite a file - [C280352]', async () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C280353]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 1 });
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C280355]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C280357]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280356]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await browser.sleep(2000);
const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]);
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Shared Files', () => {
beforeAll(async (done) => {
await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ]);
await apis.user.shared.waitForApi({ expect: 4 });
await page.refresh();
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done();
});
it('favorite a file - [C280362]', async () => {
await dataTable.selectItem(file1NotFav)
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C280363]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 1 });
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C280365]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C280367]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]);
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280366]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await browser.sleep(2000);
const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]);
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Favorites', () => {
beforeAll(async (done) => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await page.refresh();
done();
});
it('unfavorite an item - [C280368]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 1 });
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, 'item is marked as favorite');
expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280374]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await browser.sleep(2000);
await apis.user.favorites.waitForApi({ expect: 3 });
const isFavorite3 = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite3).toBe(false, 'file3 marked as favorite');
expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
const isFavorite4 = await apis.user.favorites.isFavorite(file4Id);
expect(isFavorite3).toBe(false, 'file3 marked as favorite');
expect(isFavorite4).toBe(false, 'file4 marked as favorite');
expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
expect(await dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Favorite action has full star icon for items marked as favorite - [C280371]', async () => {
@ -411,32 +411,12 @@ describe('Mark items as favorites', () => {
});
describe ('on File Libraries', () => {
const fileLibrariesPage = new BrowsingPage();
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;
fileSiteNotFav2Id = (await apis.user.nodes.createFile(fileSiteNotFav2, folderSiteId)).entry.id;
fileSiteFav2Id = (await apis.user.nodes.createFile(fileSiteFav2, folderSiteId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
done();
});
beforeEach(async (done) => {
await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await fileLibrariesPage.dataTable.waitForHeader();
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
await fileLibrariesPage.dataTable.waitForHeader();
await toolbar.closeMoreMenu();
done();
});
afterEach(async (done) => {
await browser.refresh();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await page.dataTable.waitForHeader();
await page.dataTable.doubleClickOnRowByName(siteName);
await page.dataTable.waitForHeader();
done();
});
@ -444,78 +424,81 @@ describe('Mark items as favorites', () => {
await dataTable.selectItem(folderSite);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(folderSiteId);
expect(isFavorite).toBe(true, `${folderSite} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(folderSiteId);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Favorite a file - [C280342]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteNotFav1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
expect(isFavorite).toBe(true, `${fileSiteNotFav1} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Unfavorite an item - [C280343]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteFav1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteFav1Id);
expect(isFavorite).toBe(false, `${fileSiteFav1} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Favorite multiple items - all unfavorite - [C280345]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteNotFav2 ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const listItems1 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
apis.user.favorites.isFavorite(fileSiteNotFav2Id)
]);
expect(listItems1[0]).toBe(true, 'item not marked as favorite');
expect(listItems1[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteNotFav2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Unfavorite multiple items - [C280346]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteFav1, fileSiteFav2 ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
const listItems2 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteFav1Id),
apis.user.favorites.isFavorite(fileSiteFav2Id)
]);
expect(listItems2[0]).toBe(false, 'item marked as favorite');
expect(listItems2[1]).toBe(false, 'item marked as favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteFav1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteFav2Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Favorite multiple items - some favorite and some unfavorite - [C280347]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteFav1 ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const listItems3 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
apis.user.favorites.isFavorite(fileSiteFav1)
]);
expect(listItems3[0]).toBe(true, 'item not marked as favorite');
expect(listItems3[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteFav1);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
});

View File

@ -23,7 +23,6 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Viewer } from '../../components/viewer/viewer';
import { SIDEBAR_LABELS } from '../../configs';
@ -72,20 +71,18 @@ describe('Single click on item name', () => {
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.favorites.waitForApi({ expect: 2 + 1 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(folder1Id),
apis.user.nodes.deleteNodeById(file1Id),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folder1Id);
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -113,7 +110,7 @@ describe('Single click on item name', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
});
it('Navigate inside the folder when clicking the hyperlink - [C280034]', async () => {
@ -158,7 +155,7 @@ describe('Single click on item name', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
});
});
@ -178,7 +175,7 @@ describe('Single click on item name', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
});
});
@ -198,7 +195,7 @@ describe('Single click on item name', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
});
it('Navigate inside the folder when clicking the hyperlink - [C284911]', async () => {

View File

@ -98,7 +98,8 @@ describe('Granular permissions available actions : ', () => {
});
afterAll(async done => {
await Promise.all([apis.admin.sites.deleteSite(siteName), logoutPage.load()]);
await apis.admin.sites.deleteSite(siteName);
await logoutPage.load();
done();
});
@ -119,11 +120,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
@ -134,11 +135,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
@ -149,12 +150,12 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
@ -176,11 +177,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
@ -192,12 +193,12 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
const menu = await toolbar.openMoreMenu();
await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
@ -209,12 +210,12 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
});
@ -236,11 +237,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
await toolbar.closeMoreMenu();
});
@ -253,18 +254,18 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${folder1}`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for multiple selection of files - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
@ -279,11 +280,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
@ -294,11 +295,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
@ -309,18 +310,18 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for multiple selection of folders - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
@ -335,11 +336,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
@ -350,12 +351,12 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
@ -376,11 +377,11 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
@ -391,18 +392,18 @@ describe('Granular permissions available actions : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('context menu actions are correct for a file - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
@ -465,7 +466,7 @@ describe('Granular permissions available actions : ', () => {
});
describe('context menu actions are correct for a folder - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
@ -509,7 +510,7 @@ describe('Granular permissions available actions : ', () => {
});
describe('context menu actions are correct for multiple selection of files - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
@ -562,7 +563,7 @@ describe('Granular permissions available actions : ', () => {
});
describe('context menu actions are correct for multiple selection of folders - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
@ -601,7 +602,7 @@ describe('Granular permissions available actions : ', () => {
});
describe('context menu actions are correct when both files and folders are selected - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
@ -640,7 +641,7 @@ describe('Granular permissions available actions : ', () => {
});
describe('toolbar actions appear correctly in the viewer - consumer', () => {
beforeEach(async done => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
@ -659,14 +660,14 @@ describe('Granular permissions available actions : ', () => {
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
const menu = await viewerToolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
@ -682,13 +683,13 @@ describe('Granular permissions available actions : ', () => {
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
const menu = await viewerToolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
@ -704,15 +705,15 @@ describe('Granular permissions available actions : ', () => {
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
const menu = await viewerToolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
// expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
// expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
// expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
});

View File

@ -32,14 +32,14 @@ import { Utils } from '../../utilities/utils';
describe('Toolbar actions - multiple selection : ', () => {
const username = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`;
const file1 = `file1-${Utils.random()}.txt`;
let file1Id;
const file2 = `file-${Utils.random()}.txt`;
const file2 = `file2-${Utils.random()}.txt`;
let file2Id;
const folder1 = `folder-${Utils.random()}`;
const folder1 = `folder1-${Utils.random()}`;
let folder1Id;
const folder2 = `folder-${Utils.random()}`;
const folder2 = `folder2-${Utils.random()}`;
let folder2Id;
const fileForDelete1 = `file-${Utils.random()}.txt`;
@ -87,15 +87,16 @@ describe('Toolbar actions - multiple selection : ', () => {
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.nodes.deleteNodesById([fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id], false);
await apis.user.trashcan.waitForApi({ expect: 4 });
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await Promise.all([
apis.user.nodes.createFile(file1InSite, docLibId),
apis.user.nodes.createFile(file2InSite, docLibId),
apis.user.nodes.createFolder(folder1InSite, docLibId),
apis.user.nodes.createFolder(folder2InSite, docLibId)
]);
await apis.user.nodes.createFile(file1InSite, docLibId);
await apis.user.nodes.createFile(file2InSite, docLibId);
await apis.user.nodes.createFolder(folder1InSite, docLibId);
await apis.user.nodes.createFolder(folder2InSite, docLibId);
await apis.user.search.waitForApi(username, { expect: 4 });
await loginPage.loginWith(username);
done();
});
@ -114,9 +115,10 @@ describe('Toolbar actions - multiple selection : ', () => {
describe('Personal Files', () => {
beforeEach(async done => {
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -148,11 +150,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
@ -161,11 +163,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
@ -174,23 +176,24 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('File Libraries', () => {
beforeEach(async done => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
// await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -199,11 +202,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
it('correct actions appear when multiple folders are selected - [C280462]', async () => {
@ -211,11 +214,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
it('correct actions appear when both files and folders are selected - [C280463]', async () => {
@ -223,20 +226,21 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
});
describe('Shared Files', () => {
beforeEach(async done => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
// await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -245,20 +249,21 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
});
describe('Recent Files', () => {
beforeEach(async done => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
// await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -267,20 +272,21 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
});
describe('Favorites', () => {
beforeEach(async done => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
// await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -289,11 +295,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
it('correct actions appear when multiple folders are selected - [C280470]', async () => {
@ -301,11 +307,11 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
it('correct actions appear when both files and folders are selected - [C280471]', async () => {
@ -313,19 +319,20 @@ describe('Toolbar actions - multiple selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
});
});
describe('Trash', () => {
beforeEach(async done => {
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});

View File

@ -23,7 +23,6 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
@ -110,10 +109,10 @@ describe('Toolbar actions - single selection : ', () => {
describe('Personal Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -127,11 +126,11 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
@ -141,22 +140,23 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.closeMoreMenu();
});
});
describe('File Libraries', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -170,11 +170,11 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileInSite}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileInSite}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileInSite}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileInSite}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileInSite}`);
await toolbar.closeMoreMenu();
});
@ -184,20 +184,21 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderInSite}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderInSite}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderInSite}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderInSite}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderInSite}`);
await toolbar.closeMoreMenu();
});
});
describe('Shared Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await page.dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -211,20 +212,21 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
});
describe('Recent Files', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -238,20 +240,21 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
});
describe('Favorites', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
@ -265,11 +268,11 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
@ -279,20 +282,21 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.closeMoreMenu();
});
});
describe('Trash', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE);
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});

View File

@ -60,13 +60,11 @@ describe('Login', () => {
const newPassword = 'new password';
beforeAll(async (done) => {
await Promise.all([
peopleApi.createUser({ username: testUser }),
peopleApi.createUser(russianUser),
peopleApi.createUser(johnDoe),
peopleApi.createUser({ username: disabledUser }),
peopleApi.createUser(testUser2)
]);
await peopleApi.createUser({ username: testUser });
await peopleApi.createUser(russianUser);
await peopleApi.createUser(johnDoe);
await peopleApi.createUser({ username: disabledUser });
await peopleApi.createUser(testUser2);
await peopleApi.disableUser(disabledUser);
done();
});
@ -114,7 +112,7 @@ describe('Login', () => {
const { username, firstName, lastName } = johnDoe;
await loginPage.loginWith(username);
expect(userInfo.name).toEqual(`${firstName} ${lastName}`);
expect(await userInfo.getName()).toEqual(`${firstName} ${lastName}`);
});
it(`logs in with user having username containing "@" - [C213096]`, async () => {
@ -126,9 +124,10 @@ describe('Login', () => {
const { username, password } = russianUser;
await loginPage.loginWith(username, password);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
// TODO: ACA-245
xit('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', async () => {
const { username } = johnDoe;

View File

@ -104,8 +104,9 @@ describe('Extensions - Info Drawer', () => {
await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
const val = await infoDrawer.getTabTitle(custom_tab.order);
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(custom_tab.order)).toEqual(`${custom_tab.icon}\n${custom_tab.title}\n`);
expect(val).toEqual(`${custom_tab.icon}\n${custom_tab.title}\n`);
});
it('Remove existing tab - [C284647]', async () => {

View File

@ -90,10 +90,8 @@ describe('Extensions - Viewer', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]),
logoutPage.load()
]);
await apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]);
await logoutPage.load();
done();
});
@ -106,7 +104,7 @@ describe('Extensions - Viewer', () => {
afterEach(async (done) => {
await Utils.pressEscape();
done();
})
});
xit('');

View File

@ -63,13 +63,11 @@ describe('Favorites', () => {
const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id;
const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
await Promise.all([
apis.user.favorites.addFavoriteById('file', file1Id),
apis.user.favorites.addFavoriteById('folder', folderId),
apis.user.favorites.addFavoriteById('file', file2Id),
apis.user.favorites.addFavoriteById('file', file3Id),
apis.user.favorites.addFavoriteById('file', file4Id)
]);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folderId);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.nodes.deleteNodeById(file3Id, false);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id);
@ -85,24 +83,20 @@ describe('Favorites', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]);
await apis.admin.trashcan.emptyTrash();
await logoutPage.load();
done();
});
it('has the correct columns - [C280482]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
const expectedHeader = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const headers = dataTable.getColumnHeaders();
const count = await headers.count();
expect(count).toBe(5 + 1, 'Incorrect number of columns');
expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
expect(await dataTable.getHeaderText()).toEqual(expectedHeader);
});
it('displays the favorite files and folders - [C213226]', async () => {
@ -121,9 +115,9 @@ describe('Favorites', () => {
});
it('Location column displays the parent folder of the files - [C213231]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder);
expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileName1)).toEqual(siteName);
expect(await dataTable.getItemLocation(fileName2)).toEqual(parentFolder);
expect(await dataTable.getItemLocation(favFolderName)).toEqual('Personal Files');
});
it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
@ -133,23 +127,23 @@ describe('Favorites', () => {
});
it('Location column redirect - item in user Home - [C213650]', async () => {
await dataTable.clickItemLocation(favFolderName);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
await dataTable.clickItemLocation(favFolderName);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it('Location column redirect - file in folder - [C280484]', async () => {
await dataTable.clickItemLocation(fileName2);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]);
await dataTable.clickItemLocation(fileName2);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]);
});
it('Location column redirect - file in site - [C280485]', async () => {
await dataTable.clickItemLocation(fileName1);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
await dataTable.clickItemLocation(fileName1);
expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
});
it('Navigate into folder from Favorites - [C213230]', async () => {
await dataTable.doubleClickOnRowByName(favFolderName);
await dataTable.waitForEmptyState();
expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName);
await dataTable.doubleClickOnRowByName(favFolderName);
await dataTable.waitForEmptyState();
expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName);
});
});

View File

@ -53,22 +53,18 @@ describe('File Libraries', () => {
const { dataTable } = fileLibrariesPage;
beforeAll(async (done) => {
await Promise.all([
apis.admin.people.createUser({ username }),
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription),
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null),
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2)
]);
await Promise.all([
apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER),
apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER),
apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR),
apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR),
apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR)
]);
await apis.admin.people.createUser({ username });
await apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC);
await apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null);
await apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC);
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
await apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER);
await apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER);
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR);
await apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR);
await apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR);
await loginPage.loginWith(username);
done();
@ -81,10 +77,8 @@ describe('File Libraries', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]),
logoutPage.load()
]);
await apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]);
await logoutPage.load();
done();
});

View File

@ -60,11 +60,9 @@ describe('Generic errors', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -82,7 +80,7 @@ describe('Generic errors', () => {
});
it('Invalid URL - [C217315]', 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.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);

View File

@ -144,21 +144,21 @@ describe('Special permissions', () => {
await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
});
it(`on Favorites - [C213672]`, async () => {
await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
});
it(`on Shared Files - [C213668]`, async () => {
await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
});
});
});

View File

@ -76,12 +76,10 @@ describe('Recent Files', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ folderId, file2Id ]),
apis.user.sites.deleteSite(siteName),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodesById([ folderId, file2Id ]);
await apis.user.sites.deleteSite(siteName);
await apis.admin.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -113,9 +111,9 @@ describe('Recent Files', () => {
});
it('Location column displays the parent folder of the file - [C213175]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(folderName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite);
expect(await dataTable.getItemLocation(fileName1)).toEqual(folderName);
expect(await dataTable.getItemLocation(fileName2)).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite)).toEqual(folderSite);
});
it('Location column displays a tooltip with the entire path of the file - [C213177]', async () => {

View File

@ -33,9 +33,9 @@ describe('Shared Files', () => {
const password = username;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const fileAdmin = `fileSite-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`;
const folderUser = `folder-${Utils.random()}`; let folderId;
const file1User = `file1-${Utils.random()}.txt`; let file1Id;
const file2User = `file2-${Utils.random()}.txt`; let file2Id;
const file3User = `file3-${Utils.random()}.txt`; let file3Id;
@ -59,16 +59,17 @@ describe('Shared Files', () => {
const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
await apis.admin.shared.shareFileById(nodeId);
const folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1User, folderId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2User)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3User)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4User)).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForApi({ expect: 5 });
await apis.admin.shared.waitForApi({ expect: 5 });
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.shared.unshareFile(file3User);
await apis.admin.shared.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
@ -80,33 +81,25 @@ describe('Shared Files', () => {
done();
});
afterEach(async (done) => {
await sharedFilesPage.refresh();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderUser ]),
logoutPage.load()
]);
await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folderId);
await apis.user.nodes.deleteNodeById(file4Id);
await logoutPage.load();
done();
});
it('has the correct columns - [C213113]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
const expectedHeader = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const headers = dataTable.getColumnHeaders();
const count = await headers.count();
expect(count).toBe(6 + 1, 'Incorrect number of columns');
expect(await dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
expect(await dataTable.getHeaderText()).toEqual(expectedHeader);
});
it('default sorting column - [C213115]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(await dataTable.getSortedColumnHeaderText()).toBe('Modified');
expect(await dataTable.getSortingOrder()).toBe('desc');
});
@ -119,17 +112,14 @@ describe('Shared Files', () => {
expect(await dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`);
});
// TODO: disabled cause the api is slow to update. Find a way to wait until the file is unshared
xit('unshared file is not displayed - [C213118]', async (done) => {
await apis.user.shared.waitForApi({ expect: 4 });
it('unshared file is not displayed - [C213118]', async () => {
expect(await dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
done();
});
it('Location column displays the parent folder of the file - [C213665]', async () => {
expect(await dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(file1User).getText()).toEqual(folderUser);
expect(await dataTable.getItemLocation(fileAdmin)).toEqual(siteName);
expect(await dataTable.getItemLocation(file1User)).toEqual(folderUser);
});
it('Location column redirect - file in user Home - [C213666]', async () => {

View File

@ -172,9 +172,9 @@ describe('Trash', () => {
});
it('Location column displays the parent folder of the file - [C280498]', async () => {
expect(await dataTable.getItemLocation(fileInFolder).getText()).toEqual(folderNotDeleted);
expect(await dataTable.getItemLocation(fileUser).getText()).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(fileInFolder)).toEqual(folderNotDeleted);
expect(await dataTable.getItemLocation(fileUser)).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite)).toEqual(siteName);
});
it('Location column displays a tooltip with the entire path of the file - [C280499]', async () => {
@ -184,7 +184,7 @@ describe('Trash', () => {
});
it('Location column is empty if parent folder no longer exists - [C280500]', async () => {
expect(await dataTable.getItemLocation(fileDeleted).getText()).toEqual('');
expect(await dataTable.getItemLocation(fileDeleted)).toEqual('');
});
it('Location column redirect - file in user Home - [C217144]', async () => {

View File

@ -169,7 +169,6 @@ describe('Breadcrumb', () => {
await page.dataTable.doubleClickOnRowByName(folder1);
await page.dataTable.wait();
await apis.user.nodes.renameNode(folder1Id, folder1Renamed)
// .then(done => done)
await page.refresh();
await page.dataTable.wait();
expect(await breadcrumb.getCurrentItemName()).toEqual(folder1Renamed);

View File

@ -66,7 +66,7 @@ describe('Pagination on multiple pages on Favorites', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});

View File

@ -60,7 +60,7 @@ describe('Pagination on multiple pages on File Libraries', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});

View File

@ -63,7 +63,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});

View File

@ -63,7 +63,7 @@ describe('Pagination on multiple pages on Recent Files', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});

View File

@ -66,15 +66,13 @@ describe('Pagination on multiple pages on Shared Files', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await logoutPage.load();
done();
});

View File

@ -62,15 +62,13 @@ describe('Pagination on multiple pages on Trash', () => {
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});

View File

@ -70,15 +70,11 @@ describe('Viewer actions', () => {
const pdfPersonalFiles = `pdfPF-${Utils.random()}.pdf`;
beforeAll(async (done) => {
await Promise.all([
parentId = (await apis.user.nodes.createFolder(parent)).entry.id,
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id
]);
await Promise.all([
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id,
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles),
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles)
]);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
await loginPage.loginWith(username);
done();
@ -98,12 +94,10 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.nodes.deleteNodeById(destinationId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -117,14 +111,14 @@ describe('Viewer actions', () => {
expect(await toolbar.isButtonPresent('Print')).toBe(true, `print`);
expect(await toolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `full screen`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `view details`);
const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `favorite`);
expect(await menu.isMenuItemPresent('Share')).toBe(true, `share`);
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `copy`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `move`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `delete`);
expect(await menu.isMenuItemPresent('Manage Versions')).toBe(true, `manage versions`);
expect(await menu.isMenuItemPresent('Permissions')).toBe(true, `permissions`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `favorite`);
expect(await toolbar.menu.isMenuItemPresent('Share')).toBe(true, `share`);
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `copy`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `move`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `delete`);
expect(await toolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `manage versions`);
expect(await toolbar.menu.isMenuItemPresent('Permissions')).toBe(true, `permissions`);
await toolbar.closeMoreMenu();
});
@ -140,8 +134,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Copy');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Copy');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -162,8 +156,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Move');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Move');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -181,12 +175,12 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Favorite');
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await viewer.clickClose();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.getRowByName(docxPersonalFiles).isPresent()).toBe(true, 'Item is not present in Favorites list');
});
@ -194,8 +188,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(pdfPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Delete');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfPersonalFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
@ -221,8 +215,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -231,8 +225,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Manage Versions');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Manage Versions');
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
@ -242,8 +236,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await Utils.pressEscape();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open');
@ -262,12 +256,10 @@ describe('Viewer actions', () => {
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await Promise.all([
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id,
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id,
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries),
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries)
]);
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
await loginPage.loginWith(username);
done();
@ -287,12 +279,10 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(destinationId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -308,8 +298,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Copy');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Copy');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -330,8 +320,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Move');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Move');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -349,21 +339,21 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Favorite');
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await viewer.clickClose();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await dataTable.getRowByName(docxLibraries).isPresent()).toBe(true, 'Item is not present in Favorites list');
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, `${docxLibraries} is not favorite`);
expect(await dataTable.getRowByName(docxLibraries).isPresent()).toBe(true, `${docxLibraries} is not present in Favorites list`);
});
it('Delete action - [C286373]', async () => {
await dataTable.doubleClickOnRowByName(pdfLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Delete');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfLibraries} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
@ -377,8 +367,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -387,8 +377,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Manage Versions');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Manage Versions');
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
@ -403,15 +393,12 @@ describe('Viewer actions', () => {
const pdfRecentFiles = `pdfRF-${Utils.random()}.pdf`;
beforeAll(async (done) => {
await Promise.all([
parentId = (await apis.user.nodes.createFolder(parent)).entry.id,
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id
]);
await Promise.all([
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id,
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles),
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles)
]);
await apis.user.search.waitForApi(username, {expect: 0});
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles);
await apis.user.search.waitForApi(username, {expect: 3});
@ -431,12 +418,10 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.nodes.deleteNodeById(destinationId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -452,8 +437,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Copy');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Copy');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -474,8 +459,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Move');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Move');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -494,12 +479,12 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Favorite');
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await viewer.clickClose();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.getRowByName(docxRecentFiles).isPresent()).toBe(true, 'Item is not present in Favorites list');
});
@ -507,8 +492,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(pdfRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Delete');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfRecentFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
@ -522,8 +507,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -532,8 +517,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Manage Versions');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Manage Versions');
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
@ -548,15 +533,11 @@ describe('Viewer actions', () => {
const pdfSharedFiles = `pdfSF-${Utils.random()}.pdf`; let pdfFileId;
beforeAll(async (done) => {
await Promise.all([
parentId = (await apis.user.nodes.createFolder(parent)).entry.id,
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id
]);
await Promise.all([
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id,
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id,
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id
]);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id;
await apis.user.shared.shareFilesByIds([docxFileId, xlsxFileId, pdfFileId])
await apis.user.shared.waitForApi({expect: 3});
@ -577,12 +558,10 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.nodes.deleteNodeById(destinationId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -598,8 +577,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Copy');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Copy');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -620,8 +599,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Move');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Move');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -640,12 +619,12 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Favorite');
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await viewer.clickClose();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.getRowByName(docxSharedFiles).isPresent()).toBe(true, 'Item is not present in Favorites list');
});
@ -653,8 +632,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(pdfSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Delete');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfSharedFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
@ -669,8 +648,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -679,8 +658,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Manage Versions');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Manage Versions');
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
@ -697,15 +676,11 @@ describe('Viewer actions', () => {
const pdfFavorites = `pdfFav-${Utils.random()}.pdf`; let pdfFileId;
beforeAll(async (done) => {
await Promise.all([
parentId = (await apis.user.nodes.createFolder(parent)).entry.id,
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id
]);
await Promise.all([
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id,
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id,
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id
]);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [docxFileId, xlsxFileId, pdfFileId])
await apis.user.favorites.waitForApi({expect: 3});
@ -726,12 +701,10 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.nodes.deleteNodeById(destinationId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
@ -747,8 +720,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Copy');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Copy');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -769,8 +742,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Move');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Move');
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.chooseDestination(destination);
@ -789,12 +762,12 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(xlsxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Favorite');
expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await viewer.clickClose();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite');
expect(await dataTable.getRowByName(xlsxFavorites).isPresent()).toBe(false, 'Item is still present in Favorites list');
});
@ -802,8 +775,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(pdfFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Delete');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfFavorites} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
@ -817,8 +790,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Share');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -827,8 +800,8 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
const menu = await toolbar.openMoreMenu();
await menu.clickMenuItem('Manage Versions');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Manage Versions');
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});

View File

@ -70,7 +70,7 @@ describe('Viewer general', () => {
await apis.user.shared.shareFileById(xlsxFileId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', xlsxFileId);
await apis.user.favorites.waitForApi({ expect: 1 });
await apis.user.favorites.waitForApi({ expect: 2 });
await loginPage.loginWith(username);
done();
@ -90,13 +90,11 @@ describe('Viewer general', () => {
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.admin.sites.deleteSite(siteAdmin),
apis.user.sites.deleteSite(siteUser),
logoutPage.load()
]);
done();
await apis.user.nodes.deleteNodeById(parentId);
await apis.admin.sites.deleteSite(siteAdmin);
await apis.user.sites.deleteSite(siteUser);
await logoutPage.load();
done();
});
it('Viewer opens on double clicking on a file from Personal Files - [C279269]', async () => {

View File

@ -4,7 +4,7 @@
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"target": "es2017",
"types": [
"jasmine",
"jasminewd2",

View File

@ -86,8 +86,8 @@ export class NodesApi extends RepoApi {
}
async deleteNodeChildren(parentId: string) {
const nodeIds = (await this.getNodeChildren(parentId)).list.entries
.map(entries => entries.entry.id);
const listEntries = (await this.getNodeChildren(parentId)).list.entries;
const nodeIds = listEntries.map(entries => entries.entry.id);
return await this.deleteNodesById(nodeIds);
}

View File

@ -41,7 +41,7 @@ export class RepoClient {
private password: string = RepoClientAuth.DEFAULT_PASSWORD
) {}
private get auth(): RepoClientAuth {
private get auth() {
const { username, password } = this;
return { username, password };
}

View File

@ -30,11 +30,8 @@ const fs = require('fs');
export class Utils {
// generate a random value
static random(): string {
return Math.random()
.toString(36)
.substring(5, 10)
.toLowerCase();
static random() {
return Math.random().toString(36).substring(5, 10).toLowerCase();
}
// local storage
@ -51,17 +48,17 @@ export class Utils {
return browser.executeScript('return window.sessionStorage.getItem("aca.extension.config");');
}
static async setSessionStorageFromConfig(key: string, configFileName: string) {
static setSessionStorageFromConfig(key: string, configFileName: string) {
const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`;
const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' }));
return await browser.executeScript(`window.sessionStorage.setItem(${key}, ${fileContent});`);
return browser.executeScript(`window.sessionStorage.setItem(${key}, ${fileContent});`);
}
static async resetExtensionConfig() {
static resetExtensionConfig() {
const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`;
return await this.setSessionStorageFromConfig('"aca.extension.config"', defConfig);
return this.setSessionStorageFromConfig('"aca.extension.config"', defConfig);
}
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
@ -72,20 +69,23 @@ export class Utils {
return run(retry);
}
static waitUntilElementClickable(element: ElementFinder) {
return browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT);
static async waitUntilElementClickable(element: ElementFinder) {
return await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
// static waitUntilElementClickable(element: ElementFinder) {
// return browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT);
}
static typeInField(elem: ElementFinder, value: string) {
static async typeInField(elem: ElementFinder, value: string) {
for (let i = 0; i < value.length; i++) {
const c = value.charAt(i);
elem.sendKeys(c);
browser.sleep(100);
await elem.sendKeys(c);
await browser.sleep(100);
}
}
static async fileExistsOnOS(fileName: string) {
const filePath = path.join((await browser.getProcessedConfig()).params.downloadFolder, fileName);
const config = await browser.getProcessedConfig();
const filePath = path.join(config.params.downloadFolder, fileName);
let tries = 5;
@ -108,17 +108,11 @@ export class Utils {
});
}
static async pressEscape() {
return await browser
.actions()
.sendKeys(protractor.Key.ESCAPE)
.perform();
static pressEscape() {
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
static async getBrowserLog() {
return await browser
.manage()
.logs()
.get('browser');
static getBrowserLog() {
return browser.manage().logs().get('browser');
}
}

View File

@ -2,7 +2,9 @@
// https://github.com/angular/protractor/blob/master/lib/config.ts
const path = require('path');
const { SpecReporter } = require('jasmine-spec-reporter');
const {
SpecReporter
} = require('jasmine-spec-reporter');
const jasmineReporters = require('jasmine-reporters');
const CDP = require('chrome-remote-interface');
@ -30,7 +32,7 @@ function rmDir(dirPath) {
}
exports.config = {
allScriptsTimeout: 40000,
allScriptsTimeout: 50000,
params: {
downloadFolder: downloadFolder
@ -48,6 +50,7 @@ exports.config = {
'./e2e/suites/extensions/*.test.ts'
],
SELENIUM_PROMISE_MANAGER: true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
@ -58,33 +61,32 @@ exports.config = {
default_directory: downloadFolder
}
},
args: ['--incognito', '--headless', '--remote-debugging-port=9222']
args: ['--incognito', '--headless', '--remote-debugging-port=9222', '--disable-gpu', '--no-sandbox']
}
},
directConnect: true,
// baseUrl: 'http://localhost:4000',
getPageTimeout: 50000,
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 60000,
print: function() {}
print: function () {}
},
plugins: [
{
package: 'jasmine2-protractor-utils',
disableHTMLReport: false,
disableScreenshot: false,
screenshotOnExpectFailure: true,
screenshotOnSpecFailure: false,
clearFoldersBeforeTest: true,
htmlReportDir: `${projectRoot}/e2e-output/html-report/`,
screenshotPath: `${projectRoot}/e2e-output/screenshots/`
}
],
plugins: [{
package: 'jasmine2-protractor-utils',
disableHTMLReport: false,
disableScreenshot: false,
screenshotOnExpectFailure: true,
screenshotOnSpecFailure: false,
clearFoldersBeforeTest: true,
htmlReportDir: `${projectRoot}/e2e-output/html-report/`,
screenshotPath: `${projectRoot}/e2e-output/screenshots/`
}],
onPrepare() {
require('ts-node').register({

View File

@ -1,9 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": ["jasmine", "node"]
},
"files": ["test.ts", "polyfills.ts"],
"include": ["node_modules", "**/*.spec.ts", "**/*.d.ts"]
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"target": "es2017",
"types": ["jasmine", "node"]
},
"files": ["test.ts", "polyfills.ts"],
"include": ["node_modules", "**/*.spec.ts", "**/*.d.ts"]
}