mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
@@ -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`);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user