mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
Sync latest development (#147)
* fix navigation docs issues * update documentation (#142) * update documentation changed start command used a tags for links nested inside table and p tags, because Github did not render them correctly * set link to navigation on side-nav.md * [ACA-1061] update project version (#145) [ACA-1061] update project version * move e2e to a separate repo * fix "view" button (toolbar)
This commit is contained in:
@@ -1,279 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { protractor, browser, by, ElementFinder } from 'protractor';
|
||||
|
||||
import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Create folder', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const folderName1 = `folder-${Utils.random()}`;
|
||||
const folderName2 = `folder-${Utils.random()}`;
|
||||
const folderDescription = 'description of my folder';
|
||||
const duplicateFolderName = `folder-${Utils.random()}`;
|
||||
const nameWithSpaces = ` folder-${Utils.random()} `;
|
||||
|
||||
const siteName = `site-private-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const { dataTable } = personalFilesPage;
|
||||
|
||||
function openCreateDialog(): any {
|
||||
return personalFilesPage.sidenav.openNewMenu()
|
||||
.then(menu => menu.clickMenuItem('Create folder'))
|
||||
.then(() => createDialog.waitForDialogToOpen());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
|
||||
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
|
||||
.then(() => apis.user.nodes.createFolders([ duplicateFolderName ], parent))
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('option is enabled when having enough permissions', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => personalFilesPage.sidenav.openNewMenu())
|
||||
.then(menu => {
|
||||
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
|
||||
expect(isEnabled).toBe(true, 'Create folder is not enabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('creates new folder with name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(folderName1))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
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)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(folderName2))
|
||||
.then(() => createDialog.enterDescription(folderDescription))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderName2).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
expect(apis.user.nodes.getNodeDescription(folderName2)).toEqual(folderDescription);
|
||||
});
|
||||
});
|
||||
|
||||
it('enabled option tooltip', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => personalFilesPage.sidenav.openNewMenu())
|
||||
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
|
||||
.then(() => menu))
|
||||
.then(menu => {
|
||||
expect(menu.getItemTooltip('Create folder')).toContain('Create new folder');
|
||||
});
|
||||
});
|
||||
|
||||
it('option is disabled when not enough permissions', () => {
|
||||
const fileLibrariesPage = new BrowsingPage();
|
||||
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||
.then(menu => {
|
||||
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
|
||||
expect(isEnabled).toBe(false, 'Create folder is not disabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('disabled option tooltip', () => {
|
||||
const fileLibrariesPage = new BrowsingPage();
|
||||
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
|
||||
.then(() => menu))
|
||||
.then(menu => {
|
||||
const tooltip = menu.getItemTooltip('Create folder');
|
||||
expect(tooltip).toContain(`You can't create a folder here`);
|
||||
});
|
||||
});
|
||||
|
||||
it('dialog UI elements', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => {
|
||||
const dialogTitle = createDialog.getTitle();
|
||||
const isFolderNameDisplayed = createDialog.nameInput.isDisplayed();
|
||||
const isDescriptionDisplayed = createDialog.descriptionTextArea.isDisplayed();
|
||||
const isCreateEnabled = createDialog.createButton.isEnabled();
|
||||
const isCancelEnabled = createDialog.cancelButton.isEnabled();
|
||||
|
||||
expect(dialogTitle).toMatch('Create new folder');
|
||||
expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
|
||||
expect(isDescriptionDisplayed).toBe(true, 'Description field is not displayed');
|
||||
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
|
||||
expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('with empty folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.deleteNameWithBackspace())
|
||||
.then(() => {
|
||||
const isCreateEnabled = createDialog.createButton.isEnabled();
|
||||
const validationMessage = createDialog.getValidationMessage();
|
||||
|
||||
expect(isCreateEnabled).toBe(false, 'Create button is enabled');
|
||||
expect(validationMessage).toMatch('Folder name is required');
|
||||
});
|
||||
});
|
||||
|
||||
it('with folder name ending with a dot "."', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName('folder-name.'))
|
||||
.then(dialog => {
|
||||
const isCreateEnabled = dialog.createButton.isEnabled();
|
||||
const validationMessage = dialog.getValidationMessage();
|
||||
|
||||
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
|
||||
expect(validationMessage).toMatch(`Folder name can't end with a period .`);
|
||||
});
|
||||
});
|
||||
|
||||
it('with folder name containing special characters', () => {
|
||||
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => namesWithSpecialChars.forEach(name => {
|
||||
createDialog.enterName(name);
|
||||
|
||||
const isCreateEnabled = createDialog.createButton.isEnabled();
|
||||
const validationMessage = createDialog.getValidationMessage();
|
||||
|
||||
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
|
||||
expect(validationMessage).toContain(`Folder name can't contain these characters`);
|
||||
}));
|
||||
});
|
||||
|
||||
it('with folder name containing only spaces', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(' '))
|
||||
.then(dialog => {
|
||||
const isCreateEnabled = dialog.createButton.isEnabled();
|
||||
const validationMessage = dialog.getValidationMessage();
|
||||
|
||||
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
|
||||
expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
|
||||
});
|
||||
});
|
||||
|
||||
it('cancel folder creation', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName('test'))
|
||||
.then(() => createDialog.enterDescription('test description'))
|
||||
.then(() => createDialog.clickCancel())
|
||||
.then(() => {
|
||||
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
|
||||
});
|
||||
});
|
||||
|
||||
it('duplicate folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(duplicateFolderName))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => personalFilesPage.getSnackBarMessage())
|
||||
.then(message => {
|
||||
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
|
||||
expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present');
|
||||
});
|
||||
});
|
||||
|
||||
it('trim ending spaces from folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(nameWithSpaces))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,190 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { protractor, element, browser, by, ElementFinder, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('Edit folder', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const folderName = `folder-${Utils.random()}`;
|
||||
const folderDescription = 'my folder description';
|
||||
|
||||
const folderNameToEdit = `folder-${Utils.random()}`;
|
||||
const duplicateFolderName = `folder-${Utils.random()}`;
|
||||
|
||||
const folderNameEdited = `folder-${Utils.random()}`;
|
||||
const folderDescriptionEdited = 'my folder description edited';
|
||||
|
||||
const siteName = `site-private-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const editDialog = new CreateOrEditFolderDialog();
|
||||
const { dataTable } = personalFilesPage;
|
||||
const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit');
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
|
||||
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
|
||||
|
||||
.then(() => apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ))
|
||||
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent))
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => dataTable.doubleClickOnItemName(parent))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('dialog UI defaults', () => {
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => {
|
||||
expect(editDialog.getTitle()).toEqual('Edit folder');
|
||||
expect(editDialog.nameInput.getAttribute('value')).toBe(folderName);
|
||||
expect(editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription);
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled');
|
||||
expect(editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('properties are modified when pressing OK', () => {
|
||||
dataTable.clickOnItemName(folderNameToEdit)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.waitForDialogToOpen())
|
||||
.then(() => editDialog.enterName(folderNameEdited))
|
||||
.then(() => editDialog.enterDescription(folderDescriptionEdited))
|
||||
.then(() => editDialog.clickUpdate())
|
||||
.then(() => editDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderNameEdited).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
expect(apis.user.nodes.getNodeDescription(folderNameEdited)).toEqual(folderDescriptionEdited);
|
||||
});
|
||||
});
|
||||
|
||||
it('with empty folder name', () => {
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.deleteNameWithBackspace())
|
||||
.then(() => {
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
|
||||
expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
|
||||
});
|
||||
});
|
||||
|
||||
it('with name with special characters', () => {
|
||||
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => namesWithSpecialChars.forEach(name => {
|
||||
editDialog.enterName(name);
|
||||
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled');
|
||||
expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
|
||||
}));
|
||||
});
|
||||
|
||||
it('with name ending with a dot', () => {
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.nameInput.sendKeys('.'))
|
||||
.then(() => {
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
|
||||
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
|
||||
});
|
||||
});
|
||||
|
||||
it('Cancel button', () => {
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.clickCancel())
|
||||
.then(() => {
|
||||
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
|
||||
});
|
||||
});
|
||||
|
||||
it('with duplicate folder name', () => {
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.enterName(duplicateFolderName))
|
||||
.then(() => editDialog.clickUpdate())
|
||||
.then(() => personalFilesPage.getSnackBarMessage())
|
||||
.then(message => {
|
||||
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
|
||||
expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present');
|
||||
});
|
||||
});
|
||||
|
||||
it('trim ending spaces', () => {
|
||||
dataTable.clickOnItemName(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.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,113 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('Permanently delete from Trash', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
const file2 = `file-${Utils.random()}.txt`;
|
||||
let filesIds;
|
||||
|
||||
const folder1 = `folder-${Utils.random()}`;
|
||||
const folder2 = `folder-${Utils.random()}`;
|
||||
let foldersIds;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const trashPage = new BrowsingPage();
|
||||
const { dataTable } = trashPage;
|
||||
const { toolbar } = trashPage;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.user.nodes.createFiles([ file1, file2 ]))
|
||||
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
|
||||
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
|
||||
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
|
||||
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.admin.trashcan.emptyTrash(),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('delete file', () => {
|
||||
dataTable.clickOnItemName(file1)
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toBe(`${file1} deleted`);
|
||||
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
|
||||
});
|
||||
});
|
||||
|
||||
it('delete folder', () => {
|
||||
dataTable.clickOnItemName(folder1)
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toBe(`${folder1} deleted`);
|
||||
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
|
||||
});
|
||||
});
|
||||
|
||||
it('delete multiple items', () => {
|
||||
dataTable.selectMultipleItems([ file2, folder2 ])
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toBe(`2 items deleted`);
|
||||
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
|
||||
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,147 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('Restore from Trash', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
const file2 = `file-${Utils.random()}.txt`;
|
||||
const file3 = `file-${Utils.random()}.txt`;
|
||||
let filesIds;
|
||||
|
||||
const folder1 = `folder-${Utils.random()}`;
|
||||
const folder2 = `folder-${Utils.random()}`;
|
||||
let foldersIds;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const trashPage = new BrowsingPage();
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const { dataTable } = trashPage;
|
||||
const { toolbar } = trashPage;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.user.nodes.createFiles([ file1, file2, file3 ]))
|
||||
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
|
||||
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
|
||||
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
|
||||
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.nodes.deleteNodesById(filesIds),
|
||||
apis.user.nodes.deleteNodesById(foldersIds),
|
||||
apis.admin.trashcan.emptyTrash(),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('restore file', () => {
|
||||
dataTable.clickOnItemName(file1)
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toContain(`${file1} restored`);
|
||||
expect(text).toContain(`View`);
|
||||
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list');
|
||||
})
|
||||
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
|
||||
.then(() => personalFilesPage.dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(personalFilesPage.dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item not displayed in list');
|
||||
});
|
||||
});
|
||||
|
||||
it('restore folder', () => {
|
||||
dataTable.clickOnItemName(folder1)
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toContain(`${folder1} restored`);
|
||||
expect(text).toContain(`View`);
|
||||
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list');
|
||||
})
|
||||
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
|
||||
.then(() => personalFilesPage.dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(personalFilesPage.dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item not displayed in list');
|
||||
});
|
||||
});
|
||||
|
||||
it('restore multiple items', () => {
|
||||
dataTable.selectMultipleItems([ file2, folder2 ])
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||
.then(() => trashPage.getSnackBarMessage())
|
||||
.then(text => {
|
||||
expect(text).toContain(`Restore successful`);
|
||||
expect(text).not.toContain(`View`);
|
||||
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not removed from list');
|
||||
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not removed from list');
|
||||
})
|
||||
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
|
||||
.then(() => personalFilesPage.dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(personalFilesPage.dataTable.getRowByName(file2).isPresent()).toBe(true, 'Item not displayed in list');
|
||||
expect(personalFilesPage.dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item not displayed in list');
|
||||
});
|
||||
});
|
||||
|
||||
it('View from notification', () => {
|
||||
dataTable.clickOnItemName(file3)
|
||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||
.then(() => trashPage.getSnackBarAction().click())
|
||||
.then(() => personalFilesPage.dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(personalFilesPage.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,535 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('Toolbar actions - multiple selection : ', () => {
|
||||
const user1 = `user-${Utils.random()}`;
|
||||
const user2 = `user-${Utils.random()}`;
|
||||
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
let file1Id;
|
||||
const file2 = `file-${Utils.random()}.txt`;
|
||||
let file2Id;
|
||||
|
||||
const folder1 = `folder-${Utils.random()}`;
|
||||
let folder1Id;
|
||||
const folder2 = `folder-${Utils.random()}`;
|
||||
let folder2Id;
|
||||
|
||||
const fileForDelete1 = `file-${Utils.random()}.txt`; let fileForDelete1Id;
|
||||
const fileForDelete2 = `file-${Utils.random()}.txt`; let fileForDelete2Id;
|
||||
const folderForDelete1 = `folder-${Utils.random()}`; let folderForDelete1Id;
|
||||
const folderForDelete2 = `folder-${Utils.random()}`; let folderForDelete2Id;
|
||||
|
||||
const siteName = `site-private-${Utils.random()}`;
|
||||
const file1Admin = `file-${Utils.random()}.txt`;
|
||||
const file2Admin = `file-${Utils.random()}.txt`;
|
||||
const folder1Admin = `folder-${Utils.random()}`;
|
||||
const folder2Admin = `folder-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(user1, user1)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
const { toolbar } = page;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(user1)
|
||||
.then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFiles([ fileForDelete1 ]).then(resp => fileForDelete1Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFiles([ fileForDelete2 ]).then(resp => fileForDelete2Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folderForDelete1 ]).then(resp => folderForDelete1Id = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folderForDelete2 ]).then(resp => folderForDelete2Id = resp.data.entry.id))
|
||||
|
||||
.then(() => apis.user.shared.shareFileById(file1Id))
|
||||
.then(() => apis.user.shared.shareFileById(file2Id))
|
||||
|
||||
.then(() => apis.user.favorites.addFavoriteById('file', file1Id))
|
||||
.then(() => apis.user.favorites.addFavoriteById('file', file2Id))
|
||||
.then(() => apis.user.favorites.addFavoriteById('folder', folder1Id))
|
||||
.then(() => apis.user.favorites.addFavoriteById('folder', folder2Id))
|
||||
|
||||
.then(() => apis.user.nodes.deleteNodeById(fileForDelete1Id, false))
|
||||
.then(() => apis.user.nodes.deleteNodeById(fileForDelete2Id, false))
|
||||
.then(() => apis.user.nodes.deleteNodeById(folderForDelete1Id, false))
|
||||
.then(() => apis.user.nodes.deleteNodeById(folderForDelete2Id, false))
|
||||
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.nodes.deleteNodeById(file1Id),
|
||||
apis.user.nodes.deleteNodeById(file2Id),
|
||||
apis.user.nodes.deleteNodeById(folder1Id),
|
||||
apis.user.nodes.deleteNodeById(folder2Id),
|
||||
|
||||
apis.user.trashcan.permanentlyDelete(fileForDelete1Id),
|
||||
apis.user.trashcan.permanentlyDelete(fileForDelete2Id),
|
||||
apis.user.trashcan.permanentlyDelete(folderForDelete1Id),
|
||||
apis.user.trashcan.permanentlyDelete(folderForDelete2Id),
|
||||
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('Personal Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
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(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple folders are selected', () => {
|
||||
dataTable.selectMultipleItems([folder1, folder2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when both files and folders are selected', () => {
|
||||
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
|
||||
describe('File Libraries', () => {
|
||||
beforeAll(done => {
|
||||
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)
|
||||
.then(() => apis.admin.people.createUser(user2))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER))
|
||||
.then(() => apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(() => apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
apis.admin.sites.deleteSite(siteName).then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('user is Manager', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
dataTable.selectMultipleItems([file1Admin, file2Admin])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple folders are selected', () => {
|
||||
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when both files and folders are selected', () => {
|
||||
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
|
||||
describe('user is Consumer', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user2))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
dataTable.selectMultipleItems([file1Admin, file2Admin])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple folders are selected', () => {
|
||||
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when both files and folders are selected', () => {
|
||||
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
|
||||
.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 not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shared Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
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(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Recent Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
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(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Favorites', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
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(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple folders are selected', () => {
|
||||
dataTable.selectMultipleItems([folder1, folder2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when both files and folders are selected', () => {
|
||||
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
|
||||
})
|
||||
.then(() => toolbar.actions.openMoreMenu())
|
||||
.then(menu => {
|
||||
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
|
||||
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
|
||||
})
|
||||
.then(() => browser.$('body').click())
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Trash', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(user1))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple files are selected', () => {
|
||||
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
||||
.toBe(true, 'Permanently delete is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
|
||||
})
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when multiple folders are selected', () => {
|
||||
dataTable.selectMultipleItems([folderForDelete1, folderForDelete2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
||||
.toBe(true, 'Permanently delete is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
|
||||
})
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
|
||||
it('correct actions appear when both files and folders are selected', () => {
|
||||
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2])
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
||||
.toBe(true, 'Permanently delete is displayed for selected files');
|
||||
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
|
||||
})
|
||||
.then(() => dataTable.clearSelection());
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,535 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
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 siteName = `site-private-${Utils.random()}`;
|
||||
const fileAdmin = `file-${Utils.random()}.txt`;
|
||||
const folderAdmin = `folder-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
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);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.nodes.deleteNodeById(fileUserId),
|
||||
apis.user.nodes.deleteNodeById(folderUserId),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('Personal Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('actions are displayed when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(folderUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
|
||||
it('correct actions appear when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
apis.admin.sites.deleteSite(siteName).then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('user is Manager', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileAdmin)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('actions are displayed when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(folderAdmin)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
|
||||
it('correct actions appear when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
|
||||
describe('user is Consumer', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username2))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileAdmin)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('actions are displayed when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(folderAdmin)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
|
||||
it('correct actions appear when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shared Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Recent Files', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Favorites', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('actions are displayed when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(folderUser)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
|
||||
it('correct actions appear when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(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.$('body').click());
|
||||
});
|
||||
});
|
||||
|
||||
describe('Trash', () => {
|
||||
beforeAll(done => {
|
||||
apis.user.nodes.deleteNodeById(fileForDeleteId, false)
|
||||
.then(() => apis.user.nodes.deleteNodeById(folderForDeleteId, false))
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.trashcan.permanentlyDelete(fileForDeleteId),
|
||||
apis.user.trashcan.permanentlyDelete(folderForDeleteId),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(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 displayed when a file is selected', () => {
|
||||
dataTable.clickOnItemName(fileForDelete)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('actions are displayed when a folder is selected', () => {
|
||||
dataTable.clickOnItemName(folderForDelete)
|
||||
.then(() => {
|
||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('correct actions appear when a file is selected', () => {
|
||||
dataTable.clickOnItemName(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.clickOnItemName(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}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,133 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
|
||||
import { SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('Page titles', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
xit('');
|
||||
|
||||
describe('on Login / Logout pages', () => {
|
||||
it('on Login page', () => {
|
||||
loginPage.load()
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
|
||||
it('after logout', () => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(() => page.signOut())
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
|
||||
it('when pressing Back after Logout', () => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(() => page.signOut())
|
||||
.then(() => browser.navigate().back())
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('on list views', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load()
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('Personal Files page', () => {
|
||||
const label = SIDEBAR_LABELS.PERSONAL_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('File Libraries page', () => {
|
||||
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Shared Files page', () => {
|
||||
const label = SIDEBAR_LABELS.SHARED_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Recent Files page', () => {
|
||||
const label = SIDEBAR_LABELS.RECENT_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Favorites page', () => {
|
||||
const label = SIDEBAR_LABELS.FAVORITES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Trash page', () => {
|
||||
const label = SIDEBAR_LABELS.TRASH;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,179 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
|
||||
import { APP_ROUTES } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Login', () => {
|
||||
const peopleApi = new RepoClient().people;
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
|
||||
const testUser = `user-${Utils.random()}@alfness`;
|
||||
|
||||
const russianUser = {
|
||||
username: `пользвате${Utils.random()}`,
|
||||
password: '密碼中國'
|
||||
};
|
||||
|
||||
const johnDoe = {
|
||||
username: `user-${Utils.random()}`,
|
||||
get password() { return this.username; },
|
||||
firstName: 'John',
|
||||
lastName: 'Doe'
|
||||
};
|
||||
|
||||
beforeAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
peopleApi.createUser(testUser),
|
||||
peopleApi.createUser(russianUser.username, russianUser.password),
|
||||
peopleApi.createUser(johnDoe.username, johnDoe.password, {
|
||||
firstName: johnDoe.firstName,
|
||||
lastName: johnDoe.lastName
|
||||
})
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
loginPage.load().then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
logoutPage.load()
|
||||
.then(() => Utils.clearLocalStorage())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('with valid credentials', () => {
|
||||
it('navigate to "Personal Files"', () => {
|
||||
const { username } = johnDoe;
|
||||
|
||||
loginPage.loginWith(username)
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
|
||||
it(`displays user's name in header`, () => {
|
||||
const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header;
|
||||
const { username, firstName, lastName } = johnDoe;
|
||||
|
||||
loginPage.loginWith(username)
|
||||
.then(() => {
|
||||
expect(userInfo.name).toEqual(`${firstName} ${lastName}`);
|
||||
});
|
||||
});
|
||||
|
||||
it(`logs in with user having username containing "@"`, () => {
|
||||
loginPage
|
||||
.loginWith(testUser)
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
|
||||
it('logs in with user with non-latin characters', () => {
|
||||
const { username, password } = russianUser;
|
||||
|
||||
loginPage
|
||||
.loginWith(username, password)
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
|
||||
it('redirects to Home Page when navigating to the Login page while already logged in', () => {
|
||||
const { username } = johnDoe;
|
||||
|
||||
loginPage
|
||||
.loginWith(username)
|
||||
.then(() => browser.get(APP_ROUTES.LOGIN)
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('redirects to Personal Files when pressing browser Back while already logged in ', () => {
|
||||
const { username } = johnDoe;
|
||||
|
||||
loginPage
|
||||
.loginWith(username)
|
||||
.then(() => browser.navigate().back())
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('with invalid credentials', () => {
|
||||
const { login: loginComponent } = loginPage;
|
||||
const { submitButton, errorMessage } = loginComponent;
|
||||
|
||||
it('disabled submit button when no credentials are entered', () => {
|
||||
expect(submitButton.isEnabled()).toBe(false);
|
||||
});
|
||||
|
||||
it('disabled submit button when password is empty', () => {
|
||||
loginComponent.enterUsername('any-username');
|
||||
|
||||
expect(submitButton.isEnabled()).toBe(false);
|
||||
});
|
||||
|
||||
it('disabled submit button when username is empty', () => {
|
||||
loginPage.login.enterPassword('any-password');
|
||||
|
||||
expect(submitButton.isEnabled()).toBe(false);
|
||||
});
|
||||
|
||||
it('shows error when entering nonexistent user', () => {
|
||||
loginPage
|
||||
.tryLoginWith('nonexistent-user', 'any-password')
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
expect(errorMessage.isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('shows error when entering invalid password', () => {
|
||||
const { username } = johnDoe;
|
||||
|
||||
loginPage
|
||||
.tryLoginWith(username, 'incorrect-password')
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
expect(errorMessage.isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,74 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Logout', () => {
|
||||
const page = new BrowsingPage();
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
|
||||
const peopleApi = new RepoClient().people;
|
||||
|
||||
const johnDoe = `user-${Utils.random()}`;
|
||||
|
||||
beforeAll((done) => {
|
||||
peopleApi
|
||||
.createUser(johnDoe)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach((done) => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(johnDoe))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach((done) => {
|
||||
logoutPage.load()
|
||||
.then(() => Utils.clearLocalStorage())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('redirects to Login page, on sign out', () => {
|
||||
page.signOut()
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
});
|
||||
});
|
||||
|
||||
it('redirects to Login page when pressing browser Back after logout', () => {
|
||||
page.signOut()
|
||||
.then(() => browser.navigate().back())
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,109 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Empty list views', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, password)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('empty Personal Files', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
|
||||
});
|
||||
});
|
||||
|
||||
it('empty File Libraries', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
|
||||
expect(dataTable.getEmptyStateText()).toContain('Join sites to upload, view, and share files.');
|
||||
});
|
||||
});
|
||||
|
||||
it('empty Shared Files', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyStateTitle()).toContain('No shared files or folders');
|
||||
expect(dataTable.getEmptyStateText()).toContain('Items you share using the Share option are shown here.');
|
||||
});
|
||||
});
|
||||
|
||||
it('empty Recent Files', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyStateTitle()).toContain('No recent files');
|
||||
expect(dataTable.getEmptyStateText()).toContain('Items you upload or edit in the last 30 days are shown here.');
|
||||
});
|
||||
});
|
||||
|
||||
it('empty Favorites', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyStateTitle()).toContain('No favorite files or folders');
|
||||
expect(dataTable.getEmptyStateText()).toContain('Favorite items that you want to easily find later.');
|
||||
});
|
||||
});
|
||||
|
||||
it('empty Trash', () => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => {
|
||||
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(dataTable.getEmptyStateTitle()).toContain('Trash is empty');
|
||||
expect(dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.');
|
||||
expect(dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,157 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, by } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Favorites', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const folderName = `folder-${Utils.random()}`;
|
||||
const fileName1 = `file-${Utils.random()}.txt`;
|
||||
const fileName2 = `file-${Utils.random()}.txt`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, password)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const favoritesPage = new BrowsingPage();
|
||||
const { dataTable } = favoritesPage;
|
||||
const { breadcrumb } = favoritesPage.toolbar;
|
||||
|
||||
beforeAll(done => {
|
||||
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(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ folderName ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
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');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the favorite files and folders', () => {
|
||||
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of items displayed');
|
||||
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
|
||||
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
|
||||
expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, `${folderName} not displayed`);
|
||||
});
|
||||
|
||||
it('Location column displays the parent folder of the files', () => {
|
||||
const itemsLocations = {
|
||||
[fileName1]: siteName,
|
||||
[fileName2]: folderName,
|
||||
[folderName]: 'Personal Files'
|
||||
};
|
||||
|
||||
dataTable.getRows()
|
||||
.map((row) => {
|
||||
return row.all(dataTable.cell).map(cell => cell.getText());
|
||||
})
|
||||
.then((rowCells) => {
|
||||
return rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2];
|
||||
return acc;
|
||||
}, {});
|
||||
})
|
||||
.then((favoritesList) => {
|
||||
Object.keys(itemsLocations).forEach((item) => {
|
||||
expect(favoritesList[item]).toEqual(itemsLocations[item]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - item in user Home', () => {
|
||||
dataTable.clickItemLocation(folderName)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in folder', () => {
|
||||
dataTable.clickItemLocation(fileName2)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(folderName);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in site', () => {
|
||||
dataTable.clickItemLocation(fileName1)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(siteName);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('File Libraries');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@@ -1,131 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, by } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('File Libraries', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const sitePrivate = `private-${Utils.random()}`;
|
||||
const siteModerated = `moderated-${Utils.random()}`;
|
||||
const sitePublic = `public-${Utils.random()}`;
|
||||
|
||||
const adminSite = `admin-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, password)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
||||
const { dataTable } = fileLibrariesPage;
|
||||
|
||||
beforeAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.people.createUser(username),
|
||||
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC),
|
||||
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED),
|
||||
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE),
|
||||
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC)
|
||||
])
|
||||
.then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER))
|
||||
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.admin.sites.deleteSite(sitePublic),
|
||||
apis.admin.sites.deleteSite(siteModerated),
|
||||
apis.admin.sites.deleteSite(sitePrivate),
|
||||
apis.admin.sites.deleteSite(adminSite),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Title', 'Status' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(2 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('User can see only the sites he is a member of', () => {
|
||||
const sitesCount = dataTable.countRows();
|
||||
|
||||
const expectedSites = {
|
||||
[sitePrivate]: SITE_VISIBILITY.PRIVATE,
|
||||
[siteModerated]: SITE_VISIBILITY.MODERATED,
|
||||
[sitePublic]: SITE_VISIBILITY.PUBLIC
|
||||
};
|
||||
|
||||
expect(sitesCount).toEqual(3, 'Incorrect number of sites displayed');
|
||||
expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
|
||||
|
||||
dataTable.getRows()
|
||||
.map((row) => {
|
||||
return row.all(by.css('td')).map(cell => cell.getText());
|
||||
})
|
||||
.then((rowCells) => {
|
||||
return rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2].toUpperCase();
|
||||
return acc;
|
||||
}, {});
|
||||
})
|
||||
.then((sitesList) => {
|
||||
Object.keys(expectedSites).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSites[site]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// it('Site ID is displayed when two sites have the same name', () => {
|
||||
// // cannot be implemented until ACA-987 is fixed
|
||||
// });
|
||||
});
|
@@ -1,159 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
|
||||
import { SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Personal Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const { dataTable } = personalFilesPage;
|
||||
|
||||
const adminFolder = `admin-folder-${Utils.random()}`;
|
||||
|
||||
const userFolder = `user-folder-${Utils.random()}`;
|
||||
const userFile = `file-${Utils.random()}.txt`;
|
||||
|
||||
beforeAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.people.createUser(username),
|
||||
apis.admin.nodes.createFolders([ adminFolder ])
|
||||
])
|
||||
.then(() => apis.user.nodes.createFolders([ userFolder ]))
|
||||
.then(() => apis.user.nodes.createFiles([ userFile ], userFolder))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.nodes.deleteNodes([ adminFolder ]),
|
||||
apis.user.nodes.deleteNodes([ userFolder ])
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe(`Admin user's personal files`, () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('has "Data Dictionary" folder', () => {
|
||||
expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
|
||||
});
|
||||
|
||||
it('has created content', () => {
|
||||
expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe(`Regular user's personal files`, () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Name', 'Size', 'Modified', 'Modified by' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('has default sorted column', () => {
|
||||
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
|
||||
});
|
||||
|
||||
it('has user created content', () => {
|
||||
expect(dataTable.getRowByName(userFolder).isPresent())
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it('navigates to folder', () => {
|
||||
const getNodeIdPromise = apis.user.nodes
|
||||
.getNodeByPath(`/${userFolder}`)
|
||||
.then(response => response.data.entry.id);
|
||||
|
||||
const navigatePromise = dataTable
|
||||
.doubleClickOnItemName(userFolder)
|
||||
.then(() => dataTable.waitForHeader());
|
||||
|
||||
Promise
|
||||
.all([
|
||||
getNodeIdPromise,
|
||||
navigatePromise
|
||||
])
|
||||
.then(([ nodeId ]) => {
|
||||
expect(browser.getCurrentUrl())
|
||||
.toContain(nodeId, 'Node ID is not in the URL');
|
||||
|
||||
expect(dataTable.getRowByName(userFile).isPresent())
|
||||
.toBe(true, 'user file is missing');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,149 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, by } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Recent Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const folderName = `folder-${Utils.random()}`;
|
||||
let folderId;
|
||||
const fileName1 = `file-${Utils.random()}.txt`;
|
||||
|
||||
const fileName2 = `file-${Utils.random()}.txt`;
|
||||
let file2Id;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, password)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const recentFilesPage = new BrowsingPage();
|
||||
const { dataTable } = recentFilesPage;
|
||||
const { breadcrumb } = recentFilesPage.toolbar;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.user.nodes.createFolders([ folderName ]))
|
||||
.then(resp => folderId = resp.data.entry.id)
|
||||
.then(() => apis.user.nodes.createFiles([ fileName1 ], folderName))
|
||||
|
||||
.then(() => apis.user.nodes.createFiles([ fileName2 ]))
|
||||
.then(resp => file2Id = resp.data.entry.id)
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => dataTable.isEmptyList())
|
||||
.then(empty => {
|
||||
if (empty) {
|
||||
browser.sleep(5000);
|
||||
recentFilesPage.refresh();
|
||||
}
|
||||
})
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.nodes.deleteNodesById([ folderId, file2Id ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Name', 'Location', 'Size', 'Modified' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the files added by the current user in the last 30 days', () => {
|
||||
expect(dataTable.countRows()).toEqual(2, 'Incorrect number of sites displayed');
|
||||
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
|
||||
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
|
||||
});
|
||||
|
||||
it('Location column displays the parent folder of the file', () => {
|
||||
const itemsLocations = {
|
||||
[fileName2]: 'Personal Files',
|
||||
[fileName1]: folderName
|
||||
};
|
||||
|
||||
dataTable.getRows()
|
||||
.map((row) => {
|
||||
return row.all(dataTable.cell).map(cell => cell.getText());
|
||||
})
|
||||
.then((rowCells) => {
|
||||
return rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2];
|
||||
return acc;
|
||||
}, {});
|
||||
})
|
||||
.then((recentList) => {
|
||||
Object.keys(itemsLocations).forEach((item) => {
|
||||
expect(recentList[item]).toEqual(itemsLocations[item]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in user Home', () => {
|
||||
dataTable.clickItemLocation(fileName1)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(folderName);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in folder', () => {
|
||||
dataTable.clickItemLocation(fileName2)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,155 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, by } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Shared Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const fileAdmin = `file-${Utils.random()}.txt`;
|
||||
|
||||
const folderUser = `folder-${Utils.random()}`;
|
||||
const fileUser = `file-${Utils.random()}.txt`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, password)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const sharedFilesPage = new BrowsingPage();
|
||||
const { dataTable } = sharedFilesPage;
|
||||
const { breadcrumb } = sharedFilesPage.toolbar;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
|
||||
.then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(resp => apis.admin.shared.shareFileById(resp.data.entry.id))
|
||||
|
||||
.then(() => apis.user.nodes.createFolders([ folderUser ]))
|
||||
.then(() => apis.user.nodes.createFiles([ fileUser ], folderUser))
|
||||
.then(resp => apis.user.shared.shareFileById(resp.data.entry.id))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => dataTable.isEmptyList())
|
||||
.then(empty => {
|
||||
if (empty) {
|
||||
browser.sleep(5000);
|
||||
sharedFilesPage.refresh();
|
||||
}
|
||||
})
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ folderUser ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the files shared by everyone', () => {
|
||||
expect(dataTable.countRows()).toEqual(2, 'Incorrect number of items displayed');
|
||||
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
|
||||
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
|
||||
});
|
||||
|
||||
it('Location column displays the parent folder of the file', () => {
|
||||
const itemsLocations = {
|
||||
[fileAdmin]: siteName,
|
||||
[fileUser]: folderUser
|
||||
};
|
||||
|
||||
dataTable.getRows()
|
||||
.map((row) => {
|
||||
return row.all(dataTable.cell).map(cell => cell.getText());
|
||||
})
|
||||
.then((rowCells) => {
|
||||
return rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2];
|
||||
return acc;
|
||||
}, {});
|
||||
})
|
||||
.then((recentList) => {
|
||||
Object.keys(itemsLocations).forEach((item) => {
|
||||
expect(recentList[item]).toEqual(itemsLocations[item]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in user Home', () => {
|
||||
dataTable.clickItemLocation(fileUser)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(folderUser);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in site', () => {
|
||||
dataTable.clickItemLocation(fileAdmin)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(siteName);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('File Libraries');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,188 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, by } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Trash', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const fileSite = `file-${Utils.random()}.txt`;
|
||||
let fileSiteId;
|
||||
|
||||
const folderAdmin = `folder-${Utils.random()}`;
|
||||
let folderAdminId;
|
||||
const fileAdmin = `file-${Utils.random()}.txt`;
|
||||
let fileAdminId;
|
||||
|
||||
const folderUser = `folder-${Utils.random()}`;
|
||||
let folderUserId;
|
||||
const fileUser = `file-${Utils.random()}.txt`;
|
||||
let fileUserId;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const trashPage = new BrowsingPage();
|
||||
const { dataTable } = trashPage;
|
||||
const { breadcrumb } = trashPage.toolbar;
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.admin.nodes.createFiles([ fileAdmin ])
|
||||
.then(resp => fileAdminId = resp.data.entry.id))
|
||||
.then(() => apis.admin.nodes.createFolders([ folderAdmin ])
|
||||
.then(resp => folderAdminId = resp.data.entry.id))
|
||||
.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([ fileSite ], `Sites/${siteName}/documentLibrary`)
|
||||
.then(resp => fileSiteId = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFiles([ fileUser ])
|
||||
.then(resp => fileUserId = resp.data.entry.id))
|
||||
.then(() => apis.user.nodes.createFolders([ folderUser ])
|
||||
.then(resp => folderUserId = resp.data.entry.id))
|
||||
|
||||
.then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false))
|
||||
.then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId ], false))
|
||||
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.admin.trashcan.emptyTrash()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
xit('');
|
||||
|
||||
describe('as admin', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the files and folders deleted by everyone', () => {
|
||||
expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items 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`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('as user', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('has the correct columns', () => {
|
||||
const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
expect(dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the files and folders deleted by the user', () => {
|
||||
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items 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('Location column redirect - file in user Home', () => {
|
||||
dataTable.clickItemLocation(fileUser)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('Personal Files');
|
||||
});
|
||||
});
|
||||
|
||||
it('Location column redirect - file in site', () => {
|
||||
dataTable.clickItemLocation(fileSite)
|
||||
.then(() => breadcrumb.getCurrentItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe(siteName);
|
||||
})
|
||||
.then(() => breadcrumb.getFirstItemName())
|
||||
.then(name => {
|
||||
expect(name).toBe('File Libraries');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,129 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, SIDEBAR_LABELS } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
|
||||
describe('Side navigation', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
beforeAll(done => {
|
||||
loginPage.load()
|
||||
.then(() => loginPage.loginWithAdmin())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.dataTable.wait().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load().then(done);
|
||||
});
|
||||
|
||||
it('has "Personal Files" as default', () => {
|
||||
expect(browser.getCurrentUrl())
|
||||
.toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
|
||||
expect(page.sidenav.isActiveByLabel('Personal Files'))
|
||||
.toBe(true, 'Active link');
|
||||
});
|
||||
|
||||
it('navigates to "File Libraries"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.FILE_LIBRARIES);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to "Personal Files"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to "Shared Files"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.SHARED_FILES);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.SHARED_FILES)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to "Recent Files"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.RECENT_FILES);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.RECENT_FILES)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to "Favorites"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.FAVORITES);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.FAVORITES)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to "Trash"', () => {
|
||||
const { sidenav, dataTable } = page;
|
||||
|
||||
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.wait())
|
||||
.then(() => browser.getCurrentUrl())
|
||||
.then(url => {
|
||||
expect(url).toContain(APP_ROUTES.TRASHCAN);
|
||||
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.TRASH)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,186 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Pagination on Favorites', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
const { nodes: nodesApi, favorites: favoritesApi } = apis.user;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, pagination } = page;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const files = Array(101)
|
||||
.fill('file')
|
||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||
let filesIds;
|
||||
|
||||
function resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
function resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => nodesApi.createFiles(files, parent))
|
||||
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
|
||||
.then(() => favoritesApi.addFavoritesByIds('file', filesIds))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
nodesApi.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('default values', () => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(pagination.maxItems.getText()).toContain('25');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
||||
expect(pagination.totalPages.getText()).toContain('of 5');
|
||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||
});
|
||||
|
||||
it('page sizes', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => {
|
||||
const [ first, second, third ] = [1, 2, 3]
|
||||
.map(nth => menu.getNthItem(nth).getText());
|
||||
expect(first).toBe('25');
|
||||
expect(second).toBe('50');
|
||||
expect(third).toBe('100');
|
||||
});
|
||||
});
|
||||
|
||||
it('change the page size', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('50'))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.maxItems.getText()).toContain('50');
|
||||
expect(pagination.totalPages.getText()).toContain('of 3');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageSize());
|
||||
});
|
||||
|
||||
it('current page menu items', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => {
|
||||
expect(menu.getItemsCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
it('change the current page from menu', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(3))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
||||
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.getRowByName('file-40.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to next page', () => {
|
||||
pagination.nextButton.click()
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||
expect(dataTable.getRowByName('file-70.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to previous page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(2))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => pagination.previousButton.click())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('last page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(5))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,183 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Pagination on Personal Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
const { nodes: nodesApi } = apis.user;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, pagination } = page;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const files = Array(101)
|
||||
.fill('file')
|
||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||
|
||||
function resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
function resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => nodesApi.createFiles(files, parent))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => dataTable.doubleClickOnItemName(parent))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
nodesApi.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('default values', () => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(pagination.maxItems.getText()).toContain('25');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
||||
expect(pagination.totalPages.getText()).toContain('of 5');
|
||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||
});
|
||||
|
||||
it('page sizes', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => {
|
||||
const [ first, second, third ] = [1, 2, 3]
|
||||
.map(nth => menu.getNthItem(nth).getText());
|
||||
expect(first).toBe('25');
|
||||
expect(second).toBe('50');
|
||||
expect(third).toBe('100');
|
||||
});
|
||||
});
|
||||
|
||||
it('change the page size', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('50'))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.maxItems.getText()).toContain('50');
|
||||
expect(pagination.totalPages.getText()).toContain('of 3');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageSize());
|
||||
});
|
||||
|
||||
it('current page menu items', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => {
|
||||
expect(menu.getItemsCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
it('change the current page from menu', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(3))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
||||
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.getRowByName('file-60.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to next page', () => {
|
||||
pagination.nextButton.click()
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||
expect(dataTable.getRowByName('file-30.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to previous page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(2))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => pagination.previousButton.click())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(dataTable.getRowByName('file-12.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('last page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(5))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,189 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Pagination on Recent Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
const { nodes: nodesApi } = apis.user;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, pagination } = page;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const files = Array(101)
|
||||
.fill('file')
|
||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||
|
||||
function resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
function resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => nodesApi.createFiles(files, parent))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||
.then(() => dataTable.isEmptyList())
|
||||
.then(empty => {
|
||||
if (empty) {
|
||||
browser.sleep(3000);
|
||||
page.refresh();
|
||||
}
|
||||
})
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
nodesApi.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('default values', () => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(pagination.maxItems.getText()).toContain('25');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
||||
expect(pagination.totalPages.getText()).toContain('of 5');
|
||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||
});
|
||||
|
||||
it('page sizes', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => {
|
||||
const [ first, second, third ] = [1, 2, 3]
|
||||
.map(nth => menu.getNthItem(nth).getText());
|
||||
expect(first).toBe('25');
|
||||
expect(second).toBe('50');
|
||||
expect(third).toBe('100');
|
||||
});
|
||||
});
|
||||
|
||||
it('change the page size', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('50'))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.maxItems.getText()).toContain('50');
|
||||
expect(pagination.totalPages.getText()).toContain('of 3');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageSize());
|
||||
});
|
||||
|
||||
it('current page menu items', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => {
|
||||
expect(menu.getItemsCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
it('change the current page from menu', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(3))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
||||
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.getRowByName('file-40.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to next page', () => {
|
||||
pagination.nextButton.click()
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||
expect(dataTable.getRowByName('file-70.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to previous page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(2))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => pagination.previousButton.click())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('last page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(5))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,193 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Pagination on Shared Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
const { nodes: nodesApi, shared: sharedApi } = apis.user;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, pagination } = page;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const files = Array(101)
|
||||
.fill('file')
|
||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||
let filesIds;
|
||||
|
||||
function resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
function resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => nodesApi.createFiles(files, parent))
|
||||
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
|
||||
.then(() => sharedApi.shareFilesByIds(filesIds))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||
.then(() => dataTable.isEmptyList())
|
||||
.then(empty => {
|
||||
if (empty) {
|
||||
browser.sleep(6000);
|
||||
page.refresh();
|
||||
}
|
||||
})
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
nodesApi.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('default values', () => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(pagination.maxItems.getText()).toContain('25');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
||||
expect(pagination.totalPages.getText()).toContain('of 5');
|
||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||
});
|
||||
|
||||
it('page sizes', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => {
|
||||
const [ first, second, third ] = [1, 2, 3]
|
||||
.map(nth => menu.getNthItem(nth).getText());
|
||||
expect(first).toBe('25');
|
||||
expect(second).toBe('50');
|
||||
expect(third).toBe('100');
|
||||
});
|
||||
});
|
||||
|
||||
it('change the page size', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('50'))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.maxItems.getText()).toContain('50');
|
||||
expect(pagination.totalPages.getText()).toContain('of 3');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageSize());
|
||||
});
|
||||
|
||||
it('current page menu items', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => {
|
||||
expect(menu.getItemsCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
it('change the current page from menu', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(3))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
||||
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.getRowByName('file-40.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to next page', () => {
|
||||
pagination.nextButton.click()
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||
expect(dataTable.getRowByName('file-70.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to previous page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(2))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => pagination.previousButton.click())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('last page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(5))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,184 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser, protractor, promise } from 'protractor';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||
|
||||
describe('Pagination on Trash', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
const { nodes: nodesApi, trashcan: trashApi } = apis.user;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, pagination } = page;
|
||||
|
||||
const filesForDelete = Array(101)
|
||||
.fill('file')
|
||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||
let filesDeletedIds;
|
||||
|
||||
function resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
function resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => dataTable.waitForHeader());
|
||||
}
|
||||
|
||||
beforeAll(done => {
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => nodesApi.createFiles(filesForDelete))
|
||||
.then(resp => filesDeletedIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
|
||||
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
trashApi.emptyTrash(),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('default values', () => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(pagination.maxItems.getText()).toContain('25');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
||||
expect(pagination.totalPages.getText()).toContain('of 5');
|
||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||
});
|
||||
|
||||
it('page sizes', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => {
|
||||
const [ first, second, third ] = [1, 2, 3]
|
||||
.map(nth => menu.getNthItem(nth).getText());
|
||||
expect(first).toBe('25');
|
||||
expect(second).toBe('50');
|
||||
expect(third).toBe('100');
|
||||
});
|
||||
});
|
||||
|
||||
it('change the page size', () => {
|
||||
pagination.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('50'))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.maxItems.getText()).toContain('50');
|
||||
expect(pagination.totalPages.getText()).toContain('of 3');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageSize());
|
||||
});
|
||||
|
||||
it('current page menu items', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => {
|
||||
expect(menu.getItemsCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
it('change the current page from menu', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(3))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
||||
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.getRowByName('file-40.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to next page', () => {
|
||||
pagination.nextButton.click()
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||
expect(dataTable.getRowByName('file-70.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('navigate to previous page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(2))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => pagination.previousButton.click())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
||||
.toBe(true, 'File not found on page');
|
||||
})
|
||||
|
||||
.then(() => resetToDefaultPageNumber());
|
||||
});
|
||||
|
||||
it('last page', () => {
|
||||
pagination.openCurrentPageMenu()
|
||||
.then(menu => menu.clickNthItem(5))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user