[ADF-3951] Added automated tests for failed uploading tooltips (#4206)

* [ADF-3951] Added automated tests for failed uploading tooltips

* [ADF-3951] Updated and refactored tests.
This commit is contained in:
Florin Butu
2019-01-30 11:19:47 +02:00
committed by Eugenio Romano
parent 1b81f687a3
commit 3401b508be
4 changed files with 69 additions and 16 deletions

View File

@@ -28,6 +28,8 @@ import { FolderModel } from '../../models/ACS/folderModel';
import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import { Util } from '../../util/util';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../../actions/ACS/upload.actions';
@@ -41,6 +43,7 @@ describe('Upload component', () => {
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
let uploadActions = new UploadActions();
let navigationBarPage = new NavigationBarPage();
let firstPdfFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
@@ -436,4 +439,24 @@ describe('Upload component', () => {
uploadToggles.disableFolderUpload();
});
it('[C291921] Should display tooltip for uploading files on a not found location', async () => {
let folderName = Util.generateRandomString(8);
let folderUploadedModel = await browser.controlFlow().execute(async () => {
return await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
});
navigationBarPage.openContentServicesFolder(folderUploadedModel.entry.id);
contentServicesPage.checkUploadButton();
browser.controlFlow().execute(async () => {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, folderUploadedModel.entry.id);
});
contentServicesPage.uploadFile(pdfFileModel.location);
uploadDialog.displayTooltip();
expect(uploadDialog.getTooltip()).toEqual('Upload location no longer exists [404]');
});
});

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { browser } from 'protractor';
import { Util } from '../../util/util';
@@ -34,7 +34,6 @@ import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { DropActions } from '../../actions/drop.actions';
import CONSTANTS = require('../../util/constants');
describe('Upload - User permission', () => {
@@ -121,11 +120,8 @@ describe('Upload - User permission', () => {
it('[C212861] Should not be allowed to Drag and drop a file/folder in a folder with consumer permissions', () => {
contentServicesPage.checkDragAndDropDIsDisplayed();
let dragAndDrop = new DropActions();
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
contentServicesPage.dragAndDropFile(emptyFile.location);
contentServicesPage.dragAndDropFolder(folder.location);
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
contentServicesPage.checkContentIsDisplayed(folder.name);
@@ -134,8 +130,8 @@ describe('Upload - User permission', () => {
browser.sleep(3000);
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
contentServicesPage.dragAndDropFile(emptyFile.location);
contentServicesPage.dragAndDropFolder(folder.location);
let fileInTheUploadedFolder = 'share_profile_pic.png';
@@ -146,6 +142,20 @@ describe('Upload - User permission', () => {
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);
@@ -198,12 +208,8 @@ describe('Upload - User permission', () => {
it('[C260130] Should be allowed to Drag and drop a file/folder in a folder with manager permissions', () => {
contentServicesPage.checkDragAndDropDIsDisplayed();
let dragAndDrop = new DropActions();
let dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
contentServicesPage.dragAndDropFile(emptyFile.location);
contentServicesPage.dragAndDropFolder(folder.location);
let fileInTheUploadedFolder = 'share_profile_pic.png';

View File

@@ -22,6 +22,7 @@ import { CreateFolderDialog } from './dialog/createFolderDialog';
import { CreateLibraryDialog } from './dialog/createLibraryDialog';
import { NavigationBarPage } from './navigationBarPage';
import { NodeActions } from '../../actions/ACS/node.actions';
import { DropActions } from '../../actions/drop.actions';
import { by, element, protractor, $$, browser } from 'protractor';
import path = require('path');
@@ -32,6 +33,7 @@ export class ContentServicesPage {
createFolderDialog = new CreateFolderDialog();
nodeActions = new NodeActions();
createLibraryDialog = new CreateLibraryDialog();
dragAndDropAction = new DropActions();
uploadBorder = element(by.id('document-list-container'));
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
contentServices = element(by.css('a[data-automation-id="Content Services"]'));
@@ -538,6 +540,16 @@ export class ContentServicesPage {
Util.waitUntilElementIsVisible(this.dragAndDrop);
}
dragAndDropFile(file) {
this.checkDragAndDropDIsDisplayed();
this.dragAndDropAction.dropFile(this.dragAndDrop, file);
}
dragAndDropFolder(folder) {
this.checkDragAndDropDIsDisplayed();
this.dragAndDropAction.dropFolder(this.dragAndDrop, folder);
}
checkLockIsDisplayedForElement(name) {
let lockButton = element(by.css(`div.adf-data-table-cell[filename="${name}"] button`));
Util.waitUntilElementIsVisible(lockButton);

View File

@@ -16,6 +16,7 @@
*/
import { Util } from '../../../util/util';
import { element, by, protractor, browser } from 'protractor';
export class UploadDialog {
@@ -24,7 +25,8 @@ export class UploadDialog {
minimizedDialog = element(by.css('div[class*="upload-dialog--minimized"]'));
uploadedStatusIcon = by.css('mat-icon[class*="status--done"]');
cancelledStatusIcon = by.css('div[class*="status--cancelled"]');
errorStatusIcon = by.css('div[class*="status--error"]');
errorStatusIcon = by.css('div[class*="status--error"] mat-icon');
errorTooltip = element(by.css('div.mat-tooltip'));
cancelWhileUploadingIcon = by.css('mat-icon[class*="adf-file-uploading-row__action adf-file-uploading-row__action--cancel"]');
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = element(by.css('span[class*="upload-dialog__title"]'));
@@ -185,4 +187,14 @@ export class UploadDialog {
return this;
}
displayTooltip() {
Util.waitUntilElementIsVisible(element(this.errorStatusIcon));
browser.actions().mouseMove(element(this.errorStatusIcon)).perform();
}
getTooltip() {
Util.waitUntilElementIsVisible(this.errorTooltip);
return this.errorTooltip.getText();
}
}