[no-issue] fix e2e uploader (#3840)

* fix e2e upload
move viewer subbfolder

* fix CS services e2e test

* add log for error in upload delete

* aysnc get node

* new tentative

* attempt 2

* attempt 3

* new demo shell test
travis change for test

* excluded file tslint fix

* remove desktop only class

* renable tests

* decrease time notification

* add process service multiselect demo test
fix e2e

* remove log

* add custom toolbar example
This commit is contained in:
Eugenio Romano
2018-10-02 12:26:13 +01:00
committed by GitHub
parent 77a6f1e902
commit 6a546289b7
58 changed files with 1426 additions and 1343 deletions

View File

@@ -20,7 +20,8 @@ import { element, by, browser } from 'protractor';
import LoginPage = require('../../pages/adf/loginPage');
import ContentServicesPage = require('../../pages/adf/contentServicesPage');
import UploadDialog = require('../../pages/adf/dialog/uploadDialog');
import UploadToggles = require('../../pages/adf/dialog/uploadToggles');
import { UploadToggles } from '../../pages/adf/dialog/uploadToggles';
import NavigationBarPage = require('../../pages/adf/navigationBarPage');
import AcsUserModel = require('../../models/ACS/acsUserModel');
import FileModel = require('../../models/ACS/fileModel');
@@ -31,6 +32,7 @@ import resources = require('../../util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { DropActions } from '../../actions/drop.actions';
import { ConfigEditorPage } from '../../pages/adf/configEditorPage';
describe('Upload component - Excluded Files', () => {
@@ -39,6 +41,8 @@ describe('Upload component - Excluded Files', () => {
let uploadToggles = new UploadToggles();
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
let navigationBarPage = new NavigationBarPage();
let configEditorPage = new ConfigEditorPage();
let iniExcludedFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.INI.file_name,
@@ -50,6 +54,16 @@ describe('Upload component - Excluded Files', () => {
'location': resources.Files.ADF_DOCUMENTS.FOLDER_EXCLUDED.folder_location
});
let txtFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
let pngFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
});
beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
@@ -72,7 +86,7 @@ describe('Upload component - Excluded Files', () => {
it('[C279914] Should not allow upload default excluded files using D&D', () => {
contentServicesPage.checkDandDIsDisplayed();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
let dragAndDrop = new DropActions();
@@ -98,4 +112,66 @@ describe('Upload component - Excluded Files', () => {
contentServicesPage.doubleClickRow(folderWithExcludedFile.name).checkContentIsNotDisplayed(iniExcludedFile.name).checkContentIsDisplayed('a_file.txt');
});
it('[C212862] Should not allow upload file excluded in the files extension of app.config.json', () => {
navigationBarPage.clickConfigEditorButton();
browser.refresh();
configEditorPage.clickFileConfiguration('adf-file-conf');
configEditorPage.clickClearButton();
configEditorPage.enterConfiguration('{' +
' "excluded": [' +
' ".DS_Store",' +
' "desktop.ini",' +
' "*.txt"' +
' ],' +
' "match-options": {' +
' "nocase": true' +
' }' +
'}');
configEditorPage.clickSaveButton();
contentServicesPage.goToDocumentList();
contentServicesPage
.uploadFile(txtFileModel.location)
.checkContentIsNotDisplayed(txtFileModel.name);
});
it('[C274688] Should extension type added as excluded and accepted not be uploaded', () => {
navigationBarPage.clickConfigEditorButton();
browser.refresh();
configEditorPage.clickFileConfiguration('adf-file-conf');
configEditorPage.clickClearButton();
configEditorPage.enterConfiguration('{' +
' "excluded": [' +
' ".DS_Store",' +
' "desktop.ini",' +
' "*.png"' +
' ],' +
' "match-options": {' +
' "nocase": true' +
' }' +
'}');
configEditorPage.clickSaveButton();
contentServicesPage.goToDocumentList();
uploadToggles.enableExtensionFilter();
browser.driver.sleep(1000);
uploadToggles.addExtension('.png');
contentServicesPage.uploadFile(pngFile.location);
browser.driver.sleep(1000);
contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
});
});

View File

@@ -15,12 +15,13 @@
* limitations under the License.
*/
/* tslint:disable */
import { element, by, browser } from 'protractor';
import LoginPage = require('../../pages/adf/loginPage');
import ContentServicesPage = require('../../pages/adf/contentServicesPage');
import UploadDialog = require('../../pages/adf/dialog/uploadDialog');
import UploadToggles = require('../../pages/adf/dialog/uploadToggles');
import { UploadToggles } from '../../pages/adf/dialog/uploadToggles';
import AcsUserModel = require('../../models/ACS/acsUserModel');
import FileModel = require('../../models/ACS/fileModel');
@@ -40,6 +41,7 @@ describe('Upload component', () => {
let uploadToggles = new UploadToggles();
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
let uploadActions = new UploadActions();
let firstPdfFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
@@ -53,6 +55,10 @@ describe('Upload component', () => {
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
let pngFileModelTwo = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
'location': resources.Files.ADF_DOCUMENTS.PNG_B.file_location
});
let pngFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
@@ -83,8 +89,6 @@ describe('Upload component', () => {
let filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name];
beforeAll(async (done) => {
let uploadActions = new UploadActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
@@ -107,16 +111,39 @@ describe('Upload component', () => {
done();
});
afterEach(async (done) => {
let nodersPromise = await contentServicesPage.getContentList().getAllNodeIdInList();
nodersPromise.forEach(async (currentNodePormise) => {
await currentNodePormise.then(async (currentNode) => {
if (currentNode && currentNode !== 'Node id') {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, currentNode);
}
});
});
done();
});
it('[C272788] Upload Button is visible on the page', () => {
expect(contentServicesPage.getSingleFileButtonTooltip()).toEqual('Custom tooltip');
contentServicesPage
.checkUploadButton()
.checkContentIsDisplayed(firstPdfFileModel.name);
});
contentServicesPage
.deleteContent(firstPdfFileModel.name)
.checkContentIsNotDisplayed(pdfFileModel.name);
it('[C260173] Enable folder upload', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderOne.location);
contentServicesPage.checkContentIsDisplayed(folderOne.name);
expect(contentServicesPage.getFolderButtonTooltip()).toEqual('Custom tooltip');
uploadDialog.fileIsUploaded(uploadedFileInFolder.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.doubleClickRow(folderOne.name).checkContentIsDisplayed(uploadedFileInFolder.name);
contentServicesPage.goToDocumentList();
uploadToggles.disableFolderUpload();
});
it('[C272789] Upload a pdf file', () => {
@@ -127,10 +154,6 @@ describe('Upload component', () => {
uploadDialog.fileIsUploaded(pdfFileModel.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage
.deleteContent(pdfFileModel.name)
.checkContentIsNotDisplayed(pdfFileModel.name);
});
it('[C272790] Upload a text file', () => {
@@ -140,10 +163,6 @@ describe('Upload component', () => {
uploadDialog.fileIsUploaded(docxFileModel.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage
.deleteContent(docxFileModel.name)
.checkContentIsNotDisplayed(docxFileModel.name);
});
it('[C260141] Upload a png file', () => {
@@ -153,10 +172,6 @@ describe('Upload component', () => {
uploadDialog.fileIsUploaded(pngFileModel.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage
.deleteContent(pngFileModel.name)
.checkContentIsNotDisplayed(pngFileModel.name);
});
it('[C260143] Minimize and maximize the upload dialog box', () => {
@@ -177,7 +192,6 @@ describe('Upload component', () => {
expect(uploadDialog.numberOfCurrentFilesUploaded()).toEqual('1');
expect(uploadDialog.numberOfInitialFilesUploaded()).toEqual('1');
uploadDialog.checkCloseButtonIsDisplayed().clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContent(docxFileModel.name).checkContentIsNotDisplayed(docxFileModel.name);
});
it('[C260168] Cancel the uploaded file through the upload dialog icon', () => {
@@ -189,9 +203,9 @@ describe('Upload component', () => {
contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.name);
});
it('[C272792] Cancel a big file through the upload dialog icon before the upload to be done', () => {
xit('[C272792] Cancel a big file through the upload dialog icon before the upload to be done', () => {
browser.executeScript(' setTimeout(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 5000)');
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 3000)');
contentServicesPage.uploadFile(largeFile.location);
@@ -249,7 +263,7 @@ describe('Upload component', () => {
uploadToggles.addExtension('.docx');
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
dragAndDrop.dropFile(dragAndDropArea, docxFileModel.location);
contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
@@ -264,57 +278,64 @@ describe('Upload component', () => {
});
it('[C279920] Upload same file twice', () => {
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
contentServicesPage
.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1');
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.getVersionName());
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContent(pdfFileModel.name).checkContentIsNotDisplayed(pdfFileModel.name);
contentServicesPage.deleteContent(pdfFileModel.getVersionName()).checkContentIsNotDisplayed(pdfFileModel.getVersionName());
contentServicesPage
.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.getVersionName());
uploadDialog
.clickOnCloseButton()
.dialogIsNotDisplayed();
pdfFileModel.setVersion('');
});
it('[C260172] Enable versioning', () => {
uploadToggles.enableVersioning();
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
contentServicesPage
.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1');
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
uploadDialog.fileIsUploaded(pdfFileModel.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.getVersionName());
contentServicesPage.deleteContent(pdfFileModel.name).checkContentIsNotDisplayed(pdfFileModel.name);
contentServicesPage
.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name);
uploadDialog
.fileIsUploaded(pdfFileModel.name);
uploadDialog
.clickOnCloseButton()
.dialogIsNotDisplayed();
contentServicesPage
.checkContentIsNotDisplayed(pdfFileModel.getVersionName());
pdfFileModel.setVersion('');
uploadToggles.disableVersioning();
});
it('[C260173] Enable folder upload', () => {
uploadToggles.enableFolderUpload();
browser.driver.sleep(1000);
contentServicesPage.uploadFolder(folderOne.location).checkContentIsDisplayed(folderOne.name);
expect(contentServicesPage.getFolderButtonTooltip()).toEqual('Custom tooltip');
uploadDialog.fileIsUploaded(uploadedFileInFolder.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.doubleClickRow(folderOne.name).checkContentIsDisplayed(uploadedFileInFolder.name);
contentServicesPage.goToDocumentList();
uploadToggles.disableFolderUpload();
});
it('[C260176] The files uploaded before closing the upload dialog box are not displayed anymore in the upload box', () => {
contentServicesPage.uploadFile(docxFileModel.location).checkContentIsDisplayed(docxFileModel.name);
contentServicesPage.uploadFile(pngFileModelTwo.location).checkContentIsDisplayed(pngFileModelTwo.name);
uploadDialog.fileIsUploaded(docxFileModel.name);
uploadDialog.fileIsUploaded(pngFileModelTwo.name);
contentServicesPage.uploadFile(pngFileModel.location).checkContentIsDisplayed(pngFileModel.name);
uploadDialog.fileIsUploaded(pngFileModel.name).fileIsUploaded(docxFileModel.name);
uploadDialog.fileIsUploaded(pngFileModel.name).fileIsUploaded(pngFileModelTwo.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
uploadDialog.fileIsUploaded(pdfFileModel.name).fileIsNotDisplayedInDialog(pngFileModel.name).fileIsNotDisplayedInDialog(docxFileModel.name);
uploadDialog.fileIsUploaded(pdfFileModel.name).fileIsNotDisplayedInDialog(pngFileModel.name).fileIsNotDisplayedInDialog(pngFileModelTwo.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContents([docxFileModel.name, pngFileModel.name, pdfFileModel.name])
.checkContentsAreNotDisplayed([docxFileModel.name, pngFileModel.name, pdfFileModel.name]);
});
it('[C260170] Upload files on the same time', () => {
@@ -331,40 +352,39 @@ describe('Upload component', () => {
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContents(filesName).checkContentsAreNotDisplayed(filesName);
uploadToggles.disableMultipleFileUpload();
});
xit('[C279919] Enable max size and set it to 400', () => {
it('[C260174] Enable max size and set it to 400', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer();
uploadToggles.enableMaxSize();
uploadToggles.addMaxSize('400');
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsDisplayed(fileWithSpecificSize.name);
contentServicesPage.uploadFile(fileWithSpecificSize.location);
uploadDialog.fileIsUploaded(fileWithSpecificSize.name).clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContent(fileWithSpecificSize.name).checkContentIsNotDisplayed(fileWithSpecificSize.name);
uploadToggles.addMaxSize('399');
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsNotDisplayed(fileWithSpecificSize.name);
contentServicesPage.uploadFile(fileWithSpecificSize.location);
expect(contentServicesPage.getErrorMessage()).toEqual('File ' + fileWithSpecificSize.name + ' is larger than the allowed file size');
contentServicesPage.checkContentIsNotDisplayed(fileWithSpecificSize.name);
uploadDialog.fileIsNotDisplayedInDialog(fileWithSpecificSize.name);
contentServicesPage.uploadFile(emptyFile.location).checkContentIsDisplayed(emptyFile.name);
uploadDialog.fileIsUploaded(emptyFile.name).clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContent(emptyFile.name).checkContentIsNotDisplayed(emptyFile.name);
uploadToggles.disableMaxSize();
});
xit('[C272796] Enable max size and set it to 0', () => {
it('[C272796] Enable max size and set it to 0', () => {
contentServicesPage.goToDocumentList();
uploadToggles.enableMaxSize();
uploadToggles.addMaxSize('0');
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsNotDisplayed(fileWithSpecificSize.name);
contentServicesPage.uploadFile(fileWithSpecificSize.location);
expect(contentServicesPage.getErrorMessage()).toEqual('File ' + fileWithSpecificSize.name + ' is larger than the allowed file size');
uploadDialog.fileIsNotDisplayedInDialog(fileWithSpecificSize.name);
contentServicesPage.uploadFile(emptyFile.location).checkContentIsDisplayed(emptyFile.name);
uploadDialog.fileIsUploaded(emptyFile.name).clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.deleteContent(emptyFile.name).checkContentIsNotDisplayed(emptyFile.name);
uploadToggles.disableMaxSize();
});
@@ -373,8 +393,9 @@ describe('Upload component', () => {
browser.driver.sleep(1000);
uploadToggles.addMaxSize('1');
uploadToggles.disableMaxSize();
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsDisplayed(fileWithSpecificSize.name);
contentServicesPage.uploadFile(fileWithSpecificSize.location);
uploadDialog.fileIsUploaded(fileWithSpecificSize.name).clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.checkContentIsDisplayed(fileWithSpecificSize.name);
});
it('[C91318] Should Enable/Disable upload button when change the disable property', () => {

View File

@@ -20,7 +20,7 @@ import { element, by } from 'protractor';
import LoginPage = require('../../pages/adf/loginPage');
import ContentServicesPage = require('../../pages/adf/contentServicesPage');
import UploadDialog = require('../../pages/adf/dialog/uploadDialog');
import UploadToggles = require('../../pages/adf/dialog/uploadToggles');
import { UploadToggles } from '../../pages/adf/dialog/uploadToggles';
import NavigationBarPage = require('../../pages/adf/navigationBarPage');
import NotificationPage = require('../../pages/adf/notificationPage');
@@ -99,7 +99,7 @@ describe('Upload - User permission', () => {
contentServicesPage.checkDandDIsDisplayed();
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
@@ -109,6 +109,8 @@ describe('Upload - User permission', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
browser.sleep(5000);
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
@@ -122,12 +124,6 @@ describe('Upload - User permission', () => {
});
it('[C279915] Should not be allowed to upload a file in a restricted user folder with limited permissions', () => {
navigationBarPage.clickLoginButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.uploadFile(emptyFile.location).checkContentIsDisplayed(emptyFile.name);
uploadDialog.fileIsUploaded(emptyFile.name);
@@ -136,6 +132,8 @@ describe('Upload - User permission', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
browser.sleep(5000);
contentServicesPage.uploadFile(emptyFile.location);
notificationPage.checkNotifyContains('You don\'t have the create permission to upload the content');
@@ -154,6 +152,8 @@ describe('Upload - User permission', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
browser.sleep(5000);
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folder.location);
@@ -175,7 +175,7 @@ describe('Upload - User permission', () => {
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);