diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 5007ca02d..d68be01f8 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -44,7 +44,7 @@ export class DataTable extends Component { selectedRow: '.adf-datatable-row.is-selected', cell: '.adf-data-table-cell', locationLink: '.aca-location-link', - linkCell: '.adf-location-cell', + nameLink: '.dl-link', selectedIcon: '.mat-icon', @@ -60,7 +60,7 @@ export class DataTable extends Component { body: ElementFinder = this.component.element(by.css(DataTable.selectors.body)); cell = by.css(DataTable.selectors.cell); locationLink = by.css(DataTable.selectors.locationLink); - linkCell: ElementFinder = this.component.element(by.css(DataTable.selectors.linkCell)); + nameLink: ElementFinder = browser.element(by.css(DataTable.selectors.nameLink)); emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer)); emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop)); emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle)); @@ -165,6 +165,14 @@ export class DataTable extends Component { return this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent(); } + getNameLink(itemName: string) { + return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink); + } + + hasLinkOnName(itemName: string) { + return this.getNameLink(itemName).isPresent(); + } + // Navigation/selection methods doubleClickOnRowByName(name: string): promise.Promise { const item = this.getRowFirstCell(name); @@ -178,6 +186,10 @@ export class DataTable extends Component { .then(() => item.click()); } + clickNameLink(itemName: string) { + return this.getNameLink(itemName).click(); + } + selectMultipleItems(names: string[]): promise.Promise { return this.clearSelection() .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) diff --git a/e2e/suites/actions/single-click.test.ts b/e2e/suites/actions/single-click.test.ts new file mode 100755 index 000000000..54fea644d --- /dev/null +++ b/e2e/suites/actions/single-click.test.ts @@ -0,0 +1,212 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { browser, protractor } from 'protractor'; +import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; +import { Viewer } from '../../components/viewer/viewer'; +import { SIDEBAR_LABELS } from '../../configs'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { Utils } from '../../utilities/utils'; + +describe('Single click on item name', () => { + const username = `user-${Utils.random()}`; + + const file1 = `file1-${Utils.random()}.txt`; let file1Id; + const folder1 = `folder1-${Utils.random()}`; let folder1Id; + + const deletedFile1 = `file1-${Utils.random()}.txt`; let deletedFile1Id; + const deletedFolder1 = `folder1-${Utils.random()}`; let deletedFolder1Id; + + const siteName = `site-${Utils.random()}`; + const fileSite = `fileSite-${Utils.random()}.txt`; + + const apis = { + admin: new RepoClient(), + user: new RepoClient(username, username) + }; + + const loginPage = new LoginPage(); + const logoutPage = new LogoutPage(); + const page = new BrowsingPage(); + const { dataTable } = page; + const { breadcrumb } = page.toolbar; + const viewer = new Viewer(); + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username }); + file1Id = (await apis.user.nodes.createFile(file1)).entry.id; + folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id; + + deletedFile1Id = (await apis.user.nodes.createFile(deletedFile1)).entry.id; + deletedFolder1Id = (await apis.user.nodes.createFolder(deletedFolder1)).entry.id; + await apis.user.nodes.deleteNodeById(deletedFile1Id, false); + await apis.user.nodes.deleteNodeById(deletedFolder1Id, false); + + await apis.user.sites.createSite(siteName); + const docLibId = (await apis.user.sites.getDocLibId(siteName)); + await apis.user.nodes.createFile(fileSite, docLibId); + + await apis.user.shared.shareFileById(file1Id); + await apis.user.shared.waitForApi({ expect: 1 }); + + await apis.user.favorites.addFavoriteById('file', file1Id); + await apis.user.favorites.addFavoriteById('folder', folder1Id); + await apis.user.favorites.waitForApi({ expect: 2 }); + + await loginPage.loginWith(username); + done(); + }); + + afterAll(async (done) => { + await Promise.all([ + apis.user.sites.deleteSite(siteName), + apis.user.nodes.deleteNodeById(folder1Id), + apis.user.nodes.deleteNodeById(file1Id), + apis.user.trashcan.emptyTrash(), + logoutPage.load() + ]); + done(); + }); + + it('Hyperlink does not appear for items in the Trash - [C284899]', async () => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); + await dataTable.waitForHeader(); + + expect(await dataTable.hasLinkOnName(deletedFile1)).toBe(false, 'Link on name is present'); + expect(await dataTable.hasLinkOnName(deletedFolder1)).toBe(false, 'Link on name is present'); + }); + + describe('on Personal Files', () => { + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await dataTable.waitForHeader(); + done(); + }); + + it('Hyperlink appears when mouse over a file/folder - [C280032]', async () => { + expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing'); + }); + + it('File preview opens when clicking the hyperlink - [C280033]', async () => { + await dataTable.clickNameLink(file1); + + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + }); + + it('Navigate inside the folder when clicking the hyperlink - [C280034]', async () => { + await dataTable.clickNameLink(folder1); + + expect(await breadcrumb.getCurrentItemName()).toBe(folder1); + }); + }); + + describe('on File Libraries', () => { + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); + await dataTable.waitForHeader(); + done(); + }); + + it('Hyperlink appears when mouse over a library - [C284901]', async () => { + expect(await dataTable.hasLinkOnName(siteName)).toBe(true, 'Link on site name is missing'); + }); + + it('Navigate inside the library when clicking the hyperlink - [C284902]', async () => { + await dataTable.clickNameLink(siteName); + + expect(await breadcrumb.getCurrentItemName()).toBe(siteName); + expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); + }); + }); + + describe('on Shared Files', () => { + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await dataTable.waitForHeader(); + done(); + }); + + it('Hyperlink appears when mouse over a file - [C284905]', async () => { + expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing'); + }); + + it('File preview opens when clicking the hyperlink - [C284906]', async () => { + await dataTable.clickNameLink(file1); + + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + }); + }); + + describe('on Recent Files', () => { + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await dataTable.waitForHeader(); + done(); + }); + + it('Hyperlink appears when mouse over a file - [C284907]', async () => { + expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing'); + }); + + it('File preview opens when clicking the hyperlink - [C284908]', async () => { + await dataTable.clickNameLink(file1); + + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + }); + }); + + describe('on Favorites', () => { + beforeEach(async (done) => { + await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await dataTable.waitForHeader(); + done(); + }); + + it('Hyperlink appears when mouse over a file/folder - [C284909]', async () => { + expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing'); + }); + + it('File preview opens when clicking the hyperlink - [C284910]', async () => { + await dataTable.clickNameLink(file1); + + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); + + await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); + }); + + it('Navigate inside the folder when clicking the hyperlink - [C284911]', async () => { + await dataTable.clickNameLink(folder1); + + expect(await breadcrumb.getCurrentItemName()).toBe(folder1); + }); + }); + +}); diff --git a/e2e/suites/actions/toolbar-single-selection.test.ts b/e2e/suites/actions/toolbar-single-selection.test.ts index 1baad4b9e..ad3871f47 100755 --- a/e2e/suites/actions/toolbar-single-selection.test.ts +++ b/e2e/suites/actions/toolbar-single-selection.test.ts @@ -214,7 +214,7 @@ describe('Toolbar actions - single selection : ', () => { await toolbar.actions.closeMoreMenu(); }); - // disabled until ACA-1184 is done + // disabled until ACA-1737 is done xit('on Favorites - [C213121]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await dataTable.waitForHeader(); @@ -280,7 +280,7 @@ describe('Toolbar actions - single selection : ', () => { await toolbar.actions.closeMoreMenu(); }); - // disabled until ACA-1184 is done + // disabled until ACA-1737 is done xit('on Favorites - [C280478]', async () => { await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await dataTable.waitForHeader(); diff --git a/protractor.conf.js b/protractor.conf.js index d4a6a14d2..e6e81dbce 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -74,23 +74,5 @@ exports.config = { useFullTestName: false, reportFailedUrl: true })); - - return browser.driver.executeScript(disableCSSAnimation); - - function disableCSSAnimation() { - var css = '* {' + - '-webkit-transition-duration: 0s !important;' + - 'transition-duration: 0s !important;' + - '-webkit-animation-duration: 0s !important;' + - 'animation-duration: 0s !important;' + - '}', - head = document.head || document.getElementsByTagName('head')[0], - style = document.createElement('style'); - - style.type = 'text/css'; - style.appendChild(document.createTextNode(css)); - head.appendChild(style); - } - } };