[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/
dist/
e2e-output/
e2e/downloads/
ng2-components/coverage/
!systemjs.config.js
demo-shell-ng2/app/components/router/

View File

@@ -87,7 +87,7 @@ jobs:
if: tag =~ .*beta.*
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-modeler-app
- 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
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>
</div>
<section>
<mat-checkbox [(ngModel)]="enableUpload">
<mat-checkbox id="adf-disable-upload" [(ngModel)]="enableUpload">
{{'DOCUMENT_LIST.DESCRIPTION_UPLOAD' | translate}}
</mat-checkbox>
</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 AlfrescoApi = require('alfresco-js-api-node');
describe('Test Datatable component - selection', () => {
describe('Datatable component - selection', () => {
let dataTablePage = new DataTablePage();
let loginPage = new LoginPage();

View File

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

View File

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

View File

@@ -29,7 +29,7 @@ import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions';
describe('Test Document List - Pagination', function () {
describe('Document List - Pagination', function () {
let pagination = {
base: 'newFile',
secondSetBase: 'secondSet',
@@ -256,7 +256,7 @@ describe('Test Document List - Pagination', function () {
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.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();

View File

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

@@ -40,6 +40,7 @@ var ContentServicesPage = function (){
var contentServicesURL = TestConfig.adf.url + TestConfig.adf.port + "/files";
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 dragAndDrop = element(by.css("adf-upload-drag-area div"));
/**
* Check Document List is displayed
@@ -254,7 +255,8 @@ var ContentServicesPage = function (){
var allFiles = path.resolve(path.join(TestConfig.main.rootPath, files[0]));
for (var i = 1; i < files.length; i++) {
allFiles = allFiles + "\n" + path.resolve(path.join(TestConfig.main.rootPath, files[i]));
};
}
;
uploadMultipleFileButton.sendKeys(allFiles);
Util.waitUntilElementIsVisible(uploadMultipleFileButton);
return this;
@@ -288,6 +290,10 @@ var ContentServicesPage = function (){
return this;
};
this.uploadButtonIsEnabled = function () {
return uploadFileButton.isEnabled()
};
this.deleteContent = function (content) {
contentList.deleteContent(content);
return this;
@@ -297,7 +303,8 @@ var ContentServicesPage = function (){
for (i = 0; i < content.length; i++) {
this.deleteContent(content[i]);
this.checkContentIsNotDisplayed(content[i]);
};
}
;
return this;
};
@@ -332,6 +339,10 @@ var ContentServicesPage = function (){
Util.waitUntilElementIsVisible(emptyPagination);
};
this.checkDandDIsDisplayed = function () {
Util.waitUntilElementIsVisible(dragAndDrop);
};
};
module.exports = ContentServicesPage;

View File

@@ -277,7 +277,7 @@ var ContentList = function () {
};
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;
};

View File

@@ -25,6 +25,7 @@ var UploadDialog = function () {
var minimizedDialog = element(by.css("div[class*='upload-dialog--minimized']"));
var uploadedStatusIcon = by.css("mat-icon[class*='status--done']");
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 rowByRowName = by.xpath("ancestor::adf-file-uploading-list-row");
var title = element(by.css("span[class*='upload-dialog__title']"));
@@ -78,6 +79,11 @@ var UploadDialog = function () {
return this;
};
this.fileIsError = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content).element(errorStatusIcon));
return this;
};
this.filesAreUploaded = function (content) {
for (i=0; i<content.length; 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 extensionAcceptedField = element(by.css("input[data-automation-id='accepted-files-type']"));
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.enableToggle(multipleFileUploadToggle);
@@ -78,6 +79,10 @@ var UploadToggles = function () {
return this;
};
this.clickCheckboxDisableUpload = function () {
return disableUploadCheckbox.click();
};
this.enableToggle = function (toggle) {
Util.waitUntilElementIsVisible(toggle);
Util.waitUntilElementIsPresent(toggle);

View File

@@ -242,11 +242,18 @@ var LoginPage = function (){
this.login(userModel.getId(), userModel.getPassword());
};
this.loginToContentServices = function (username, password) {
adfSettingsPage.setProviderEcm();
this.waitForElements();
this.login(username, password);
};
/**
* Go to adf login page
* @method goToLoginPage
*/
this.goToLoginPage = function (){
this.goToLoginPage = function () {
browser.driver.get(TestConfig.adf.url + TestConfig.adf.port + '/login');
};

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 { UsersActions } from './actions/users.actions';
describe('Test Process List - Pagination when adding processes', () => {
describe('Process List - Pagination when adding processes', () => {
let itemsPerPage = {
fifteen: '15',

View File

@@ -31,7 +31,7 @@ import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions';
describe('Test Process List - Pagination', function () {
describe('Process List - Pagination', function () {
let itemsPerPage = {
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 { UploadActions } from './actions/ACS/upload.actions';
describe('Test Search component - Search Bar', () => {
describe('Search component - Search Bar', () => {
let search = {
inactive: {

View File

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

View File

@@ -25,7 +25,7 @@ import CONSTANTS = require('./util/constants');
import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Theming component', () => {
describe('Theming component', () => {
let navigationBarPage = new NavigationBarPage();
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.
*/
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 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 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 TestConfig = require('../test.config');
import resources = require('../util/resources');
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 uploadDialog = new UploadDialog();
@@ -70,7 +71,12 @@ describe('Test Uploader component', () => {
'name': resources.Files.ADF_DOCUMENTS.FOLDER_ONE.folder_name,
'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 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 filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name];
@@ -99,7 +105,7 @@ describe('Test Uploader component', () => {
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');
contentServicesPage
@@ -111,7 +117,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pdfFileModel.name);
});
it('2. Upload a pdf file', () => {
it('[C272789] Upload a pdf file', () => {
contentServicesPage
.uploadFile(pdfFileModel.location)
.checkContentIsDisplayed(pdfFileModel.name);
@@ -125,7 +131,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pdfFileModel.name);
});
it('3. Upload a text file', () => {
it('[C272790] Upload a text file', () => {
contentServicesPage
.uploadFile(docxFileModel.location)
.checkContentIsDisplayed(docxFileModel.name);
@@ -138,7 +144,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(docxFileModel.name);
});
it('4. Upload a png file', () => {
it('[C260141] Upload a png file', () => {
contentServicesPage
.uploadFile(pngFileModel.location)
.checkContentIsDisplayed(pngFileModel.name);
@@ -151,7 +157,7 @@ describe('Test Uploader component', () => {
.checkContentIsNotDisplayed(pngFileModel.name);
});
it('5. Minimize and maximize the upload dialog box', () => {
it('[C260143] Minimize and maximize the upload dialog box', () => {
contentServicesPage
.uploadFile(docxFileModel.location)
.checkContentIsDisplayed(docxFileModel.name);
@@ -172,7 +178,7 @@ describe('Test Uploader component', () => {
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)
.checkContentIsDisplayed(pdfFileModel.name);
uploadDialog.removeUploadedFile(pdfFileModel.name).fileIsCancelled(pdfFileModel.name);
@@ -181,7 +187,7 @@ describe('Test Uploader component', () => {
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);
uploadDialog.removeFileWhileUploading(largeFile.name).fileIsCancelled(largeFile.name);
@@ -191,7 +197,7 @@ describe('Test Uploader component', () => {
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);
uploadDialog.cancelUploads();
expect(uploadDialog.getTitleText()).toEqual('Uploading 0 / 1');
@@ -203,7 +209,7 @@ describe('Test Uploader component', () => {
contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
});
xit('9. Cancel uploading multiple files', () => {
xit('[C272793] Cancel uploading multiple files', () => {
uploadToggles.enableMultipleFileUpload();
contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]);
uploadDialog.cancelUploads();
@@ -216,13 +222,13 @@ describe('Test Uploader component', () => {
uploadToggles.disableMultipleFileUpload();
});
it('10. Tooltip of uploading multiple files button', () => {
it('[C272794] Tooltip of uploading multiple files button', () => {
uploadToggles.enableMultipleFileUpload();
expect(contentServicesPage.getMultipleFileButtonTooltip()).toEqual('Custom tooltip');
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');
contentServicesPage.uploadFile(docxFileModel.location).checkContentIsDisplayed(docxFileModel.name);
uploadDialog.removeUploadedFile(docxFileModel.name).fileIsCancelled(docxFileModel.name);
@@ -232,7 +238,25 @@ describe('Test Uploader component', () => {
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);
pdfFileModel.setVersion('1');
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.getVersionName());
@@ -242,7 +266,7 @@ describe('Test Uploader component', () => {
pdfFileModel.setVersion('');
});
it('13. Enable versioning', () => {
it('[C260172] Enable versioning', () => {
uploadToggles.enableVersioning();
contentServicesPage.uploadFile(pdfFileModel.location).checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1');
@@ -255,7 +279,7 @@ describe('Test Uploader component', () => {
uploadToggles.disableVersioning();
});
xit('14. Enable folder upload', () => {
xit('[C260173] Enable folder upload', () => {
uploadToggles.enableFolderUpload();
contentServicesPage.uploadFolder(folderOne.location).checkContentIsDisplayed(folderOne.name);
expect(contentServicesPage.getFolderButtonTooltip()).toEqual('Custom tooltip');
@@ -266,7 +290,7 @@ describe('Test Uploader component', () => {
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);
uploadDialog.fileIsUploaded(docxFileModel.name);
@@ -285,7 +309,7 @@ describe('Test Uploader component', () => {
.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.checkAcsContainer();
@@ -304,7 +328,7 @@ describe('Test Uploader component', () => {
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.checkAcsContainer();
uploadToggles.enableMaxSize().addMaxSize('400');
@@ -321,7 +345,7 @@ describe('Test Uploader component', () => {
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.checkAcsContainer();
uploadToggles.enableMaxSize().addMaxSize('0');
@@ -334,10 +358,37 @@ describe('Test Uploader component', () => {
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.disableMaxSize();
contentServicesPage.uploadFile(fileWithSpecificSize.location).checkContentIsDisplayed(fileWithSpecificSize.name);
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 { UsersActions } from './actions/users.actions';
describe('Test User Info component', () => {
describe('User Info component', () => {
let adfSettingsPage = new AdfSettingsPage();
let loginPage = new LoginPage();

View File

@@ -137,10 +137,22 @@ exports.Files = {
folder_location: "/resources/adf/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_location: "/resources/adf/folderOne/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: {
file_location: "/resources/adf/allFileTypes/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_name: "a_zip_file.mp4.zip"
},
PAGES:{
file_location: "/resources/adf/allFileTypes/file_unsupported.pages",
file_name: "file_unsupported.pages"
},
INI:{
file_location: "/resources/adf/allFileTypes/desktop.ini",
file_name: "desktop.ini"
},
},
PROFILE_IMAGES: {

View File

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

View File

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

View File

@@ -373,6 +373,7 @@ Script to run e2e test
|-e or --email |email user to use|
|-b or --browser |browser run the test in the browsrwer (No headless mode)|
|-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|
|-proxy or --proxy | proxy Back end URL to use |

View File

@@ -3,6 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/../"
BROWSER_RUN=false
DEVELOPMENT=false
show_help() {
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 "-b or --browser run the test in the browsrwer (No headless mode)"
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 "-save save the error screenshot in the remote env"
echo "-h or --help"
@@ -44,10 +46,15 @@ set_browser(){
set_proxy(){
PROXY=$1
}
set_save_screenshot(){
SAVE_SCREENSHOT=true
}
set_development(){
DEVELOPMENT=true
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
@@ -55,6 +62,7 @@ while [[ $1 == -* ]]; do
-p|--password) set_password $2; shift 2;;
-e|--email) set_email $2; shift 2;;
-b|--browser) set_browser; shift;;
-dev|--dev) set_development; shift;;
-s|--spec) set_test $2; shift 2;;
-save) set_save_screenshot; shift;;
-proxy|--proxy) set_proxy $2; shift 2;;
@@ -74,10 +82,28 @@ export BROWSER_RUN=$BROWSER_RUN
export PROXY_HOST_ADF=$PROXY
export SAVE_SCREENSHOT=$SAVE_SCREENSHOT
if [[ $DEVELOPMENT == "true" ]]; then
echo "====== Run against local development ====="
if [[ $SINGLE_TEST == "true" ]]; then
echo "====== Single test run $NAME_TEST ====="
npm run e2e-lib -- --specs ./e2e/$NAME_TEST
else
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