[ADF-3330] Create automated tests for Uploader component (#3581)

* Upload button e2e

* improve test organization

* add dev option in test run

* Create desktop.ini

* upload component automation final step

* remove fdescribe

* ignore downloads folder

* exclude pagination
This commit is contained in:
Eugenio Romano
2018-07-11 23:00:27 +01:00
committed by Eugenio Romano
parent ee8151d50d
commit fcaa033a57
33 changed files with 726 additions and 514 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ workspace.xml
.idea/ .idea/
dist/ dist/
e2e-output/ e2e-output/
e2e/downloads/
ng2-components/coverage/ ng2-components/coverage/
!systemjs.config.js !systemjs.config.js
demo-shell-ng2/app/components/router/ demo-shell-ng2/app/components/router/

View File

@@ -87,7 +87,7 @@ jobs:
if: tag =~ .*beta.* if: tag =~ .*beta.*
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-modeler-app script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-modeler-app
- stage: e2e Test - stage: e2e Test
script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -save script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev
- stage: Deploy PR - stage: Deploy PR
script: node ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1 script: node ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1

View File

@@ -572,7 +572,7 @@
</adf-upload-button> </adf-upload-button>
</div> </div>
<section> <section>
<mat-checkbox [(ngModel)]="enableUpload"> <mat-checkbox id="adf-disable-upload" [(ngModel)]="enableUpload">
{{'DOCUMENT_LIST.DESCRIPTION_UPLOAD' | translate}} {{'DOCUMENT_LIST.DESCRIPTION_UPLOAD' | translate}}
</mat-checkbox> </mat-checkbox>
</section> </section>

View File

@@ -0,0 +1,84 @@
import fs = require('fs');
import path = require('path');
import TestConfig = require('../test.config');
let JS_BIND_INPUT = function (target) {
let input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.addEventListener('change', function (event) {
target.scrollIntoView(true);
let rect = target.getBoundingClientRect();
let x = rect.left + (rect.width >> 1);
let y = rect.top + (rect.height >> 1);
let data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach(function (name) {
let mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
let JS_BIND_INPUT_FOLDER = function (target) {
let input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.multiple = 'multiple';
input.webkitdirectory = true;
input.addEventListener('change', function (event) {
target.scrollIntoView(true);
let rect = target.getBoundingClientRect();
let x = rect.left + (rect.width >> 1);
let y = rect.top + (rect.height >> 1);
let data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach(function (name) {
let mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
export class DropActions {
dropFile(dropArea, filePath) {
let absolutePath = path.resolve(path.join(TestConfig.main.rootPath, filePath));
fs.accessSync(absolutePath, fs.F_OK);
return dropArea.getWebElement().then((element) => {
browser.executeScript(JS_BIND_INPUT, element).then((input) => {
input.sendKeys(absolutePath);
});
});
}
dropFolder(dropArea, folderPath) {
let absolutePath = path.resolve(path.join(TestConfig.main.rootPath, folderPath));
fs.accessSync(absolutePath, fs.F_OK);
return dropArea.getWebElement().then((element) => {
browser.executeScript(JS_BIND_INPUT_FOLDER, element).then((input) => {
input.sendKeys(absolutePath);
});
});
}
}

View File

@@ -22,7 +22,7 @@ import TestConfig = require('./test.config');
import AcsUserModel = require('./models/ACS/acsUserModel'); import AcsUserModel = require('./models/ACS/acsUserModel');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Datatable component - selection', () => { describe('Datatable component - selection', () => {
let dataTablePage = new DataTablePage(); let dataTablePage = new DataTablePage();
let loginPage = new LoginPage(); let loginPage = new LoginPage();

View File

@@ -22,7 +22,7 @@ import TestConfig = require('./test.config.js');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Datatable component', () => { describe('Datatable component', () => {
let dataTablePage = new DataTablePage(); let dataTablePage = new DataTablePage();
let loginPage = new LoginPage(); let loginPage = new LoginPage();

View File

@@ -29,7 +29,7 @@ import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from './actions/ACS/upload.actions';
describe('Test DocumentList component', () => { describe('DocumentList component', () => {
let loginPage = new LoginPage(); let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage(); let contentServicesPage = new ContentServicesPage();

View File

@@ -29,7 +29,7 @@ import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from './actions/ACS/upload.actions';
describe('Test Document List - Pagination', function () { describe('Document List - Pagination', function () {
let pagination = { let pagination = {
base: 'newFile', base: 'newFile',
secondSetBase: 'secondSet', secondSetBase: 'secondSet',
@@ -256,7 +256,7 @@ describe('Test Document List - Pagination', function () {
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen); expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
}); });
it('[C91320] Pagination when the content is sorted', function () { xit('[C91320] Pagination when the content is sorted', function () {
contentServicesPage.goToDocumentList(); contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name); contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer(); contentServicesPage.checkAcsContainer();

View File

@@ -25,7 +25,7 @@ import AcsUserModel = require('./models/ACS/acsUserModel');
import AdfSettingsPage = require('./pages/adf/settingsPage'); import AdfSettingsPage = require('./pages/adf/settingsPage');
describe('Test Login component', () => { describe('Login component', () => {
let adfSettingsPage = new AdfSettingsPage(); let adfSettingsPage = new AdfSettingsPage();
let processServicesPage = new ProcessServicesPage(); let processServicesPage = new ProcessServicesPage();

View File

@@ -1,382 +0,0 @@
/*!
* @license
* Copyright 2016 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.
*/
var Page = require('astrolabe').Page;
var Util = require('../../../util/util');
/**
* Provides activiti
* @module pages
* @submodule share
* @class pages.share.LoginPage
*/
module.exports = Page.create({
/**
* Provides the task App
* @property taskApp
* @type protractor.Element
*/
taskApp: {
get: function () {
return element(by.cssContainingText("h1[class*='mdl-card__title-text']", "Task App"));
}
},
/**
* clicks the activiti option
* @property clickActiviti
* */
clickActiviti: {
value: function() {
var activitiButton = element(by.css("a[data-automation-id='activiti']"));
Util.waitUntilElementIsVisible(activitiButton);
activitiButton.click();
}
},
/**
* Provides the wait required for the page
* @property waitForElements
* @type protractor.Element
* */
waitForElements: {
value: function () {
Util.waitUntilElementIsVisible(this.taskApp);
Util.waitUntilElementIsVisible(element(by.css("i[class='material-icons']")));
}
},
/**
* Fills the username input
* @method enterUsername
* @param {String} username
*/
enterUsername: {
value: function (username) {
Util.waitUntilElementIsVisible(this.txtUsername);
this.txtUsername.clear();
this.txtUsername.sendKeys(username);
}
},
/**
* Fills the password input
* @method enterPassword
* @param {String} password
*/
enterPassword: {
value: function (password) {
Util.waitUntilElementIsVisible(this.txtPassword);
this.txtPassword.clear();
this.txtPassword.sendKeys(password);
}
},
/**
* Logs into adf
* @method login
* @param {String} username, {String} password
*/
login: {
value: function (username, password) {
this.waitForElements();
this.enterUsername(username);
this.enterPassword(password);
Util.waitUntilElementIsVisible(element(by.css("ol[data-automation-id='breadcrumb']")));
}
},
/**
* Logs out
* @method logout
*/
logout: {
value: function () {
var menuButton = element(by.css("button[data-automation-id='right-action-menu']"));
var logoutOption = element(by.cssContainingText("li[class*='mdl-menu__item'] > label", "Logout"));
Util.waitUntilElementIsVisible(menuButton);
menuButton.click();
Util.waitUntilElementIsVisible(logoutOption);
logoutOption.click();
this.waitForElements();
}
},
/**
* Enable ECM
* @method enableECM
*/
enableECM: {
value: function () {
Util.waitUntilElementIsVisible(this.ecmSwitch);
this.ecmSwitch.click();
Util.waitUntilElementIsVisible(element(by.css("label[class*='is-checked'][for='switch1']")));
element(by.css("label[class*='is-checked'][for='switch2']")).isPresent().then(function(check) {
if(check) {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers*='ALL']")));
}
else {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers='ECM']")));
}
});
}
},
/**
* Disable ECM
* @method enableECM
*/
disableECM: {
value: function () {
Util.waitUntilElementIsVisible(this.ecmSwitch);
this.ecmSwitch.click();
element(by.css("label[class*='is-checked'][for='switch2']")).isPresent().then(function(check) {
if(check) {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers*='BPM']")));
}
else {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers='']")));
}
});
}
},
/**
* Enable BPM
* @method enableBPM
*/
enableBPM: {
value: function () {
Util.waitUntilElementIsVisible(this.bpmSwitch);
this.bpmSwitch.click();
Util.waitUntilElementIsVisible(element(by.css("label[class*='is-checked'][for='switch2']")));
element(by.css("label[class*='is-checked'][for='switch1']")).isPresent().then(function(check) {
if(check) {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers*='ALL']")));
}
else {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers='BPM']")));
}
});
}
},
/**
* Disable BPM
* @method enableBPM
*/
disableBPM: {
value: function () {
Util.waitUntilElementIsVisible(this.bpmSwitch);
this.bpmSwitch.click();
element(by.css("label[class*='is-checked'][for='switch1']")).isPresent().then(function(check) {
if(check) {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers*='ECM']")));
}
else {
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-providers='']")));
}
});
}
},
/**
* Enable CSRF
* @method enableBPM
*/
enableCSRF: {
value: function () {
Util.waitUntilElementIsVisible(this.csrfSwitch);
this.csrfSwitch.click();
Util.waitUntilElementIsVisible(element(by.css("label[class*='is-checked'][for='switch3']")));
}
},
/**
* Disable BPM
* @method enableBPM
*/
disableBPM: {
value: function () {
Util.waitUntilElementIsVisible(this.bpmSwitch);
this.bpmSwitch.click();
Util.waitUntilElementIsVisible(element(by.css("alfresco-login[ng-reflect-disable-csrf='true']")));
}
},
/**
* clears the username input
* @method clearUsername
*/
clearUsername: {
value: function () {
Util.waitUntilElementIsVisible(this.txtUsername);
this.txtUsername.clear();
}
},
/**
* Check username tooltip
* @method checkUsernameTooltip
* @param {String} message
*/
checkUsernameTooltip: {
value: function (message) {
Util.waitUntilElementIsPresent(element(by.css("span[data-automation-id='username-error']")));
Util.waitUntilElementIsPresent(element(by.cssContainingText("span[data-automation-id='username-error']"), message));
}
},
/**
* Check username tooltip not visible
* @method checkUsernameTooltipNotVisible
*/
checkUsernameTooltipNotVisible: {
value: function () {
var error = "span[data-automation-id='username-error']";
Util.waitUntilElementIsNotVisible(element(by.css(error)));
}
},
/**
* Check sign in button disabled
* @method checkSignInButtonIsDisabled
*/
checkSignInButtonIsDisabled: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("button[data-automation-id='login-button'][ng-reflect-disabled='true']")));
}
},
/**
* Check sign in button enabled
* @method checkSignInButtonIsEnabled
*/
checkSignInButtonIsEnabled: {
value: function () {
Util.waitUntilElementIsNotVisible(element(by.css("button[data-automation-id='login-button'][ng-reflect-disabled='true']")));
}
},
/**
* Click sign in button
* @method clickSignInButton
*/
clickSignInButton: {
value: function () {
Util.waitUntilElementIsVisible(this.signInButton);
this.signInButton.click();
}
},
/**
* Check login error
* @method checkLoginError
* * @param {String} message
*/
checkLoginError: {
value: function (message) {
Util.waitUntilElementIsVisible(element(by.cssContainingText("div[data-automation-id='login-error']", message)));
}
},
/**
* Check password is hidden
* @method checkPasswordIsHidden
*/
checkPasswordIsHidden: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("input[data-automation-id='password'][type='password']")));
}
},
/**
* Click show password
* @method showPassword
*/
showPassword: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("i[data-automation-id='show_password']")));
element(by.css("i[data-automation-id='show_password']")).click();
}
},
/**
* Click hide password
* @method hidePassword
*/
hidePassword: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("i[data-automation-id='hide_password']")));
element(by.css("i[data-automation-id='hide_password']")).click();
}
},
/**
* Check password is shown
* @method checkPasswordIsShown
* @param {String} password
*/
checkPasswordIsShown: {
value: function (password) {
var passwordText = element(by.css("input[data-automation-id='password']"));
passwordText.getAttribute('value').then(function (text) {
expect(passwordText.getAttribute('value')).toEqual(password);
});
}
},
/**
* Check 'Remember' is displayed
* @method checkRememberIsDisplayed
*/
checkRememberIsDisplayed: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("span[id='login-remember']")));
}
},
/**
* Check 'Need Help' is displayed
* @method checkNeedHelpIsDisplayed
*/
checkNeedHelpIsDisplayed: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='login-action-help']")));
}
},
/**
* Check 'Register' is displayed
* @method checkRegisterDisplayed
*/
checkRegisterDisplayed: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='login-action-register']")));
}
},
});

View File

@@ -21,7 +21,7 @@ var CreateFolderDialog = require('./dialog/createFolderDialog');
var path = require('path'); var path = require('path');
var TestConfig = require('../../test.config'); var TestConfig = require('../../test.config');
var ContentServicesPage = function (){ var ContentServicesPage = function () {
var contentList = new ContentList(); var contentList = new ContentList();
var createFolderDialog = new CreateFolderDialog(); var createFolderDialog = new CreateFolderDialog();
@@ -40,17 +40,18 @@ var ContentServicesPage = function (){
var contentServicesURL = TestConfig.adf.url + TestConfig.adf.port + "/files"; var contentServicesURL = TestConfig.adf.url + TestConfig.adf.port + "/files";
var loadMoreButton = element(by.css("button[data-automation-id='adf-infinite-pagination-button']")); var loadMoreButton = element(by.css("button[data-automation-id='adf-infinite-pagination-button']"));
var emptyPagination = element(by.css("adf-pagination[class*='adf-pagination__empty']")); var emptyPagination = element(by.css("adf-pagination[class*='adf-pagination__empty']"));
var dragAndDrop = element(by.css("adf-upload-drag-area div"));
/** /**
* Check Document List is displayed * Check Document List is displayed
* @method checkAcsContainer * @method checkAcsContainer
*/ */
this.checkAcsContainer = function (){ this.checkAcsContainer = function () {
Util.waitUntilElementIsVisible(uploadBorder); Util.waitUntilElementIsVisible(uploadBorder);
return this; return this;
}; };
this.waitForTableBody = function (){ this.waitForTableBody = function () {
Util.waitUntilElementIsVisible(tableBody); Util.waitUntilElementIsVisible(tableBody);
}; };
@@ -58,14 +59,14 @@ var ContentServicesPage = function (){
* Go to Document List Page * Go to Document List Page
* @method goToDocumentList * @method goToDocumentList
* */ * */
this.goToDocumentList = function() { this.goToDocumentList = function () {
Util.waitUntilElementIsVisible(contentServices); Util.waitUntilElementIsVisible(contentServices);
Util.waitUntilElementIsClickable(contentServices); Util.waitUntilElementIsClickable(contentServices);
contentServices.click(); contentServices.click();
this.checkAcsContainer(); this.checkAcsContainer();
}; };
this.navigateToDocumentList = function() { this.navigateToDocumentList = function () {
browser.driver.get(contentServicesURL); browser.driver.get(contentServicesURL);
this.checkAcsContainer(); this.checkAcsContainer();
}; };
@@ -74,7 +75,7 @@ var ContentServicesPage = function (){
return contentList.getAllDisplayedRows(); return contentList.getAllDisplayedRows();
}; };
this.currentFolderName = function() { this.currentFolderName = function () {
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(currentFolder); Util.waitUntilElementIsVisible(currentFolder);
currentFolder.getText().then(function (result) { currentFolder.getText().then(function (result) {
@@ -88,7 +89,7 @@ var ContentServicesPage = function (){
}; };
this.getBreadcrumbTooltip = function (content) { this.getBreadcrumbTooltip = function (content) {
return element(by.css("nav[data-automation-id='breadcrumb'] div[title='" +content +"']")).getAttribute('title'); return element(by.css("nav[data-automation-id='breadcrumb'] div[title='" + content + "']")).getAttribute('title');
}; };
this.getAllRowsNameColumn = function () { this.getAllRowsNameColumn = function () {
@@ -130,7 +131,7 @@ var ContentServicesPage = function (){
this.sortAndCheckListIsOrderedByName = function (sortOrder) { this.sortAndCheckListIsOrderedByName = function (sortOrder) {
this.sortByName(sortOrder); this.sortByName(sortOrder);
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByNameColumn(sortOrder).then(function(result) { contentList.checkListIsOrderedByNameColumn(sortOrder).then(function (result) {
deferred.fulfill(result); deferred.fulfill(result);
}); });
return deferred.promise; return deferred.promise;
@@ -145,7 +146,7 @@ var ContentServicesPage = function (){
this.sortAndCheckListIsOrderedByAuthor = function (sortOrder) { this.sortAndCheckListIsOrderedByAuthor = function (sortOrder) {
this.sortByAuthor(sortOrder); this.sortByAuthor(sortOrder);
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByAuthorColumn(sortOrder).then(function(result) { contentList.checkListIsOrderedByAuthorColumn(sortOrder).then(function (result) {
deferred.fulfill(result); deferred.fulfill(result);
}); });
return deferred.promise; return deferred.promise;
@@ -160,7 +161,7 @@ var ContentServicesPage = function (){
this.sortAndCheckListIsOrderedByCreated = function (sortOrder) { this.sortAndCheckListIsOrderedByCreated = function (sortOrder) {
this.sortByCreated(sortOrder); this.sortByCreated(sortOrder);
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByCreatedColumn(sortOrder).then(function(result) { contentList.checkListIsOrderedByCreatedColumn(sortOrder).then(function (result) {
deferred.fulfill(result); deferred.fulfill(result);
}); });
return deferred.promise; return deferred.promise;
@@ -195,7 +196,7 @@ var ContentServicesPage = function (){
}; };
this.checkContentsAreDisplayed = function (content) { this.checkContentsAreDisplayed = function (content) {
for( i=0; i < content.length; i++) { for (i = 0; i < content.length; i++) {
this.checkContentIsDisplayed(content[i]); this.checkContentIsDisplayed(content[i]);
} }
return this; return this;
@@ -207,7 +208,7 @@ var ContentServicesPage = function (){
}; };
this.checkContentsAreNotDisplayed = function (content) { this.checkContentsAreNotDisplayed = function (content) {
for( i=0; i < content.length; i++) { for (i = 0; i < content.length; i++) {
this.checkContentIsNotDisplayed(content[i]); this.checkContentIsNotDisplayed(content[i]);
} }
return this; return this;
@@ -220,7 +221,7 @@ var ContentServicesPage = function (){
this.navigateToFolderViaBreadcrumbs = function (folder) { this.navigateToFolderViaBreadcrumbs = function (folder) {
contentList.tableIsLoaded(); contentList.tableIsLoaded();
var breadcrumb = element(by.css("a[data-automation-id='breadcrumb_"+ folder +"']")); var breadcrumb = element(by.css("a[data-automation-id='breadcrumb_" + folder + "']"));
Util.waitUntilElementIsVisible(breadcrumb); Util.waitUntilElementIsVisible(breadcrumb);
breadcrumb.click(); breadcrumb.click();
contentList.tableIsLoaded(); contentList.tableIsLoaded();
@@ -232,7 +233,7 @@ var ContentServicesPage = function (){
return activeBreadcrumb.getAttribute("title"); return activeBreadcrumb.getAttribute("title");
}; };
this.getCurrentFolderID = function() { this.getCurrentFolderID = function () {
Util.waitUntilElementIsVisible(folderID); Util.waitUntilElementIsVisible(folderID);
return folderID.getText(); return folderID.getText();
}; };
@@ -252,9 +253,10 @@ var ContentServicesPage = function (){
this.uploadMultipleFile = function (files) { this.uploadMultipleFile = function (files) {
Util.waitUntilElementIsVisible(uploadMultipleFileButton); Util.waitUntilElementIsVisible(uploadMultipleFileButton);
var allFiles = path.resolve(path.join(TestConfig.main.rootPath, files[0])); var allFiles = path.resolve(path.join(TestConfig.main.rootPath, files[0]));
for(var i =1; i< files.length; i++) { for (var i = 1; i < files.length; i++) {
allFiles = allFiles + "\n" + path.resolve(path.join(TestConfig.main.rootPath, files[i])); allFiles = allFiles + "\n" + path.resolve(path.join(TestConfig.main.rootPath, files[i]));
}; }
;
uploadMultipleFileButton.sendKeys(allFiles); uploadMultipleFileButton.sendKeys(allFiles);
Util.waitUntilElementIsVisible(uploadMultipleFileButton); Util.waitUntilElementIsVisible(uploadMultipleFileButton);
return this; return this;
@@ -288,23 +290,28 @@ var ContentServicesPage = function (){
return this; return this;
}; };
this.uploadButtonIsEnabled = function () {
return uploadFileButton.isEnabled()
};
this.deleteContent = function (content) { this.deleteContent = function (content) {
contentList.deleteContent(content); contentList.deleteContent(content);
return this; return this;
}; };
this.deleteContents = function (content) { this.deleteContents = function (content) {
for( i=0; i<content.length; i++) { for (i = 0; i < content.length; i++) {
this.deleteContent(content[i]); this.deleteContent(content[i]);
this.checkContentIsNotDisplayed(content[i]); this.checkContentIsNotDisplayed(content[i]);
}; }
;
return this; return this;
}; };
this.getErrorMessage = function() { this.getErrorMessage = function () {
Util.waitUntilElementIsVisible(errorSnackBar); Util.waitUntilElementIsVisible(errorSnackBar);
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
errorSnackBar.getText().then( function (text) { errorSnackBar.getText().then(function (text) {
deferred.fulfill(text); deferred.fulfill(text);
}); });
return deferred.promise; return deferred.promise;
@@ -328,10 +335,14 @@ var ContentServicesPage = function (){
return this; return this;
}; };
this.checkPaginationIsNotDisplayed = function (){ this.checkPaginationIsNotDisplayed = function () {
Util.waitUntilElementIsVisible(emptyPagination); Util.waitUntilElementIsVisible(emptyPagination);
}; };
this.checkDandDIsDisplayed = function () {
Util.waitUntilElementIsVisible(dragAndDrop);
};
}; };
module.exports = ContentServicesPage; module.exports = ContentServicesPage;

View File

@@ -277,7 +277,7 @@ var ContentList = function () {
}; };
this.checkContentIsNotDisplayed = function (content) { this.checkContentIsNotDisplayed = function (content) {
Util.waitUntilElementIsNotVisible(element(by.css("span[title='" + content + "']"))); Util.waitUntilElementIsNotVisible(element(by.css("adf-document-list span[title='" + content + "']")));
return this; return this;
}; };

View File

@@ -25,6 +25,7 @@ var UploadDialog = function () {
var minimizedDialog = element(by.css("div[class*='upload-dialog--minimized']")); var minimizedDialog = element(by.css("div[class*='upload-dialog--minimized']"));
var uploadedStatusIcon = by.css("mat-icon[class*='status--done']"); var uploadedStatusIcon = by.css("mat-icon[class*='status--done']");
var cancelledStatusIcon = by.css("div[class*='status--cancelled']"); var cancelledStatusIcon = by.css("div[class*='status--cancelled']");
var errorStatusIcon = by.css("div[class*='status--error']");
var cancelWhileUploadingIcon = by.css("mat-icon[class*='adf-file-uploading-row__action adf-file-uploading-row__action--cancel']"); var cancelWhileUploadingIcon = by.css("mat-icon[class*='adf-file-uploading-row__action adf-file-uploading-row__action--cancel']");
var rowByRowName = by.xpath("ancestor::adf-file-uploading-list-row"); var rowByRowName = by.xpath("ancestor::adf-file-uploading-list-row");
var title = element(by.css("span[class*='upload-dialog__title']")); var title = element(by.css("span[class*='upload-dialog__title']"));
@@ -78,6 +79,11 @@ var UploadDialog = function () {
return this; return this;
}; };
this.fileIsError = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content).element(errorStatusIcon));
return this;
};
this.filesAreUploaded = function (content) { this.filesAreUploaded = function (content) {
for (i=0; i<content.length; i++) { for (i=0; i<content.length; i++) {
this.fileIsUploaded(content[i]); this.fileIsUploaded(content[i]);

View File

@@ -27,6 +27,7 @@ var UploadToggles = function () {
var versioningToggle = element(by.cssContainingText("span[class*='toggle-content']", "Enable versioning")); var versioningToggle = element(by.cssContainingText("span[class*='toggle-content']", "Enable versioning"));
var extensionAcceptedField = element(by.css("input[data-automation-id='accepted-files-type']")); var extensionAcceptedField = element(by.css("input[data-automation-id='accepted-files-type']"));
var maxSizeField = element(by.css("input[data-automation-id='max-files-size']")); var maxSizeField = element(by.css("input[data-automation-id='max-files-size']"));
var disableUploadCheckbox = element(by.css("[id='adf-disable-upload']"));
this.enableMultipleFileUpload = function () { this.enableMultipleFileUpload = function () {
this.enableToggle(multipleFileUploadToggle); this.enableToggle(multipleFileUploadToggle);
@@ -78,6 +79,10 @@ var UploadToggles = function () {
return this; return this;
}; };
this.clickCheckboxDisableUpload = function () {
return disableUploadCheckbox.click();
};
this.enableToggle = function (toggle) { this.enableToggle = function (toggle) {
Util.waitUntilElementIsVisible(toggle); Util.waitUntilElementIsVisible(toggle);
Util.waitUntilElementIsPresent(toggle); Util.waitUntilElementIsPresent(toggle);

View File

@@ -19,7 +19,7 @@ var Util = require('../../util/util');
var TestConfig = require('../../test.config'); var TestConfig = require('../../test.config');
var AdfSettingsPage = require('./settingsPage'); var AdfSettingsPage = require('./settingsPage');
var LoginPage = function (){ var LoginPage = function () {
var loginURL = TestConfig.adf.url + TestConfig.adf.port + "/login"; var loginURL = TestConfig.adf.url + TestConfig.adf.port + "/login";
var txtUsername = element(by.css("input[id='username']")); var txtUsername = element(by.css("input[id='username']"));
@@ -48,13 +48,13 @@ var LoginPage = function (){
* @property waitForElements * @property waitForElements
* @type protractor.Element * @type protractor.Element
* */ * */
this.waitForElements = function (){ this.waitForElements = function () {
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(txtUsername).then(()=>{ Util.waitUntilElementIsVisible(txtUsername).then(() => {
Util.waitUntilElementIsVisible(txtPassword).then(()=>{ Util.waitUntilElementIsVisible(txtPassword).then(() => {
deferred.fulfill(); deferred.fulfill();
},()=>{ }, () => {
deferred.rejected(); deferred.rejected();
}) })
}); });
@@ -68,7 +68,7 @@ var LoginPage = function (){
* @method enterUsername * @method enterUsername
* @param {String} username * @param {String} username
*/ */
this.enterUsername = function (username){ this.enterUsername = function (username) {
Util.waitUntilElementIsVisible(txtUsername); Util.waitUntilElementIsVisible(txtUsername);
txtUsername.sendKeys(''); txtUsername.sendKeys('');
txtUsername.clear(); txtUsername.clear();
@@ -81,7 +81,7 @@ var LoginPage = function (){
* @method enterPassword * @method enterPassword
* @param {String} password * @param {String} password
*/ */
this.enterPassword = function (password){ this.enterPassword = function (password) {
Util.waitUntilElementIsVisible(txtPassword); Util.waitUntilElementIsVisible(txtPassword);
browser.driver.sleep(500); browser.driver.sleep(500);
txtPassword.clear(); txtPassword.clear();
@@ -93,7 +93,7 @@ var LoginPage = function (){
* @method clearUsername * @method clearUsername
* @param {String} username * @param {String} username
*/ */
this.clearUsername = function(){ this.clearUsername = function () {
Util.waitUntilElementIsVisible(txtUsername); Util.waitUntilElementIsVisible(txtUsername);
txtUsername.click().clear(); txtUsername.click().clear();
}; };
@@ -103,9 +103,9 @@ var LoginPage = function (){
* @method clearPassword * @method clearPassword
* @param {String} password * @param {String} password
*/ */
this.clearPassword = function (){ this.clearPassword = function () {
Util.waitUntilElementIsVisible(txtPassword); Util.waitUntilElementIsVisible(txtPassword);
txtPassword.getAttribute('value').then(function (value){ txtPassword.getAttribute('value').then(function (value) {
for (var i = value.length; i >= 0; i--) { for (var i = value.length; i >= 0; i--) {
txtPassword.sendKeys(protractor.Key.BACK_SPACE); txtPassword.sendKeys(protractor.Key.BACK_SPACE);
} }
@@ -117,7 +117,7 @@ var LoginPage = function (){
* @method checkUsernameTooltip * @method checkUsernameTooltip
* @param {String} message * @param {String} message
*/ */
this.checkUsernameTooltip = function (message){ this.checkUsernameTooltip = function (message) {
Util.waitUntilElementIsVisible(usernameTooltip); Util.waitUntilElementIsVisible(usernameTooltip);
}; };
@@ -126,7 +126,7 @@ var LoginPage = function (){
* @method checkPasswordTooltip * @method checkPasswordTooltip
* @param {String} message * @param {String} message
*/ */
this.checkPasswordTooltip = function (message){ this.checkPasswordTooltip = function (message) {
Util.waitUntilElementIsVisible(passwordTooltip); Util.waitUntilElementIsVisible(passwordTooltip);
}; };
@@ -135,7 +135,7 @@ var LoginPage = function (){
* @method checkLoginError * @method checkLoginError
* @param {String} message * @param {String} message
*/ */
this.checkLoginError = function (message){ this.checkLoginError = function (message) {
Util.waitUntilElementIsVisible(loginTooltip); Util.waitUntilElementIsVisible(loginTooltip);
expect(loginTooltip.getText()).toEqual(message); expect(loginTooltip.getText()).toEqual(message);
}; };
@@ -144,7 +144,7 @@ var LoginPage = function (){
* checks username field is inactive * checks username field is inactive
* @method checkUsernameInactive * @method checkUsernameInactive
*/ */
this.checkUsernameInactive = function (){ this.checkUsernameInactive = function () {
Util.waitUntilElementIsVisible(usernameInactive); Util.waitUntilElementIsVisible(usernameInactive);
}, },
@@ -152,7 +152,7 @@ var LoginPage = function (){
* checks password field is inactive * checks password field is inactive
* @method checkPasswordInactive * @method checkPasswordInactive
*/ */
this.checkPasswordInactive = function (){ this.checkPasswordInactive = function () {
Util.waitUntilElementIsVisible(passwordInactive); Util.waitUntilElementIsVisible(passwordInactive);
}; };
@@ -160,7 +160,7 @@ var LoginPage = function (){
* checks username field is highlighted * checks username field is highlighted
* @method checkUsernameHighlighted * @method checkUsernameHighlighted
*/ */
this.checkUsernameHighlighted = function (){ this.checkUsernameHighlighted = function () {
adfLogo.click(); adfLogo.click();
Util.waitUntilElementIsVisible(usernameHighlighted); Util.waitUntilElementIsVisible(usernameHighlighted);
}; };
@@ -169,7 +169,7 @@ var LoginPage = function (){
* checks password field is highlighted * checks password field is highlighted
* @method checkPasswordHighlighted * @method checkPasswordHighlighted
*/ */
this.checkPasswordHighlighted = function (){ this.checkPasswordHighlighted = function () {
adfLogo.click(); adfLogo.click();
Util.waitUntilElementIsVisible(passwordHighlighted); Util.waitUntilElementIsVisible(passwordHighlighted);
}; };
@@ -178,7 +178,7 @@ var LoginPage = function (){
* check Username tooltip is not visible * check Username tooltip is not visible
* @method checkUsernameTooltipIsNotVisible * @method checkUsernameTooltipIsNotVisible
*/ */
this.checkUsernameTooltipIsNotVisible = function (){ this.checkUsernameTooltipIsNotVisible = function () {
Util.waitUntilElementIsNotVisible(usernameTooltip); Util.waitUntilElementIsNotVisible(usernameTooltip);
}; };
@@ -186,7 +186,7 @@ var LoginPage = function (){
* checks password tooltip is not visible * checks password tooltip is not visible
* @method checkPasswordTooltipIsNotVisible * @method checkPasswordTooltipIsNotVisible
*/ */
this.checkPasswordTooltipIsNotVisible = function (){ this.checkPasswordTooltipIsNotVisible = function () {
Util.waitUntilElementIsNotVisible(passwordTooltip); Util.waitUntilElementIsNotVisible(passwordTooltip);
}; };
@@ -194,7 +194,7 @@ var LoginPage = function (){
* checks sign in button is enabled * checks sign in button is enabled
* @method checkSignInButtonIsEnabled * @method checkSignInButtonIsEnabled
*/ */
this.checkSignInButtonIsEnabled = function (){ this.checkSignInButtonIsEnabled = function () {
Util.waitUntilElementIsVisible(signInButton); Util.waitUntilElementIsVisible(signInButton);
expect(signInButton.isEnabled()).toBe(true); expect(signInButton.isEnabled()).toBe(true);
}; };
@@ -203,7 +203,7 @@ var LoginPage = function (){
* Logs into adf using default host config * Logs into adf using default host config
* @method defaultLogin * @method defaultLogin
*/ */
this.defaultLogin = function (){ this.defaultLogin = function () {
browser.driver.get(TestConfig.adf.url + TestConfig.adf.login); browser.driver.get(TestConfig.adf.url + TestConfig.adf.login);
this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
}; };
@@ -212,7 +212,7 @@ var LoginPage = function (){
* Logs into adf using userModel * Logs into adf using userModel
* @method loginUsingUserModel * @method loginUsingUserModel
*/ */
this.loginUsingUserModel = function (userModel){ this.loginUsingUserModel = function (userModel) {
browser.driver.get(TestConfig.adf.url + TestConfig.adf.login); browser.driver.get(TestConfig.adf.url + TestConfig.adf.login);
this.waitForElements(); this.waitForElements();
this.login(userModel.getId(), userModel.getPassword()); this.login(userModel.getId(), userModel.getPassword());
@@ -222,14 +222,14 @@ var LoginPage = function (){
* Logs into ADF using userModel - only Process Services enabled * Logs into ADF using userModel - only Process Services enabled
* @method loginUsingUserModel * @method loginUsingUserModel
*/ */
this.loginToProcessServicesUsingUserModel = function (userModel){ this.loginToProcessServicesUsingUserModel = function (userModel) {
adfSettingsPage.setProviderBpm(); adfSettingsPage.setProviderBpm();
this.waitForElements(); this.waitForElements();
this.login(userModel.email, userModel.password); this.login(userModel.email, userModel.password);
}; };
this.loginToProcessServicesUsingDefaultUser = function (){ this.loginToProcessServicesUsingDefaultUser = function () {
adfSettingsPage.setProviderBpm(); adfSettingsPage.setProviderBpm();
this.waitForElements(); this.waitForElements();
this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
@@ -242,19 +242,26 @@ var LoginPage = function (){
this.login(userModel.getId(), userModel.getPassword()); this.login(userModel.getId(), userModel.getPassword());
}; };
this.loginToContentServices = function (username, password) {
adfSettingsPage.setProviderEcm();
this.waitForElements();
this.login(username, password);
};
/** /**
* Go to adf login page * Go to adf login page
* @method goToLoginPage * @method goToLoginPage
*/ */
this.goToLoginPage = function (){ this.goToLoginPage = function () {
browser.driver.get(TestConfig.adf.url + TestConfig.adf.port+'/login'); browser.driver.get(TestConfig.adf.url + TestConfig.adf.port + '/login');
}; };
/** /**
* checks sign in button is disabled * checks sign in button is disabled
* @method checkSignInButtonIsDisabled * @method checkSignInButtonIsDisabled
*/ */
this.checkSignInButtonIsDisabled = function (){ this.checkSignInButtonIsDisabled = function () {
Util.waitUntilElementIsVisible(signInButton); Util.waitUntilElementIsVisible(signInButton);
expect(signInButton.isEnabled()).toBe(false); expect(signInButton.isEnabled()).toBe(false);
}; };
@@ -263,7 +270,7 @@ var LoginPage = function (){
* clicks the sign in button * clicks the sign in button
* @method clickSignInButton * @method clickSignInButton
*/ */
this.clickSignInButton = function (){ this.clickSignInButton = function () {
Util.waitUntilElementIsVisible(signInButton); Util.waitUntilElementIsVisible(signInButton);
signInButton.click(); signInButton.click();
}; };
@@ -272,12 +279,12 @@ var LoginPage = function (){
* clicks icon to show password * clicks icon to show password
* @method showPassword * @method showPassword
*/ */
this.showPassword = function (){ this.showPassword = function () {
Util.waitUntilElementIsVisible(showPassword); Util.waitUntilElementIsVisible(showPassword);
showPassword.click(); showPassword.click();
}; };
this.getShowPasswordIconColor = function (){ this.getShowPasswordIconColor = function () {
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(showPassword); Util.waitUntilElementIsVisible(showPassword);
@@ -288,7 +295,7 @@ var LoginPage = function (){
return deferred.promise; return deferred.promise;
}; };
this.getSignInButtonColor = function (){ this.getSignInButtonColor = function () {
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(signInButton); Util.waitUntilElementIsVisible(signInButton);
@@ -299,7 +306,7 @@ var LoginPage = function (){
return deferred.promise; return deferred.promise;
}; };
this.getBackgroundColor = function (){ this.getBackgroundColor = function () {
var deferred = protractor.promise.defer(); var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(cardBackground); Util.waitUntilElementIsVisible(cardBackground);
@@ -314,7 +321,7 @@ var LoginPage = function (){
* clicks icon to hide password * clicks icon to hide password
* @method hidePassword * @method hidePassword
*/ */
this.hidePassword = function (){ this.hidePassword = function () {
Util.waitUntilElementIsVisible(hidePassword); Util.waitUntilElementIsVisible(hidePassword);
hidePassword.click(); hidePassword.click();
}; };
@@ -324,7 +331,7 @@ var LoginPage = function (){
* @method checkPasswordIsShown * @method checkPasswordIsShown
* @param password * @param password
*/ */
this.checkPasswordIsShown = function (password){ this.checkPasswordIsShown = function (password) {
txtPassword.getAttribute('value').then(function (text) { txtPassword.getAttribute('value').then(function (text) {
expect(text).toEqual(password); expect(text).toEqual(password);
}); });
@@ -334,7 +341,7 @@ var LoginPage = function (){
* checks if password is hidden * checks if password is hidden
* @method checkPasswordIsHidden * @method checkPasswordIsHidden
*/ */
this.checkPasswordIsHidden = function (){ this.checkPasswordIsHidden = function () {
Util.waitUntilElementIsVisible(txtPassword); Util.waitUntilElementIsVisible(txtPassword);
}; };
@@ -342,7 +349,7 @@ var LoginPage = function (){
* checks 'Remember me' is displayed * checks 'Remember me' is displayed
* @method checkRememberIsDisplayed * @method checkRememberIsDisplayed
*/ */
this.checkRememberIsDisplayed = function (){ this.checkRememberIsDisplayed = function () {
Util.waitUntilElementIsVisible(rememberMe); Util.waitUntilElementIsVisible(rememberMe);
}; };
@@ -350,7 +357,7 @@ var LoginPage = function (){
* checks 'Remember me' is not displayed * checks 'Remember me' is not displayed
* @method checkRememberIsNotDisplayed * @method checkRememberIsNotDisplayed
*/ */
this.checkRememberIsNotDisplayed = function (){ this.checkRememberIsNotDisplayed = function () {
Util.waitUntilElementIsNotVisible(rememberMe); Util.waitUntilElementIsNotVisible(rememberMe);
}; };
@@ -358,7 +365,7 @@ var LoginPage = function (){
* checks 'Need help' is Displayed * checks 'Need help' is Displayed
* @method checkNeedHelpIsDisplayed * @method checkNeedHelpIsDisplayed
*/ */
this.checkNeedHelpIsDisplayed = function (){ this.checkNeedHelpIsDisplayed = function () {
Util.waitUntilElementIsVisible(needHelp); Util.waitUntilElementIsVisible(needHelp);
}; };
@@ -366,7 +373,7 @@ var LoginPage = function (){
* checks 'Need Help' is not displayed * checks 'Need Help' is not displayed
* @method checkNeedHelpIsNotDisplayed * @method checkNeedHelpIsNotDisplayed
*/ */
this.checkNeedHelpIsNotDisplayed = function (){ this.checkNeedHelpIsNotDisplayed = function () {
Util.waitUntilElementIsNotVisible(needHelp); Util.waitUntilElementIsNotVisible(needHelp);
}; };
@@ -374,7 +381,7 @@ var LoginPage = function (){
* checks 'Register' is displayed * checks 'Register' is displayed
* @method checkRegisterDisplayed * @method checkRegisterDisplayed
*/ */
this.checkRegisterDisplayed = function (){ this.checkRegisterDisplayed = function () {
Util.waitUntilElementIsVisible(register); Util.waitUntilElementIsVisible(register);
}; };
@@ -382,7 +389,7 @@ var LoginPage = function (){
* checks 'Register' is not displayed * checks 'Register' is not displayed
* @method checkRegisterIsNotDisplayed * @method checkRegisterIsNotDisplayed
*/ */
this.checkRegisterIsNotDisplayed = function (){ this.checkRegisterIsNotDisplayed = function () {
Util.waitUntilElementIsNotVisible(register); Util.waitUntilElementIsNotVisible(register);
}; };
@@ -390,10 +397,10 @@ var LoginPage = function (){
* enables footer switch * enables footer switch
* @method enableFooter * @method enableFooter
*/ */
this.enableFooter = function (){ this.enableFooter = function () {
Util.waitUntilElementIsVisible(footerSwitch); Util.waitUntilElementIsVisible(footerSwitch);
footerSwitch.getAttribute('class').then(function (check) { footerSwitch.getAttribute('class').then(function (check) {
if (check === 'mat-slide-toggle mat-primary'){ if (check === 'mat-slide-toggle mat-primary') {
footerSwitch.click(); footerSwitch.click();
expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked');
} }
@@ -404,10 +411,10 @@ var LoginPage = function (){
* disables footer switch * disables footer switch
* @method disableFooter * @method disableFooter
*/ */
this.disableFooter = function (){ this.disableFooter = function () {
Util.waitUntilElementIsVisible(footerSwitch); Util.waitUntilElementIsVisible(footerSwitch);
footerSwitch.getAttribute('class').then(function (check) { footerSwitch.getAttribute('class').then(function (check) {
if (check ==='mat-slide-toggle mat-primary mat-checked'){ if (check === 'mat-slide-toggle mat-primary mat-checked') {
footerSwitch.click(); footerSwitch.click();
expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary');
} }

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright 2016 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.
*/
var Util = require('../../util/util');
var NotificationPage = function () {
this.checkNotifyContains = function (message) {
Util.waitUntilElementIsVisible(element(by.cssContainingText('simple-snack-bar', message)));
return this;
};
};
module.exports = NotificationPage;

View File

@@ -28,7 +28,7 @@ import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions'; import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions'; import { UsersActions } from './actions/users.actions';
describe('Test Process List - Pagination when adding processes', () => { describe('Process List - Pagination when adding processes', () => {
let itemsPerPage = { let itemsPerPage = {
fifteen: '15', fifteen: '15',

View File

@@ -31,7 +31,7 @@ import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions'; import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions'; import { UsersActions } from './actions/users.actions';
describe('Test Process List - Pagination', function () { describe('Process List - Pagination', function () {
let itemsPerPage = { let itemsPerPage = {
five: '5', five: '5',

View File

@@ -0,0 +1 @@
example file

View File

View File

@@ -32,7 +32,7 @@ import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from './actions/ACS/upload.actions';
describe('Test Search component - Search Bar', () => { describe('Search component - Search Bar', () => {
let search = { let search = {
inactive: { inactive: {

View File

@@ -32,7 +32,7 @@ import resources = require('./util/resources');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from './actions/ACS/upload.actions';
describe('Test Search component - Search Page', () => { describe('Search component - Search Page', () => {
let search = { let search = {
active: { active: {
base: Util.generateRandomString(3), base: Util.generateRandomString(3),

View File

@@ -25,7 +25,7 @@ import CONSTANTS = require('./util/constants');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Theming component', () => { describe('Theming component', () => {
let navigationBarPage = new NavigationBarPage(); let navigationBarPage = new NavigationBarPage();
let loginPage = new LoginPage(); let loginPage = new LoginPage();

View File

@@ -0,0 +1,109 @@
/*!
* @license
* Copyright 2016 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 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 AcsUserModel = require('../models/ACS/acsUserModel');
import FileModel = require('../models/ACS/fileModel');
import FolderModel = require('../models/ACS/folderModel');
import TestConfig = require('../test.config');
import resources = require('../util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../actions/ACS/upload.actions';
import { DropActions } from '../actions/drop.actions';
import path = require('path');
describe('Upload component - Excluded Files', () => {
let contentServicesPage = new ContentServicesPage();
let uploadDialog = new UploadDialog();
let uploadToggles = new UploadToggles();
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
let iniExcludedFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.INI.file_name,
'location': resources.Files.ADF_DOCUMENTS.INI.file_location
});
let folderWithExcludedFile = new FolderModel({
'name': resources.Files.ADF_DOCUMENTS.FOLDER_EXCLUDED.folder_name,
'location': resources.Files.ADF_DOCUMENTS.FOLDER_EXCLUDED.folder_location
});
let emptyFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
beforeAll(async (done) => {
let uploadActions = new UploadActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
done();
});
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 dragAndDrop = new DropActions();
dragAndDrop.dropFile(dragAndDropArea, iniExcludedFile.location);
browser.driver.sleep(2000);
uploadDialog.dialogIsNotDisplayed();
contentServicesPage.checkContentIsNotDisplayed(iniExcludedFile.name);
});
it('[C260122] Should not allow upload default excluded files using Upload button', () => {
contentServicesPage
.uploadFile(iniExcludedFile.location)
.checkContentIsNotDisplayed(iniExcludedFile.name);
});
it('[C260125] Should not upload excluded file when they are in a Folder', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderWithExcludedFile.location).checkContentIsDisplayed(folderWithExcludedFile.name);
contentServicesPage.doubleClickRow(folderWithExcludedFile.name).checkContentIsNotDisplayed(iniExcludedFile.name).checkContentIsDisplayed('a_file.txt');
});
});

View File

@@ -15,22 +15,23 @@
* limitations under the License. * limitations under the License.
*/ */
import LoginPage = require('./pages/adf/loginPage'); import LoginPage = require('../pages/adf/loginPage');
import ContentServicesPage = require('./pages/adf/contentServicesPage'); import ContentServicesPage = require('../pages/adf/contentServicesPage');
import UploadDialog = require('./pages/adf/dialog/uploadDialog'); import UploadDialog = require('../pages/adf/dialog/uploadDialog');
import UploadToggles = require('./pages/adf/dialog/uploadToggles'); import UploadToggles = require('../pages/adf/dialog/uploadToggles');
import AcsUserModel = require('./models/ACS/acsUserModel'); import AcsUserModel = require('../models/ACS/acsUserModel');
import FileModel = require('./models/ACS/fileModel'); import FileModel = require('../models/ACS/fileModel');
import FolderModel = require('./models/ACS/folderModel'); import FolderModel = require('../models/ACS/folderModel');
import TestConfig = require('./test.config'); import TestConfig = require('../test.config');
import resources = require('./util/resources'); import resources = require('../util/resources');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from '../actions/ACS/upload.actions';
import { DropActions } from '../actions/drop.actions';
describe('Test Uploader component', () => { describe('Upload component', () => {
let contentServicesPage = new ContentServicesPage(); let contentServicesPage = new ContentServicesPage();
let uploadDialog = new UploadDialog(); let uploadDialog = new UploadDialog();
@@ -70,7 +71,12 @@ describe('Test Uploader component', () => {
'name': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_name, 'name': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_name,
'location': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_location 'location': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_location
}); });
let folderTwo = new FolderModel({
'name': resources.Files.ADF_DOCUMENTS.FOLDER_TWO.folder_name,
'location': resources.Files.ADF_DOCUMENTS.FOLDER_TWO.folder_location
});
let uploadedFileInFolder = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.FILE_INSIDE_FOLDER_ONE.file_name }); let uploadedFileInFolder = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.FILE_INSIDE_FOLDER_ONE.file_name });
let uploadedFileInFolderTwo = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.FILE_INSIDE_FOLDER_TWO.file_name });
let filesLocation = [pdfFileModel.location, docxFileModel.location, pngFileModel.location, firstPdfFileModel.location]; let filesLocation = [pdfFileModel.location, docxFileModel.location, pngFileModel.location, firstPdfFileModel.location];
let filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name]; let filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name];
@@ -99,7 +105,7 @@ describe('Test Uploader component', () => {
done(); done();
}); });
it('1. Upload Button is visible on the page', () => { it('[C272788] Upload Button is visible on the page', () => {
expect(contentServicesPage.getSingleFileButtonTooltip()).toEqual('Custom tooltip'); expect(contentServicesPage.getSingleFileButtonTooltip()).toEqual('Custom tooltip');
contentServicesPage contentServicesPage
@@ -111,7 +117,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pdfFileModel.name); .checkContentIsNotDisplayed(pdfFileModel.name);
}); });
it('2. Upload a pdf file', () => { it('[C272789] Upload a pdf file', () => {
contentServicesPage contentServicesPage
.uploadFile(pdfFileModel.location) .uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name); .checkContentIsDisplayed(pdfFileModel.name);
@@ -125,7 +131,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pdfFileModel.name); .checkContentIsNotDisplayed(pdfFileModel.name);
}); });
it('3. Upload a text file', () => { it('[C272790] Upload a text file', () => {
contentServicesPage contentServicesPage
.uploadFile(docxFileModel.location) .uploadFile(docxFileModel.location)
.checkContentIsDisplayed(docxFileModel.name); .checkContentIsDisplayed(docxFileModel.name);
@@ -138,7 +144,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(docxFileModel.name); .checkContentIsNotDisplayed(docxFileModel.name);
}); });
it('4. Upload a png file', () => { it('[C260141] Upload a png file', () => {
contentServicesPage contentServicesPage
.uploadFile(pngFileModel.location) .uploadFile(pngFileModel.location)
.checkContentIsDisplayed(pngFileModel.name); .checkContentIsDisplayed(pngFileModel.name);
@@ -151,7 +157,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pngFileModel.name); .checkContentIsNotDisplayed(pngFileModel.name);
}); });
it('5. Minimize and maximize the upload dialog box', () => { it('[C260143] Minimize and maximize the upload dialog box', () => {
contentServicesPage contentServicesPage
.uploadFile(docxFileModel.location) .uploadFile(docxFileModel.location)
.checkContentIsDisplayed(docxFileModel.name); .checkContentIsDisplayed(docxFileModel.name);
@@ -172,7 +178,7 @@ describe('Test Uploader component', () => {
contentServicesPage.deleteContent(docxFileModel.name).checkContentIsNotDisplayed(docxFileModel.name); contentServicesPage.deleteContent(docxFileModel.name).checkContentIsNotDisplayed(docxFileModel.name);
}); });
it('6. Cancel the uploaded file through the upload dialog icon', () => { it('[C260168] Cancel the uploaded file through the upload dialog icon', () => {
contentServicesPage.uploadFile(pdfFileModel.location) contentServicesPage.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name); .checkContentIsDisplayed(pdfFileModel.name);
uploadDialog.removeUploadedFile(pdfFileModel.name).fileIsCancelled(pdfFileModel.name); uploadDialog.removeUploadedFile(pdfFileModel.name).fileIsCancelled(pdfFileModel.name);
@@ -181,7 +187,7 @@ describe('Test Uploader component', () => {
contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.name); contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.name);
}); });
xit('7. 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', () => {
contentServicesPage.uploadFile(largeFile.location); contentServicesPage.uploadFile(largeFile.location);
uploadDialog.removeFileWhileUploading(largeFile.name).fileIsCancelled(largeFile.name); uploadDialog.removeFileWhileUploading(largeFile.name).fileIsCancelled(largeFile.name);
@@ -191,7 +197,7 @@ describe('Test Uploader component', () => {
contentServicesPage.checkContentIsNotDisplayed(largeFile.name); contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
}); });
xit('8. Cancel a big file through the cancel uploads button', () => { xit('[C260169] Cancel a big file through the cancel uploads button', () => {
contentServicesPage.uploadFile(largeFile.location); contentServicesPage.uploadFile(largeFile.location);
uploadDialog.cancelUploads(); uploadDialog.cancelUploads();
expect(uploadDialog.getTitleText()).toEqual('Uploading 0 / 1'); expect(uploadDialog.getTitleText()).toEqual('Uploading 0 / 1');
@@ -203,7 +209,7 @@ describe('Test Uploader component', () => {
contentServicesPage.checkContentIsNotDisplayed(largeFile.name); contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
}); });
xit('9. Cancel uploading multiple files', () => { xit('[C272793] Cancel uploading multiple files', () => {
uploadToggles.enableMultipleFileUpload(); uploadToggles.enableMultipleFileUpload();
contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]); contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]);
uploadDialog.cancelUploads(); uploadDialog.cancelUploads();
@@ -216,13 +222,13 @@ describe('Test Uploader component', () => {
uploadToggles.disableMultipleFileUpload(); uploadToggles.disableMultipleFileUpload();
}); });
it('10. Tooltip of uploading multiple files button', () => { it('[C272794] Tooltip of uploading multiple files button', () => {
uploadToggles.enableMultipleFileUpload(); uploadToggles.enableMultipleFileUpload();
expect(contentServicesPage.getMultipleFileButtonTooltip()).toEqual('Custom tooltip'); expect(contentServicesPage.getMultipleFileButtonTooltip()).toEqual('Custom tooltip');
uploadToggles.disableMultipleFileUpload(); uploadToggles.disableMultipleFileUpload();
}); });
it('11. Enable extension filter', () => { it('[C260171] Should upload only the extension filter allowed when Enable extension filter is enabled', () => {
uploadToggles.enableExtensionFilter().addExtension('.docx'); uploadToggles.enableExtensionFilter().addExtension('.docx');
contentServicesPage.uploadFile(docxFileModel.location).checkContentIsDisplayed(docxFileModel.name); contentServicesPage.uploadFile(docxFileModel.location).checkContentIsDisplayed(docxFileModel.name);
uploadDialog.removeUploadedFile(docxFileModel.name).fileIsCancelled(docxFileModel.name); uploadDialog.removeUploadedFile(docxFileModel.name).fileIsCancelled(docxFileModel.name);
@@ -232,7 +238,25 @@ describe('Test Uploader component', () => {
uploadToggles.disableExtensionFilter(); uploadToggles.disableExtensionFilter();
}); });
it('12. Upload same file twice', () => { it('[C274687] Should upload with drag and drop only the extension filter allowed when Enable extension filter is enabled', () => {
uploadToggles.enableExtensionFilter().addExtension('.docx');
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
dragAndDrop.dropFile(dragAndDropArea, docxFileModel.location);
contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
uploadDialog.removeUploadedFile(docxFileModel.name).fileIsCancelled(docxFileModel.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
dragAndDrop.dropFile(dragAndDropArea, largeFile.location);
contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
uploadDialog.dialogIsNotDisplayed();
uploadToggles.disableExtensionFilter();
});
it('[C279920] Upload same file twice', () => {
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name); contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1'); pdfFileModel.setVersion('1');
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.getVersionName()); contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.getVersionName());
@@ -242,7 +266,7 @@ describe('Test Uploader component', () => {
pdfFileModel.setVersion(''); pdfFileModel.setVersion('');
}); });
it('13. Enable versioning', () => { it('[C260172] Enable versioning', () => {
uploadToggles.enableVersioning(); uploadToggles.enableVersioning();
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name); contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1'); pdfFileModel.setVersion('1');
@@ -255,7 +279,7 @@ describe('Test Uploader component', () => {
uploadToggles.disableVersioning(); uploadToggles.disableVersioning();
}); });
xit('14. Enable folder upload', () => { xit('[C260173] Enable folder upload', () => {
uploadToggles.enableFolderUpload(); uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderOne.location).checkContentIsDisplayed(folderOne.name); contentServicesPage.uploadFolder(folderOne.location).checkContentIsDisplayed(folderOne.name);
expect(contentServicesPage.getFolderButtonTooltip()).toEqual('Custom tooltip'); expect(contentServicesPage.getFolderButtonTooltip()).toEqual('Custom tooltip');
@@ -266,7 +290,7 @@ describe('Test Uploader component', () => {
uploadToggles.disableFolderUpload(); uploadToggles.disableFolderUpload();
}); });
xit('16. The files uploaded before closing the upload dialog box are not displayed anymore in the upload box', () => { xit('[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(docxFileModel.location).checkContentIsDisplayed(docxFileModel.name);
uploadDialog.fileIsUploaded(docxFileModel.name); uploadDialog.fileIsUploaded(docxFileModel.name);
@@ -285,7 +309,7 @@ describe('Test Uploader component', () => {
.checkContentsAreNotDisplayed([docxFileModel.name, pngFileModel.name, pdfFileModel.name]); .checkContentsAreNotDisplayed([docxFileModel.name, pngFileModel.name, pdfFileModel.name]);
}); });
xit('18. Upload files on the same time', () => { xit('[C260170] Upload files on the same time', () => {
contentServicesPage.goToDocumentList(); contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer(); contentServicesPage.checkAcsContainer();
@@ -304,7 +328,7 @@ describe('Test Uploader component', () => {
uploadToggles.disableMultipleFileUpload(); uploadToggles.disableMultipleFileUpload();
}); });
xit('19. Enable max size and set it to 400', () => { xit('[C279919] Enable max size and set it to 400', () => {
contentServicesPage.goToDocumentList(); contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer(); contentServicesPage.checkAcsContainer();
uploadToggles.enableMaxSize().addMaxSize('400'); uploadToggles.enableMaxSize().addMaxSize('400');
@@ -321,7 +345,7 @@ describe('Test Uploader component', () => {
uploadToggles.disableMaxSize(); uploadToggles.disableMaxSize();
}); });
xit('20. Enable max size and set it to 0', () => { xit('[C272796] Enable max size and set it to 0', () => {
contentServicesPage.goToDocumentList(); contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer(); contentServicesPage.checkAcsContainer();
uploadToggles.enableMaxSize().addMaxSize('0'); uploadToggles.enableMaxSize().addMaxSize('0');
@@ -334,10 +358,37 @@ describe('Test Uploader component', () => {
uploadToggles.disableMaxSize(); uploadToggles.disableMaxSize();
}); });
xit('21. Set max size to 1 and disable it', () => { xit('[C272797] Set max size to 1 and disable it', () => {
uploadToggles.enableMaxSize().addMaxSize('1'); uploadToggles.enableMaxSize().addMaxSize('1');
uploadToggles.disableMaxSize(); uploadToggles.disableMaxSize();
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsDisplayed(fileWithSpecificSize.name); contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsDisplayed(fileWithSpecificSize.name);
uploadDialog.fileIsUploaded(fileWithSpecificSize.name).clickOnCloseButton().dialogIsNotDisplayed(); uploadDialog.fileIsUploaded(fileWithSpecificSize.name).clickOnCloseButton().dialogIsNotDisplayed();
}); });
it('[C91318] Should Enable/Disable upload button when change the disable property', () => {
uploadToggles.clickCheckboxDisableUpload();
expect(contentServicesPage.uploadButtonIsEnabled()).toBeFalsy();
uploadToggles.clickCheckboxDisableUpload();
expect(contentServicesPage.uploadButtonIsEnabled()).toBeTruthy();
});
it('[C279882] Should be possible Upload a folder in a folder', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderOne.location).checkContentIsDisplayed(folderOne.name);
uploadDialog.fileIsUploaded(uploadedFileInFolder.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.doubleClickRow(folderOne.name).checkContentIsDisplayed(uploadedFileInFolder.name);
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderTwo.location).checkContentIsDisplayed(folderTwo.name);
uploadDialog.fileIsUploaded(uploadedFileInFolderTwo.name);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.doubleClickRow(folderTwo.name).checkContentIsDisplayed(uploadedFileInFolderTwo.name);
uploadToggles.disableFolderUpload();
});
}); });

View File

@@ -0,0 +1,249 @@
/*!
* @license
* Copyright 2016 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 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 NavigationBarPage = require('../pages/adf/navigationBarPage');
import NotificationPage = require('../pages/adf/notificationPage');
import AcsUserModel = require('../models/ACS/acsUserModel');
import FileModel = require('../models/ACS/fileModel');
import FolderModel = require('../models/ACS/folderModel');
import TestConfig = require('../test.config');
import resources = require('../util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../actions/ACS/upload.actions';
import { DropActions } from '../actions/drop.actions';
import path = require('path');
describe('Upload - User permission', () => {
let contentServicesPage = new ContentServicesPage();
let uploadDialog = new UploadDialog();
let uploadToggles = new UploadToggles();
let loginPage = new LoginPage();
let acsUser;
let acsUserTwo;
let navigationBarPage = new NavigationBarPage();
let notificationPage = new NotificationPage();
let emptyFile = 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
});
let pdfFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
let folder = new FolderModel({
'name': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_name,
'location': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_location
});
beforeAll(() => {
let uploadActions = new UploadActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
beforeEach(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
describe('limited permissions', () => {
beforeEach(async (done) => {
contentServicesPage.goToDocumentList();
done();
});
it('[C212861] Should not be allowed to Drag and drop a file/folder in a restricted user folder with limited permissions', () => {
contentServicesPage.checkDandDIsDisplayed();
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
contentServicesPage.checkContentIsDisplayed(folder.name);
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
let fileInTheUploadedFolder = 'share_profile_pic.png';
uploadDialog.fileIsError(emptyFile.name);
uploadDialog.fileIsError(fileInTheUploadedFolder);
contentServicesPage.checkContentIsNotDisplayed(emptyFile.name);
contentServicesPage.checkContentIsNotDisplayed(folder.name);
});
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);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
contentServicesPage.uploadFile(emptyFile.location);
notificationPage.checkNotifyContains('You don\'t have the create permission to upload the content');
});
it('[C279916] Should not be allowed to upload a folder in a restricted user folder with limited permissions', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folder.location).checkContentIsDisplayed(folder.name);
let fileInTheUploadedFolder = 'share_profile_pic.png';
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
uploadDialog.clickOnCloseButton().dialogIsNotDisplayed();
contentServicesPage.navigateToFolderViaBreadcrumbs('User Homes');
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folder.location);
notificationPage.checkNotifyContains('You don\'t have the create permission to upload the content');
});
});
describe('full permissions', () => {
beforeEach(async (done) => {
loginPage.loginToContentServices(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
contentServicesPage.goToDocumentList();
done();
});
it('[C260130] Should be allowed to Drag and drop a file/folder in a restricted user folder with full permissions', () => {
contentServicesPage.checkDandDIsDisplayed();
let dragAndDrop = new DropActions();
let dragAndDropArea = element(by.css('adf-upload-drag-area div'));
dragAndDrop.dropFile(dragAndDropArea, emptyFile.location);
dragAndDrop.dropFolder(dragAndDropArea, folder.location);
let fileInTheUploadedFolder = 'share_profile_pic.png';
uploadDialog.fileIsUploaded(emptyFile.name);
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
});
it('[C279917] Should be allowed to upload a file in a restricted user folder with full permissions', () => {
contentServicesPage.uploadFile(emptyFile.location);
uploadDialog.fileIsUploaded(emptyFile.name);
});
it('[C279918] Should be allowed to upload a folder in a restricted user folder with full permissions', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folder.location);
let fileInTheUploadedFolder = 'share_profile_pic.png';
uploadDialog.fileIsUploaded(fileInTheUploadedFolder);
});
});
describe('multiple users', () => {
beforeEach(async (done) => {
acsUserTwo = new AcsUserModel();
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUserTwo);
contentServicesPage.goToDocumentList();
done();
});
it('[C260175] Should two different user upload files in the proper User Home', () => {
contentServicesPage.uploadFile(emptyFile.location);
uploadDialog.fileIsUploaded(emptyFile.name);
contentServicesPage.checkContentIsDisplayed(emptyFile.name);
navigationBarPage.clickLoginButton();
loginPage.loginToContentServicesUsingUserModel(acsUserTwo);
contentServicesPage.goToDocumentList();
contentServicesPage.checkContentIsNotDisplayed(emptyFile.name);
contentServicesPage.uploadFile(pngFile.location);
contentServicesPage.checkContentIsDisplayed(pngFile.name);
navigationBarPage.clickLoginButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
contentServicesPage.uploadFile(pdfFile.location);
contentServicesPage.checkContentIsDisplayed(pdfFile.name);
});
});
});

View File

@@ -30,7 +30,7 @@ import resources = require('./util/resources');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UsersActions } from './actions/users.actions'; import { UsersActions } from './actions/users.actions';
describe('Test User Info component', () => { describe('User Info component', () => {
let adfSettingsPage = new AdfSettingsPage(); let adfSettingsPage = new AdfSettingsPage();
let loginPage = new LoginPage(); let loginPage = new LoginPage();

View File

@@ -137,10 +137,22 @@ exports.Files = {
folder_location: "/resources/adf/folderOne", folder_location: "/resources/adf/folderOne",
folder_name: "folderOne" folder_name: "folderOne"
}, },
FOLDER_TWO: {
folder_location: "/resources/adf/folderTwo",
folder_name: "folderTwo"
},
FOLDER_EXCLUDED: {
folder_location: "/resources/adf/folderExcluded",
folder_name: "folderExcluded"
},
FILE_INSIDE_FOLDER_ONE: { FILE_INSIDE_FOLDER_ONE: {
file_location: "/resources/adf/folderOne/share_profile_pic.png", file_location: "/resources/adf/folderOne/share_profile_pic.png",
file_name: "share_profile_pic.png" file_name: "share_profile_pic.png"
}, },
FILE_INSIDE_FOLDER_TWO: {
file_location: "/resources/adf/folderOne/a_file.txt",
file_name: "a_file.txt"
},
JPG: { JPG: {
file_location: "/resources/adf/allFileTypes/a_jpg_file.jpg", file_location: "/resources/adf/allFileTypes/a_jpg_file.jpg",
file_name: "a_jpg_file.jpg" file_name: "a_jpg_file.jpg"
@@ -178,11 +190,14 @@ exports.Files = {
file_location: "/resources/adf/allFileTypes/a_zip_file.mp4.zip", file_location: "/resources/adf/allFileTypes/a_zip_file.mp4.zip",
file_name: "a_zip_file.mp4.zip" file_name: "a_zip_file.mp4.zip"
}, },
PAGES:{ PAGES:{
file_location: "/resources/adf/allFileTypes/file_unsupported.pages", file_location: "/resources/adf/allFileTypes/file_unsupported.pages",
file_name: "file_unsupported.pages" file_name: "file_unsupported.pages"
}, },
INI:{
file_location: "/resources/adf/allFileTypes/desktop.ini",
file_name: "desktop.ini"
},
}, },
PROFILE_IMAGES: { PROFILE_IMAGES: {

View File

@@ -31,7 +31,7 @@ import AcsUserModel = require('./models/ACS/acsUserModel');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions'; import { UploadActions } from './actions/ACS/upload.actions';
describe('Test Content Services Viewer', () => { describe('Content Services Viewer', () => {
let acsUser = new AcsUserModel(); let acsUser = new AcsUserModel();
let viewerPage = new ViewerPage(); let viewerPage = new ViewerPage();

View File

@@ -27,7 +27,7 @@ exports.config = {
allScriptsTimeout: 60000, allScriptsTimeout: 60000,
specs: [ specs: [
'./e2e/*.e2e.ts' './e2e/**/*.e2e.ts'
], ],
capabilities: { capabilities: {

View File

@@ -373,6 +373,7 @@ Script to run e2e test
|-e or --email |email user to use| |-e or --email |email user to use|
|-b or --browser |browser run the test in the browsrwer (No headless mode)| |-b or --browser |browser run the test in the browsrwer (No headless mode)|
|-s or --spec |spec run a single test file| |-s or --spec |spec run a single test file|
|-dev or --dev |run it against local development environment it will deploy on localhost:4200 the current version of your branch|
|-host or --host | host against to run the test| |-host or --host | host against to run the test|
|-proxy or --proxy | proxy Back end URL to use | |-proxy or --proxy | proxy Back end URL to use |

View File

@@ -3,6 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/../" cd "$DIR/../"
BROWSER_RUN=false BROWSER_RUN=false
DEVELOPMENT=false
show_help() { show_help() {
echo "Usage: ./scripts/test-e2e-lib.sh -host adf.domain.com -u admin -p admin -e admin" echo "Usage: ./scripts/test-e2e-lib.sh -host adf.domain.com -u admin -p admin -e admin"
@@ -12,7 +13,8 @@ show_help() {
echo "-e or --email" echo "-e or --email"
echo "-b or --browser run the test in the browsrwer (No headless mode)" echo "-b or --browser run the test in the browsrwer (No headless mode)"
echo "-s or --spec run a single test file" echo "-s or --spec run a single test file"
echo "-p or --proxy proxy Back end URL to use" echo "-proxy or --proxy proxy Back end URL to use only possibel to use with -dev option"
echo "-dev or --dev run it against local development environment it will deploy on localhost:4200 the current version of your branch"
echo "-host or --host URL of the Front end to test" echo "-host or --host URL of the Front end to test"
echo "-save save the error screenshot in the remote env" echo "-save save the error screenshot in the remote env"
echo "-h or --help" echo "-h or --help"
@@ -44,10 +46,15 @@ set_browser(){
set_proxy(){ set_proxy(){
PROXY=$1 PROXY=$1
} }
set_save_screenshot(){ set_save_screenshot(){
SAVE_SCREENSHOT=true SAVE_SCREENSHOT=true
} }
set_development(){
DEVELOPMENT=true
}
while [[ $1 == -* ]]; do while [[ $1 == -* ]]; do
case "$1" in case "$1" in
-h|--help|-\?) show_help; exit 0;; -h|--help|-\?) show_help; exit 0;;
@@ -55,6 +62,7 @@ while [[ $1 == -* ]]; do
-p|--password) set_password $2; shift 2;; -p|--password) set_password $2; shift 2;;
-e|--email) set_email $2; shift 2;; -e|--email) set_email $2; shift 2;;
-b|--browser) set_browser; shift;; -b|--browser) set_browser; shift;;
-dev|--dev) set_development; shift;;
-s|--spec) set_test $2; shift 2;; -s|--spec) set_test $2; shift 2;;
-save) set_save_screenshot; shift;; -save) set_save_screenshot; shift;;
-proxy|--proxy) set_proxy $2; shift 2;; -proxy|--proxy) set_proxy $2; shift 2;;
@@ -74,10 +82,28 @@ export BROWSER_RUN=$BROWSER_RUN
export PROXY_HOST_ADF=$PROXY export PROXY_HOST_ADF=$PROXY
export SAVE_SCREENSHOT=$SAVE_SCREENSHOT export SAVE_SCREENSHOT=$SAVE_SCREENSHOT
if [[ $SINGLE_TEST == "true" ]]; then
if [[ $DEVELOPMENT == "true" ]]; then
echo "====== Run against local development ====="
if [[ $SINGLE_TEST == "true" ]]; then
echo "====== Single test run $NAME_TEST =====" echo "====== Single test run $NAME_TEST ====="
npm run e2e-lib -- --specs ./e2e/$NAME_TEST npm run e2e-lib -- --specs ./e2e/$NAME_TEST
else else
npm run e2e-lib npm run e2e-lib
fi
else
if [[ $SINGLE_TEST == "true" ]]; then
npm install --save-dev jasmine2-protractor-utils -g
echo "====== Single test run $NAME_TEST ====="
webdriver-manager update --gecko=false --versions.chrome=2.38
protractor protractor.conf.js --specs ./e2e/$NAME_TEST
else
webdriver-manager update --gecko=false --versions.chrome=2.38
protractor protractor.conf.js
fi
fi fi