mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* increase timeout and modify login async * run e2e if testing is changed * improve cdk fix * fix travis update projects * disable ghostMode lite server * lint fix * fix timeout * multiple try * Update content-services-e2e.sh * Update search-e2e.sh * Update process-services-e2e.sh * Update core-e2e.sh * Update protractor.conf.ts * fix unit * remove async * increqase notification time * 3 parallel * dix path issue in save * small refactor protractor ts * fix save * create license check first script adf cli * modify regex check * refactor notification history component * decrease notification * fix notification message problem * fix test * update packages wit high risk * revert cahnge login sso e2e * fix dep * fix documentation duplication and issue * fix after review * fix after review * try 6 parallel test * back to 3 parallel test no real time improve with 6
282 lines
10 KiB
TypeScript
282 lines
10 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright 2019 Alfresco Software, Ltd.
|
|
*
|
|
* 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 { StringUtil, LoginPage, NotificationHistoryPage } from '@alfresco/adf-testing';
|
|
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
|
|
import { UploadDialog } from '../../pages/adf/dialog/uploadDialog';
|
|
import { UploadToggles } from '../../pages/adf/dialog/uploadToggles';
|
|
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
|
|
|
|
import { AcsUserModel } from '../../models/ACS/acsUserModel';
|
|
import { FileModel } from '../../models/ACS/fileModel';
|
|
import { FolderModel } from '../../models/ACS/folderModel';
|
|
|
|
import resources = require('../../util/resources');
|
|
|
|
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
|
|
|
import CONSTANTS = require('../../util/constants');
|
|
|
|
describe('Upload - User permission', () => {
|
|
|
|
const contentServicesPage = new ContentServicesPage();
|
|
const uploadDialog = new UploadDialog();
|
|
const uploadToggles = new UploadToggles();
|
|
const loginPage = new LoginPage();
|
|
let acsUser;
|
|
let acsUserTwo;
|
|
const navigationBarPage = new NavigationBarPage();
|
|
const notificationHistoryPage = new NotificationHistoryPage();
|
|
|
|
const emptyFile = new FileModel({
|
|
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
|
|
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
|
|
});
|
|
|
|
const pngFile = new FileModel({
|
|
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
|
|
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
|
|
});
|
|
|
|
const pdfFile = new FileModel({
|
|
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
|
|
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
|
|
});
|
|
|
|
const folder = new FolderModel({
|
|
'name': resources.Files.ADF_DOCUMENTS.FOLDER_TWO.folder_name,
|
|
'location': resources.Files.ADF_DOCUMENTS.FOLDER_TWO.folder_location
|
|
});
|
|
|
|
beforeAll(() => {
|
|
this.alfrescoJsApi = new AlfrescoApi({
|
|
provider: 'ECM',
|
|
hostEcm: browser.params.testConfig.adf.url
|
|
});
|
|
});
|
|
|
|
beforeEach(async (done) => {
|
|
acsUser = new AcsUserModel();
|
|
acsUserTwo = new AcsUserModel();
|
|
|
|
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
|
|
|
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
|
|
|
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUserTwo);
|
|
|
|
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
|
|
|
this.consumerSite = await this.alfrescoJsApi.core.sitesApi.createSite({
|
|
title: StringUtil.generateRandomString(),
|
|
visibility: 'PUBLIC'
|
|
});
|
|
|
|
this.managerSite = await this.alfrescoJsApi.core.sitesApi.createSite({
|
|
title: StringUtil.generateRandomString(),
|
|
visibility: 'PUBLIC'
|
|
});
|
|
|
|
await this.alfrescoJsApi.core.sitesApi.addSiteMember(this.consumerSite.entry.id, {
|
|
id: acsUser.id,
|
|
role: CONSTANTS.CS_USER_ROLES.CONSUMER
|
|
});
|
|
|
|
await this.alfrescoJsApi.core.sitesApi.addSiteMember(this.managerSite.entry.id, {
|
|
id: acsUser.id,
|
|
role: CONSTANTS.CS_USER_ROLES.MANAGER
|
|
});
|
|
|
|
done();
|
|
});
|
|
|
|
describe('Consumer permissions', () => {
|
|
|
|
beforeEach(async (done) => {
|
|
contentServicesPage.goToDocumentList();
|
|
|
|
done();
|
|
});
|
|
|
|
xit('[C212861] Should not be allowed to Drag and drop a file/folder in a folder with consumer permissions', () => {
|
|
contentServicesPage.checkDragAndDropDIsDisplayed();
|
|
|
|
contentServicesPage.dragAndDropFolder(folder.location);
|
|
contentServicesPage.checkContentIsDisplayed(folder.name);
|
|
|
|
contentServicesPage.dragAndDropFile(emptyFile.location);
|
|
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
|
|
|
|
navigationBarPage.openContentServicesFolder(this.consumerSite.entry.guid);
|
|
|
|
browser.sleep(3000);
|
|
|
|
contentServicesPage.dragAndDropFile(emptyFile.location);
|
|
contentServicesPage.dragAndDropFolder(folder.location);
|
|
|
|
const fileInTheUploadedFolder = 'share_profile_pic.png';
|
|
|
|
uploadDialog.fileIsError(emptyFile.name);
|
|
uploadDialog.fileIsError(fileInTheUploadedFolder);
|
|
|
|
contentServicesPage.checkContentIsNotDisplayed(emptyFile.name);
|
|
contentServicesPage.checkContentIsNotDisplayed(folder.name);
|
|
});
|
|
|
|
it('[C291921] Should display tooltip for uploading files without permissions', () => {
|
|
navigationBarPage.openContentServicesFolder(this.consumerSite.entry.guid);
|
|
|
|
contentServicesPage.checkDragAndDropDIsDisplayed();
|
|
|
|
contentServicesPage.dragAndDropFile(emptyFile.location);
|
|
|
|
uploadDialog.fileIsError(emptyFile.name);
|
|
|
|
uploadDialog.displayTooltip();
|
|
|
|
expect(uploadDialog.getTooltip()).toEqual('Insufficient permissions to upload in this location [403]');
|
|
});
|
|
|
|
it('[C279915] Should not be allowed to upload a file in folder with consumer permissions', () => {
|
|
contentServicesPage.uploadFile(emptyFile.location).checkContentIsDisplayed(emptyFile.name);
|
|
|
|
uploadDialog.fileIsUploaded(emptyFile.name);
|
|
|
|
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
|
|
|
|
navigationBarPage.openContentServicesFolder(this.consumerSite.entry.guid);
|
|
|
|
browser.sleep(3000);
|
|
|
|
contentServicesPage.uploadFile(emptyFile.location);
|
|
|
|
notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
|
|
});
|
|
|
|
xit('[C279916] Should not be allowed to upload a folder in folder with consumer permissions', () => {
|
|
uploadToggles.enableFolderUpload();
|
|
uploadToggles.checkFolderUploadToggleIsEnabled();
|
|
|
|
contentServicesPage.uploadFolder(folder.location)
|
|
.checkContentIsDisplayed(folder.name);
|
|
|
|
const fileInTheUploadedFolder = 'share_profile_pic.png';
|
|
|
|
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
|
|
|
|
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
|
|
|
|
navigationBarPage.openContentServicesFolder(this.consumerSite.entry.guid);
|
|
|
|
browser.sleep(3000);
|
|
|
|
uploadToggles.enableFolderUpload();
|
|
uploadToggles.checkFolderUploadToggleIsEnabled();
|
|
|
|
contentServicesPage.uploadFolder(folder.location);
|
|
|
|
notificationHistoryPage.checkNotifyContains('You don\'t have the create permission to upload the content');
|
|
});
|
|
});
|
|
|
|
describe('full permissions', () => {
|
|
|
|
beforeEach(async (done) => {
|
|
navigationBarPage.openContentServicesFolder(this.managerSite.entry.guid);
|
|
|
|
contentServicesPage.goToDocumentList();
|
|
|
|
done();
|
|
});
|
|
|
|
xit('[C260130] Should be allowed to Drag and drop a file/folder in a folder with manager permissions', () => {
|
|
contentServicesPage.checkDragAndDropDIsDisplayed();
|
|
|
|
contentServicesPage.dragAndDropFile(emptyFile.location);
|
|
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
|
|
|
|
contentServicesPage.dragAndDropFolder(folder.location);
|
|
contentServicesPage.checkContentIsDisplayed(folder.name);
|
|
|
|
const fileInTheUploadedFolder = 'share_profile_pic.png';
|
|
|
|
uploadDialog.fileIsUploaded(emptyFile.name);
|
|
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
|
|
});
|
|
|
|
it('[C279917] Should be allowed to upload a file in a folder with manager permissions', () => {
|
|
contentServicesPage.uploadFile(emptyFile.location);
|
|
|
|
uploadDialog.fileIsUploaded(emptyFile.name);
|
|
});
|
|
|
|
xit('[C279918] Should be allowed to upload a folder in a folder with manager permissions', () => {
|
|
uploadToggles.enableFolderUpload();
|
|
uploadToggles.checkFolderUploadToggleIsEnabled();
|
|
|
|
contentServicesPage.uploadFolder(folder.location);
|
|
uploadDialog.checkUploadCompleted().then(() => {
|
|
contentServicesPage.checkContentIsDisplayed(folder.name);
|
|
});
|
|
|
|
const fileInTheUploadedFolder = 'share_profile_pic.png';
|
|
|
|
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
|
|
});
|
|
});
|
|
|
|
describe('multiple users', () => {
|
|
|
|
beforeEach(async (done) => {
|
|
contentServicesPage.goToDocumentList();
|
|
|
|
done();
|
|
});
|
|
|
|
it('[C260175] Should two different user upload files in the proper User Home', async () => {
|
|
contentServicesPage.uploadFile(emptyFile.location);
|
|
|
|
uploadDialog.fileIsUploaded(emptyFile.name);
|
|
|
|
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
|
|
|
|
navigationBarPage.clickLoginButton();
|
|
await loginPage.loginToContentServicesUsingUserModel(acsUserTwo);
|
|
contentServicesPage.goToDocumentList();
|
|
|
|
contentServicesPage.checkContentIsNotDisplayed(emptyFile.name);
|
|
|
|
contentServicesPage.uploadFile(pngFile.location);
|
|
|
|
contentServicesPage.checkContentIsDisplayed(pngFile.name);
|
|
|
|
navigationBarPage.clickLoginButton();
|
|
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
|
contentServicesPage.goToDocumentList();
|
|
|
|
contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
|
|
|
|
contentServicesPage.uploadFile(pdfFile.location);
|
|
|
|
contentServicesPage.checkContentIsDisplayed(pdfFile.name);
|
|
});
|
|
});
|
|
|
|
});
|