diff --git a/cspell.json b/cspell.json index 34641d842..d59de3c5b 100644 --- a/cspell.json +++ b/cspell.json @@ -40,7 +40,9 @@ "exif", "cardview", "webm", - "keycodes" + "keycodes", + + "docx" ], "dictionaries": [ "html", diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 9fe1c48ee..5007ca02d 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -172,7 +172,7 @@ export class DataTable extends Component { .then(() => browser.actions().mouseMove(item).click().click().perform()); } - clickOnRowByName(name: string): promise.Promise { + selectItem(name: string): promise.Promise { const item = this.getRowFirstCell(name); return Utils.waitUntilElementClickable(item) .then(() => item.click()); @@ -183,7 +183,7 @@ export class DataTable extends Component { .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) .then(() => { names.forEach(name => { - this.clickOnRowByName(name); + this.selectItem(name); }); }) .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()); diff --git a/e2e/components/toolbar/toolbar-actions.ts b/e2e/components/toolbar/toolbar-actions.ts index f72fa57b9..00c07003c 100755 --- a/e2e/components/toolbar/toolbar-actions.ts +++ b/e2e/components/toolbar/toolbar-actions.ts @@ -40,29 +40,34 @@ export class ToolbarActions extends Component { super(ToolbarActions.selectors.root, ancestor); } - isEmpty(): promise.Promise { - return this.buttons.count().then(count => (count === 0)); + async isEmpty() { + return await this.buttons.count() === 0; } - isButtonPresent(title: string): promise.Promise { - return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent(); + async isButtonPresent(title: string) { + return await this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent(); } - getButtonByLabel(label: string): ElementFinder { + getButtonByLabel(label: string) { return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label)); } - getButtonByTitleAttribute(title: string): ElementFinder { + getButtonByTitleAttribute(title: string) { return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)); } - openMoreMenu() { - return this.getButtonByTitleAttribute('More actions').click() - .then(() => this.menu.waitForMenuToOpen()) - .then(() => this.menu); + async openMoreMenu() { + await this.getButtonByTitleAttribute('More actions').click(); + await this.menu.waitForMenuToOpen(); + return this.menu; } - closeMoreMenu() { - return browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + async closeMoreMenu() { + return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); } + + async getButtonTooltip(button: ElementFinder) { + return await button.getAttribute('title'); + } + } diff --git a/e2e/components/viewer/viewer.ts b/e2e/components/viewer/viewer.ts new file mode 100755 index 000000000..34bad50f6 --- /dev/null +++ b/e2e/components/viewer/viewer.ts @@ -0,0 +1,88 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { Component } from '../component'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { ToolbarActions } from '../toolbar/toolbar-actions'; + +export class Viewer extends Component { + 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' + }; + + 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)); + + toolbar = new ToolbarActions(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(); + } +} diff --git a/e2e/configs.ts b/e2e/configs.ts index 8706ae07f..77b0b4204 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -26,7 +26,7 @@ export const BROWSER_RESOLUTION_WIDTH = 1200; export const BROWSER_RESOLUTION_HEIGHT = 800; -export const BROWSER_WAIT_TIMEOUT = 30000; +export const BROWSER_WAIT_TIMEOUT = 10000; // Application configs export const APP_HOST = 'http://localhost:4000'; @@ -40,6 +40,8 @@ export const ADMIN_USERNAME = 'admin'; export const ADMIN_PASSWORD = 'admin'; export const ADMIN_FULL_NAME = 'Administrator'; +export const E2E_ROOT_PATH = __dirname; + // Application Routes export const APP_ROUTES = { FAVORITES: '/favorites', @@ -76,3 +78,9 @@ export const SITE_ROLES = { SITE_CONTRIBUTOR: 'SiteContributor', SITE_MANAGER: 'SiteManager' }; + +export const FILES = { + docxFile: 'file-docx.docx', + xlsxFile: 'file-xlsx.xlsx', + unsupportedFile: 'file_unsupported.3DS' +}; diff --git a/e2e/resources/file-docx.docx b/e2e/resources/file-docx.docx new file mode 100644 index 000000000..7d4e30425 Binary files /dev/null and b/e2e/resources/file-docx.docx differ diff --git a/e2e/resources/file-xlsx.xlsx b/e2e/resources/file-xlsx.xlsx new file mode 100644 index 000000000..3039a7cdc Binary files /dev/null and b/e2e/resources/file-xlsx.xlsx differ diff --git a/e2e/resources/file_unsupported.3DS b/e2e/resources/file_unsupported.3DS new file mode 100755 index 000000000..be21d1142 --- /dev/null +++ b/e2e/resources/file_unsupported.3DS @@ -0,0 +1 @@ +™™ \ No newline at end of file diff --git a/e2e/suites/actions/delete-undo-delete.test.ts b/e2e/suites/actions/delete-undo-delete.test.ts index f8199a849..0f26ad43d 100755 --- a/e2e/suites/actions/delete-undo-delete.test.ts +++ b/e2e/suites/actions/delete-undo-delete.test.ts @@ -102,7 +102,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(file1) + dataTable.selectItem(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -147,7 +147,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(folder1) + dataTable.selectItem(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => { @@ -165,7 +165,7 @@ describe('Delete and undo delete', () => { }); it('delete a folder containing locked files - [C217127]', () => { - dataTable.clickOnRowByName(folder2) + dataTable.selectItem(folder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -199,7 +199,7 @@ describe('Delete and undo delete', () => { }); it('successful delete notification shows Undo action - [C217131]', () => { - dataTable.clickOnRowByName(file1) + dataTable.selectItem(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -211,7 +211,7 @@ describe('Delete and undo delete', () => { }); it('unsuccessful delete notification does not show Undo action - [C217134]', () => { - dataTable.clickOnRowByName(folder2) + dataTable.selectItem(folder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -224,7 +224,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(file1) + dataTable.selectItem(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) @@ -238,7 +238,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(folder1) + dataTable.selectItem(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) @@ -306,7 +306,7 @@ describe('Delete and undo delete', () => { }); it('delete a file and check notification - [C280316]', () => { - dataTable.clickOnRowByName(sharedFile1) + dataTable.selectItem(sharedFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -345,7 +345,7 @@ describe('Delete and undo delete', () => { }); it('successful delete notification shows Undo action - [C280323]', () => { - dataTable.clickOnRowByName(sharedFile1) + dataTable.selectItem(sharedFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -355,7 +355,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of file - [C280324]', () => { - dataTable.clickOnRowByName(sharedFile2) + dataTable.selectItem(sharedFile2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) @@ -432,7 +432,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(favoriteFile1) + dataTable.selectItem(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -476,7 +476,7 @@ describe('Delete and undo delete', () => { it('delete a folder with content - [C280518]', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(favoriteFolder1) + dataTable.selectItem(favoriteFolder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => { @@ -494,7 +494,7 @@ describe('Delete and undo delete', () => { }); it('delete a folder containing locked files - [C280519]', () => { - dataTable.clickOnRowByName(favoriteFolder2) + dataTable.selectItem(favoriteFolder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -532,7 +532,7 @@ describe('Delete and undo delete', () => { }); it('successful delete notification shows Undo action - [C280522]', () => { - dataTable.clickOnRowByName(favoriteFile1) + dataTable.selectItem(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -542,7 +542,7 @@ describe('Delete and undo delete', () => { }); it('unsuccessful delete notification does not show Undo action - [C280523]', () => { - dataTable.clickOnRowByName(favoriteFolder2) + dataTable.selectItem(favoriteFolder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -553,7 +553,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(favoriteFile1) + dataTable.selectItem(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) @@ -567,7 +567,7 @@ describe('Delete and undo delete', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnRowByName(favoriteFolder1) + dataTable.selectItem(favoriteFolder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) @@ -641,7 +641,7 @@ describe('Delete and undo delete', () => { }); it('delete a file and check notification - [C280528]', () => { - dataTable.clickOnRowByName(recentFile1) + dataTable.selectItem(recentFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -678,7 +678,7 @@ describe('Delete and undo delete', () => { }); it('successful delete notification shows Undo action - [C280534]', () => { - dataTable.clickOnRowByName(recentFile1) + dataTable.selectItem(recentFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -693,7 +693,7 @@ describe('Delete and undo delete', () => { // without adding a very big browser.sleep followed by a page.refresh // so for the moment we're testing that the restored file is not displayed in the Trash it('undo delete of file - [C280536]', () => { - dataTable.clickOnRowByName(recentFile2) + dataTable.selectItem(recentFile2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index 30cc18e43..32e4ce3f4 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -94,7 +94,7 @@ describe('Edit folder', () => { }); it('dialog UI defaults - [C216331]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => { expect(editDialog.getTitle()).toEqual('Edit folder'); @@ -106,7 +106,7 @@ describe('Edit folder', () => { }); it('properties are modified when pressing OK - [C216335]', () => { - dataTable.clickOnRowByName(folderNameToEdit) + dataTable.selectItem(folderNameToEdit) .then(() => editButton.click()) .then(() => editDialog.waitForDialogToOpen()) .then(() => editDialog.enterDescription(folderDescriptionEdited)) @@ -120,7 +120,7 @@ describe('Edit folder', () => { }); it('with empty folder name - [C216332]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => editDialog.deleteNameWithBackspace()) .then(() => { @@ -132,7 +132,7 @@ describe('Edit folder', () => { it('with name with special characters - [C216333]', () => { const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => namesWithSpecialChars.forEach(name => { editDialog.enterName(name); @@ -143,7 +143,7 @@ describe('Edit folder', () => { }); it('with name ending with a dot - [C216334]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => editDialog.nameInput.sendKeys('.')) .then(() => { @@ -153,7 +153,7 @@ describe('Edit folder', () => { }); it('Cancel button - [C216336]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => editDialog.clickCancel()) .then(() => { @@ -162,7 +162,7 @@ describe('Edit folder', () => { }); it('with duplicate folder name - [C216337]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => editDialog.enterName(duplicateFolderName)) .then(() => editDialog.clickUpdate()) @@ -174,7 +174,7 @@ describe('Edit folder', () => { }); it('trim ending spaces - [C216338]', () => { - dataTable.clickOnRowByName(folderName) + dataTable.selectItem(folderName) .then(() => editButton.click()) .then(() => editDialog.nameInput.sendKeys(' ')) .then(() => editDialog.clickUpdate()) diff --git a/e2e/suites/actions/mark-favorite.test.ts b/e2e/suites/actions/mark-favorite.test.ts index 67484ab1e..ab91c9587 100644 --- a/e2e/suites/actions/mark-favorite.test.ts +++ b/e2e/suites/actions/mark-favorite.test.ts @@ -90,7 +90,7 @@ describe('Mark items as favorites', () => { }); it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', () => { - dataTable.clickOnRowByName(file1NotFav) + dataTable.selectItem(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border')); }); @@ -102,13 +102,13 @@ describe('Mark items as favorites', () => { }); it('Favorite action has full star icon for items marked as favorite - [C217188]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star')); }); it('favorite a file - [C217189]', () => { - dataTable.clickOnRowByName(file1NotFav) + dataTable.selectItem(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -119,7 +119,7 @@ describe('Mark items as favorites', () => { }); it('favorite a folder - [C280390]', () => { - dataTable.clickOnRowByName(folder1) + dataTable.selectItem(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -130,7 +130,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item - [C217190]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -206,7 +206,7 @@ describe('Mark items as favorites', () => { }); it('favorite a file - [C280352]', () => { - dataTable.clickOnRowByName(file1NotFav) + dataTable.selectItem(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -217,7 +217,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item - [C280353]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -296,7 +296,7 @@ describe('Mark items as favorites', () => { }); it('favorite a file - [C280362]', () => { - dataTable.clickOnRowByName(file1NotFav) + dataTable.selectItem(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -307,7 +307,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item - [C280363]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -383,7 +383,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item - [C280368]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -417,7 +417,7 @@ describe('Mark items as favorites', () => { }); it('Favorite action has full star icon for items marked as favorite - [C280371]', () => { - dataTable.clickOnRowByName(file3Fav) + dataTable.selectItem(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star')); }); diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/permanently-delete.test.ts index 9322f53ea..c984225ed 100755 --- a/e2e/suites/actions/permanently-delete.test.ts +++ b/e2e/suites/actions/permanently-delete.test.ts @@ -78,7 +78,7 @@ describe('Permanently delete from Trash', () => { }); it('delete file - [C217091]', () => { - dataTable.clickOnRowByName(file1) + dataTable.selectItem(file1) .then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) .then(() => trashPage.waitForDialog()) .then(() => trashPage.getDialogActionByLabel('Delete')) @@ -92,7 +92,7 @@ describe('Permanently delete from Trash', () => { }); it('delete folder - [C280416]', () => { - dataTable.clickOnRowByName(folder1) + dataTable.selectItem(folder1) .then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) .then(() => trashPage.waitForDialog()) .then(() => trashPage.getDialogActionByLabel('Delete')) diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index 538632406..4de3137ff 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -80,7 +80,7 @@ describe('Restore from Trash', () => { }); it('restore file - [C217177]', () => { - dataTable.clickOnRowByName(file) + dataTable.selectItem(file) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => { @@ -98,7 +98,7 @@ describe('Restore from Trash', () => { }); it('restore folder - [C280438]', () => { - dataTable.clickOnRowByName(folder) + dataTable.selectItem(folder) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => { @@ -136,7 +136,7 @@ describe('Restore from Trash', () => { }); it('View from notification - [C217181]', () => { - dataTable.clickOnRowByName(file) + dataTable.selectItem(file) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.clickSnackBarAction()) .then(() => page.dataTable.waitForHeader()) @@ -186,7 +186,7 @@ describe('Restore from Trash', () => { it('Restore a file when another file with same name exists on the restore location - [C217178]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.clickOnRowByName(file1)) + .then(() => dataTable.selectItem(file1)) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => expect(text).toEqual(`Can't restore, ${file1} already exists`)); @@ -194,7 +194,7 @@ describe('Restore from Trash', () => { it('Restore a file when original location no longer exists - [C217179]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.clickOnRowByName(file2)) + .then(() => dataTable.selectItem(file2)) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`)); diff --git a/e2e/suites/actions/toolbar-multiple-selection.test.ts b/e2e/suites/actions/toolbar-multiple-selection.test.ts index f0180d8c9..164641b17 100755 --- a/e2e/suites/actions/toolbar-multiple-selection.test.ts +++ b/e2e/suites/actions/toolbar-multiple-selection.test.ts @@ -65,481 +65,433 @@ describe('Toolbar actions - multiple selection : ', () => { const { dataTable } = page; const { toolbar } = page; - beforeAll(done => { - apis.admin.people.createUser({ username: user1 }) - .then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.entry.id)) - .then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.entry.id)) - .then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.entry.id)) - .then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.entry.id)) - .then(() => apis.user.nodes.createFiles([ fileForDelete1 ]).then(resp => fileForDelete1Id = resp.entry.id)) - .then(() => apis.user.nodes.createFiles([ fileForDelete2 ]).then(resp => fileForDelete2Id = resp.entry.id)) - .then(() => apis.user.nodes.createFolders([ folderForDelete1 ]).then(resp => folderForDelete1Id = resp.entry.id)) - .then(() => apis.user.nodes.createFolders([ folderForDelete2 ]).then(resp => folderForDelete2Id = resp.entry.id)) + beforeAll(async (done) => { + await apis.admin.people.createUser({ username: user1 }); + file1Id = (await apis.user.nodes.createFiles([ file1 ])).entry.id; + file2Id = (await apis.user.nodes.createFiles([ file2 ])).entry.id; + folder1Id = (await apis.user.nodes.createFolders([ folder1 ])).entry.id; + folder2Id = (await apis.user.nodes.createFolders([ folder2 ])).entry.id; + fileForDelete1Id = (await apis.user.nodes.createFiles([ fileForDelete1 ])).entry.id; + fileForDelete2Id = (await apis.user.nodes.createFiles([ fileForDelete2 ])).entry.id; + folderForDelete1Id = (await apis.user.nodes.createFolders([ folderForDelete1 ])).entry.id; + folderForDelete2Id = (await apis.user.nodes.createFolders([ folderForDelete2 ])).entry.id; - .then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id ])) - .then(() => apis.user.shared.waitForApi({ expect: 2 })) + await apis.user.shared.shareFilesByIds([ file1Id, file2Id ]); + await apis.user.shared.waitForApi({ expect: 2 }); - .then(() => apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ])) - .then(() => apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ])) - .then(() => apis.user.favorites.waitForApi({ expect: 4 })) + await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ]); + await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]); + await apis.user.favorites.waitForApi({ expect: 4 }); - .then(() => apis.user.nodes.deleteNodesById([ - fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id - ], false)) + await apis.user.nodes.deleteNodesById([ fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id ], false); - .then(done); + done(); }); - afterAll(done => { - Promise.all([ + afterAll(async (done) => { + await Promise.all([ apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]), apis.user.trashcan.emptyTrash(), logoutPage.load() - ]) - .then(done); + ]); + done(); }); xit(''); describe('Personal Files', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('Unselect items with single click - [C280458]', () => { - dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]) - .then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number')) - .then(() => dataTable.clickOnRowByName(file1)) - .then(() => expect(dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number')) - .then(() => dataTable.clearSelection()); + it('Unselect items with single click - [C280458]', async () => { + await dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]); + expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'); + await dataTable.selectItem(file1); + expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number'); + await dataTable.clearSelection(); }); - it('Select / unselect selected items by CMD+click - [C217110]', () => { - browser.actions().sendKeys(protractor.Key.COMMAND).perform() - .then(() => dataTable.clickOnRowByName(file1)) - .then(() => dataTable.clickOnRowByName(file2)) - .then(() => dataTable.clickOnRowByName(folder1)) - .then(() => dataTable.clickOnRowByName(folder2)) - .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()) - .then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number')) - .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) - .then(() => dataTable.clickOnRowByName(file1)) - .then(() => dataTable.clickOnRowByName(file2)) - .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()) - .then(() => expect(dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number')) - .then(() => dataTable.clearSelection()); + it('Select / unselect selected items by CMD+click - [C217110]', async () => { + await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); + await dataTable.selectItem(file1); + await dataTable.selectItem(file2); + await dataTable.selectItem(folder1); + await dataTable.selectItem(folder2); + await browser.actions().sendKeys(protractor.Key.NULL).perform(); + expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'); + await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); + await dataTable.selectItem(file1); + await dataTable.selectItem(file2); + await browser.actions().sendKeys(protractor.Key.NULL).perform(); + expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number'); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple files are selected - [C217112]', () => { - dataTable.selectMultipleItems([file1, file2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - .then(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C217112]', async () => { + await dataTable.selectMultipleItems([file1, file2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple folders are selected - [C280459]', () => { - dataTable.selectMultipleItems([folder1, folder2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - .then(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple folders are selected - [C280459]', async () => { + await dataTable.selectMultipleItems([folder1, folder2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when both files and folders are selected - [C280460]', () => { - dataTable.selectMultipleItems([file1, file2, folder1, folder2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - .then(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when both files and folders are selected - [C280460]', async () => { + await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await dataTable.clearSelection(); }); }); describe('File Libraries', () => { - beforeAll(done => { - apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC) - .then(() => apis.admin.people.createUser({ username: user2 })) - .then(() => apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER)) - .then(() => apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER)) - .then(() => apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`)) - .then(() => apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`)) - .then(done); + beforeAll(async (done) => { + await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); + await apis.admin.people.createUser({ username: user2 }); + await apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER); + await apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER); + await apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`); + await apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnRowByName(siteName)) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - apis.admin.sites.deleteSite(siteName).then(done); + afterAll(async (done) => { + await apis.admin.sites.deleteSite(siteName); + done(); }); xit(''); describe('user is Manager', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280461]', () => { - dataTable.selectMultipleItems([file1Admin, file2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280461]', async () => { + await dataTable.selectMultipleItems([file1Admin, file2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple folders are selected - [C280462]', () => { - dataTable.selectMultipleItems([folder1Admin, folder2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple folders are selected - [C280462]', async () => { + await dataTable.selectMultipleItems([folder1Admin, folder2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when both files and folders are selected - [C280463]', () => { - dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when both files and folders are selected - [C280463]', async () => { + await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); }); describe('user is Consumer', () => { - beforeAll(done => { - loginPage.loginWith(user2).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user2); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280464]', () => { - dataTable.selectMultipleItems([file1Admin, file2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280464]', async () => { + await dataTable.selectMultipleItems([file1Admin, file2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple folders are selected - [C280465]', () => { - dataTable.selectMultipleItems([folder1Admin, folder2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple folders are selected - [C280465]', async () => { + await dataTable.selectMultipleItems([folder1Admin, folder2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when both files and folders are selected - [C280466]', () => { - dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when both files and folders are selected - [C280466]', async () => { + await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for selected files`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); + + await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); }); }); describe('Shared Files', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280467]', () => { - dataTable.selectMultipleItems([file1, file2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280467]', async () => { + await dataTable.selectMultipleItems([file1, file2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); }); describe('Recent Files', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280468]', () => { - dataTable.selectMultipleItems([file1, file2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280468]', async () => { + await dataTable.selectMultipleItems([file1, file2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); }); describe('Favorites', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280469]', () => { - dataTable.selectMultipleItems([file1, file2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280469]', async () => { + await dataTable.selectMultipleItems([file1, file2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple folders are selected - [C280470]', () => { - dataTable.selectMultipleItems([folder1, folder2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple folders are selected - [C280470]', async () => { + await dataTable.selectMultipleItems([folder1, folder2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); - it('correct actions appear when both files and folders are selected - [C280471]', () => { - dataTable.selectMultipleItems([file1, file2, folder1, folder2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); - }) - // .then(() => browser.$('body').click()) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clearSelection()); + it('correct actions appear when both files and folders are selected - [C280471]', async () => { + await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); + expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); + expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); + const menu = await toolbar.actions.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 browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); + await dataTable.clearSelection(); }); }); describe('Trash', () => { - beforeAll(done => { - loginPage.loginWith(user1).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(user1); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('correct actions appear when multiple files are selected - [C280472]', () => { - dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('Permanently delete')) - .toBe(true, 'Permanently delete is displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); - }) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple files are selected - [C280472]', async () => { + await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]); + expect(await toolbar.actions.isButtonPresent('Permanently delete')) + .toBe(true, 'Permanently delete is displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); + await dataTable.clearSelection(); }); - it('correct actions appear when multiple folders are selected - [C280473]', () => { - dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('Permanently delete')) - .toBe(true, 'Permanently delete is displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); - }) - .then(() => dataTable.clearSelection()); + it('correct actions appear when multiple folders are selected - [C280473]', async () => { + await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]); + expect(await toolbar.actions.isButtonPresent('Permanently delete')) + .toBe(true, 'Permanently delete is displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); + await dataTable.clearSelection(); }); - it('correct actions appear when both files and folders are selected - [C280474]', () => { - dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]) - .then(() => { - expect(toolbar.actions.isButtonPresent('Permanently delete')) - .toBe(true, 'Permanently delete is displayed for selected files'); - expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); - }) - .then(() => dataTable.clearSelection()); + it('correct actions appear when both files and folders are selected - [C280474]', async () => { + await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]); + expect(await toolbar.actions.isButtonPresent('Permanently delete')) + .toBe(true, 'Permanently delete is displayed for selected files'); + expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); + await dataTable.clearSelection(); }); }); }); diff --git a/e2e/suites/actions/toolbar-single-selection.test.ts b/e2e/suites/actions/toolbar-single-selection.test.ts index 028c5f6c2..1baad4b9e 100755 --- a/e2e/suites/actions/toolbar-single-selection.test.ts +++ b/e2e/suites/actions/toolbar-single-selection.test.ts @@ -102,14 +102,14 @@ describe('Toolbar actions - single selection : ', () => { it('actions not displayed for top level of File Libraries - [C213135]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await dataTable.waitForHeader(); - await dataTable.clickOnRowByName(userSite); + await dataTable.selectItem(userSite); expect(await toolbar.actions.isEmpty()).toBe(true, 'toolbar not empty'); }); it('selected row is marked with a check circle icon - [C213134]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); await dataTable.waitForHeader(); - await dataTable.clickOnRowByName(fileUser); + await dataTable.selectItem(fileUser); expect(await dataTable.hasCheckMarkIcon(fileUser)).toBe(true, 'check mark missing'); }); }); @@ -161,7 +161,7 @@ describe('Toolbar actions - single selection : ', () => { await dataTable.waitForHeader(); await dataTable.doubleClickOnRowByName(site); await dataTable.waitForHeader(); - await dataTable.clickOnRowByName(file1); + await dataTable.selectItem(file1); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); @@ -173,7 +173,7 @@ describe('Toolbar actions - single selection : ', () => { expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); await toolbar.actions.closeMoreMenu(); - await dataTable.clickOnRowByName(file2); + await dataTable.selectItem(file2); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); @@ -189,7 +189,7 @@ describe('Toolbar actions - single selection : ', () => { it('on Shared Files - [C280456]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); await page.dataTable.waitForHeader(); - await page.dataTable.clickOnRowByName(file1); + await page.dataTable.selectItem(file1); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); @@ -201,7 +201,7 @@ describe('Toolbar actions - single selection : ', () => { expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); await toolbar.actions.closeMoreMenu(); - await page.dataTable.clickOnRowByName(file2); + await page.dataTable.selectItem(file2); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); @@ -218,7 +218,7 @@ describe('Toolbar actions - single selection : ', () => { xit('on Favorites - [C213121]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await dataTable.waitForHeader(); - await dataTable.clickOnRowByName(file1); + await dataTable.selectItem(file1); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); @@ -229,7 +229,7 @@ describe('Toolbar actions - single selection : ', () => { expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); await toolbar.actions.closeMoreMenu(); - await dataTable.clickOnRowByName(file2); + await dataTable.selectItem(file2); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); @@ -323,7 +323,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C213122]', async () => { - await dataTable.clickOnRowByName(fileUser); + await dataTable.selectItem(fileUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); @@ -337,7 +337,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a folder is selected - [C213123]', async () => { - await dataTable.clickOnRowByName(folderUser); + await dataTable.selectItem(folderUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); @@ -397,7 +397,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280440]', async () => { - await dataTable.clickOnRowByName(fileAdmin); + await dataTable.selectItem(fileAdmin); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`); @@ -411,7 +411,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a folder is selected - [C280441]', async () => { - await dataTable.clickOnRowByName(folderAdmin); + await dataTable.selectItem(folderAdmin); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`); @@ -450,7 +450,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280443]', async () => { - await dataTable.clickOnRowByName(fileAdmin); + await dataTable.selectItem(fileAdmin); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`); @@ -464,7 +464,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a folder is selected - [C280444]', async () => { - await dataTable.clickOnRowByName(folderAdmin); + await dataTable.selectItem(folderAdmin); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`); @@ -502,7 +502,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280446]', async () => { - await page.dataTable.clickOnRowByName(fileUser); + await page.dataTable.selectItem(fileUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); @@ -539,7 +539,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280448]', async () => { - await dataTable.clickOnRowByName(fileUser); + await dataTable.selectItem(fileUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); @@ -576,7 +576,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280450]', async () => { - await dataTable.clickOnRowByName(fileUser); + await dataTable.selectItem(fileUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); @@ -590,7 +590,7 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a folder is selected - [C280451]', async () => { - await dataTable.clickOnRowByName(folderUser); + await dataTable.selectItem(folderUser); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); @@ -633,14 +633,14 @@ describe('Toolbar actions - single selection : ', () => { }); it('correct actions appear when a file is selected - [C280453]', async () => { - await dataTable.clickOnRowByName(fileForDelete); + await dataTable.selectItem(fileForDelete); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`); expect(await toolbar.actions.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is not displayed for file`); expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not displayed for file`); }); it('correct actions appear when a folder is selected - [C280454]', async () => { - await dataTable.clickOnRowByName(folderForDelete); + await dataTable.selectItem(folderForDelete); expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`); expect(await toolbar.actions.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is displayed for folder`); expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not enabled for folder`); diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts new file mode 100755 index 000000000..c8a95bad7 --- /dev/null +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -0,0 +1,189 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { protractor, browser } from 'protractor'; +import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; +import { SIDEBAR_LABELS, FILES, SITE_VISIBILITY } from '../../configs'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { Utils } from '../../utilities/utils'; +import { Viewer } from '../../components/viewer/viewer'; + +describe('Viewer general', () => { + const username = `user-${Utils.random()}`; + + const parent = `parent-${Utils.random()}`; let parentId; + + const xlsxFile = FILES.xlsxFile; let xlsxFileId; + const fileAdmin = FILES.docxFile; let fileAdminId; + + const siteAdmin = `siteAdmin-${Utils.random()}`; let docLibId; + const siteUser = `siteUser-${Utils.random()}`; let docLibSiteUserId; + + const fileInSite = FILES.docxFile; + + const apis = { + admin: new RepoClient(), + user: new RepoClient(username, username) + }; + + const loginPage = new LoginPage(); + const logoutPage = new LogoutPage(); + const page = new BrowsingPage(); + const dataTable = page.dataTable; + const viewer = new Viewer(); + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username }); + parentId = (await apis.user.nodes.createFolder(parent)).entry.id; + xlsxFileId = (await apis.user.upload.uploadFile(xlsxFile, parentId)).entry.id; + + await apis.admin.sites.createSite(siteAdmin, SITE_VISIBILITY.PRIVATE); + docLibId = await apis.admin.sites.getDocLibId(siteAdmin); + fileAdminId = (await apis.admin.upload.uploadFile(fileAdmin, docLibId)).entry.id; + + await apis.user.sites.createSite(siteUser, SITE_VISIBILITY.PUBLIC); + docLibSiteUserId = await apis.user.sites.getDocLibId(siteUser); + await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId); + + 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 loginPage.loginWith(username); + done(); + }); + + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(parent); + await dataTable.waitForHeader(); + done(); + }); + + afterEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + done(); + }); + + afterAll(async (done) => { + await Promise + .all([ + apis.user.nodes.deleteNodeById(parentId), + apis.admin.sites.deleteSite(siteAdmin), + apis.user.sites.deleteSite(siteUser), + logoutPage.load() + ]) + .then(done); + }); + + it('Viewer opens on double clicking on a file from Personal Files - [C279269]', async () => { + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + }); + + it('Viewer opens when clicking the View action for a file - [C279270]', async () => { + await dataTable.selectItem(xlsxFile); + await page.toolbar.actions.getButtonByTitleAttribute('View').click(); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + }); + + it('The viewer general elements are displayed - [C279283]', async () => { + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed'); + expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed'); + expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); + }); + + it('Close the viewer - [C279271]', async () => { + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + await viewer.clickClose(); + expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close'); + }); + + it('Close button tooltip - [C284632]', async () => { + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.getCloseButtonTooltip()).toEqual('Close'); + }); + + it('Viewer opens when accessing the preview URL for a file - [C279285]', async () => { + const previewURL = `personal-files/${parentId}/preview/${xlsxFileId}`; + await page.load(previewURL); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.getFileTitle()).toEqual(xlsxFile); + }); + + it('Viewer does not open when accessing the preview URL for a file without permissions - [C279287]', async () => { + const previewURL = `libraries/${docLibId}/preview/${fileAdminId}`; + await page.load(previewURL); + expect(await viewer.isViewerOpened()).toBe(false, 'Viewer should not be opened!'); + }); + + it('Viewer opens for a file from File Libraries - [C284633]', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(siteUser); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(fileInSite); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed'); + expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed'); + expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); + }); + + it('Viewer opens for a file from Recent Files - [C284636]', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed'); + expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed'); + expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); + }); + + it('Viewer opens for a file from Shared Files - [C284635]', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed'); + expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed'); + expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); + }); + + it('Viewer opens for a file from Favorites - [C284634]', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(xlsxFile); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed'); + expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed'); + expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); + }); + +}); diff --git a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts index 8a4b7ebaf..bd04dfa6c 100755 --- a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts @@ -107,7 +107,7 @@ export class NodesApi extends RepoApi { return await this.createNode('cm:folder', name, parentId, title, description); } - async createChildren(data: NodeBodyCreate[]) { + async createChildren(data: NodeBodyCreate[]): Promise { await this.apiAuth(); return await this.alfrescoJsApi.core.nodesApi.addNode('-my-', data); } diff --git a/e2e/utilities/repo-client/apis/upload/upload-api.ts b/e2e/utilities/repo-client/apis/upload/upload-api.ts new file mode 100644 index 000000000..15b362bf6 --- /dev/null +++ b/e2e/utilities/repo-client/apis/upload/upload-api.ts @@ -0,0 +1,47 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { RepoApi } from '../repo-api'; +import { E2E_ROOT_PATH } from '../../../../configs'; +const fs = require('fs'); + +export class UploadApi extends RepoApi { + + constructor(username?, password?) { + super(username, password); + } + + async uploadFile(fileName: string, parentFolderId: string = '-my-') { + const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/${fileName}`); + const opts = { + mane: file.name, + nodeType: 'cm:content' + }; + + await this.apiAuth(); + return await this.alfrescoJsApi.upload.uploadFile(file, '', parentFolderId, null, opts); + } + +} diff --git a/e2e/utilities/repo-client/repo-client.ts b/e2e/utilities/repo-client/repo-client.ts index d8b7456f8..b8b708df8 100755 --- a/e2e/utilities/repo-client/repo-client.ts +++ b/e2e/utilities/repo-client/repo-client.ts @@ -32,6 +32,7 @@ import { FavoritesApi } from './apis/favorites/favorites-api'; import { SharedLinksApi } from './apis/shared-links/shared-links-api'; import { TrashcanApi } from './apis/trashcan/trashcan-api'; import { SearchApi } from './apis/search/search-api'; +import { UploadApi } from './apis/upload/upload-api'; export class RepoClient { constructor( @@ -71,6 +72,10 @@ export class RepoClient { get search() { return new SearchApi(this.auth.username, this.auth.password); } + + get upload() { + return new UploadApi(this.auth.username, this.auth.password); + } } export * from './apis/nodes/node-body-create'; diff --git a/protractor.conf.js b/protractor.conf.js index 8d4c8f8e5..17ed65744 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -19,7 +19,8 @@ exports.config = { './e2e/suites/application/page-titles.test.ts', './e2e/suites/navigation/*.test.ts', './e2e/suites/pagination/*.test.ts', - './e2e/suites/actions/*.test.ts' + './e2e/suites/actions/*.test.ts', + './e2e/suites/viewer/*.test.ts' ], capabilities: {