[ACS-5761] Demo Shell Cleanup (part 2) (#8807)

cleanup demo shell
This commit is contained in:
Denys Vuika
2023-08-10 22:18:21 +01:00
committed by GitHub
parent ca60b392d4
commit f201efd56a
203 changed files with 1005 additions and 10703 deletions
@@ -1,354 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
WaitActions
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { LockFilePage } from '../../content-services/pages/lock-file.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { NodeEntry, NodesApi, SitesApi } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Lock File', () => {
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const lockFilePage = new LockFilePage();
const contentServices = new ContentServicesPage();
const adminUser = new UserModel();
const managerUser = new UserModel();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const waitActions = new WaitActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const pngFileToLock = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_path
});
const pngFileToLockAdmin = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_path
});
let site; let documentLibrary;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(adminUser);
await usersActions.createUser(managerUser);
await apiService.login(adminUser.username, adminUser.password);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PRIVATE'
});
const resultNode = await nodesApi.listNodeChildren(site.entry.guid);
documentLibrary = resultNode.list.entries[0].entry.id;
await sitesApi.createSiteMembership(site.entry.id, {
id: managerUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
try {
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
} catch (e) {
}
});
describe('Lock file interaction with the UI', () => {
let pngLockedUploadedFile: NodeEntry;
let pngUploadedFile: NodeEntry;
beforeAll(async () => {
pngLockedUploadedFile = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
await loginPage.login(adminUser.username, adminUser.password);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await navigationBarPage.openContentServicesFolder(documentLibrary);
await contentServices.waitForTableBody();
});
afterEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
try {
await nodesApi.unlockNode(pngUploadedFile.entry.id);
await waitActions.nodeIsUnlock(pngUploadedFile.entry.id);
} catch (e) {
}
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
try {
await nodesApi.unlockNode(pngLockedUploadedFile.entry.id);
} catch (e) {
}
try {
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
} catch (e) {
}
try {
await uploadActions.deleteFileOrFolder(pngLockedUploadedFile.entry.id);
} catch (e) {
}
await navigationBarPage.clickLogoutButton();
});
it('[C286604] Should be able to open Lock file option by clicking the lock image', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.cancelButton.waitVisible();
await lockFilePage.saveButton.waitVisible();
});
it('[C286625] Should be able to click Cancel to cancel lock file operation', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.cancelButton.click();
await contentServices.checkUnlockedIcon(pngFileModel.name);
});
it('[C286603] Should be able to click on Lock file checkbox and lock a file', async () => {
await contentServices.lockContent(pngFileToLock.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkLockedIcon(pngFileToLock.name);
});
it('[C286618] Should be able to uncheck Lock file checkbox and unlock a file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkLockedIcon(pngFileModel.name);
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkUnlockedIcon(pngFileModel.name);
});
});
describe('Locked file without owner permissions', () => {
let pngUploadedFile: NodeEntry;
beforeEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await loginPage.login(managerUser.username, managerUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
});
afterEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
try {
await nodesApi.unlockNode(pngUploadedFile.entry.id);
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
} catch (error) {
}
await navigationBarPage.clickLogoutButton();
});
it('[C286610] Should not be able to delete a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await nodesApi.deleteNode(pngUploadedFile.entry.id);
} catch (error) {
await expect(error.status).toEqual(409);
}
});
it('[C286611] Should not be able to rename a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await nodesApi.updateNode(pngUploadedFile.entry.id, { name: 'My new name' });
} catch (error) {
await expect(error.status).toEqual(409);
}
});
it('[C286612] Should not be able to move a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await nodesApi.moveNode(pngUploadedFile.entry.id, { targetParentId: '-my-' });
} catch (error) {
await expect(error.status).toEqual(409);
}
});
it('[C286613] Should not be able to update a new version on a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await nodesApi.updateNodeContent(pngUploadedFile.entry.id, 'NEW FILE CONTENT');
} catch (error) {
await expect(error.status).toEqual(409);
}
});
});
describe('Locked file with owner permissions', () => {
let pngFileToBeLocked: NodeEntry;
let pngUploadedFile: NodeEntry;
beforeEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
pngFileToBeLocked = await uploadActions.uploadFile(pngFileToLockAdmin.location, pngFileToLockAdmin.name, documentLibrary);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await loginPage.login(adminUser.username, adminUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
await contentServices.getDocumentList().dataTable.waitTillContentLoaded();
});
afterEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
try {
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
await uploadActions.deleteFileOrFolder(pngFileToBeLocked.entry.id);
} catch (e) {
}
await navigationBarPage.clickLogoutButton();
});
it('[C286615] Owner of the locked file should be able to update a new version if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.login(adminUser.username, adminUser.password);
const response = await nodesApi.updateNodeContent(pngUploadedFile.entry.id, 'NEW FILE CONTENT');
await expect(response.entry.modifiedAt.getTime()).toBeGreaterThan(response.entry.createdAt.getTime());
} catch (error) {
}
});
it('[C286616] Owner of the locked file should be able to move if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.login(adminUser.username, adminUser.password);
await nodesApi.moveNode(pngUploadedFile.entry.id, { targetParentId: '-my-' });
const movedFile = await nodesApi.getNode(pngUploadedFile.entry.id);
await expect(movedFile.entry.parentId).not.toEqual(documentLibrary);
} catch (error) {
}
});
it('[C286617] Owner of the locked file should be able to delete if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileToLockAdmin.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.deleteContent(pngFileToBeLocked.entry.name);
await contentServices.checkContentIsNotDisplayed(pngFileToBeLocked.entry.name);
});
it('[C286614] Owner of the locked file should be able to rename if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
const response = await nodesApi.updateNode(pngUploadedFile.entry.id, { name: 'My new name' });
await expect(response.entry.name).toEqual('My new name');
} catch (error) {
}
});
});
});
@@ -22,7 +22,6 @@ import {
createApiService,
BrowserActions, Logger,
LoginPage,
NotificationHistoryPage,
PermissionActions,
SearchService,
StringUtil,
@@ -37,7 +36,7 @@ import { FolderModel } from '../../models/ACS/folder.model';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
import { GroupsApi } from '@alfresco/js-api';
import { GroupsApi, NodeEntry } from '@alfresco/js-api';
describe('Permissions Component', () => {
@@ -56,7 +55,6 @@ describe('Permissions Component', () => {
const contentList = contentServicesPage.getDocumentList();
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const notificationHistoryPage = new NotificationHistoryPage();
const uploadDialog = new UploadDialogPage();
let file;
const fileModel = new FileModel({
@@ -89,11 +87,11 @@ describe('Permissions Component', () => {
const roleContributorFolderModel = new FolderModel({ name: 'roleContributor' + StringUtil.generateRandomString() });
const roleEditorFolderModel = new FolderModel({ name: 'roleEditor' + StringUtil.generateRandomString() });
let roleConsumerFolder;
let roleCoordinatorFolder;
let roleContributorFolder;
let roleCollaboratorFolder;
let roleEditorFolder;
let roleConsumerFolder: NodeEntry;
let roleCoordinatorFolder: NodeEntry;
let roleContributorFolder: NodeEntry;
let roleCollaboratorFolder: NodeEntry;
let roleEditorFolder: NodeEntry;
beforeAll(async () => {
try {
@@ -305,11 +303,9 @@ describe('Permissions Component', () => {
await contentList.checkActionMenuIsNotDisplayed();
await contentServicesPage.metadataContent('RoleConsumer' + fileModel.name);
await expect(await snackbarPage.getSnackBarMessage()).toEqual('You don\'t have access to do this.');
await notificationHistoryPage.checkNotifyContains('You don\'t have access to do this.');
await browser.sleep(3000);
await contentServicesPage.uploadFile(fileLocation);
await expect(await snackbarPage.getSnackBarMessage()).toEqual('You don\'t have the create permission to upload the content');
await notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
});
it('[C276996] Role Contributor', async () => {
@@ -324,7 +320,6 @@ describe('Permissions Component', () => {
await BrowserActions.closeMenuAndDialogs();
await contentList.checkActionMenuIsNotDisplayed();
await contentServicesPage.metadataContent('RoleContributor' + fileModel.name);
await notificationHistoryPage.checkNotifyContains('You don\'t have access to do this.');
await contentServicesPage.uploadFile(testFileModel.location);
await contentServicesPage.checkContentIsDisplayed(testFileModel.name);
await uploadDialog.fileIsUploaded(testFileModel.name);
@@ -351,7 +346,6 @@ describe('Permissions Component', () => {
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle1');
await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(fileLocation);
await notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
});
it('[C277003] Role Collaborator', async () => {
@@ -1,221 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
ApiUtil,
BrowserActions,
LocalStorageUtil,
LoginPage,
NotificationHistoryPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ShareDialogPage } from '../../core/pages/dialog/share-dialog.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { SharedLinkEntry, SharedLinkPaging, SharedlinksApi } from '@alfresco/js-api';
import { CustomSourcesPage } from '../../core/pages/custom-sources.page';
describe('Share file', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const contentListPage = contentServicesPage.getDocumentList();
const shareDialog = new ShareDialogPage();
const navigationBarPage = new NavigationBarPage();
const customSourcesPage = new CustomSourcesPage();
const viewerPage = new ViewerPage();
const notificationHistoryPage = new NotificationHistoryPage();
let acsUser: UserModel;
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const sharedLinksApi = new SharedlinksApi(apiService.getInstance());
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
let nodeId;
const waitForShareLink = async (nodeIdSharedFile: string) => {
const predicate = (sharedLinkPaging: SharedLinkPaging) => {
const sharedLink = sharedLinkPaging.list.entries.find((sharedLinkEntry: SharedLinkEntry) => sharedLinkEntry.entry.nodeId === nodeIdSharedFile);
return !!sharedLink;
};
const apiCall = async () => {
await apiService.login(acsUser.username, acsUser.password);
return sharedLinksApi.listSharedLinks();
};
return ApiUtil.waitForApi(apiCall, predicate, 10, 2000);
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
nodeId = pngUploadedFile.entry.id;
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(nodeId);
});
describe('Shared link dialog', () => {
beforeAll(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentListPage.selectRow(pngFileModel.name);
await BrowserActions.closeMenuAndDialogs();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C286549] Should check automatically toggle button in Share dialog', async () => {
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.shareToggleButtonIsChecked();
await BrowserActions.closeMenuAndDialogs();
});
it('[C286544] Should display notification when clicking URL copy button', async () => {
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
await BrowserActions.closeMenuAndDialogs();
await notificationHistoryPage.checkNotifyContains('Link copied to the clipboard');
});
it('[C286543] Should be possible to close Share dialog', async () => {
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.checkShareLinkIsDisplayed();
await BrowserActions.closeMenuAndDialogs();
});
it('[C286578] Should disable today option in expiration day calendar', async () => {
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickExpireToggle();
await shareDialog.clickDateTimePickerButton();
await shareDialog.calendarTodayDayIsDisabled();
await BrowserActions.closeMenuAndDialogs();
});
it('[C310329] Should be possible to set expiry date only for link', async () => {
await LocalStorageUtil.setConfigField('sharedLinkDateTimePickerType', JSON.stringify('date'));
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickExpireToggle();
await shareDialog.setDefaultDay();
await shareDialog.dateTimePickerDialogIsClosed();
const value = await shareDialog.getExpirationDate();
await shareDialog.clickCloseButton();
await shareDialog.dialogIsClosed();
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.expirationDateInputHasValue(value);
await BrowserActions.closeMenuAndDialogs();
});
});
describe('Shared link preview', () => {
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await BrowserActions.getUrl('/');
await navigationBarPage.clickLogoutButton();
});
it('[C286565] Should open file when logged user access shared link', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
const sharedLink = await shareDialog.getShareLink();
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.getUrl(sharedLink);
await viewerPage.checkFileNameIsDisplayed(pngFileModel.name);
});
it('[C287803] Should the URL be kept the same when opening the share dialog multiple times', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
const sharedLink = await shareDialog.getShareLink();
await shareDialog.clickCloseButton();
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
const secondSharedLink = await shareDialog.getShareLink();
await BrowserActions.closeMenuAndDialogs();
await expect(sharedLink).toEqual(secondSharedLink);
await BrowserActions.getUrl(sharedLink);
await viewerPage.checkFileNameIsDisplayed(pngFileModel.name);
});
it('[C286539] Should open file when non-logged user access shared link', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.checkShareLinkIsDisplayed();
const sharedLink = await shareDialog.getShareLink();
await shareDialog.clickCloseButton();
await navigationBarPage.clickLogoutButton();
await BrowserActions.getUrl(sharedLink);
await viewerPage.checkFileNameIsDisplayed(pngFileModel.name);
});
it('[C260153] Should shared files listed in share files custom resources', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
await BrowserActions.closeMenuAndDialogs();
await waitForShareLink(nodeId);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectSharedLinksSourceType();
await customSourcesPage.checkRowIsDisplayed(pngFileModel.name);
});
});
});
@@ -1,397 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PermissionsPage } from '../../content-services/pages/permissions.page';
import {
createApiService,
BrowserActions, Logger,
LoginPage,
NotificationHistoryPage, SearchService,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage,
SnackbarPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { VersionManagePage } from '../../core/pages/version-manager.page';
import CONSTANTS = require('../../util/constants');
import { NodesApi, SitesApi } from '@alfresco/js-api';
describe('Permissions Component', () => {
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const searchService = new SearchService(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const permissionsPage = new PermissionsPage();
const viewerPage = new ViewerPage();
const navigationBarPage = new NavigationBarPage();
const metadataViewPage = new MetadataViewPage();
const notificationHistoryPage = new NotificationHistoryPage();
const snackbarPage = new SnackbarPage();
const uploadDialog = new UploadDialogPage();
const versionManagePage = new VersionManagePage();
const contentList = contentServicesPage.getDocumentList();
let publicSite;
let privateSite;
let folderName;
const fileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
const testFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_location
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const newVersionFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_location
});
let siteFolder;
let privateSiteFile;
const folderOwnerUser = new UserModel();
const consumerUser: UserModel = new UserModel();
const siteConsumerUser: UserModel = new UserModel();
const collaboratorUser: UserModel = new UserModel();
const contributorUser: UserModel = new UserModel();
const managerUser: UserModel = new UserModel();
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
try {
await apiService.loginWithProfile('admin');
await usersActions.createUser(folderOwnerUser);
await usersActions.createUser(siteConsumerUser);
await usersActions.createUser(consumerUser);
await usersActions.createUser(contributorUser);
await usersActions.createUser(collaboratorUser);
await usersActions.createUser(managerUser);
await apiService.login(folderOwnerUser.username, folderOwnerUser.password);
const publicSiteName = `PUBLIC_TEST_SITE_${StringUtil.generateRandomString(5)}`;
const privateSiteName = `PRIVATE_TEST_SITE_${StringUtil.generateRandomString(5)}`;
folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}`;
const publicSiteBody = { visibility: 'PUBLIC', title: publicSiteName };
const privateSiteBody = { visibility: 'PRIVATE', title: privateSiteName };
const sitesApi = new SitesApi(apiService.getInstance());
publicSite = await sitesApi.createSite(publicSiteBody);
privateSite = await sitesApi.createSite(privateSiteBody);
await sitesApi.createSiteMembership(publicSite.entry.id, {
id: siteConsumerUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
await sitesApi.createSiteMembership(publicSite.entry.id, {
id: collaboratorUser.username,
role: CONSTANTS.CS_USER_ROLES.COLLABORATOR
});
await sitesApi.createSiteMembership(publicSite.entry.id, {
id: contributorUser.username,
role: CONSTANTS.CS_USER_ROLES.CONTRIBUTOR
});
await sitesApi.createSiteMembership(publicSite.entry.id, {
id: managerUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
await sitesApi.createSiteMembership(privateSite.entry.id, {
id: managerUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
siteFolder = await uploadActions.createFolder(folderName, publicSite.entry.guid);
privateSiteFile = await uploadActions.uploadFile(fileModel.location, 'privateSite' + fileModel.name, privateSite.entry.guid);
await nodesApi.updateNode(privateSiteFile.entry.id,
{
permissions: {
locallySet: [{
authorityId: managerUser.username,
name: 'SiteConsumer',
accessStatus: 'ALLOWED'
}]
}
});
await uploadActions.uploadFile(fileModel.location, 'Site' + fileModel.name, siteFolder.entry.id);
// to sync user in acs
try {
await searchService.isUserSearchable(consumerUser);
} catch (e) {
Logger.error(`*****\n Failed to sync user \n*****`);
}
await browser.sleep(browser.params.testConfig.timeouts.index_search);
} catch (error) {
fail('Failed to setup site permission : ' + JSON.stringify(error, null, 2));
}
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(publicSite.entry.id, { permanent: true });
await sitesApi.deleteSite(privateSite.entry.id, { permanent: true });
});
describe('Role Site Dropdown', () => {
beforeAll(async () => {
await loginPage.login(folderOwnerUser.username, folderOwnerUser.password);
await BrowserActions.getUrl(browser.baseUrl + '/files/' + publicSite.entry.guid);
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C277002] Should display the Role Site dropdown', async () => {
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentList.rightClickOnRow(folderName);
await contentServicesPage.pressContextMenuActionNamed('Permission');
await permissionsPage.checkPermissionManagerDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();
await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed();
await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed();
await permissionsPage.addPermissionsDialog.searchUserOrGroup(consumerUser.username);
await permissionsPage.addPermissionsDialog.checkResultListIsDisplayed();
await permissionsPage.addPermissionsDialog.clickUserOrGroup(consumerUser.firstName);
await permissionsPage.addPermissionsDialog.selectRole(consumerUser.fullName, 'Site Collaborator');
await expect(await permissionsPage.addPermissionsDialog.getRoleCellValue(consumerUser.fullName)).toEqual('Site Collaborator');
await expect(await permissionsPage.addPermissionsDialog.addButtonIsEnabled()).toBe(true, 'Add button should be enabled');
await permissionsPage.addPermissionsDialog.clickAddButton();
await expect(await snackbarPage.getSnackBarMessage()).toEqual('Added 1 user(s) 0 group(s)');
await snackbarPage.waitForSnackBarToClose();
await permissionsPage.checkUserIsAdded(consumerUser.username);
await expect(await permissionsPage.getRoleCellValue(consumerUser.username)).toEqual(CONSTANTS.CS_USER_ROLES_I18N.COLLABORATOR);
await permissionsPage.clickRoleDropdownByUserOrGroupName(consumerUser.username);
const roleDropdownOptions = permissionsPage.addPermissionsDialog.getRoleDropdownOptions();
await expect(await roleDropdownOptions.count()).toBe(4);
await expect(await BrowserActions.getText(roleDropdownOptions.get(0))).toBe(CONSTANTS.CS_USER_ROLES_I18N.COLLABORATOR);
await expect(await BrowserActions.getText(roleDropdownOptions.get(1))).toBe(CONSTANTS.CS_USER_ROLES_I18N.CONSUMER);
await expect(await BrowserActions.getText(roleDropdownOptions.get(2))).toBe(CONSTANTS.CS_USER_ROLES_I18N.CONTRIBUTOR);
await expect(await BrowserActions.getText(roleDropdownOptions.get(3))).toBe(CONSTANTS.CS_USER_ROLES_I18N.MANAGER);
});
});
describe('Roles: SiteConsumer, SiteCollaborator, SiteContributor, SiteManager', () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C276994] Role SiteConsumer', async () => {
await loginPage.login(siteConsumerUser.username, siteConsumerUser.password);
await navigationBarPage.openContentServicesFolder(siteFolder.entry.id);
await contentServicesPage.checkContentIsDisplayed('Site' + fileModel.name);
await contentList.doubleClickRow('Site' + fileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.clickCloseButton();
await contentList.waitForTableBody();
await contentServicesPage.checkDeleteIsDisabled('Site' + fileModel.name);
await BrowserActions.closeMenuAndDialogs();
await contentList.checkActionMenuIsNotDisplayed();
await contentServicesPage.metadataContent('Site' + fileModel.name);
await notificationHistoryPage.checkNotifyContains('You don\'t have access to do this.');
await contentServicesPage.uploadFile(testFileModel.location);
await notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
});
it('[C276997] Role SiteContributor', async () => {
await loginPage.login(contributorUser.username, contributorUser.password);
await navigationBarPage.openContentServicesFolder(siteFolder.entry.id);
await contentServicesPage.checkContentIsDisplayed('Site' + fileModel.name);
await contentList.doubleClickRow('Site' + fileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.clickCloseButton();
await contentList.waitForTableBody();
await contentServicesPage.checkDeleteIsDisabled('Site' + fileModel.name);
await BrowserActions.closeMenuAndDialogs();
await contentList.checkActionMenuIsNotDisplayed();
await contentServicesPage.metadataContent('Site' + fileModel.name);
await notificationHistoryPage.checkNotifyContains('You don\'t have access to do this.');
await contentServicesPage.uploadFile(testFileModel.location);
await contentServicesPage.checkContentIsDisplayed(testFileModel.name);
await uploadDialog.fileIsUploaded(testFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C277005] Role SiteCollaborator', async () => {
await loginPage.login(collaboratorUser.username, collaboratorUser.password);
await navigationBarPage.openContentServicesFolder(siteFolder.entry.id);
await contentServicesPage.checkContentIsDisplayed('Site' + fileModel.name);
await contentList.doubleClickRow('Site' + fileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.clickCloseButton();
await contentList.waitForTableBody();
await contentServicesPage.checkDeleteIsDisabled('Site' + fileModel.name);
await BrowserActions.closeMenuAndDialogs();
await contentList.checkActionMenuIsNotDisplayed();
await contentServicesPage.metadataContent('Site' + fileModel.name);
await metadataViewPage.editIconIsDisplayed();
await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle');
await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(pngFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pngFileModel.name);
await uploadDialog.fileIsUploaded(pngFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C277006] Role SiteManager', async () => {
await loginPage.login(managerUser.username, managerUser.password);
await navigationBarPage.openContentServicesFolder(siteFolder.entry.id);
await contentServicesPage.checkContentIsDisplayed('Site' + fileModel.name);
await contentList.doubleClickRow('Site' + fileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.clickCloseButton();
await contentList.waitForTableBody();
await contentServicesPage.metadataContent('Site' + fileModel.name);
await metadataViewPage.editIconIsDisplayed();
await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:description');
await metadataViewPage.enterDescriptionText('newDescription');
await metadataViewPage.clickSaveMetadata();
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('newDescription');
await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(testFileModel.location);
await contentServicesPage.checkContentIsDisplayed(testFileModel.name);
await uploadDialog.fileIsUploaded(testFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed('Site' + fileModel.name);
await contentServicesPage.deleteContent('Site' + fileModel.name);
await contentServicesPage.checkContentIsNotDisplayed('Site' + fileModel.name);
});
});
describe('Roles: Private site and Manager User', () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C277196] should a user with Manager permissions be able to upload a new version for the created file', async () => {
await loginPage.login(managerUser.username, managerUser.password);
await navigationBarPage.openContentServicesFolder(privateSite.entry.guid);
await contentServicesPage.versionManagerContent('privateSite' + fileModel.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
await expect(await versionManagePage.getFileVersionName('1.1')).toEqual(newVersionFile.name);
});
});
});
@@ -1,199 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CONSTANTS = require('../../util/constants');
import { createApiService,
BrowserActions,
ErrorPage,
LoginPage,
NotificationHistoryPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { NodeEntry, NodesApi, SharedlinksApi, SitesApi } from '@alfresco/js-api';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { ShareDialogPage } from '../../core/pages/dialog/share-dialog.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
describe('Unshare file', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navBar = new NavigationBarPage();
const errorPage = new ErrorPage();
const notificationHistoryPage = new NotificationHistoryPage();
const navigationBarPage = new NavigationBarPage();
const shareDialog = new ShareDialogPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const sharedlinksApi = new SharedlinksApi(apiService.getInstance());
const siteName = `PRIVATE-TEST-SITE-${StringUtil.generateRandomString(5)}`;
let acsUser: UserModel;
let nodeBody; let shareFilesSite;
let pngUploadedFile: NodeEntry;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
const site = {
title: siteName,
visibility: 'PRIVATE',
id: siteName
};
nodeBody = {
name: StringUtil.generateRandomString(5),
nodeType: 'cm:content',
properties: {
'cm:title': StringUtil.generateRandomString(5)
}
};
const sitesApi = new SitesApi(apiService.getInstance());
shareFilesSite = await sitesApi.createSite(site);
const docLibId = (await sitesApi.listSiteContainers(siteName)).list.entries[0].entry.id;
const testFile1Id = (await nodesApi.createNode(docLibId, nodeBody)).entry.id;
await sitesApi.createSiteMembership(siteName, {
id: acsUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
await nodesApi.updateNode(testFile1Id, {
permissions: {
isInheritanceEnabled: false,
locallySet: [
{
authorityId: acsUser.username,
name: CONSTANTS.CS_USER_ROLES.CONSUMER
}
]
}
});
await sharedlinksApi.createSharedLink({ nodeId: testFile1Id });
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(shareFilesSite.entry.id, { permanent: true });
});
describe('with permission', () => {
afterEach(async () => {
await apiService.loginWithProfile('admin');
await navigationBarPage.clickLogoutButton();
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
});
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await navBar.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
it('[C286551] Should be able to cancel unshare action', async () => {
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
await shareDialog.clickConfirmationDialogCancelButton();
await shareDialog.shareToggleButtonIsChecked();
});
it('[C286550] Should display unshare confirmation dialog', async () => {
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await browser.sleep(2000);
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
});
it('[C286552] Should be able to confirm unshare action', async () => {
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
await shareDialog.clickConfirmationDialogRemoveButton();
await shareDialog.dialogIsClosed();
});
it('[C280556] Should redirect to 404 when trying to access an unshared file', async () => {
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await browser.sleep(2000);
const sharedLink = await shareDialog.getShareLink();
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
await shareDialog.clickConfirmationDialogRemoveButton();
await shareDialog.dialogIsClosed();
await BrowserActions.getUrl(sharedLink.replace(browser.params.testConfig.appConfig.ecmHost, `${browser.baseUrl}`));
await errorPage.checkErrorCode();
});
});
describe('without permission', () => {
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C286555] Should NOT be able to unshare file without permission', async () => {
await navBar.goToSite(shareFilesSite);
await contentServicesPage.openFolder('documentLibrary');
await contentServicesPage.getDocumentList().selectRow(nodeBody.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.shareToggleButtonIsChecked();
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
await shareDialog.clickConfirmationDialogRemoveButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.shareToggleButtonIsChecked();
await notificationHistoryPage.checkNotifyContains(`You don't have permission to unshare this file`);
});
});
});
@@ -1,147 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
LoginPage,
NotificationHistoryPage,
StringUtil,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FolderDialogPage } from '../../core/pages/dialog/folder-dialog.page';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { browser, Key } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Create folder directive', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const createFolderDialog = new FolderDialogPage();
const notificationHistoryPage = new NotificationHistoryPage();
const metadataViewPage = new MetadataViewPage();
let acsUser: UserModel;
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await browser.actions().sendKeys(Key.ESCAPE).perform();
});
afterEach(async () => {
await browser.actions().sendKeys(Key.ESCAPE).perform();
});
it('[C260154] Should not create the folder if cancel button is clicked', async () => {
const folderName = 'cancelFolder';
await contentServicesPage.clickOnCreateNewFolder();
await createFolderDialog.addFolderName(folderName);
await createFolderDialog.clickOnCancelButton();
await contentServicesPage.checkContentIsNotDisplayed(folderName);
});
it('[C260155] Should enable the Create button only when a folder name is present', async () => {
const folderName = 'NotEnableFolder';
await contentServicesPage.clickOnCreateNewFolder();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName(folderName);
await createFolderDialog.checkCreateUpdateBtnIsEnabled();
});
it('[C260156] Should not be possible create two folder with the same name', async () => {
const folderName = 'duplicate';
await contentServicesPage.createNewFolder(folderName);
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.createNewFolder(folderName);
await notificationHistoryPage.checkNotifyContains('There\'s already a folder with this name. Try a different name.');
});
it('[C260157] Should be possible create a folder under a folder with the same name', async () => {
const folderName = 'sameSubFolder';
await contentServicesPage.createNewFolder(folderName);
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.openFolder(folderName);
await contentServicesPage.createNewFolder(folderName);
await contentServicesPage.checkContentIsDisplayed(folderName);
});
it('[C260158] Should be possible add a folder description when create a new folder', async () => {
const folderName = StringUtil.generateRandomString();
const description = 'this is the description';
await contentServicesPage.clickOnCreateNewFolder();
await createFolderDialog.addFolderName(folderName);
await createFolderDialog.addFolderDescription(description);
await createFolderDialog.clickOnCreateUpdateButton();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.metadataContent(folderName);
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('this is the description');
});
it('[C260159] Should not be possible create a folder with banned character', async () => {
await contentServicesPage.clickOnCreateNewFolder();
await createFolderDialog.addFolderName('*');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('<');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('>');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('\\');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('/');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('?');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName(':');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('|');
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
});
});
@@ -1,266 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService, BrowserActions, LoginPage, StringUtil, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { CreateLibraryDialogPage } from '../../core/pages/dialog/create-library-dialog.page';
import { CustomSourcesPage } from '../../core/pages/custom-sources.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SitesApi } from '@alfresco/js-api';
describe('Create library directive', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const createLibraryDialog = new CreateLibraryDialogPage();
const customSourcesPage = new CustomSourcesPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const visibility = {
public: 'Public',
private: 'Private',
moderated: 'Moderated'
};
let createSite;
let acsUser: UserModel;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
const sitesApi = new SitesApi(apiService.getInstance());
createSite = await sitesApi.createSite({
title: StringUtil.generateRandomString(20).toLowerCase(),
visibility: 'PUBLIC'
});
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(createSite.entry.id, { permanent: true });
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.openCreateLibraryDialog();
});
afterEach(async () => {
await BrowserActions.closeMenuAndDialogs();
});
it('[C290158] Should display the Create Library defaults', async () => {
await expect(await createLibraryDialog.libraryTitle.getText()).toMatch('Create Library');
await expect(await createLibraryDialog.libraryNameField.isDisplayed()).toBe(true, 'Name input field is not displayed');
await expect(await createLibraryDialog.libraryIdField.isDisplayed()).toBe(true, 'Library ID field is not displayed');
await expect(await createLibraryDialog.libraryDescriptionField.isDisplayed()).toBe(true, 'Library description is not displayed');
await expect(await createLibraryDialog.publicRadioButton.isDisplayed()).toBe(true, 'Public radio button is not displayed');
await expect(await createLibraryDialog.privateRadioButton.isDisplayed()).toBe(true, 'Private radio button is not displayed');
await expect(await createLibraryDialog.moderatedRadioButton.isDisplayed()).toBe(true, 'Moderated radio button is not displayed');
await expect(await createLibraryDialog.createButton.isEnabled()).toBe(false, 'Create button is not disabled');
await expect(await createLibraryDialog.cancelButton.isEnabled()).toBe(true, 'Cancel button is disabled');
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The default visibility is not public');
});
it('[C290159] Should close the dialog when clicking Cancel button', async () => {
const libraryName = 'cancelLibrary';
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.cancelButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
});
it('[C290160] Should create a public library', async () => {
const libraryName = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.publicRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The visibility is not public');
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
await customSourcesPage.checkRowIsDisplayed(libraryName);
await expect(await customSourcesPage.getStatusCell(libraryName)).toMatch('PUBLIC', 'Wrong library status.');
});
it('[C290173] Should create a private library', async () => {
const libraryName = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.privateRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.private, 'The visibility is not private');
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
await customSourcesPage.checkRowIsDisplayed(libraryName);
await expect(await customSourcesPage.getStatusCell(libraryName)).toMatch('PRIVATE', 'Wrong library status.');
});
it('[C290174, C290175] Should create a moderated library with a given Library ID', async () => {
const libraryName = StringUtil.generateRandomString();
const libraryId = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.moderatedRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.moderated, 'The visibility is not moderated');
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
await customSourcesPage.checkRowIsDisplayed(libraryName);
await expect(await customSourcesPage.getStatusCell(libraryName)).toMatch('MODERATED', 'Wrong library status.');
});
it('[C290163] Should disable Create button when a mandatory field is not filled in', async () => {
const inputValue = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(inputValue);
await createLibraryDialog.libraryIdField.clearInput();
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.libraryNameField.clearInput();
await createLibraryDialog.libraryIdField.typeText(inputValue);
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.libraryIdField.clearInput();
await createLibraryDialog.libraryDescriptionField.typeText(inputValue);
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
});
it('[C290164] Should auto-fill in the Library Id built from library name', async () => {
const name: string[] = ['abcd1234', 'ab cd 12 34', 'ab cd&12+34_@link/*'];
const libraryId: string[] = ['abcd1234', 'ab-cd-12-34', 'ab-cd1234link'];
for (let i = 0; i < 3; i++) {
await createLibraryDialog.libraryNameField.typeText(name[i]);
await createLibraryDialog.libraryIdField.waitHasValue(libraryId[i]);
await createLibraryDialog.libraryNameField.clearInput();
}
});
it('[C290176] Should not accept special characters for Library Id', async () => {
const name = 'My Library';
const libraryId: string[] = ['My New Library', 'My+New+Library123!', '<>'];
await createLibraryDialog.libraryNameField.typeText(name);
for (let i = 0; i < 3; i++) {
await createLibraryDialog.libraryIdField.typeText(libraryId[i]);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('Use numbers and letters only');
}
});
it('[C291985] Should not accept less than 2 characters for Library name', async () => {
const name = 'x';
const libraryId = 'my-library-id';
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('Title must be at least 2 characters long');
});
it('[C291793] Should display error for Name field filled in with spaces only', async () => {
const name = ' ';
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('Library name can\'t contain only spaces');
});
it('[C290177] Should not accept a duplicate Library Id', async () => {
const name = 'My Library';
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await contentServicesPage.openCreateLibraryDialog();
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('This Library ID isn\'t available. Try a different Library ID.');
});
it('[C290178] Should accept the same library name but different Library Ids', async () => {
const name = createSite.entry.title;
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.libraryNameField.typeText(name.toUpperCase());
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.libraryNameHint.waitVisible();
await expect(await createLibraryDialog.libraryNameHint.getText()).toMatch('Library name already in use', 'The library name hint is wrong');
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
});
it('[C290179] Should not accept more than the expected characters for input fields', async () => {
const name = StringUtil.generateRandomString(257);
const libraryId = StringUtil.generateRandomString(73);
const libraryDescription = StringUtil.generateRandomString(513);
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.publicRadioButton.click();
await expect(await createLibraryDialog.getErrorMessages(0)).toMatch('Use 256 characters or less for title');
await expect(await createLibraryDialog.getErrorMessages(1)).toMatch('Use 72 characters or less for the URL name');
await expect(await createLibraryDialog.getErrorMessages(2)).toMatch('Use 512 characters or less for description');
});
});
@@ -1,271 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { createApiService,
BrowserActions,
LoginPage,
PaginationPage,
PermissionActions,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { FolderModel } from '../../models/ACS/folder.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SitesApi } from '@alfresco/js-api';
describe('Delete Directive', () => {
let baseFolderUploaded;
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const paginationPage = new PaginationPage();
const navigationBarPage = new NavigationBarPage();
const contentListPage = contentServicesPage.getDocumentList();
const acsUser = new UserModel();
const secondAcsUser = new UserModel();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const permissionActions = new PermissionActions(apiService);
const usersActions = new UsersActions(apiService);
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const file0BytesModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const secondPdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_path
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const secondPngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_path
});
const folderInfo = new FolderModel({
name: 'myFolder',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_path
});
const folderSecond = new FolderModel({
name: 'myrSecondFolder',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_location
});
const baseFolder = new FolderModel({
name: 'BASE_FOLDER',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await usersActions.createUser(secondAcsUser);
});
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
baseFolderUploaded = await uploadActions.createFolder(
baseFolder.name,
'-my-'
);
});
afterEach(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(baseFolderUploaded.entry.id);
});
describe('Handling multiselection', () => {
beforeEach(async () => {
await uploadActions.uploadFile(txtFileModel.location, txtFileModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(file0BytesModel.location, file0BytesModel.name, baseFolderUploaded.entry.id);
const textFolderUploaded = await uploadActions.createFolder(folderInfo.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFolder(folderInfo.location, textFolderUploaded.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, textFolderUploaded.entry.id);
await uploadActions.createFolder(folderSecond.name, baseFolderUploaded.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
await BrowserActions.getUrl(`${browser.baseUrl}/files/${baseFolderUploaded.entry.id}`);
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260188] Delete multiple content', async () => {
await contentListPage.selectRowsWithKeyboard(txtFileModel.name, file0BytesModel.name, folderSecond.name, folderInfo.name);
await contentServicesPage.clickDeleteOnToolbar();
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', folderInfo.name);
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', txtFileModel.name);
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', file0BytesModel.name);
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', folderSecond.name);
});
it('[C260192] Delete file and folder with hierarchy', async () => {
await contentListPage.selectRowsWithKeyboard(txtFileModel.name, folderInfo.name);
await contentServicesPage.clickDeleteOnToolbar();
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', txtFileModel.name);
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', folderInfo.name);
});
it('[C260193] Delete file when different selections are set', async () => {
await contentServicesPage.chooseSelectionMode('None');
await contentListPage.selectRow(txtFileModel.name);
await contentListPage.dataTable.checkRowIsNotSelected('Display name', txtFileModel.name);
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentServicesPage.chooseSelectionMode('Single');
await contentListPage.selectRow(txtFileModel.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', txtFileModel.name);
await contentListPage.selectRowsWithKeyboard(folderInfo.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', folderInfo.name);
await contentListPage.dataTable.checkRowIsNotSelected('Display name', txtFileModel.name);
await contentServicesPage.clickDeleteOnToolbar();
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', folderInfo.name);
await contentListPage.dataTable.checkContentIsDisplayed('Display name', txtFileModel.name);
await contentServicesPage.chooseSelectionMode('Multiple');
await contentListPage.selectRowsWithKeyboard(txtFileModel.name, file0BytesModel.name);
await contentServicesPage.clickDeleteOnToolbar();
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', txtFileModel.name);
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', file0BytesModel.name);
});
});
describe('When selection on multiple pages', () => {
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.uploadFile( txtFileModel.location, txtFileModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(file0BytesModel.location, file0BytesModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(secondPdfFileModel.location, secondPdfFileModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, baseFolderUploaded.entry.id);
await uploadActions.uploadFile(secondPngFileModel.location, secondPngFileModel.name, baseFolderUploaded.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
await BrowserActions.getUrl(`${browser.baseUrl}/files/${baseFolderUploaded.entry.id}`);
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260191] Delete content selected from different pages', async () => {
await contentServicesPage.sortByName('ASC');
await paginationPage.selectItemsPerPage('5');
await contentListPage.selectRowWithKeyboard(txtFileModel.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', txtFileModel.name);
await paginationPage.clickOnNextPage();
await contentListPage.selectRowWithKeyboard(file0BytesModel.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', file0BytesModel.name);
await contentServicesPage.clickDeleteOnToolbar();
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', file0BytesModel.name);
await contentListPage.dataTable.checkContentIsDisplayed('Display name', txtFileModel.name);
});
});
describe('when user does not have `delete` permission', () => {
let createdSite = null;
let fileTxt; let filePdf; let folderA; let folderB;
beforeAll(async () => {
await apiService.login(acsUser.username, acsUser.password);
const sitesApi = new SitesApi(apiService.getInstance());
createdSite = await sitesApi.createSite({
title: StringUtil.generateRandomString(20).toLowerCase(),
visibility: 'PRIVATE'
});
await sitesApi.createSiteMembership(createdSite.entry.id, {
id: secondAcsUser.username,
role: 'SiteCollaborator'
});
fileTxt = await uploadActions.uploadFile(txtFileModel.location, txtFileModel.name, createdSite.entry.guid);
filePdf = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, createdSite.entry.guid);
folderA = await uploadActions.createFolder(StringUtil.generateRandomString(5), createdSite.entry.guid);
folderB = await uploadActions.createFolder(StringUtil.generateRandomString(5), createdSite.entry.guid);
await permissionActions.addRoleForUser(secondAcsUser.username, 'SiteManager', folderA);
await permissionActions.addRoleForUser(secondAcsUser.username, 'SiteManager', fileTxt);
await permissionActions.addRoleForUser(secondAcsUser.username, 'SiteConsumer', folderB);
await permissionActions.addRoleForUser(secondAcsUser.username, 'SiteConsumer', filePdf);
await permissionActions.disableInheritedPermissionsForNode(folderA.entry.id);
await permissionActions.disableInheritedPermissionsForNode(folderB.entry.id);
await permissionActions.disableInheritedPermissionsForNode(fileTxt.entry.id);
await permissionActions.disableInheritedPermissionsForNode(filePdf.entry.id);
await loginPage.login(secondAcsUser.username, secondAcsUser.password);
await BrowserActions.getUrl(`${browser.baseUrl}/files/${createdSite.entry.guid}`);
await contentServicesPage.waitForTableBody();
});
afterAll(async () => {
try {
await apiService.login(acsUser.username, acsUser.password);
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(createdSite.entry.id, { permanent: true });
} catch (error) {}
await navigationBarPage.clickLogoutButton();
});
it('[C216426] Delete file without delete permissions', async () => {
await contentListPage.selectRowWithKeyboard(filePdf.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', filePdf.entry.name);
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentListPage.selectRowWithKeyboard(folderB.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', folderB.entry.name);
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentListPage.selectRowWithKeyboard(fileTxt.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', fileTxt.entry.name);
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
});
});
});
@@ -1,138 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { createApiService,
BrowserVisibility,
FileBrowserUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FolderModel } from '../../models/ACS/folder.model';
describe('Version component actions', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const contentListPage = contentServicesPage.getDocumentList();
let acsUser: UserModel;
const txtFileComma = new FileModel({
name: 'comma,name',
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const file0BytesModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
const folderInfo = new FolderModel({
name: 'myFolder',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_path
});
const folderSecond = new FolderModel({
name: 'myrSecondFolder',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_location
});
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.uploadFile( txtFileModel.location, txtFileModel.name, '-my-');
await uploadActions.uploadFile(file0BytesModel.location, file0BytesModel.name, '-my-');
await uploadActions.uploadFile(txtFileComma.location, txtFileComma.name, '-my-');
const textFolderUploaded = await uploadActions.createFolder(folderInfo.name, '-my-');
await uploadActions.uploadFolder(folderInfo.location, textFolderUploaded.entry.id);
await uploadActions.createFolder(folderSecond.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
afterEach(async () => {
await BrowserVisibility.waitUntilDialogIsClose();
});
it('[C260083] Download files - Different size values', async () => {
await contentListPage.selectRow(txtFileModel.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(txtFileModel.name);
await BrowserVisibility.waitUntilDialogIsClose();
await contentListPage.selectRow(file0BytesModel.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(file0BytesModel.name);
});
it('[C260084] Download folder', async () => {
await contentListPage.selectRow(folderInfo.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(folderInfo.name + '.zip');
});
it('[C261032] File and Folder', async () => {
await contentServicesPage.clickMultiSelectToggle();
await contentServicesPage.checkAcsContainer();
await contentListPage.dataTablePage().checkAllRows();
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded('archive.zip');
});
it('[C261033] Folder and Folder', async () => {
await contentListPage.selectRow(folderInfo.name);
await contentListPage.selectRow(folderSecond.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded('archive.zip');
await BrowserVisibility.waitUntilDialogIsClose();
});
it('[C277757] Download file - Comma in file name', async () => {
await contentListPage.selectRow(txtFileComma.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(txtFileComma.name);
});
});
@@ -1,252 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
BrowserActions,
LoginPage,
NotificationHistoryPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FolderDialogPage } from '../../core/pages/dialog/folder-dialog.page';
import { browser, protractor } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import { NodesApi } from '@alfresco/js-api';
describe('Edit folder directive', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const editFolderDialog = new FolderDialogPage();
const acsUser = new UserModel();
const anotherAcsUser = new UserModel();
const navigationBarPage = new NavigationBarPage();
const notificationHistoryPage = new NotificationHistoryPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const uploadActions = new UploadActions(apiService);
const updateFolderName = StringUtil.generateRandomString(5);
let editFolder; let anotherFolder; let filePdfNode; let subFolder;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await usersActions.createUser(anotherAcsUser);
await apiService.login(acsUser.username, acsUser.password);
editFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
anotherFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
subFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), editFolder.entry.id);
filePdfNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
await nodesApi.updateNode(editFolder.entry.id,
{
permissions: {
locallySet: [{
authorityId: anotherAcsUser.username,
name: 'Consumer',
accessStatus: 'ALLOWED'
}]
}
});
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(editFolder.entry.id);
await uploadActions.deleteFileOrFolder(anotherFolder.entry.id);
await uploadActions.deleteFileOrFolder(filePdfNode.entry.id);
});
beforeEach(async () => {
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
});
afterEach(async () => {
await BrowserActions.closeMenuAndDialogs();
});
it('[C260161] Update folder - Cancel button', async () => {
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await contentServicesPage.clickOnEditFolder();
await editFolderDialog.checkFolderDialogIsDisplayed();
await expect(await editFolderDialog.getDialogTitle()).toBe('Edit folder');
await expect(await editFolderDialog.getFolderName()).toBe(editFolder.entry.name);
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.checkCancelBtnIsEnabled();
await editFolderDialog.clickOnCancelButton();
await editFolderDialog.checkFolderDialogIsNotDisplayed();
});
it('[C260162] Update folder - Introducing letters', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(true);
await contentServicesPage.clickOnEditFolder();
await editFolderDialog.checkFolderDialogIsDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.addFolderName(editFolder.entry.name + 'a');
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.clickOnCancelButton();
await editFolderDialog.checkFolderDialogIsNotDisplayed();
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', editFolder.entry.name);
});
it('[C260163] Update folder name with an existing one', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(true);
await contentServicesPage.clickOnEditFolder();
await editFolderDialog.checkFolderDialogIsDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.addFolderName(anotherFolder.entry.name);
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.clickOnCreateUpdateButton();
await editFolderDialog.checkFolderDialogIsDisplayed();
await browser.sleep(3000); // The error needs time to come back
await notificationHistoryPage.checkNotifyContains('There\'s already a folder with this name. Try a different name.');
});
it('[C260164] Edit Folder - Unsupported characters', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await contentServicesPage.clickOnEditFolder();
await editFolderDialog.checkFolderDialogIsDisplayed();
await editFolderDialog.addFolderName('a*"<>\\/?:|');
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t contain these characters * " < > \\ / ? : |');
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await editFolderDialog.addFolderName('a.a');
await editFolderDialog.checkValidationMessageIsNotDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.addFolderName('a.');
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t end with a period .');
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await BrowserActions.clearSendKeys(editFolderDialog.getFolderNameField(), protractor.Key.SPACE);
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t contain only spaces');
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await editFolderDialog.addFolderName(editFolder.entry.name);
await editFolderDialog.addFolderDescription('a*"<>\\/?:|');
await editFolderDialog.checkValidationMessageIsNotDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.addFolderDescription('a.');
await editFolderDialog.checkValidationMessageIsNotDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.addFolderDescription('a.a');
await editFolderDialog.checkValidationMessageIsNotDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.getFolderDescriptionField().sendKeys(protractor.Key.SPACE);
await editFolderDialog.checkValidationMessageIsNotDisplayed();
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.clickOnCancelButton();
await editFolderDialog.checkFolderDialogIsNotDisplayed();
});
it('[C260166] Enable/Disable edit folder icon - when file selected', async () => {
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(0);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(false);
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', filePdfNode.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', filePdfNode.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', filePdfNode.entry.name);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(false);
});
it('[C260166] Enable/Disable edit folder icon - when multiple folders selected', async () => {
await contentServicesPage.clickMultiSelectToggle();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().checkAllRowsButtonIsDisplayed();
await contentServicesPage.getDocumentList().dataTablePage().checkAllRows();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsChecked('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsChecked('Display name', anotherFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', filePdfNode.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotChecked('Display name', filePdfNode.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(2);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(false);
});
it('[C260166] Enable/Disable edit folder icon - when single folder selected', async () => {
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(0);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(1);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(true);
});
it('[C260165] Update folder name with non-existing one', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', editFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', editFolder.entry.name);
await contentServicesPage.clickOnEditFolder();
await editFolderDialog.checkFolderDialogIsDisplayed();
await editFolderDialog.addFolderName(updateFolderName);
await editFolderDialog.checkCreateUpdateBtnIsEnabled();
await editFolderDialog.clickOnCreateUpdateButton();
await editFolderDialog.checkFolderDialogIsNotDisplayed();
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', updateFolderName);
});
describe('Edit Folder - no permission', () => {
beforeEach(async () => {
await navigationBarPage.clickLogoutButton();
await loginPage.login(anotherAcsUser.username, anotherAcsUser.password);
await BrowserActions.getUrl(browser.baseUrl + '/files/' + editFolder.entry.id);
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
});
it('[C260167] Edit folder without permission', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', subFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', subFolder.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', subFolder.entry.name);
await expect(await contentServicesPage.isEditFolderButtonEnabled()).toBe(false);
});
});
});
@@ -1,227 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
ContentNodeSelectorDialogPage,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { CustomSourcesPage } from '../../core/pages/custom-sources.page';
import { TrashcanPage } from '../../core/pages/trashcan.page';
describe('Favorite directive', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
let acsUser: UserModel;
const customSourcesPage = new CustomSourcesPage();
const trashcanPage = new TrashcanPage();
const contentListPage = contentServicesPage.getDocumentList();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const uploadActions = new UploadActions(apiService);
let testFolder1; let testFolder2; let testFolder3; let testFolder4; let testFile;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
testFolder1 = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
testFolder2 = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
testFolder3 = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
testFolder4 = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
testFile = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(testFolder1.entry.id);
await uploadActions.deleteFileOrFolder(testFolder2.entry.id);
await uploadActions.deleteFileOrFolder(testFolder3.entry.id);
await uploadActions.deleteFileOrFolder(testFolder4.entry.id);
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
});
it('[C260247] Should be able to mark a file as favorite', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsDisplayed(testFile.entry.name);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsNotMarkedFavorite();
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsNotDisplayed(testFile.entry.name);
});
it('[C260249] Should be able to mark a folder as favorite', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder1.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsDisplayed(testFolder1.entry.name);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder1.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsNotMarkedFavorite();
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsNotDisplayed(testFolder1.entry.name);
});
it('[C260251] Should retain the restored file as favorite', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await contentListPage.rightClickOnRow(testFile.entry.name);
await contentServicesPage.pressContextMenuActionNamed('Delete');
await contentServicesPage.checkContentIsNotDisplayed(testFile.entry.name);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsNotDisplayed(testFile.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await expect(await trashcanPage.numberOfResultsDisplayed()).toBe(1);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContent(testFile.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(testFile.entry.name);
await trashcanPage.clickRestore();
await trashcanPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await trashcanPage.checkTrashcanIsEmpty();
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.checkIsMarkedFavorite();
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectFavoritesSourceType();
await customSourcesPage.checkRowIsDisplayed(testFile.entry.name);
});
it('[C260252] Should retain the moved file as favorite', async () => {
await contentServicesPage.getDocumentList().dataTablePage().checkContentIsDisplayed('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await contentServicesPage.getDocumentList().rightClickOnRow(testFile.entry.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(testFolder1.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(testFolder1.entry.name);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsNotDisplayed(testFile.entry.name);
await contentServicesPage.openFolder(testFolder1.entry.name);
await contentServicesPage.checkContentIsDisplayed(testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().selectRow('Display name', testFile.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFile.entry.name);
await contentServicesPage.checkIsMarkedFavorite();
});
it('[C217216] Should be able to mark and unmark multiple folders as favorite', async () => {
await contentServicesPage.clickMultiSelectToggle();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder2.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder3.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder2.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder3.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(3);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder3.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected('Display name', testFolder3.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(2);
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder4.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(3);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder1.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder2.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder4.entry.name);
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsMarkedFavorite();
await contentServicesPage.clickOnFavoriteButton();
await contentServicesPage.checkIsNotMarkedFavorite();
await contentServicesPage.getDocumentList().dataTablePage().checkAllRows();
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBeGreaterThanOrEqual(4);
await contentServicesPage.getDocumentList().dataTablePage().uncheckAllRows();
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(0);
await contentServicesPage.getDocumentList().dataTablePage().clickCheckbox('Display name', testFolder3.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected('Display name', testFolder3.entry.name);
await expect(await contentServicesPage.getDocumentList().dataTablePage().getNumberOfSelectedRows()).toBe(1);
await contentServicesPage.checkIsMarkedFavorite();
});
});
@@ -1,286 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { NodeEntry } from '@alfresco/js-api';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TrashcanPage } from '../../core/pages/trashcan.page';
import { createApiService,
BreadcrumbPage,
LoginPage,
NotificationHistoryPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
WaitActions
} from '@alfresco/adf-testing';
describe('Restore content directive', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const acsUser = new UserModel();
const anotherAcsUser = new UserModel();
const trashcanPage = new TrashcanPage();
const breadCrumbPage = new BreadcrumbPage();
const notificationHistoryPage = new NotificationHistoryPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const waitActions = new WaitActions(apiService);
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
let testFolder: NodeEntry;
const uploadActions = new UploadActions(apiService);
let folderWithContent; let folderWithFolder; let subFolder; let subFile; let testFile;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await usersActions.createUser(anotherAcsUser);
await apiService.login(acsUser.username, acsUser.password);
testFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
folderWithContent = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
subFile = await uploadActions.uploadFile(testFileModel.location, testFileModel.name, folderWithContent.entry.id);
testFile = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, '-my-');
folderWithFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
subFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), folderWithFolder.entry.id);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(folderWithContent.entry.id);
await uploadActions.deleteFileOrFolder(folderWithFolder.entry.id);
});
describe('Restore same name folders', () => {
beforeAll(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await contentServicesPage.deleteContent(testFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFolder.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(testFolder.entry.name);
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260227] Should validate when restoring Folders with same name', async () => {
await uploadActions.createFolder(testFolder.entry.name, '-my-');
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await contentServicesPage.deleteContent(testFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFolder.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkAllRows();
await trashcanPage.clickRestore();
await waitActions.nodeIsPresent(testFolder.entry.id);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await notificationHistoryPage.checkNotifyContains('Can\'t restore, ' + testFolder.entry.name + ' item already exists');
});
});
describe('Validate', () => {
beforeAll(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
it('[C260238] Should restore a file', async () => {
await contentServicesPage.checkContentIsDisplayed(testFile.entry.name);
await contentServicesPage.deleteContent(testFile.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFile.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContent(testFile.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(testFile.entry.name);
await trashcanPage.clickRestore();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsNotDisplayed(testFile.entry.name);
await notificationHistoryPage.checkNotifyContains(testFile.entry.name + ' item restored');
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(testFile.entry.name);
await contentServicesPage.deleteContent(testFile.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFile.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(testFile.entry.name);
});
it('[C260239] Should restore folder with content', async () => {
await contentServicesPage.checkContentIsDisplayed(folderWithContent.entry.name);
await contentServicesPage.deleteContent(folderWithContent.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(folderWithContent.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContent(folderWithContent.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(folderWithContent.entry.name);
await trashcanPage.clickRestore();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsNotDisplayed(folderWithContent.entry.name);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(folderWithContent.entry.name);
await contentServicesPage.getDocumentList().dataTablePage().doubleClickRow('Display name', folderWithContent.entry.name);
await contentServicesPage.checkContentIsDisplayed(subFile.entry.name);
await notificationHistoryPage.checkNotifyContains(folderWithContent.entry.name + ' item restored');
});
it('[C260240] Should validate restore when the original location no longer exists', async () => {
await contentServicesPage.checkContentIsDisplayed(folderWithFolder.entry.name);
await contentServicesPage.openFolder(folderWithFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(subFolder.entry.name);
await contentServicesPage.deleteContent(subFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(subFolder.entry.name);
await breadCrumbPage.chooseBreadCrumb(acsUser.username);
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(folderWithFolder.entry.name);
await contentServicesPage.deleteContent(folderWithFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(folderWithFolder.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(subFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(folderWithFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContent(subFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(subFolder.entry.name);
await trashcanPage.clickRestore();
await notificationHistoryPage.checkNotifyContains(`Can't restore ${subFolder.entry.name} item, the original location no longer exists`);
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(subFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(folderWithFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(subFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(subFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(folderWithFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(folderWithFolder.entry.name);
await trashcanPage.clickRestore();
await notificationHistoryPage.checkNotifyContains('Restore successful');
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(folderWithFolder.entry.name);
await contentServicesPage.openFolder(folderWithFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(subFolder.entry.name);
});
});
describe('Restore with folder hierarchies', () => {
let parentFolder; let folderWithin; let pdfFile; let pngFile; let mainFile; let mainFolder;
beforeAll(async () => {
await apiService.login(anotherAcsUser.username, anotherAcsUser.password);
await uploadActions.createFolder(testFolder.entry.name, '-my-');
parentFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
folderWithin = await uploadActions.createFolder(StringUtil.generateRandomString(5), parentFolder.entry.id);
pdfFile = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, folderWithin.entry.id);
pngFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folderWithin.entry.id);
mainFile = await uploadActions.uploadFile(testFileModel.location, testFileModel.name, '-my-');
mainFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
await loginPage.login(anotherAcsUser.username, anotherAcsUser.password);
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(parentFolder.entry.id);
await uploadActions.deleteFileOrFolder(mainFolder.entry.id);
await uploadActions.deleteFileOrFolder(mainFile.entry.id);
});
it('[C216431] Should restore hierarchy of folders', async () => {
await contentServicesPage.deleteContent(parentFolder.entry.name);
await contentServicesPage.deleteContent(mainFolder.entry.name);
await contentServicesPage.deleteContent(mainFile.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.checkRestoreButtonIsNotDisplayed();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(parentFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(parentFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(mainFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(mainFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(mainFile.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(mainFile.entry.name);
await trashcanPage.clickRestore();
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(parentFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(mainFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(mainFile.entry.name);
await contentServicesPage.openFolder(parentFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(folderWithin.entry.name);
await contentServicesPage.openFolder(folderWithin.entry.name);
await contentServicesPage.checkContentIsDisplayed(pdfFile.entry.name);
await contentServicesPage.checkContentIsDisplayed(pngFile.entry.name);
});
});
});
@@ -1,249 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import { createApiService,
ContentNodeSelectorDialogPage,
LoginPage,
StringUtil,
UploadActions,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import { FolderModel } from '../../models/ACS/folder.model';
describe('Document List Component - Actions', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const viewerPage = new ViewerPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
describe('Document List Component - Check Actions', () => {
let uploadedFolder; let secondUploadedFolder;
let acsUser = null;
let pdfUploadedNode;
let folderName;
let fileNames = [];
const nrOfFiles = 5;
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const files = {
base: 'newFile',
extension: '.txt'
};
beforeAll(async () => {
folderName = `TATSUMAKY_${StringUtil.generateRandomString(5)}_SENPOUKYAKU`;
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
pdfUploadedNode = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, '-my-');
await uploadActions.uploadFile(testFileModel.location, testFileModel.name, '-my-');
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
secondUploadedFolder = await uploadActions.createFolder('secondFolder', '-my-');
fileNames = StringUtil.generateFilesNames(1, nrOfFiles, files.base, files.extension);
await uploadActions.createEmptyFiles(fileNames, uploadedFolder.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
describe('File Actions', () => {
it('[C213257] Should be able to copy a file', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfUploadedNode.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.clickContentNodeSelectorResult(folderName);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
});
it('[C260131] Copy - Destination picker search', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.contentListPage().dataTablePage().checkCellByHighlightContent(folderName);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
});
it('[C297491] Should be able to move a file', async () => {
await contentServicesPage.checkContentIsDisplayed(testFileModel.name);
await contentServicesPage.getDocumentList().rightClickOnRow(testFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.clickContentNodeSelectorResult(folderName);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsNotDisplayed(testFileModel.name);
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(testFileModel.name);
});
it('[C260127] Move - Destination picker search', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.contentListPage().dataTablePage().checkCellByHighlightContent(folderName);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
});
it('[C280561] Should be able to delete a file via dropdown menu', async () => {
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(fileNames[0]);
await contentServicesPage.deleteContent(fileNames[0]);
await contentServicesPage.checkContentIsNotDisplayed(fileNames[0]);
});
it('[C280562] Only one file is deleted when multiple files are selected using dropdown menu', async () => {
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.getDocumentList().selectRow(fileNames[1]);
await contentServicesPage.getDocumentList().selectRow(fileNames[2]);
await contentServicesPage.deleteContent(fileNames[1]);
await contentServicesPage.checkContentIsNotDisplayed(fileNames[1]);
await contentServicesPage.checkContentIsDisplayed(fileNames[2]);
});
it('[C280565] Should be able to delete a file using context menu', async () => {
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(fileNames[2]);
await contentServicesPage.getDocumentList().rightClickOnRow(fileNames[2]);
await contentServicesPage.pressContextMenuActionNamed('Delete');
await contentServicesPage.checkContentIsNotDisplayed(fileNames[2]);
});
it('[C280567] Only one file is deleted when multiple files are selected using context menu', async () => {
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.getDocumentList().selectRow(fileNames[3]);
await contentServicesPage.getDocumentList().selectRow(fileNames[4]);
await contentServicesPage.getDocumentList().rightClickOnRow(fileNames[3]);
await contentServicesPage.pressContextMenuActionNamed('Delete');
await contentServicesPage.checkContentIsNotDisplayed(fileNames[3]);
await contentServicesPage.checkContentIsDisplayed(fileNames[4]);
});
it('[C280566] Should be able to open context menu with right click', async () => {
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.checkContextActionIsVisible('Download');
await contentServicesPage.checkContextActionIsVisible('Copy');
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.checkContextActionIsVisible('Delete');
await contentServicesPage.checkContextActionIsVisible('Info');
await contentServicesPage.checkContextActionIsVisible('Manage versions');
await contentServicesPage.checkContextActionIsVisible('Permission');
await contentServicesPage.checkContextActionIsVisible('Lock');
await contentServicesPage.closeActionContext();
});
it('[C260060] Should be able to open a file/folder through double click action - file', async () => {
await contentServicesPage.doubleClickRow(pdfFileModel.name);
await expect(await viewerPage.getDisplayedFileName()).toEqual(pdfFileModel.name);
await viewerPage.checkPreviewFileDefaultOptionsAreDisplayed();
await viewerPage.clickCloseButton();
});
});
describe('Folder Actions', () => {
it('[C260138] Should be able to copy a folder', async () => {
await contentServicesPage.copyContent(folderName);
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(secondUploadedFolder.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(secondUploadedFolder.entry.name);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.openFolder(secondUploadedFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(folderName);
});
it('[C260060] Should be able to open a file/folder through double click action - folder', async () => {
const folderTwoModel = new FolderModel({ name: 'folderTwo' });
const numberOfSubFolders = 3;
await contentServicesPage.createNewFolder(folderTwoModel.name);
const nodeIdSubFolderTwo = await contentServicesPage.getAttributeValueForElement(folderTwoModel.name, 'Node id');
await contentServicesPage.openFolder(folderTwoModel.name);
for (let i = 0; i < numberOfSubFolders; i++) {
await uploadActions.createFolder('subfolder' + (i + 1), nodeIdSubFolderTwo);
}
await browser.refresh();
await contentServicesPage.checkContentsAreDisplayed(numberOfSubFolders);
});
it('[C260123] Should be able to delete a folder using context menu', async () => {
await contentServicesPage.deleteContent(folderName);
await contentServicesPage.checkContentIsNotDisplayed(folderName);
});
it('[C280568] Should be able to open context menu with right click', async () => {
await contentServicesPage.checkContentIsDisplayed(secondUploadedFolder.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(secondUploadedFolder.entry.name);
await contentServicesPage.checkContextActionIsVisible('Download');
await contentServicesPage.checkContextActionIsVisible('Copy');
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.checkContextActionIsVisible('Delete');
await contentServicesPage.checkContextActionIsVisible('Info');
await contentServicesPage.checkContextActionIsVisible('Permission');
});
});
});
});
@@ -1,295 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import { createApiService,
BrowserActions,
ContentNodeSelectorDialogPage,
LoginPage,
NotificationHistoryPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import CONSTANTS = require('../../util/constants');
import { NodesApi, SitesApi } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const notificationHistoryPage = new NotificationHistoryPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const uploadActions = new UploadActions(apiService);
let uploadedFolder; let uploadedFile; let sourceFolder; let destinationFolder; let subFolder; let subFolder2; let copyFolder; let subFile;
let duplicateFolderName;
const acsUser = new UserModel();
const anotherAcsUser = new UserModel();
let folderName; let sameNameFolder; let site;
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
beforeAll(async () => {
folderName = StringUtil.generateRandomString(5);
sameNameFolder = StringUtil.generateRandomString(5);
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await usersActions.createUser(anotherAcsUser);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: anotherAcsUser.username,
role: CONSTANTS.CS_USER_ROLES.COLLABORATOR
});
await apiService.login(acsUser.username, acsUser.password);
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
destinationFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
sourceFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
subFolder = await uploadActions.createFolder(sameNameFolder, sourceFolder.entry.id);
subFolder2 = await uploadActions.createFolder(StringUtil.generateRandomString(5), subFolder.entry.id);
copyFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), sourceFolder.entry.id);
duplicateFolderName = await uploadActions.createFolder(sameNameFolder, '-my-');
subFile = await uploadActions.uploadFile(testFileModel.location, testFileModel.name, subFolder.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, uploadedFolder.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, sourceFolder.entry.id);
uploadedFile = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, '-my-');
await nodesApi.updateNode(sourceFolder.entry.id,
{
permissions: {
locallySet: [{
authorityId: anotherAcsUser.username,
name: 'Consumer',
accessStatus: 'ALLOWED'
}]
}
});
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(uploadedFolder.entry.id);
await uploadActions.deleteFileOrFolder(uploadedFile.entry.id);
await uploadActions.deleteFileOrFolder(sourceFolder.entry.id);
await uploadActions.deleteFileOrFolder(destinationFolder.entry.id);
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});
describe('Document List Component - Actions Move and Copy', () => {
beforeAll(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
beforeEach(async () => {
await BrowserActions.closeMenuAndDialogs();
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260128] Move - Same name file', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.clickContentNodeSelectorResult(folderName);
await contentNodeSelector.clickMoveCopyButton();
await notificationHistoryPage.checkNotifyContains('This name is already in use, try a different name.');
});
it('[C260134] Move - folder with subfolder and file within it', async () => {
await contentServicesPage.checkContentIsDisplayed(destinationFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(sourceFolder.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(sourceFolder.entry.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(destinationFolder.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(destinationFolder.entry.name);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsNotDisplayed(sourceFolder.entry.name);
await contentServicesPage.openFolder(destinationFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(sourceFolder.entry.name);
await contentServicesPage.openFolder(sourceFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(subFolder.entry.name);
await contentServicesPage.openFolder(subFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(subFile.entry.name);
});
it('[C260135] Move - Same name folder', async () => {
await contentServicesPage.checkContentIsDisplayed(duplicateFolderName.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(duplicateFolderName.entry.name);
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(sourceFolder.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(sourceFolder.entry.name);
await contentNodeSelector.clickMoveCopyButton();
await notificationHistoryPage.checkNotifyContains('This name is already in use, try a different name.');
});
it('[C260129] Copy - Same name file', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.getDocumentList().rightClickOnRow(pdfFileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(folderName);
await contentNodeSelector.clickContentNodeSelectorResult(folderName);
await contentNodeSelector.clickMoveCopyButton();
await notificationHistoryPage.checkNotifyContains('This name is already in use, try a different name.');
});
it('[C260136] Copy - Same name folder', async () => {
await contentServicesPage.checkContentIsDisplayed(duplicateFolderName.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(duplicateFolderName.entry.name);
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.typeIntoNodeSelectorSearchField(sourceFolder.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(sourceFolder.entry.name);
await contentNodeSelector.clickMoveCopyButton();
await notificationHistoryPage.checkNotifyContains('This name is already in use, try a different name.');
});
it('[C260124] should be able to move file using action menu and content node selector', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.moveContent(pdfFileModel.name);
await contentNodeSelector.checkDialogIsDisplayed();
await expect(await contentNodeSelector.getDialogHeaderText()).toBe(`Move '${pdfFileModel.name}' to...`);
await contentNodeSelector.clickContentNodeSelectorResult(destinationFolder.entry.name);
await contentNodeSelector.checkSelectedFolder(destinationFolder.entry.name);
await contentNodeSelector.checkCopyMoveButtonIsEnabled();
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.moveContent(pdfFileModel.name);
await contentNodeSelector.clickContentNodeSelectorResult(destinationFolder.entry.name);
await contentNodeSelector.checkSelectedFolder(destinationFolder.entry.name);
await contentNodeSelector.checkCopyMoveButtonIsEnabled();
await contentNodeSelector.clickMoveCopyButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.name);
});
});
describe('Document List actions - Move, Copy on no permission folder', () => {
beforeAll(async () => {
await loginPage.login(anotherAcsUser.username, anotherAcsUser.password);
await BrowserActions.getUrl(`${browser.baseUrl}/files/${sourceFolder.entry.id}`);
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260133] Move - no permission folder', async () => {
await contentServicesPage.checkContentIsDisplayed(subFolder.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(subFolder.entry.name);
await contentServicesPage.checkContextActionIsVisible('Move');
await expect(await contentServicesPage.isContextActionEnabled('Move')).toBe(false);
await contentServicesPage.closeActionContext();
});
it('[C260140] Copy - No permission folder', async () => {
await contentServicesPage.checkContentIsDisplayed(subFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(copyFolder.entry.name);
await contentServicesPage.getDocumentList().rightClickOnRow(copyFolder.entry.name);
await contentServicesPage.checkContextActionIsVisible('Copy');
await expect(await contentServicesPage.isContextActionEnabled('Copy')).toBe(true);
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.contentListPage().dataTablePage().checkRowContentIsDisplayed(subFolder.entry.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowContentIsDisabled(subFolder.entry.name);
await contentNodeSelector.clickContentNodeSelectorResult(subFolder.entry.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected(subFolder.entry.name);
await expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelector.contentListPage().dataTablePage().doubleClickRowByContent(subFolder.entry.name);
await contentNodeSelector.contentListPage().dataTablePage().waitTillContentLoaded();
await contentNodeSelector.contentListPage().dataTablePage().checkRowContentIsDisplayed(subFolder2.entry.name);
});
it('[C261160] should disable copy/move button when user is not allowed in a specific folder', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.copyContent(pdfFileModel.name);
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.clickContentNodeSelectorResult(subFolder.entry.name);
await contentNodeSelector.checkSelectedFolder(subFolder.entry.name);
await expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
});
it('[C261990] should enable copy/move button when user selects own site\'s documentLibrary', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.copyContent(pdfFileModel.name);
await contentNodeSelector.checkDialogIsDisplayed();
await expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelector.typeIntoNodeSelectorSearchField(site.entry.title);
await contentNodeSelector.doubleClickContentNodeSelectorResult(site.entry.id);
await contentNodeSelector.clickContentNodeSelectorResult('documentLibrary');
await expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(true);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
});
it('[C260137] should disable delete action when user has no permission', async () => {
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.checkDeleteIsDisabled(pdfFileModel.name);
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await BrowserActions.getUrl(`${browser.baseUrl}/files/${sourceFolder.entry.id}`);
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.deleteContent(pdfFileModel.name);
await contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.name);
});
});
});
@@ -1,191 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $ } from 'protractor';
import { createApiService,
BreadcrumbPage,
BreadcrumbDropdownPage,
ContentNodeSelectorDialogPage,
LoginPage,
PaginationPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { InfinitePaginationPage } from '../../core/pages/infinite-pagination.page';
import { FolderModel } from '../../models/ACS/folder.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Document List Component - Actions', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const contentListPage = contentServicesPage.getDocumentList();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const paginationPage = new PaginationPage();
const breadCrumbDropdownPage = new BreadcrumbDropdownPage();
const breadCrumbPage = new BreadcrumbPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const infinitePaginationPage = new InfinitePaginationPage($('adf-content-node-selector'));
describe('Folder Actions - Copy and Move', () => {
const folderModel1 = new FolderModel({ name: StringUtil.generateRandomString() });
const folderModel2 = new FolderModel({ name: StringUtil.generateRandomString() });
const folderModel3 = new FolderModel({ name: StringUtil.generateRandomString() });
const folderModel4 = new FolderModel({ name: StringUtil.generateRandomString() });
const folderModel5 = new FolderModel({ name: StringUtil.generateRandomString() });
const folderModel6 = new FolderModel({ name: StringUtil.generateRandomString() });
let folder1; let folder2; let folder3; let folder4; let folder5; let folder6;
let folders;
const contentServicesUser = new UserModel();
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(contentServicesUser);
await apiService.login(contentServicesUser.username, contentServicesUser.password);
folder1 = await uploadActions.createFolder('A' + folderModel1.name, '-my-');
folder2 = await uploadActions.createFolder('B' + folderModel2.name, '-my-');
folder3 = await uploadActions.createFolder('C' + folderModel3.name, '-my-');
folder4 = await uploadActions.createFolder('D' + folderModel4.name, '-my-');
folder5 = await uploadActions.createFolder('E' + folderModel5.name, '-my-');
folder6 = await uploadActions.createFolder('F' + folderModel6.name, '-my-');
folders = [folder1, folder2, folder3, folder4, folder5, folder6];
});
beforeEach(async () => {
await loginPage.login(contentServicesUser.username, contentServicesUser.password);
await contentServicesPage.goToDocumentList();
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.checkAcsContainer();
await contentListPage.waitForTableBody();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
for (const folder of folders) {
await uploadActions.deleteFileOrFolder(folder.entry.id);
}
});
it('[C260132] Move action on folder with - Load more', async () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await expect(await contentNodeSelector.getDialogHeaderText()).toBe('Move \'' + 'A' + folderModel1.name + '\' to...');
await contentNodeSelector.checkSearchInputIsDisplayed();
await expect(await contentNodeSelector.getSearchLabel()).toBe('Search');
await contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
await contentNodeSelector.checkCancelButtonIsDisplayed();
await contentNodeSelector.checkMoveCopyButtonIsDisplayed();
await expect(await contentNodeSelector.getMoveCopyButtonText()).toBe('MOVE');
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
await infinitePaginationPage.clickLoadMoreButton();
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await infinitePaginationPage.clickLoadMoreButton();
await contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
await contentServicesPage.openFolder('F' + folderModel6.name);
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await breadCrumbDropdownPage.clickParentFolder();
await breadCrumbDropdownPage.checkBreadCrumbDropdownIsDisplayed();
await breadCrumbDropdownPage.choosePath(contentServicesUser.username);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
await breadCrumbPage.chooseBreadCrumb(contentServicesUser.username);
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
it('[C305051] Copy action on folder with - Load more', async () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Copy');
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await expect(await contentNodeSelector.getDialogHeaderText()).toBe('Copy \'' + 'A' + folderModel1.name + '\' to...');
await contentNodeSelector.checkSearchInputIsDisplayed();
await expect(await contentNodeSelector.getSearchLabel()).toBe('Search');
await contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
await contentNodeSelector.checkCancelButtonIsDisplayed();
await contentNodeSelector.checkMoveCopyButtonIsDisplayed();
await expect(await contentNodeSelector.getMoveCopyButtonText()).toBe('COPY');
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
await infinitePaginationPage.clickLoadMoreButton();
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
await contentNodeSelector.clickCancelButton();
await contentNodeSelector.checkDialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Copy');
await contentServicesPage.pressContextMenuActionNamed('Copy');
await contentNodeSelector.checkDialogIsDisplayed();
await infinitePaginationPage.clickLoadMoreButton();
await contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
await contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
await contentNodeSelector.clickMoveCopyButton();
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
await paginationPage.clickOnNextPage();
await contentServicesPage.getDocumentList().dataTable.waitTillContentLoaded();
await contentServicesPage.openFolder('F' + folderModel6.name);
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
});
});
@@ -17,7 +17,7 @@
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UsersActions } from '@alfresco/adf-testing';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -29,7 +29,7 @@ describe('Document List Component', () => {
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
let acsUser = null;
let acsUser: UserModel;
const navigationBarPage = new NavigationBarPage();
describe('Gallery View', () => {
@@ -90,10 +90,9 @@ describe('Document List Component', () => {
if (folderNode) {
await uploadActions.deleteFileOrFolder(folderNode.entry.id);
}
});
});
beforeEach(async () => {
await navigationBarPage.clickHomeButton();
await contentServicesPage.goToDocumentList();
await contentServicesPage.clickGridViewButton();
await contentServicesPage.checkCardViewContainerIsDisplayed();
@@ -146,21 +145,6 @@ describe('Document List Component', () => {
await expect(await contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
});
// eslint-disable-next-line ban/ban
xit('[C280129] Should keep Gallery View when accessing a folder', async () => {
await contentServicesPage.navigateToCardFolder(folderName);
await expect(await contentServicesPage.getCardElementShowedInPage()).toBe(1);
await expect(await contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
});
it('[C280130] Should be able to go back to List View', async () => {
await contentServicesPage.clickGridViewButton();
await contentServicesPage.checkAcsContainer();
await contentServicesPage.openFolder(folderName);
await contentServicesPage.checkRowIsDisplayed(pdfFile.name);
});
it('[C261993] Should be able to sort Gallery Cards by display name', async () => {
await contentServicesPage.selectGridSortingFromDropdown(cardProperties.DISPLAY_NAME);
await contentServicesPage.checkListIsSortedByNameColumn('asc');
@@ -50,8 +50,6 @@ describe('Document List - Pagination', () => {
let acsUser: UserModel;
let fileNames = [];
let currentPage = 1;
let secondSetOfFiles = [];
const nrOfFiles = 20;
@@ -130,6 +128,7 @@ describe('Document List - Pagination', () => {
});
it('[C260069] Should be able to set Items per page to 5', async () => {
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
@@ -178,7 +177,7 @@ describe('Document List - Pagination', () => {
});
it('[C260067] Should be able to set Items per page to 10', async () => {
currentPage = 1;
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('10');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
@@ -207,9 +206,8 @@ describe('Document List - Pagination', () => {
});
it('[C260065] Should be able to set Items per page to 15', async () => {
currentPage = 1;
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await expect(await contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
await paginationPage.selectItemsPerPage('15');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
@@ -236,7 +234,6 @@ describe('Document List - Pagination', () => {
it('[C91320] Pagination should preserve sorting', async () => {
await contentServicesPage.openFolder(newFolderModel.name);
await expect(await contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
await paginationPage.selectItemsPerPage('20');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
@@ -269,7 +266,6 @@ describe('Document List - Pagination', () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await contentServicesPage.openFolder(newFolderModel.name);
await expect(await contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await contentServicesPage.createAndOpenNewFolder(folderTwoModel.name);
@@ -280,9 +276,8 @@ describe('Document List - Pagination', () => {
});
it('[C260071] Should be able to change pagination when having 25 files', async () => {
currentPage = 1;
let currentPage = 1;
await contentServicesPage.openFolder(folderThreeModel.name);
await expect(await contentServicesPage.getActiveBreadcrumb()).toEqual(folderThreeModel.name);
await paginationPage.selectItemsPerPage('15');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
@@ -370,7 +365,6 @@ describe('Document List - Pagination', () => {
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await contentServicesPage.openFolder(newFolderModel.name);
await expect(await contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await apiService.login(acsUser.username, acsUser.password);
@@ -436,5 +430,4 @@ describe('Document List - Pagination', () => {
await contentServicesPage.deleteSubFolderUnderRoot(newFolderModel.name, folderTwoModel.name);
});
});
@@ -1,92 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService, DropActions, LoginPage, UploadActions, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
describe('Document List Component - Properties', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBar = new NavigationBarPage();
let subFolder; let parentFolder;
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
let acsUser = null;
const usersActions = new UsersActions(apiService);
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
describe('Allow drop files property', () => {
beforeEach(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
parentFolder = await uploadActions.createFolder('parentFolder', '-my-');
subFolder = await uploadActions.createFolder('subFolder', parentFolder.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBar.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
});
afterEach(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(subFolder.entry.id);
await uploadActions.deleteFileOrFolder(parentFolder.entry.id);
await navigationBar.clickLogoutButton();
});
it('[C299154] Should disallow upload content on a folder row if allowDropFiles is false', async () => {
await contentServicesPage.openFolder(parentFolder.entry.name);
await contentServicesPage.disableDropFilesInAFolder();
await browser.sleep(1000);
const dragAndDropArea = contentServicesPage.getRowByName(subFolder.entry.name);
await DropActions.dropFile(dragAndDropArea, pngFile.location);
await contentServicesPage.checkContentIsDisplayed(pngFile.name);
await contentServicesPage.openFolder(subFolder.entry.name);
await contentServicesPage.checkEmptyFolderTextToBe('This folder is empty');
});
it('[C91319] Should allow upload content on a folder row if allowDropFiles is true', async () => {
await contentServicesPage.openFolder(parentFolder.entry.name);
await contentServicesPage.enableDropFilesInAFolder();
await browser.sleep(1000);
const dragAndDropArea = contentServicesPage.getRowByName(subFolder.entry.name);
await DropActions.dropFile(dragAndDropArea, pngFile.location);
await contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
await contentServicesPage.openFolder(subFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(pngFile.name);
});
});
});
@@ -17,38 +17,31 @@
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UsersActions } from '@alfresco/adf-testing';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
let acsUser = null;
const navigationBarPage = new NavigationBarPage();
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
describe('Thumbnails and tooltips', () => {
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const docxFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode; let fileTestNode; let fileDocxNode; let folderNode;
let filePdfNode: NodeEntry;
let folderNode: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
@@ -57,8 +50,6 @@ describe('Document List Component', () => {
await apiService.login(acsUser.username, acsUser.password);
filePdfNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(folderName, '-my-');
});
@@ -69,12 +60,6 @@ describe('Document List Component', () => {
if (filePdfNode) {
await uploadActions.deleteFileOrFolder(filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFileOrFolder(fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFileOrFolder(fileDocxNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFileOrFolder(folderNode.entry.id);
}
@@ -97,26 +82,6 @@ describe('Document List Component', () => {
await expect(await contentServicesPage.getDocumentList().getTooltip(folderName)).toEqual(folderName);
});
it('[C260119] Should have a specific thumbnail for folders', async () => {
const folderIconUrl = await contentServicesPage.getRowIconImageUrl(folderName);
await expect(folderIconUrl).toContain('/assets/images/ft_ic_folder.svg');
});
it('[C280066] Should have a specific thumbnail PDF files', async () => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
await expect(fileIconUrl).toContain('/assets/images/ft_ic_pdf.svg');
});
it('[C280067] Should have a specific thumbnail DOCX files', async () => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(docxFile.name);
await expect(fileIconUrl).toContain('/assets/images/ft_ic_ms_word.svg');
});
it('[C280068] Should have a specific thumbnail files', async () => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(testFile.name);
await expect(fileIconUrl).toContain('/assets/images/ft_ic_document.svg');
});
it('[C274701] Should be able to enable thumbnails', async () => {
await contentServicesPage.enableThumbnails();
await contentServicesPage.checkAcsContainer();
@@ -1,27 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestElement } from '@alfresco/adf-testing';
export class LockFilePage {
cancelButton = TestElement.byCss('button[data-automation-id="lock-dialog-btn-cancel"]');
saveButton = TestElement.byText('button span', 'Save');
lockFileCheckboxText = TestElement.byText('mat-checkbox label span', ' Lock file ');
lockFileCheckbox = TestElement.byCss('mat-checkbox[data-automation-id="adf-lock-node-checkbox"]');
allowOwnerCheckbox = TestElement.byText('mat-checkbox[class*="adf-lock-file-name"] span', ' Allow the owner to modify this file ');
}
@@ -99,8 +99,6 @@ describe('Upload component', () => {
});
it('[C272788] Should display upload button', async () => {
await expect(await contentServicesPage.getSingleFileButtonTooltip()).toEqual('Custom tooltip');
await contentServicesPage.checkUploadButton();
await contentServicesPage.checkContentIsDisplayed(firstPdfFileModel.name);
});
@@ -133,13 +131,6 @@ describe('Upload component', () => {
await uploadDialog.dialogIsNotDisplayed();
});
it('[C272794] Should display tooltip for uploading files', async () => {
await uploadToggles.enableMultipleFileUpload();
await uploadToggles.checkMultipleFileUploadToggleIsEnabled();
await expect(await contentServicesPage.getMultipleFileButtonTooltip()).toEqual('Custom tooltip');
await uploadToggles.disableMultipleFileUpload();
});
it('[C279920] Should rename a file uploaded twice', async () => {
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
@@ -16,13 +16,13 @@
*/
import { browser } from 'protractor';
import { createApiService, LoginPage, NotificationHistoryPage, StringUtil, UsersActions } from '@alfresco/adf-testing';
import { createApiService, LoginPage, SnackbarPage, StringUtil, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import CONSTANTS = require('../../util/constants');
import { SitesApi } from '@alfresco/js-api';
import { SiteEntry, SitesApi } from '@alfresco/js-api';
describe('Upload - User permission', () => {
@@ -30,7 +30,6 @@ describe('Upload - User permission', () => {
const uploadDialog = new UploadDialogPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const notificationHistoryPage = new NotificationHistoryPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
@@ -39,17 +38,10 @@ describe('Upload - User permission', () => {
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_location
});
let acsUser; let acsUserTwo; let consumerSite; let managerSite;
let acsUser: UserModel;
let acsUserTwo: UserModel;
let consumerSite: SiteEntry;
let managerSite: SiteEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
@@ -125,7 +117,8 @@ describe('Upload - User permission', () => {
await contentServicesPage.uploadFile(emptyFile.location);
await notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual('You don\'t have the create permission to upload the content');
});
});
@@ -141,38 +134,4 @@ describe('Upload - User permission', () => {
await uploadDialog.fileIsUploaded(emptyFile.name);
});
});
describe('multiple users', () => {
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
});
it('[C260175] Should two different user upload files in the proper User Home', async () => {
await contentServicesPage.uploadFile(emptyFile.location);
await uploadDialog.fileIsUploaded(emptyFile.name);
await contentServicesPage.checkContentIsDisplayed(emptyFile.name);
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUserTwo.username, acsUserTwo.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsNotDisplayed(emptyFile.name);
await contentServicesPage.uploadFile(pngFile.location);
await contentServicesPage.checkContentIsDisplayed(pngFile.name);
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
await contentServicesPage.uploadFile(pdfFile.location);
await contentServicesPage.checkContentIsDisplayed(pdfFile.name);
});
});
});
@@ -16,9 +16,10 @@
*/
import { browser, by, element } from 'protractor';
import { createApiService,
import {
createApiService,
LoginPage,
NotificationHistoryPage,
SnackbarPage,
StringUtil,
UploadActions,
UserModel,
@@ -38,7 +39,6 @@ describe('Version component permissions', () => {
const versionManagePage = new VersionManagePage();
const navigationBarPage = new NavigationBarPage();
const uploadDialog = new UploadDialogPage();
const notificationHistoryPage = new NotificationHistoryPage();
const contentServices = new ContentServicesPage();
let site;
@@ -194,7 +194,8 @@ describe('Version component permissions', () => {
it('[C277197] Should a user with Consumer permission not be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await notificationHistoryPage.checkNotifyContains(`You don't have access to do this`);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual(`You don't have access to do this.`);
});
it('[C277201] Should a user with Consumer permission not be able to upload a new version for a locked file', async () => {
@@ -249,7 +250,8 @@ describe('Version component permissions', () => {
it('[C277198] Should a user with Contributor permission not be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await notificationHistoryPage.checkNotifyContains(`You don't have access to do this`);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual(`You don't have access to do this.`);
});
it('[C277202] Should be disabled the option for a locked file', async () => {