diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index eb4d788e1..b448710b6 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -43,7 +43,7 @@ export class DataTable extends Component { row: '.adf-datatable-row[role]', selectedRow: '.adf-datatable-row.is-selected', cell: '.adf-data-table-cell', - locationLink: 'aca-location-link', + locationLink: '.aca-location-link', linkCell: '.adf-location-cell', selectedIcon: '.mat-icon', @@ -125,6 +125,10 @@ export class DataTable extends Component { return this.body.all(by.css(DataTable.selectors.row)); } + countRows(): promise.Promise { + return this.getRows().count(); + } + getSelectedRows(): ElementArrayFinder { return this.body.all(by.css(DataTable.selectors.selectedRow)); } @@ -137,66 +141,41 @@ export class DataTable extends Component { return this.getRows().get(nth - 1); } - getRowName(name: string): ElementFinder { - return this.body.element(by.cssContainingText(`.adf-data-table-cell span`, name)); + getRowByName(name: string): ElementFinder { + return this.body.element(by.cssContainingText(DataTable.selectors.row, name)); + } + + getRowFirstCell(name: string) { + return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(0); + } + + getRowNameCell(name: string) { + return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1); + } + + getRowNameCellText(name: string) { + return this.getRowNameCell(name).$('span'); } getItemNameTooltip(name: string): promise.Promise { - return this.getRowName(name).getAttribute('title'); - } - - countRows(): promise.Promise { - return this.getRows().count(); + return this.getRowNameCellText(name).getAttribute('title'); } hasCheckMarkIcon(itemName: string) { - return this.getRowName(itemName).element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`)) - .element(by.css(DataTable.selectors.selectedIcon)).isPresent(); + return this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent(); } // Navigation/selection methods - doubleClickOnItemName(name: string): promise.Promise { - const dblClick = browser.actions() - .mouseMove(this.getRowName(name)) - .click() - .click(); - - return dblClick.perform(); - } - - // Navigation/selection methods - doubleClickOnItemNameRow(name: string): promise.Promise { - const dblClick = browser.actions() - .mouseMove(this.getRowName(name).element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`))) - .click() - .click(); - - return dblClick.perform(); - } - - clickOnItemName(name: string): promise.Promise { - const item = this.getRowName(name); + doubleClickOnRowByName(name: string): promise.Promise { + const item = this.getRowFirstCell(name); return Utils.waitUntilElementClickable(item) - .then(() => this.getRowName(name).click()); + .then(() => browser.actions().mouseMove(item).click().click().perform()); } - clickOnItemNameRow(name: string): promise.Promise { - const item = this.getRowName(name); + clickOnRowByName(name: string): promise.Promise { + const item = this.getRowFirstCell(name); return Utils.waitUntilElementClickable(item) - .then(() => this.getRowName(name) - .element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`)) - .click()); - } - - selectMultipleItemsRow(names: string[]): promise.Promise { - return this.clearSelection() - .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) - .then(() => { - names.forEach(name => { - this.clickOnItemNameRow(name); - }); - }) - .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()); + .then(() => item.click()); } selectMultipleItems(names: string[]): promise.Promise { @@ -204,7 +183,7 @@ export class DataTable extends Component { .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) .then(() => { names.forEach(name => { - this.clickOnItemName(name); + this.clickOnRowByName(name); }); }) .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()); @@ -218,8 +197,7 @@ export class DataTable extends Component { } getItemLocation(name: string) { - return this.getRowName(name).element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`)) - .element(this.locationLink); + return this.getRowByName(name).element(this.locationLink); } getItemLocationTooltip(name: string): promise.Promise { diff --git a/e2e/components/toolbar/toolbar-actions.ts b/e2e/components/toolbar/toolbar-actions.ts index 6847a306d..f72fa57b9 100755 --- a/e2e/components/toolbar/toolbar-actions.ts +++ b/e2e/components/toolbar/toolbar-actions.ts @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor'; +import { ElementFinder, ElementArrayFinder, by, promise, protractor, browser } from 'protractor'; import { Menu } from '../menu/menu'; import { Component } from '../component'; @@ -61,4 +61,8 @@ export class ToolbarActions extends Component { .then(() => this.menu.waitForMenuToOpen()) .then(() => this.menu); } + + closeMoreMenu() { + return browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + } } diff --git a/e2e/configs.ts b/e2e/configs.ts index 3ac50a40d..8706ae07f 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -29,7 +29,7 @@ export const BROWSER_RESOLUTION_HEIGHT = 800; export const BROWSER_WAIT_TIMEOUT = 30000; // Application configs -export const APP_HOST = 'http://localhost:3000'; +export const APP_HOST = 'http://localhost:4000'; // Repository configs export const REPO_API_HOST = 'http://localhost:8080'; diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index d3b4024d8..ae0ce261b 100755 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -85,7 +85,7 @@ describe('Create folder', () => { }); it('option is enabled when having enough permissions', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openNewMenu()) .then(menu => { const isEnabled = menu.getItemByLabel('Create folder').isEnabled(); @@ -94,7 +94,7 @@ describe('Create folder', () => { }); it('creates new folder with name', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName(folderName1)) @@ -102,13 +102,13 @@ describe('Create folder', () => { .then(() => createDialog.waitForDialogToClose()) .then(() => dataTable.waitForHeader()) .then(() => { - const isPresent = dataTable.getRowName(folderName1).isPresent(); + const isPresent = dataTable.getRowByName(folderName1).isPresent(); expect(isPresent).toBe(true, 'Folder not displayed in list view'); }); }); it('creates new folder with name and description', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName(folderName2)) @@ -116,13 +116,13 @@ describe('Create folder', () => { .then(() => createDialog.clickCreate()) .then(() => createDialog.waitForDialogToClose()) .then(() => dataTable.waitForHeader()) - .then(() => expect(dataTable.getRowName(folderName2).isPresent()).toBe(true, 'Folder not displayed')) + .then(() => expect(dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed')) .then(() => apis.user.nodes.getNodeDescription(folderName2, parent)) .then(desc => expect(desc).toEqual(folderDescription)); }); it('enabled option tooltip', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openNewMenu()) .then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() .then(() => menu)) @@ -135,8 +135,8 @@ describe('Create folder', () => { const fileLibrariesPage = new BrowsingPage(); fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName)) - .then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1)) + .then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName)) + .then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) .then(() => fileLibrariesPage.sidenav.openNewMenu()) .then(menu => { const isEnabled = menu.getItemByLabel('Create folder').isEnabled(); @@ -148,8 +148,8 @@ describe('Create folder', () => { const fileLibrariesPage = new BrowsingPage(); fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName)) - .then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1)) + .then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName)) + .then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) .then(() => fileLibrariesPage.sidenav.openNewMenu()) .then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() .then(() => menu)) @@ -160,7 +160,7 @@ describe('Create folder', () => { }); it('dialog UI elements', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => { @@ -179,7 +179,7 @@ describe('Create folder', () => { }); it('with empty folder name', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.deleteNameWithBackspace()) @@ -193,7 +193,7 @@ describe('Create folder', () => { }); it('with folder name ending with a dot "."', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName('folder-name.')) @@ -209,7 +209,7 @@ describe('Create folder', () => { it('with folder name containing special characters', () => { const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => namesWithSpecialChars.forEach(name => { @@ -224,7 +224,7 @@ describe('Create folder', () => { }); it('with folder name containing only spaces', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName(' ')) @@ -238,7 +238,7 @@ describe('Create folder', () => { }); it('cancel folder creation', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName('test')) @@ -250,7 +250,7 @@ describe('Create folder', () => { }); it('duplicate folder name', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName(duplicateFolderName)) @@ -263,7 +263,7 @@ describe('Create folder', () => { }); it('trim ending spaces from folder name', () => { - personalFilesPage.dataTable.doubleClickOnItemName(parent) + personalFilesPage.dataTable.doubleClickOnRowByName(parent) .then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.enterName(nameWithSpaces)) @@ -271,7 +271,7 @@ describe('Create folder', () => { .then(() => createDialog.waitForDialogToClose()) .then(() => dataTable.waitForHeader()) .then(() => { - const isPresent = dataTable.getRowName(nameWithSpaces.trim()).isPresent(); + const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent(); expect(isPresent).toBe(true, 'Folder not displayed in list view'); }); }); diff --git a/e2e/suites/actions/delete.test.ts b/e2e/suites/actions/delete.test.ts index a4e5f42fb..1a6d09b77 100755 --- a/e2e/suites/actions/delete.test.ts +++ b/e2e/suites/actions/delete.test.ts @@ -101,18 +101,18 @@ describe('Delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(file1) + dataTable.clickOnRowByName(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${file1} deleted`); - expect(dataTable.getRowName(file1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list'); items--; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(file1).isPresent()).toBe(true, 'Item is not in trash')) + .then(() => expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => apis.user.trashcan.restore(file1Id)); }); @@ -121,21 +121,21 @@ describe('Delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.selectMultipleItemsRow([file1, file2]) + dataTable.selectMultipleItems([file1, file2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`Deleted 2 items`); - expect(dataTable.getRowName(file1).isPresent()).toBe(false, `${file1} was not removed from list`); - expect(dataTable.getRowName(file2).isPresent()).toBe(false, `${file2} was not removed from list`); + expect(dataTable.getRowByName(file1).isPresent()).toBe(false, `${file1} was not removed from list`); + expect(dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} was not removed from list`); items = items - 2; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(file1).isPresent()).toBe(true, `${file1} is not in trash`); - expect(dataTable.getRowName(file2).isPresent()).toBe(true, `${file2} is not in trash`); + expect(dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} is not in trash`); + expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} is not in trash`); }) .then(() => apis.user.trashcan.restore(file1Id)) @@ -146,41 +146,41 @@ describe('Delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(folder1) + dataTable.clickOnRowByName(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => { - expect(dataTable.getRowName(folder1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list'); items--; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(folder1).isPresent()).toBe(true, 'Item is not in trash'); - expect(dataTable.getRowName(file3).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item is not in trash'); + expect(dataTable.getRowByName(file3).isPresent()).toBe(false, 'Item is in trash'); }) .then(() => apis.user.trashcan.restore(folder1Id)); }); it('delete a folder containing locked files', () => { - dataTable.clickOnItemNameRow(folder2) + dataTable.clickOnRowByName(folder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${folder2} couldn't be deleted`); - expect(dataTable.getRowName(folder2).isPresent()).toBe(true, 'Item was removed from list'); + expect(dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item was removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(folder2).isPresent()).toBe(false, 'Item is in trash'); - expect(dataTable.getRowName(file4).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(file4).isPresent()).toBe(false, 'Item is in trash'); }); }); it('notification on multiple items deletion - some items fail to delete', () => { - dataTable.selectMultipleItemsRow([file1, folder2]) + dataTable.selectMultipleItems([file1, folder2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -191,7 +191,7 @@ describe('Delete content', () => { // TODO: needs to operate on two folders containing locked items xit('Notification on multiple items deletion - all items fail to delete', () => { - dataTable.selectMultipleItemsRow([fileLocked1, folder2]) + dataTable.selectMultipleItems([fileLocked1, folder2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -234,34 +234,34 @@ describe('Delete content', () => { }); it('delete a file and check notification', () => { - dataTable.clickOnItemNameRow(sharedFile1) + dataTable.clickOnRowByName(sharedFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${sharedFile1} deleted`); - expect(dataTable.getRowName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash')) + .then(() => expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => apis.user.trashcan.restore(sharedFile1Id)); }); it('delete multiple files and check notification', () => { - dataTable.selectMultipleItemsRow([sharedFile2, sharedFile3]) + dataTable.selectMultipleItems([sharedFile2, sharedFile3]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`Deleted 2 items`); - expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`); - expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`); + expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`); + expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`); - expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`); + expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`); + expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`); }) .then(() => apis.user.trashcan.restore(sharedFile2Id)) @@ -324,18 +324,18 @@ describe('Delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(favoriteFile1) + dataTable.clickOnRowByName(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${favoriteFile1} deleted`); - expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list'); items--; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash')) + .then(() => expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => apis.user.trashcan.restore(favoriteFile1Id)); }); @@ -344,21 +344,21 @@ describe('Delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.selectMultipleItemsRow([favoriteFile1, favoriteFile2]) + dataTable.selectMultipleItems([favoriteFile1, favoriteFile2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`Deleted 2 items`); - expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`); - expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`); + expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`); + expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`); items = items - 2; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`); - expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`); + expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`); + expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`); }) .then(() => apis.user.trashcan.restore(favoriteFile1Id)) @@ -368,41 +368,41 @@ describe('Delete content', () => { it('delete a folder with content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(favoriteFolder1) + dataTable.clickOnRowByName(favoriteFolder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => { - expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list'); items--; expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash'); - expect(dataTable.getRowName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash'); + expect(dataTable.getRowByName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash'); }) .then(() => apis.user.trashcan.restore(favoriteFolder1Id)); }); it('delete a folder containing locked files', () => { - dataTable.clickOnItemNameRow(favoriteFolder2) + dataTable.clickOnRowByName(favoriteFolder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${favoriteFolder2} couldn't be deleted`); - expect(dataTable.getRowName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list'); + expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash'); - expect(dataTable.getRowName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash'); + expect(dataTable.getRowByName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash'); }); }); it('notification on multiple items deletion - some items fail to delete', () => { - dataTable.selectMultipleItemsRow([favoriteFile1, favoriteFolder2]) + dataTable.selectMultipleItems([favoriteFile1, favoriteFolder2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -414,7 +414,7 @@ describe('Delete content', () => { }); it('Notification on multiple items deletion - all items fail to delete', () => { - dataTable.selectMultipleItemsRow([favoriteFileLocked1, favoriteFolder2]) + dataTable.selectMultipleItems([favoriteFileLocked1, favoriteFolder2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -467,34 +467,34 @@ describe('Delete content', () => { }); xit('delete a file and check notification', () => { - dataTable.clickOnItemNameRow(recentFile1) + dataTable.clickOnRowByName(recentFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`${recentFile1} deleted`); - expect(dataTable.getRowName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(recentFile1).isPresent()).toBe(true, 'Item is not in trash')) + .then(() => expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => apis.user.trashcan.restore(recentFile1Id)); }); xit('delete multiple files and check notification', () => { - dataTable.selectMultipleItemsRow([recentFile2, recentFile3]) + dataTable.selectMultipleItems([recentFile2, recentFile3]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) .then(message => { expect(message).toContain(`Deleted 2 items`); - expect(dataTable.getRowName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`); - expect(dataTable.getRowName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`); + expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`); + expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`); - expect(dataTable.getRowName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`); + expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`); + expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`); }) .then(() => apis.user.trashcan.restore(recentFile2Id)) diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index 5395463ab..f8aa6a9ec 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -74,7 +74,7 @@ describe('Edit folder', () => { beforeEach(done => { personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(parent)) + .then(() => dataTable.doubleClickOnRowByName(parent)) .then(() => dataTable.waitForHeader()) .then(done); }); @@ -94,7 +94,7 @@ describe('Edit folder', () => { }); it('dialog UI defaults', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(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', () => { - dataTable.clickOnItemNameRow(folderNameToEdit) + dataTable.clickOnRowByName(folderNameToEdit) .then(() => editButton.click()) .then(() => editDialog.waitForDialogToOpen()) .then(() => editDialog.enterDescription(folderDescriptionEdited)) @@ -114,13 +114,13 @@ describe('Edit folder', () => { .then(() => editDialog.clickUpdate()) .then(() => editDialog.waitForDialogToClose()) .then(() => dataTable.waitForHeader()) - .then(() => expect(dataTable.getRowName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed')) + .then(() => expect(dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed')) .then(() => apis.user.nodes.getNodeDescription(folderNameEdited, parent)) .then(desc => expect(desc).toEqual(folderDescriptionEdited)); }); it('with empty folder name', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(folderName) .then(() => editButton.click()) .then(() => editDialog.deleteNameWithBackspace()) .then(() => { @@ -132,7 +132,7 @@ describe('Edit folder', () => { it('with name with special characters', () => { const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(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', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(folderName) .then(() => editButton.click()) .then(() => editDialog.nameInput.sendKeys('.')) .then(() => { @@ -153,7 +153,7 @@ describe('Edit folder', () => { }); it('Cancel button', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(folderName) .then(() => editButton.click()) .then(() => editDialog.clickCancel()) .then(() => { @@ -162,7 +162,7 @@ describe('Edit folder', () => { }); it('with duplicate folder name', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(folderName) .then(() => editButton.click()) .then(() => editDialog.enterName(duplicateFolderName)) .then(() => editDialog.clickUpdate()) @@ -174,14 +174,14 @@ describe('Edit folder', () => { }); it('trim ending spaces', () => { - dataTable.clickOnItemNameRow(folderName) + dataTable.clickOnRowByName(folderName) .then(() => editButton.click()) .then(() => editDialog.nameInput.sendKeys(' ')) .then(() => editDialog.clickUpdate()) .then(() => editDialog.waitForDialogToClose()) .then(() => { expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears'); - expect(dataTable.getRowName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view'); + expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view'); }); }); }); diff --git a/e2e/suites/actions/mark-favorite.test.ts b/e2e/suites/actions/mark-favorite.test.ts index bc63bb92b..6ee1703ee 100644 --- a/e2e/suites/actions/mark-favorite.test.ts +++ b/e2e/suites/actions/mark-favorite.test.ts @@ -61,6 +61,9 @@ describe('Mark items as favorites', () => { .then(() => apis.user.favorites.addFavoriteById('file', file3Id)) .then(() => apis.user.favorites.addFavoriteById('file', file4Id)) + .then(() => apis.user.search.waitForApi(username, { expect: 4 })) + .then(() => apis.user.favorites.waitForApi({ expect: 2 })) + .then(() => loginPage.loginWith(username)) .then(done); }); @@ -82,31 +85,30 @@ describe('Mark items as favorites', () => { .then(done); }); - afterEach(done => { - // browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); - browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); + beforeEach(done => { + toolbar.actions.closeMoreMenu().then(done); }); it('Favorite action has empty star icon for an item not marked as favorite', () => { - dataTable.clickOnItemNameRow(file1NotFav) + dataTable.clickOnRowByName(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border')); }); it('Favorite action has empty star icon for multiple selection of items when some are not favorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file3Fav ]) + dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border')); }); it('Favorite action has full star icon for items marked as favorite', () => { - dataTable.clickOnItemNameRow(file3Fav) + dataTable.clickOnRowByName(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star')); }); it('favorite a file', () => { - dataTable.clickOnItemNameRow(file1NotFav) + dataTable.clickOnRowByName(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -117,7 +119,7 @@ describe('Mark items as favorites', () => { }); it('favorite a folder', () => { - dataTable.clickOnItemNameRow(folder1) + dataTable.clickOnRowByName(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -128,7 +130,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item', () => { - dataTable.clickOnItemNameRow(file3Fav) + dataTable.clickOnRowByName(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -139,7 +141,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - all unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file2NotFav ]) + dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 4 })) @@ -157,7 +159,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - some favorite and some unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file3Fav ]) + dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -174,7 +176,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite multiple items', () => { - dataTable.selectMultipleItemsRow([ file3Fav, file4Fav ]) + dataTable.selectMultipleItems([ file3Fav, file4Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => browser.sleep(2000)) @@ -199,13 +201,12 @@ describe('Mark items as favorites', () => { .then(done); }); - afterEach(done => { - // browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); - browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); + beforeEach(done => { + toolbar.actions.closeMoreMenu().then(done); }); it('favorite a file', () => { - dataTable.clickOnItemNameRow(file1NotFav) + dataTable.clickOnRowByName(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -216,7 +217,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item', () => { - dataTable.clickOnItemNameRow(file3Fav) + dataTable.clickOnRowByName(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -227,7 +228,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - all unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file2NotFav ]) + dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 4 })) @@ -245,7 +246,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - some favorite and some unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file3Fav ]) + dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -262,7 +263,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite multiple items', () => { - dataTable.selectMultipleItemsRow([ file3Fav, file4Fav ]) + dataTable.selectMultipleItems([ file3Fav, file4Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => browser.sleep(2000)) @@ -295,7 +296,7 @@ describe('Mark items as favorites', () => { }); it('favorite a file', () => { - dataTable.clickOnItemNameRow(file1NotFav) + dataTable.clickOnRowByName(file1NotFav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -306,7 +307,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item', () => { - dataTable.clickOnItemNameRow(file3Fav) + dataTable.clickOnRowByName(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) @@ -317,7 +318,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - all unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file2NotFav ]) + dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 4 })) @@ -335,7 +336,7 @@ describe('Mark items as favorites', () => { }); it('favorite multiple items - some favorite and some unfavorite', () => { - dataTable.selectMultipleItemsRow([ file1NotFav, file3Fav ]) + dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 3 })) @@ -352,7 +353,7 @@ describe('Mark items as favorites', () => { }); it('unfavorite multiple items', () => { - dataTable.selectMultipleItemsRow([ file3Fav, file4Fav ]) + dataTable.selectMultipleItems([ file3Fav, file4Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => browser.sleep(2000)) @@ -382,33 +383,33 @@ describe('Mark items as favorites', () => { }); it('unfavorite an item', () => { - dataTable.clickOnItemNameRow(file3Fav) + dataTable.clickOnRowByName(file3Fav) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => apis.user.favorites.waitForApi({ expect: 1 })) .then(() => apis.user.favorites.isFavorite(file3Id)) .then(isFavorite => { expect(isFavorite).toBe(false, 'item is marked as favorite'); - expect(dataTable.getRowName(file3Fav).isPresent()).toBe(false, 'item still displayed'); + expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed'); }) .then(() => apis.user.favorites.addFavoriteById('file', file3Id)); }); it('unfavorite multiple items', () => { - dataTable.selectMultipleItemsRow([ file3Fav, file4Fav ]) + dataTable.selectMultipleItems([ file3Fav, file4Fav ]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => browser.sleep(2000)) .then(() => apis.user.favorites.isFavorite(file3Id)) .then(resp => { expect(resp).toBe(false, 'file3 marked as favorite'); - expect(dataTable.getRowName(file3Fav).isPresent()).toBe(false, 'file3 still displayed'); + expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed'); }) .then(() => apis.user.favorites.isFavorite(file4Id)) .then(resp => { expect(resp).toBe(false, 'file4 marked as favorite'); - expect(dataTable.getRowName(file4Fav).isPresent()).toBe(false, 'file4 still displayed'); + expect(dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed'); }) .then(() => apis.user.favorites.addFavoriteById('file', file3Id)) diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/permanently-delete.test.ts index c725ab506..e924fa13a 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 [C217094] [C217091] [C217092]', () => { - dataTable.clickOnItemNameRow(file1) + dataTable.clickOnRowByName(file1) .then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) .then(() => trashPage.waitForDialog()) .then(() => trashPage.getDialogActionByLabel('Delete')) @@ -87,12 +87,12 @@ describe('Permanently delete from Trash', () => { .then(() => trashPage.getSnackBarMessage()) .then(text => { expect(text).toEqual(`${file1} deleted`); - expect(dataTable.getRowName(file1).isPresent()).toBe(false, 'Item was not deleted'); + expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted'); }); }); it('delete folder [C217091] [C217092]', () => { - dataTable.clickOnItemNameRow(folder1) + dataTable.clickOnRowByName(folder1) .then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) .then(() => trashPage.waitForDialog()) .then(() => trashPage.getDialogActionByLabel('Delete')) @@ -101,12 +101,12 @@ describe('Permanently delete from Trash', () => { .then(() => trashPage.getSnackBarMessage()) .then(text => { expect(text).toEqual(`${folder1} deleted`); - expect(dataTable.getRowName(folder1).isPresent()).toBe(false, 'Item was not deleted'); + expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted'); }); }); it('delete multiple items [C217093]', () => { - dataTable.selectMultipleItemsRow([ file2, folder2 ]) + dataTable.selectMultipleItems([ file2, folder2 ]) .then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) .then(() => trashPage.waitForDialog()) .then(() => trashPage.getDialogActionByLabel('Delete')) @@ -115,8 +115,8 @@ describe('Permanently delete from Trash', () => { .then(() => trashPage.getSnackBarMessage()) .then(text => { expect(text).toEqual(`2 items deleted`); - expect(dataTable.getRowName(file2).isPresent()).toBe(false, 'Item was not deleted'); - expect(dataTable.getRowName(folder2).isPresent()).toBe(false, 'Item was not deleted'); + expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted'); + expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted'); }); }); }); diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index 96ee9a69e..56e3117f2 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -80,63 +80,63 @@ describe('Restore from Trash', () => { }); it('restore file', () => { - dataTable.clickOnItemNameRow(file) + dataTable.clickOnRowByName(file) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => { expect(text).toContain(`${file} restored`); expect(text).toContain(`View`); - expect(dataTable.getRowName(file).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.dataTable.waitForHeader()) .then(() => { - expect(page.dataTable.getRowName(file).isPresent()).toBe(true, 'Item not displayed in list'); + expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list'); }) .then(() => apis.user.nodes.deleteNodeById(fileId, false)); }); it('restore folder', () => { - dataTable.clickOnItemNameRow(folder) + dataTable.clickOnRowByName(folder) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => { expect(text).toContain(`${folder} restored`); expect(text).toContain(`View`); - expect(dataTable.getRowName(folder).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.dataTable.waitForHeader()) .then(() => { - expect(page.dataTable.getRowName(folder).isPresent()).toBe(true, 'Item not displayed in list'); + expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list'); }) .then(() => apis.user.nodes.deleteNodeById(folderId, false)); }); it('restore multiple items', () => { - dataTable.selectMultipleItemsRow([ file, folder ]) + dataTable.selectMultipleItems([ file, folder ]) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => { expect(text).toContain(`Restore successful`); expect(text).not.toContain(`View`); - expect(dataTable.getRowName(file).isPresent()).toBe(false, 'Item was not removed from list'); - expect(dataTable.getRowName(folder).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); + expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); }) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.dataTable.waitForHeader()) .then(() => { - expect(page.dataTable.getRowName(file).isPresent()).toBe(true, 'Item not displayed in list'); - expect(page.dataTable.getRowName(folder).isPresent()).toBe(true, 'Item not displayed in list'); + expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list'); + expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list'); }) .then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false)); }); it('View from notification', () => { - dataTable.clickOnItemNameRow(file) + dataTable.clickOnRowByName(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', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.clickOnItemNameRow(file1)) + .then(() => dataTable.clickOnRowByName(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', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.clickOnItemNameRow(file2)) + .then(() => dataTable.clickOnRowByName(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`)); @@ -252,14 +252,14 @@ describe('Restore from Trash', () => { }); it('one failure', () => { - dataTable.selectMultipleItemsRow([ file1, file2 ]) + dataTable.selectMultipleItems([ file1, file2 ]) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`)); }); it('multiple failures', () => { - dataTable.selectMultipleItemsRow([ file3, file4, file5 ]) + dataTable.selectMultipleItems([ file3, file4, file5 ]) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => page.getSnackBarMessage()) .then(text => expect(text).toEqual('2 items not restored because of issues with the restore location')); diff --git a/e2e/suites/actions/toolbar-multiple-selection.test.ts b/e2e/suites/actions/toolbar-multiple-selection.test.ts index 5a0642220..2a996f360 100755 --- a/e2e/suites/actions/toolbar-multiple-selection.test.ts +++ b/e2e/suites/actions/toolbar-multiple-selection.test.ts @@ -25,7 +25,7 @@ import { browser, protractor } from 'protractor'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS, APP_ROUTES } from '../../configs'; +import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { RepoClient } from '../../utilities/repo-client/repo-client'; import { Utils } from '../../utilities/utils'; @@ -77,9 +77,11 @@ describe('Toolbar actions - multiple selection : ', () => { .then(() => apis.user.nodes.createFolders([ folderForDelete2 ]).then(resp => folderForDelete2Id = resp.data.entry.id)) .then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id ])) + .then(() => 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 })) .then(() => apis.user.nodes.deleteNodesById([ fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id @@ -115,26 +117,26 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('unselect selected items - single click', () => { - dataTable.selectMultipleItemsRow([ file1, file2, folder1, folder2 ]) + dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]) .then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number')) - .then(() => dataTable.clickOnItemNameRow(file1)) + .then(() => dataTable.clickOnRowByName(file1)) .then(() => expect(dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number')) .then(() => dataTable.clearSelection()); }); it('unselect selected items - CMD+click', () => { - dataTable.selectMultipleItemsRow([ file1, file2, folder1, folder2 ]) + dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]) .then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number')) .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) - .then(() => dataTable.clickOnItemNameRow(file1)) - .then(() => dataTable.clickOnItemNameRow(file2)) + .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('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2]) + dataTable.selectMultipleItems([file1, file2]) .then(() => toolbar.actions.openMoreMenu()) .then(menu => { expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); @@ -142,13 +144,12 @@ describe('Toolbar actions - multiple selection : ', () => { 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(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) .then(() => dataTable.clearSelection()); }); it('correct actions appear when multiple folders are selected', () => { - dataTable.selectMultipleItemsRow([folder1, folder2]) + dataTable.selectMultipleItems([folder1, folder2]) .then(() => toolbar.actions.openMoreMenu()) .then(menu => { expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); @@ -156,55 +157,54 @@ describe('Toolbar actions - multiple selection : ', () => { 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(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) .then(() => dataTable.clearSelection()); }); it('should not display View action when multiple entries selected', async () => { - await dataTable.selectMultipleItemsRow([folder1, file1, folder2]); + await dataTable.selectMultipleItems([folder1, file1, folder2]); expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'Action is displayed'); }); it('should display View action when one file is selected', async () => { - await dataTable.selectMultipleItemsRow([file1]); + await dataTable.selectMultipleItems([file1]); expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'Action is not displayed'); }); it('should not display View action when only folders selected', async () => { - await dataTable.selectMultipleItemsRow([folder1, folder2]); + await dataTable.selectMultipleItems([folder1, folder2]); expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'Action is displayed'); }); it('should display Download action for selected items', async () => { - await dataTable.selectMultipleItemsRow([folder1, file1, folder2]); + await dataTable.selectMultipleItems([folder1, file1, folder2]); expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Action is not displayed'); }); it('should not display Download action for empty selection', async () => { - await dataTable.selectMultipleItemsRow([folder1, file1, folder2]); + await dataTable.selectMultipleItems([folder1, file1, folder2]); await dataTable.clearSelection(); expect(toolbar.actions.isButtonPresent('Download')).toBe(false, 'Action is displayed'); }); it('should display Edit action when single folder selected', async () => { - await dataTable.selectMultipleItemsRow([folder1]); + await dataTable.selectMultipleItems([folder1]); expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Action is not displayed'); }); it('should not display Edit action when multiple folders selected', async () => { - await dataTable.selectMultipleItemsRow([folder1, file1, folder2]); + await dataTable.selectMultipleItems([folder1, file1, folder2]); expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Action is displayed'); }); it('should not display Edit action if no folders selected', async () => { - await dataTable.selectMultipleItemsRow([file1, file2]); + await dataTable.selectMultipleItems([file1, file2]); expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Action is displayed'); }); it('correct actions appear when both files and folders are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2, folder1, folder2]) + dataTable.selectMultipleItems([file1, file2, folder1, folder2]) .then(() => toolbar.actions.openMoreMenu()) .then(menu => { expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); @@ -212,8 +212,7 @@ describe('Toolbar actions - multiple selection : ', () => { 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(() => browser.actions().sendKeys(protractor.Key.ESCAPE).perform()) .then(() => dataTable.clearSelection()); }); }); @@ -232,7 +231,7 @@ describe('Toolbar actions - multiple selection : ', () => { beforeEach(done => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(siteName)) + .then(() => dataTable.doubleClickOnRowByName(siteName)) .then(() => dataTable.waitForHeader()) .then(done); }); @@ -253,7 +252,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1Admin, file2Admin]) + 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'); @@ -272,7 +271,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple folders are selected', () => { - dataTable.selectMultipleItemsRow([folder1Admin, folder2Admin]) + 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'); @@ -291,7 +290,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when both files and folders are selected', () => { - dataTable.selectMultipleItemsRow([file1Admin, file2Admin, folder1Admin, folder2Admin]) + 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'); @@ -320,7 +319,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1Admin, file2Admin]) + 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'); @@ -339,7 +338,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple folders are selected', () => { - dataTable.selectMultipleItemsRow([folder1Admin, folder2Admin]) + 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'); @@ -358,7 +357,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when both files and folders are selected', () => { - dataTable.selectMultipleItemsRow([file1Admin, file2Admin, folder1Admin, folder2Admin]) + 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'); @@ -384,8 +383,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); beforeEach(done => { - // page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) - browser.get(APP_ROUTES.SHARED_FILES) + page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) .then(() => dataTable.waitForHeader()) .then(done); }); @@ -395,7 +393,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2]) + 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'); @@ -408,7 +406,6 @@ describe('Toolbar actions - multiple selection : ', () => { 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()); }); @@ -430,7 +427,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2]) + 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'); @@ -465,7 +462,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2]) + 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'); @@ -484,7 +481,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple folders are selected', () => { - dataTable.selectMultipleItemsRow([folder1, folder2]) + 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'); @@ -503,7 +500,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when both files and folders are selected', () => { - dataTable.selectMultipleItemsRow([file1, file2, folder1, folder2]) + 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'); @@ -539,7 +536,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple files are selected', () => { - dataTable.selectMultipleItemsRow([fileForDelete1, fileForDelete2]) + dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]) .then(() => { expect(toolbar.actions.isButtonPresent('Permanently delete')) .toBe(true, 'Permanently delete is displayed for selected files'); @@ -549,7 +546,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when multiple folders are selected', () => { - dataTable.selectMultipleItemsRow([folderForDelete1, folderForDelete2]) + dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]) .then(() => { expect(toolbar.actions.isButtonPresent('Permanently delete')) .toBe(true, 'Permanently delete is displayed for selected files'); @@ -559,7 +556,7 @@ describe('Toolbar actions - multiple selection : ', () => { }); it('correct actions appear when both files and folders are selected', () => { - dataTable.selectMultipleItemsRow([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]) + dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]) .then(() => { expect(toolbar.actions.isButtonPresent('Permanently delete')) .toBe(true, 'Permanently delete is displayed for selected files'); diff --git a/e2e/suites/actions/toolbar-single-selection.test.ts b/e2e/suites/actions/toolbar-single-selection.test.ts index 64416adab..0b2e2690b 100755 --- a/e2e/suites/actions/toolbar-single-selection.test.ts +++ b/e2e/suites/actions/toolbar-single-selection.test.ts @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { browser } from 'protractor'; +import { browser, protractor } from 'protractor'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { RepoClient } from '../../utilities/repo-client/repo-client'; @@ -33,17 +33,14 @@ describe('Toolbar actions - single selection : ', () => { const username = `user-${Utils.random()}`; const username2 = `user-${Utils.random()}`; - const fileUser = `file-${Utils.random()}.txt`; let fileUserId; - - const folderUser = `folder-${Utils.random()}`; let folderUserId; - - const fileForDelete = `file-${Utils.random()}.txt`; let fileForDeleteId; - - const folderForDelete = `folder-${Utils.random()}`; let folderForDeleteId; + const fileUser = `fileUser-${Utils.random()}.txt`; let fileUserId; + const folderUser = `folderUser-${Utils.random()}`; let folderUserId; + const fileForDelete = `fileForDelete-${Utils.random()}.txt`; let fileForDeleteId; + const folderForDelete = `folderForDelete-${Utils.random()}`; let folderForDeleteId; const siteName = `site-private-${Utils.random()}`; - const fileAdmin = `file-${Utils.random()}.txt`; - const folderAdmin = `folder-${Utils.random()}`; + const fileAdmin = `fileAdmin-${Utils.random()}.txt`; + const folderAdmin = `folderAdmin-${Utils.random()}`; const apis = { admin: new RepoClient(), @@ -55,709 +52,599 @@ describe('Toolbar actions - single selection : ', () => { const page = new BrowsingPage(); const { dataTable, toolbar } = page; - beforeAll(done => { - apis.admin.people.createUser(username) - .then(() => apis.user.nodes.createFiles([ fileUser ])) - .then(resp => fileUserId = resp.data.entry.id) - .then(() => apis.user.nodes.createFiles([ fileForDelete ])) - .then(resp => fileForDeleteId = resp.data.entry.id) - .then(() => apis.user.nodes.createFolders([ folderForDelete ])) - .then(resp => folderForDeleteId = resp.data.entry.id) - .then(() => apis.user.nodes.createFolders([ folderUser ])) - .then(resp => folderUserId = resp.data.entry.id) - .then(() => apis.user.shared.shareFileById(fileUserId)) - .then(() => apis.user.favorites.addFavoriteById('file', fileUserId)) - .then(() => apis.user.favorites.addFavoriteById('folder', folderUserId)) - .then(done); + beforeAll(async (done) => { + await apis.admin.people.createUser(username); + + fileUserId = (await apis.user.nodes.createFiles([fileUser])).data.entry.id; + fileForDeleteId = (await apis.user.nodes.createFiles([fileForDelete])).data.entry.id; + folderForDeleteId = (await apis.user.nodes.createFolders([ folderForDelete ])).data.entry.id; + folderUserId = (await apis.user.nodes.createFolders([ folderUser ])).data.entry.id; + + await apis.user.shared.shareFileById(fileUserId); + await apis.user.shared.waitForApi({ expect: 1 }); + + await apis.user.favorites.addFavoriteById('file', fileUserId); + await apis.user.favorites.addFavoriteById('folder', folderUserId); + await apis.user.favorites.waitForApi({ expect: 2 }); + + done(); }); - afterAll(done => { - Promise.all([ + afterAll(async (done) => { + await Promise.all([ apis.user.nodes.deleteNodeById(fileUserId), - apis.user.nodes.deleteNodeById(folderUserId), - logoutPage.load() - ]) - .then(done); + apis.user.nodes.deleteNodeById(folderUserId) + ]); + + done(); }); xit(''); describe('General tests', () => { - const userSite = `site-${Utils.random()}`; + const userSite = `userSite-${Utils.random()}`; - beforeAll(done => { - apis.user.sites.createSite(userSite, SITE_VISIBILITY.PUBLIC) - .then(() => loginPage.loginWith(username)) - .then(done); + beforeAll(async (done) => { + await apis.user.sites.createSite(userSite, SITE_VISIBILITY.PUBLIC); + await loginPage.loginWith(username); + done(); }); - afterAll(done => { - Promise.all([ + afterAll(async (done) => { + await Promise.all([ apis.user.sites.deleteSite(userSite), logoutPage.load() - ]) - .then(done); + ]); + + done(); }); - xit('actions not displayed for top level of File Libraries', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.clickOnItemNameRow(userSite)) - .then(() => expect(toolbar.actions.isEmpty()).toBe(true, 'toolbar not empty')); + it('actions not displayed for top level of File Libraries', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.clickOnRowByName(userSite); + expect(await toolbar.actions.isEmpty()).toBe(true, 'toolbar not empty'); }); - it('selected row is marked with a check circle icon', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.clickOnItemNameRow(fileUser)) - .then(() => expect(dataTable.hasCheckMarkIcon(fileUser)).toBe(true, 'check mark missing')); - }); - - describe('granular permissions', () => { - const site = `site-${Utils.random()}`; - const file1 = `file-${Utils.random()}`; let file1Id; - const file2 = `file-${Utils.random()}`; let file2Id; - - beforeAll(done => { - apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE) - .then(() => apis.admin.nodes.createFiles([ file1 ], `Sites/${site}/documentLibrary`) - .then(resp => file1Id = resp.data.entry.id)) - .then(() => apis.admin.nodes.createFiles([ file2 ], `Sites/${site}/documentLibrary`) - .then(resp => file2Id = resp.data.entry.id)) - .then(() => apis.admin.sites.addSiteMember(site, username, SITE_ROLES.SITE_CONSUMER)) - .then(() => apis.admin.nodes.setGranularPermission(file1Id, false, username, SITE_ROLES.SITE_CONSUMER)) - .then(() => apis.admin.nodes.setGranularPermission(file2Id, false, username, SITE_ROLES.SITE_MANAGER)) - - .then(() => apis.user.shared.shareFileById(file1Id)) - .then(() => apis.admin.shared.shareFileById(file2Id)) - - .then(() => apis.user.shared.waitForApi({ expect: 1 })) - .then(() => apis.admin.shared.waitForApi({ expect: 1 })) - - .then(() => apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id])) - - .then(() => loginPage.loginWith(username)) - .then(done); - }); - - afterAll(done => { - Promise.all([ - apis.admin.sites.deleteSite(site), - logoutPage.load() - ]) - .then(done); - }); - - describe('actions update accordingly for files with different granular permissions', () => { - it('on File Libraries', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(site)) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.clickOnItemNameRow(file1)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clickOnItemNameRow(file2)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - xit('on Shared Files', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.clickOnItemNameRow(file1)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clickOnItemNameRow(file2)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - // disabled until ACA-1184 is done - xit('on Favorites', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.clickOnItemNameRow(file1)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) - .then(() => dataTable.clickOnItemNameRow(file2)) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - }); - - describe('correct actions are displayed when selecting multiple files with different granular permissions', () => { - it('on File Libraries', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(site)) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.selectMultipleItems([ file1, file2 ])) - .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.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - xit('on Shared Files', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.selectMultipleItems([ file1, file2 ])) - .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.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - // disabled until ACA-1184 is done - xit('on Favorites', () => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.selectMultipleItems([ file1, file2 ])) - .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.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - }); - - xit(''); + it('selected row is marked with a check circle icon', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await dataTable.waitForHeader(); + await dataTable.clickOnRowByName(fileUser); + expect(await dataTable.hasCheckMarkIcon(fileUser)).toBe(true, 'check mark missing'); }); }); + describe('granular permissions', () => { + const site = `site-${Utils.random()}`; + const file1 = `file1-${Utils.random()}`; let file1Id; + const file2 = `file2-${Utils.random()}`; let file2Id; + + beforeAll(async (done) => { + await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); + const docLibId = await apis.admin.sites.getDocLibId(site); + + file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).data.entry.id; + file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).data.entry.id; + + await apis.admin.sites.addSiteMember(site, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.nodes.setGranularPermission(file1Id, false, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.nodes.setGranularPermission(file2Id, false, username, SITE_ROLES.SITE_MANAGER); + + await apis.user.shared.shareFileById(file1Id); + await apis.admin.shared.shareFileById(file2Id); + await apis.user.shared.waitForApi({ expect: 3 }); + + await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id]); + await apis.user.favorites.waitForApi({ expect: 3 }); + + await loginPage.loginWith(username); + done(); + }); + + afterAll(async (done) => { + await Promise.all([ + apis.admin.sites.deleteSite(site), + logoutPage.load() + ]); + + done(); + }); + + describe('actions update accordingly for files with different granular permissions', () => { + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + done(); + }); + + it('on File Libraries', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(site); + await dataTable.waitForHeader(); + await dataTable.clickOnRowByName(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}`); + + let menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); + await toolbar.actions.closeMoreMenu(); + + await dataTable.clickOnRowByName(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}`); + + menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); + await toolbar.actions.closeMoreMenu(); + }); + + it('on Shared Files', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await page.dataTable.waitForHeader(); + await page.dataTable.clickOnRowByName(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}`); + let menu = await toolbar.actions.openMoreMenu(); + + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); + await toolbar.actions.closeMoreMenu(); + + await page.dataTable.clickOnRowByName(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}`); + menu = await toolbar.actions.openMoreMenu(); + + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); + await toolbar.actions.closeMoreMenu(); + }); + + // disabled until ACA-1184 is done + xit('on Favorites', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + await dataTable.clickOnRowByName(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}`); + let menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`); + await toolbar.actions.closeMoreMenu(); + + await dataTable.clickOnRowByName(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}`); + menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`); + await toolbar.actions.closeMoreMenu(); + }); + }); + + describe('correct actions are displayed when selecting multiple files with different granular permissions', () => { + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + done(); + }); + + it('on File Libraries', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(site); + await dataTable.waitForHeader(); + await dataTable.selectMultipleItems([ file1, file2 ]); + 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 toolbar.actions.closeMoreMenu(); + }); + + xit('on Shared Files', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await dataTable.waitForHeader(); + await dataTable.selectMultipleItems([ file1, file2 ]); + 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 toolbar.actions.closeMoreMenu(); + }); + + // disabled until ACA-1184 is done + xit('on Favorites', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + await dataTable.selectMultipleItems([ file1, file2 ]); + 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 toolbar.actions.closeMoreMenu(); + }); + }); + + xit(''); + }); + describe('Personal Files', () => { - beforeAll(done => { - loginPage.loginWith(username).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + 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('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); - }); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); + await toolbar.actions.closeMoreMenu(); }); - it('actions are displayed when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); - }); - }); - - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - it('correct actions appear when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a folder is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); + await toolbar.actions.closeMoreMenu(); }); }); describe('File Libraries', () => { - beforeAll(done => { - apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC) - .then(() => apis.admin.people.createUser(username2)) - .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER)) - .then(() => apis.admin.sites.addSiteMember(siteName, username2, SITE_ROLES.SITE_CONSUMER)) - .then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`)) - .then(() => apis.admin.nodes.createFolders([ folderAdmin ], `Sites/${siteName}/documentLibrary`)) - .then(done); + beforeAll(async (done) => { + await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); + const docLibId = await apis.admin.sites.getDocLibId(siteName); + + await apis.admin.people.createUser(username2); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); + await apis.admin.sites.addSiteMember(siteName, username2, SITE_ROLES.SITE_CONSUMER); + + await apis.admin.nodes.createFile(fileAdmin, docLibId); + await apis.admin.nodes.createFolder(folderAdmin, docLibId); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) - .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(siteName)) - .then(() => dataTable.waitForHeader()) - .then(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(username).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + done(); }); - it('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileAdmin) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`); - }); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are displayed when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderAdmin) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`); - }); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`); + await toolbar.actions.closeMoreMenu(); }); - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileAdmin) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - it('correct actions appear when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderAdmin) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderAdmin}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a folder is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderAdmin}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`); + await toolbar.actions.closeMoreMenu(); }); }); describe('user is Consumer', () => { - beforeAll(done => { - loginPage.loginWith(username2).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username2); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + done(); }); - it('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileAdmin) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`); - }); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are displayed when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderAdmin) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`); - }); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${fileAdmin}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`); + await toolbar.actions.closeMoreMenu(); }); - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileAdmin) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${fileAdmin}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - it('correct actions appear when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderAdmin) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folderAdmin}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folderAdmin}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a folder is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folderAdmin}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folderAdmin}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`); + await toolbar.actions.closeMoreMenu(); }); }); }); describe('Shared Files', () => { - beforeAll(done => { - loginPage.loginWith(username).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await page.dataTable.waitForHeader(); + done(); }); - afterEach(() => { - dataTable.clearSelection(); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); - }); - }); - - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a file is selected', async () => { + await page.dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); + await toolbar.actions.closeMoreMenu(); }); }); describe('Recent Files', () => { - beforeAll(done => { - loginPage.loginWith(username).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await dataTable.waitForHeader(); + done(); }); - afterEach(() => { - dataTable.clearSelection(); + afterAll(async (done) => { + await logoutPage.load(); + done(); }); - afterAll(done => { - logoutPage.load().then(done); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); - }); - }); - - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); + await toolbar.actions.closeMoreMenu(); }); }); describe('Favorites', () => { - beforeAll(done => { - loginPage.loginWith(username).then(done); + beforeAll(async (done) => { + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + 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('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); - }); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); + await toolbar.actions.closeMoreMenu(); }); - it('actions are displayed when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderUser) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); - }); - }); - - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); - }); - - it('correct actions appear when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderUser) - .then(() => { - expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); - expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); - expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); - }) - .then(() => toolbar.actions.openMoreMenu()) - .then(menu => { - expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); - expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); - }) - .then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()); + it('correct actions appear when a folder is selected', async () => { + await dataTable.clickOnRowByName(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}`); + expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); + const menu = await toolbar.actions.openMoreMenu(); + expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); + expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); + await toolbar.actions.closeMoreMenu(); }); }); // [C217090] describe('Trash', () => { - beforeAll(done => { - apis.user.nodes.deleteNodeById(fileForDeleteId, false) - .then(() => apis.user.nodes.deleteNodeById(folderForDeleteId, false)) - .then(() => loginPage.loginWith(username)) - .then(done); + beforeAll(async (done) => { + await apis.user.nodes.deleteNodeById(fileForDeleteId, false); + await apis.user.nodes.deleteNodeById(folderForDeleteId, false); + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await browser.actions().sendKeys(protractor.Key.ESCAPE); + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - Promise.all([ + afterAll(async (done) => { + await Promise.all([ apis.user.trashcan.permanentlyDelete(fileForDeleteId), apis.user.trashcan.permanentlyDelete(folderForDeleteId), logoutPage.load() - ]) - .then(done); + ]); + done(); }); - it('actions are not displayed when no item is selected', () => { - expect(toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); + it('actions are not displayed when no item is selected', async () => { + expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); - it('actions are displayed when a file is selected', () => { - dataTable.clickOnItemNameRow(fileForDelete) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`); - }); + it('correct actions appear when a file is selected', async () => { + await dataTable.clickOnRowByName(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('actions are displayed when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderForDelete) - .then(() => { - expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`); - }); - }); - - it('correct actions appear when a file is selected', () => { - dataTable.clickOnItemNameRow(fileForDelete) - .then(() => { - expect(toolbar.actions.isButtonPresent('Permanently delete')) - .toBe(true, `Permanently delete is not displayed for ${fileForDelete}`); - expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not displayed for ${fileForDelete}`); - }); - }); - - it('correct actions appear when a folder is selected', () => { - dataTable.clickOnItemNameRow(folderForDelete) - .then(() => { - expect(toolbar.actions.isButtonPresent('Permanently delete')) - .toBe(true, `Permanently delete is displayed for ${folderForDelete}`); - expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not enabled for ${folderForDelete}`); - }); + it('correct actions appear when a folder is selected', async () => { + await dataTable.clickOnRowByName(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/actions/undo-delete.test.ts b/e2e/suites/actions/undo-delete.test.ts index 527344420..6ef4299aa 100755 --- a/e2e/suites/actions/undo-delete.test.ts +++ b/e2e/suites/actions/undo-delete.test.ts @@ -95,7 +95,7 @@ describe('Undo delete content', () => { }); it('Successful delete notification shows Undo action', () => { - dataTable.clickOnItemNameRow(file1) + dataTable.clickOnRowByName(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -107,7 +107,7 @@ describe('Undo delete content', () => { }); it('Unsuccessful delete notification does not show Undo action', () => { - dataTable.clickOnItemNameRow(folder2) + dataTable.clickOnRowByName(folder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -120,12 +120,12 @@ describe('Undo delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(file1) + dataTable.clickOnRowByName(file1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(file1).isPresent()).toBe(true, 'Item was not restored'); + expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item was not restored'); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }); }); @@ -134,17 +134,17 @@ describe('Undo delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(folder1) + dataTable.clickOnRowByName(folder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(folder1).isPresent()).toBe(true, 'Item was not restored'); + expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item was not restored'); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) - .then(() => dataTable.doubleClickOnItemNameRow(folder1)) + .then(() => dataTable.doubleClickOnRowByName(folder1)) .then(() => { - expect(dataTable.getRowName(file4).isPresent()).toBe(true, 'file from folder not restored'); + expect(dataTable.getRowByName(file4).isPresent()).toBe(true, 'file from folder not restored'); }); }); @@ -152,13 +152,13 @@ describe('Undo delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.selectMultipleItemsRow([file2, file3]) + dataTable.selectMultipleItems([file2, file3]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(file2).isPresent()).toBe(true, `${file2} was not removed from list`); - expect(dataTable.getRowName(file3).isPresent()).toBe(true, `${file3} was not removed from list`); + expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} was not removed from list`); + expect(dataTable.getRowByName(file3).isPresent()).toBe(true, `${file3} was not removed from list`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }); }); @@ -201,7 +201,7 @@ describe('Undo delete content', () => { }); it('Successful delete notification shows Undo action', () => { - dataTable.clickOnItemNameRow(sharedFile1) + dataTable.clickOnRowByName(sharedFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -209,23 +209,23 @@ describe('Undo delete content', () => { }); it('Undo delete of file', () => { - dataTable.clickOnItemNameRow(sharedFile2) + dataTable.clickOnRowByName(sharedFile2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(false, 'Item was not restored')); + .then(() => expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, 'Item was not restored')); }); it('undo delete of multiple files', () => { - dataTable.selectMultipleItemsRow([sharedFile3, sharedFile4]) + dataTable.selectMultipleItems([sharedFile3, sharedFile4]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`); - expect(dataTable.getRowName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`); + expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`); + expect(dataTable.getRowByName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`); }); }); }); @@ -276,7 +276,7 @@ describe('Undo delete content', () => { }); it('Successful delete notification shows Undo action', () => { - dataTable.clickOnItemNameRow(favoriteFile1) + dataTable.clickOnRowByName(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -286,7 +286,7 @@ describe('Undo delete content', () => { }); it('Unsuccessful delete notification does not show Undo action', () => { - dataTable.clickOnItemNameRow(favoriteFolder2) + dataTable.clickOnRowByName(favoriteFolder2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -297,12 +297,12 @@ describe('Undo delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(favoriteFile1) + dataTable.clickOnRowByName(favoriteFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored'); + expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored'); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }); }); @@ -311,29 +311,29 @@ describe('Undo delete content', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.clickOnItemNameRow(favoriteFolder1) + dataTable.clickOnRowByName(favoriteFolder1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored'); + expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored'); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }) - .then(() => dataTable.doubleClickOnItemNameRow(favoriteFolder1)) - .then(() => expect(dataTable.getRowName(favoriteFile4).isPresent()).toBe(true, 'file from folder not restored')); + .then(() => dataTable.doubleClickOnRowByName(favoriteFolder1)) + .then(() => expect(dataTable.getRowByName(favoriteFile4).isPresent()).toBe(true, 'file from folder not restored')); }); it('undo delete of multiple files', () => { let items: number; page.dataTable.countRows().then(number => { items = number; }); - dataTable.selectMultipleItemsRow([favoriteFile1, favoriteFile2]) + dataTable.selectMultipleItems([favoriteFile1, favoriteFile2]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => { - expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`); - expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`); + expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`); + expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); }); }); @@ -384,7 +384,7 @@ describe('Undo delete content', () => { }); xit('Successful delete notification shows Undo action', () => { - dataTable.clickOnItemNameRow(recentFile1) + dataTable.clickOnRowByName(recentFile1) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.getSnackBarMessage()) @@ -396,12 +396,12 @@ describe('Undo delete content', () => { // 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 xit('Undo delete of file', () => { - dataTable.clickOnItemNameRow(recentFile2) + dataTable.clickOnRowByName(recentFile2) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) - .then(() => expect(dataTable.getRowName(recentFile2).isPresent()).toBe(false, 'Item is in Trash')); + .then(() => expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, 'Item is in Trash')); }); // due to the fact that the search api is slow to update, @@ -409,14 +409,14 @@ describe('Undo delete content', () => { // 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 xit('undo delete of multiple files', () => { - dataTable.selectMultipleItemsRow([recentFile3, recentFile4]) + dataTable.selectMultipleItems([recentFile3, recentFile4]) .then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => page.clickSnackBarAction()) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => { - expect(dataTable.getRowName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`); - expect(dataTable.getRowName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`); + expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`); + expect(dataTable.getRowByName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`); }); }); }); diff --git a/e2e/suites/actions/upload-file.test.ts b/e2e/suites/actions/upload-file.test.ts index 1b5b3486f..ea39da12c 100755 --- a/e2e/suites/actions/upload-file.test.ts +++ b/e2e/suites/actions/upload-file.test.ts @@ -67,7 +67,7 @@ describe('Upload files', () => { }); it('Upload a file', () => { - dataTable.doubleClickOnItemNameRow(folder1) + dataTable.doubleClickOnRowByName(folder1) .then(() => page.sidenav.openNewMenu()) .then(() => page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`)); }); diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index cb734a35c..015cb57b7 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -33,11 +33,12 @@ describe('Favorites', () => { const password = username; const siteName = `site-${Utils.random()}`; - const folderName = `folder-${Utils.random()}`; + const favFolderName = `favFolder-${Utils.random()}`; + const parentFolder = `parent-${Utils.random()}`; const fileName1 = `file1-${Utils.random()}.txt`; const fileName2 = `file2-${Utils.random()}.txt`; - const fileName3 = `file3-${Utils.random()}.txt`; let file3Id; - const fileName4 = `file4-${Utils.random()}.txt`; let file4Id; + const fileName3 = `file3-${Utils.random()}.txt`; + const fileName4 = `file4-${Utils.random()}.txt`; const apis = { admin: new RepoClient(), @@ -50,107 +51,109 @@ describe('Favorites', () => { const { dataTable } = favoritesPage; const { breadcrumb } = favoritesPage.toolbar; - beforeAll(done => { - apis.admin.people.createUser(username) + beforeAll(async (done) => { + await apis.admin.people.createUser(username); - .then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) - .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER)) - .then(() => apis.admin.nodes.createFiles([ fileName1 ], `Sites/${siteName}/documentLibrary`) - .then(resp => apis.user.favorites.addFavoriteById('file', resp.data.entry.id))) - .then(() => apis.user.nodes.createFolders([ folderName ]) - .then(resp => apis.user.favorites.addFavoriteById('folder', resp.data.entry.id))) - .then(() => apis.user.nodes.createFiles([ fileName2 ], folderName) - .then(resp => apis.user.favorites.addFavoriteById('file', resp.data.entry.id))) - .then(() => apis.user.nodes.createFiles([ fileName3 ], folderName) - .then(resp => file3Id = resp.data.entry.id) - .then(() => apis.user.favorites.addFavoriteById('file', file3Id)) - .then(() => apis.user.nodes.deleteNodeById(file3Id, false))) - .then(() => apis.user.nodes.createFiles([ fileName4 ], folderName) - .then(resp => file4Id = resp.data.entry.id) - .then(() => apis.user.favorites.addFavoriteById('file', file4Id)) - .then(() => apis.user.nodes.deleteNodeById(file4Id, false)) - .then(() => apis.user.trashcan.restore(file4Id))) + await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); + const docLibId = await apis.admin.sites.getDocLibId(siteName); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); - .then(() => loginPage.loginWith(username)) - .then(done); + const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).data.entry.id; + await apis.user.favorites.addFavoriteById('file', file1Id); + + const folderId = (await apis.user.nodes.createFolder(favFolderName)).data.entry.id; + await apis.user.favorites.addFavoriteById('folder', folderId); + + const parentId = (await apis.user.nodes.createFolder(parentFolder)).data.entry.id; + + const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).data.entry.id; + await apis.user.favorites.addFavoriteById('file', file2Id); + + const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).data.entry.id; + await apis.user.favorites.addFavoriteById('file', file3Id); + await apis.user.nodes.deleteNodeById(file3Id, false); + + const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).data.entry.id; + await apis.user.favorites.addFavoriteById('file', file4Id); + await apis.user.nodes.deleteNodeById(file4Id, false); + await apis.user.trashcan.restore(file4Id); + + await loginPage.loginWith(username); + done(); }); - beforeEach(done => { - favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) - .then(() => dataTable.waitForHeader()) - .then(done); + beforeEach(async (done) => { + await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + done(); }); - afterAll(done => { - Promise.all([ + afterAll(async (done) => { + await Promise.all([ apis.admin.sites.deleteSite(siteName), - apis.user.nodes.deleteNodes([ folderName ]), + apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]), apis.admin.trashcan.emptyTrash(), logoutPage.load() - ]) - .then(done); + ]); + done(); }); - it('has the correct columns', () => { + it('has the correct columns', async () => { const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ]; const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); - expect(dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns'); + expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns'); - elements.forEach((element, index) => { - expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`); + await elements.forEach(async (element, index) => { + expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`); }); }); - it('displays the favorite files and folders [C213226]', () => { - expect(dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed'); - expect(dataTable.getRowName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); - expect(dataTable.getRowName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); - expect(dataTable.getRowName(folderName).isPresent()).toBe(true, `${folderName} not displayed`); + it('displays the favorite files and folders [C213226]', async () => { + expect(await dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed'); + expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); + expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); + expect(await dataTable.getRowByName(favFolderName).isPresent()).toBe(true, `${favFolderName} not displayed`); }); - it(`file not displayed if it's in the Trashcan [C213228]`, () => { - expect(dataTable.getRowName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); + it(`file not displayed if it's in the Trashcan [C213228]`, async () => { + expect(await dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); }); - it(`file is displayed after it is restored from Trashcan [C213229]`, () => { - expect(dataTable.getRowName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`); + it(`file is displayed after it is restored from Trashcan [C213229]`, async () => { + expect(await dataTable.getRowByName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`); }); - it('Location column displays the parent folder of the files [C213231]', () => { - expect(dataTable.getItemLocation(fileName1).getText()).toEqual(siteName); - expect(dataTable.getItemLocation(fileName2).getText()).toEqual(folderName); - expect(dataTable.getItemLocation(folderName).getText()).toEqual('Personal Files'); + it('Location column displays the parent folder of the files [C213231]', async () => { + expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName); + expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder); + expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files'); }); - it('Location column displays a tooltip with the entire path of the file [C213671]', () => { + it('Location column displays a tooltip with the entire path of the file [C213671]', async () => { expect(dataTable.getItemLocationTooltip(fileName1)).toEqual(`File Libraries/${siteName}`); - expect(dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${folderName}`); - expect(dataTable.getItemLocationTooltip(folderName)).toEqual('Personal Files'); + expect(dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${parentFolder}`); + expect(dataTable.getItemLocationTooltip(favFolderName)).toEqual('Personal Files'); }); - it('Location column redirect - item in user Home [C213650] [C260968]', () => { - dataTable.clickItemLocation(folderName) - .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); + it('Location column redirect - item in user Home [C213650] [C260968]', async () => { + await dataTable.clickItemLocation(favFolderName); + expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]); }); - it('Location column redirect - file in folder [C213650] [C260968]', () => { - dataTable.clickItemLocation(fileName2) - .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ])); + it('Location column redirect - file in folder [C213650] [C260968]', async () => { + await dataTable.clickItemLocation(fileName2); + expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]); }); - it('Location column redirect - file in site [C213650] [C260969]', () => { - dataTable.clickItemLocation(fileName1) - .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); + it('Location column redirect - file in site [C213650] [C260969]', async () => { + await dataTable.clickItemLocation(fileName1); + expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]); }); - it('Navigate into folder from Favorites [C213230]', () => { - dataTable.doubleClickOnItemNameRow(folderName) - .then(() => dataTable.waitForHeader()) - .then(() => breadcrumb.getCurrentItemName()) - .then(name => { - expect(name).toBe(folderName); - }); + it('Navigate into folder from Favorites [C213230]', async () => { + await dataTable.doubleClickOnRowByName(favFolderName); + await dataTable.waitForEmptyState(); + expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName); }); - }); diff --git a/e2e/suites/list-views/file-libraries.test.ts b/e2e/suites/list-views/file-libraries.test.ts index 3f6567ddd..5fb17bb30 100755 --- a/e2e/suites/list-views/file-libraries.test.ts +++ b/e2e/suites/list-views/file-libraries.test.ts @@ -23,8 +23,6 @@ * along with Alfresco. If not, see . */ -import { by } from 'protractor'; - import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { Utils } from '../../utilities/utils'; @@ -117,7 +115,7 @@ describe('File Libraries', () => { }; expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed'); - expect(dataTable.getRowName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); + expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); dataTable.getRows() .map((row) => { diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/suites/list-views/personal-files.test.ts index 168cee8bc..7a531e69e 100755 --- a/e2e/suites/list-views/personal-files.test.ts +++ b/e2e/suites/list-views/personal-files.test.ts @@ -86,11 +86,11 @@ describe('Personal Files', () => { }); it('has "Data Dictionary" folder [C213241]', () => { - expect(dataTable.getRowName('Data Dictionary').isPresent()).toBe(true); + expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true); }); it('has created content', () => { - expect(dataTable.getRowName(adminFolder).isPresent()).toBe(true); + expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true); }); }); @@ -125,7 +125,7 @@ describe('Personal Files', () => { }); it('has user created content [C213242]', () => { - expect(dataTable.getRowName(userFolder).isPresent()) + expect(dataTable.getRowByName(userFolder).isPresent()) .toBe(true); }); @@ -135,7 +135,7 @@ describe('Personal Files', () => { .then(response => response.data.entry.id); const navigatePromise = dataTable - .doubleClickOnItemNameRow(userFolder) + .doubleClickOnRowByName(userFolder) .then(() => dataTable.waitForHeader()); Promise @@ -147,13 +147,13 @@ describe('Personal Files', () => { expect(browser.getCurrentUrl()) .toContain(nodeId, 'Node ID is not in the URL'); - expect(dataTable.getRowName(userFile).isPresent()) + expect(dataTable.getRowByName(userFile).isPresent()) .toBe(true, 'user file is missing'); }); }); it('redirects to Personal Files on clicking the link from sidebar [C213245]', () => { - personalFilesPage.dataTable.doubleClickOnItemNameRow(userFolder) + personalFilesPage.dataTable.doubleClickOnRowByName(userFolder) .then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => browser.getCurrentUrl()) .then(url => expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url')); diff --git a/e2e/suites/list-views/recent-files.test.ts b/e2e/suites/list-views/recent-files.test.ts index 0902c7c70..1e76a4de7 100755 --- a/e2e/suites/list-views/recent-files.test.ts +++ b/e2e/suites/list-views/recent-files.test.ts @@ -103,13 +103,13 @@ describe('Recent Files', () => { it('displays the files added by the current user in the last 30 days [C213170]', () => { expect(dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed'); - expect(dataTable.getRowName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); - expect(dataTable.getRowName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); - expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); + expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); + expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); + expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); }); it(`file not displayed if it's in the Trashcan [C213174]`, () => { - expect(dataTable.getRowName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); + expect(dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); }); it('Location column displays the parent folder of the file [C213175]', () => { diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/suites/list-views/shared-files.test.ts index b81fc56a9..d34d0d910 100755 --- a/e2e/suites/list-views/shared-files.test.ts +++ b/e2e/suites/list-views/shared-files.test.ts @@ -108,16 +108,16 @@ describe('Shared Files', () => { }); it('displays the files shared by everyone [C213114]', () => { - expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); - expect(dataTable.getRowName(file1User).isPresent()).toBe(true, `${file1User} not displayed`); + expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); + expect(dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`); }); it(`file not displayed if it's in the Trashcan [C213117]`, () => { - expect(dataTable.getRowName(file2User).isPresent()).toBe(false, `${file2User} is displayed`); + expect(dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`); }); xit('unshared file is not displayed [C213118]', () => { - expect(dataTable.getRowName(file3User).isPresent()).toBe(false, `${file3User} is displayed`); + expect(dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`); }); it('Location column displays the parent folder of the file [C213665]', () => { diff --git a/e2e/suites/list-views/tooltips.test.ts b/e2e/suites/list-views/tooltips.test.ts index 770b169ea..473c0dd16 100755 --- a/e2e/suites/list-views/tooltips.test.ts +++ b/e2e/suites/list-views/tooltips.test.ts @@ -100,7 +100,7 @@ describe('File / folder tooltips', () => { describe('on Personal Files', () => { beforeAll(done => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) - .then(() => dataTable.doubleClickOnItemNameRow(parent)) + .then(() => dataTable.doubleClickOnRowByName(parent)) .then(done); }); diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/suites/list-views/trash.test.ts index df378e765..d78cfcbdd 100755 --- a/e2e/suites/list-views/trash.test.ts +++ b/e2e/suites/list-views/trash.test.ts @@ -108,11 +108,11 @@ describe('Trash', () => { it('displays the files and folders deleted by everyone [C213217]', () => { expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items displayed'); - expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); - expect(dataTable.getRowName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`); - expect(dataTable.getRowName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); - expect(dataTable.getRowName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); - expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); + expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); + expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`); + expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); + expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); + expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); }); }); @@ -145,10 +145,10 @@ describe('Trash', () => { it('displays the files and folders deleted by the user [C213218]', () => { expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items displayed'); - expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); - expect(dataTable.getRowName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); - expect(dataTable.getRowName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); - expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`); + expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); + expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); + expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); + expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`); }); it('default sorting column [C213219]', () => { diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index 974c62df7..6dd02f0a1 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -136,9 +136,9 @@ describe('Breadcrumb', () => { it('Personal Files breadcrumb for a folder hierarchy [C260965]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(parent)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder1)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder2)) + .then(() => page.dataTable.doubleClickOnRowByName(parent)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) .then(() => { const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ]; expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb); @@ -148,10 +148,10 @@ describe('Breadcrumb', () => { it('File Libraries breadcrumb for a folder hierarchy [C260967]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(siteName)) - .then(() => page.dataTable.doubleClickOnItemName(parent)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder1)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder2)) + .then(() => page.dataTable.doubleClickOnRowByName(siteName)) + .then(() => page.dataTable.doubleClickOnRowByName(parent)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) .then(() => { const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ]; expect(breadcrumb.getAllItems()).toEqual(expectedItems); @@ -161,9 +161,9 @@ describe('Breadcrumb', () => { it('User can navigate to any location by clicking on a step from the breadcrumb [C213235]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(parent)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder1)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder2)) + .then(() => page.dataTable.doubleClickOnRowByName(parent)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) .then(() => breadcrumb.clickItem(subFolder1)) .then(() => { const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1 ]; @@ -174,9 +174,9 @@ describe('Breadcrumb', () => { it('Tooltip appears on hover on a step in breadcrumb [C213237]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(parent)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder1)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder2)) + .then(() => page.dataTable.doubleClickOnRowByName(parent)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) .then(() => { expect(breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1); }); @@ -185,8 +185,8 @@ describe('Breadcrumb', () => { it('Breadcrumb updates correctly when folder is renamed [C213238]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(parent2)) - .then(() => page.dataTable.doubleClickOnItemName(folder1)) + .then(() => page.dataTable.doubleClickOnRowByName(parent2)) + .then(() => page.dataTable.doubleClickOnRowByName(folder1)) .then(() => page.dataTable.wait()) .then(() => apis.user.nodes.renameNode(folder1Id, folder1Renamed).then(done => done)) .then(() => page.refresh()) @@ -199,9 +199,9 @@ describe('Breadcrumb', () => { it('Browser back navigates to previous location regardless of breadcrumb steps [C213240]', () => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => page.dataTable.waitForHeader()) - .then(() => page.dataTable.doubleClickOnItemName(parent)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder1)) - .then(() => page.dataTable.doubleClickOnItemName(subFolder2)) + .then(() => page.dataTable.doubleClickOnRowByName(parent)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) + .then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.dataTable.waitForEmptyState()) .then(() => browser.navigate().back()) @@ -234,10 +234,10 @@ describe('Breadcrumb', () => { }); it(`Breadcrumb on navigation to a user's home [C260970]`, () => { - page.dataTable.doubleClickOnItemName('User Homes') - .then(() => page.dataTable.doubleClickOnItemName(user2)) + page.dataTable.doubleClickOnRowByName('User Homes') + .then(() => page.dataTable.doubleClickOnRowByName(user2)) .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2 ])) - .then(() => page.dataTable.doubleClickOnItemName(userFolder)) + .then(() => page.dataTable.doubleClickOnRowByName(userFolder)) .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2, userFolder ])); }); }); diff --git a/e2e/suites/pagination/pag-favorites.test.ts b/e2e/suites/pagination/pag-favorites.test.ts index 2244be6e8..3e338694e 100755 --- a/e2e/suites/pagination/pag-favorites.test.ts +++ b/e2e/suites/pagination/pag-favorites.test.ts @@ -181,7 +181,7 @@ describe('Pagination on Favorites', () => { expect(pagination.getText(pagination.currentPage)).toContain('Page 3'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); - expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); }); @@ -191,7 +191,7 @@ describe('Pagination on Favorites', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('26-50 of 101'); - expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); }); @@ -204,7 +204,7 @@ describe('Pagination on Favorites', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('1-25 of 101'); - expect(dataTable.getRowName('file-88.txt').isPresent()) + expect(dataTable.getRowByName('file-88.txt').isPresent()) .toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); diff --git a/e2e/suites/pagination/pag-personal-files.test.ts b/e2e/suites/pagination/pag-personal-files.test.ts index fcd2817d4..9d82f0c05 100755 --- a/e2e/suites/pagination/pag-personal-files.test.ts +++ b/e2e/suites/pagination/pag-personal-files.test.ts @@ -110,7 +110,7 @@ describe('Pagination on Personal Files', () => { beforeEach(done => { page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) .then(() => dataTable.waitForHeader()) - .then(() => dataTable.doubleClickOnItemNameRow(parent)) + .then(() => dataTable.doubleClickOnRowByName(parent)) .then(done); }); @@ -179,7 +179,7 @@ describe('Pagination on Personal Files', () => { expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); - expect(dataTable.getRowName('file-60.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-60.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -190,7 +190,7 @@ describe('Pagination on Personal Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('26-50 of 101'); - expect(dataTable.getRowName('file-30.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-30.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -204,7 +204,7 @@ describe('Pagination on Personal Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('1-25 of 101'); - expect(dataTable.getRowName('file-12.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-12.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); diff --git a/e2e/suites/pagination/pag-recent-files.test.ts b/e2e/suites/pagination/pag-recent-files.test.ts index bf3baa066..83456733c 100755 --- a/e2e/suites/pagination/pag-recent-files.test.ts +++ b/e2e/suites/pagination/pag-recent-files.test.ts @@ -181,7 +181,7 @@ describe('Pagination on Recent Files', () => { expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); - expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -192,7 +192,7 @@ describe('Pagination on Recent Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('26-50 of 101'); - expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -206,7 +206,7 @@ describe('Pagination on Recent Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('1-25 of 101'); - expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); diff --git a/e2e/suites/pagination/pag-shared-files.test.ts b/e2e/suites/pagination/pag-shared-files.test.ts index ae0b47511..b12bc97ee 100755 --- a/e2e/suites/pagination/pag-shared-files.test.ts +++ b/e2e/suites/pagination/pag-shared-files.test.ts @@ -186,7 +186,7 @@ describe('Pagination on Shared Files', () => { expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); - expect(dataTable.getRowName('file-40.txt').isPresent()) + expect(dataTable.getRowByName('file-40.txt').isPresent()) .toBe(true, 'File not found on page'); }) @@ -198,7 +198,7 @@ describe('Pagination on Shared Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('26-50 of 101'); - expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -212,7 +212,7 @@ describe('Pagination on Shared Files', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('1-25 of 101'); - expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); diff --git a/e2e/suites/pagination/pag-trash.test.ts b/e2e/suites/pagination/pag-trash.test.ts index 35452d2c3..7619c92a5 100755 --- a/e2e/suites/pagination/pag-trash.test.ts +++ b/e2e/suites/pagination/pag-trash.test.ts @@ -184,7 +184,7 @@ describe('Pagination on Trash', () => { expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); - expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -195,7 +195,7 @@ describe('Pagination on Trash', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('26-50 of 101'); - expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber()); @@ -209,7 +209,7 @@ describe('Pagination on Trash', () => { .then(() => dataTable.waitForHeader()) .then(() => { expect(pagination.range.getText()).toContain('1-25 of 101'); - expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); + expect(dataTable.getRowByName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); }) .then(() => pagination.resetToDefaultPageNumber());