Add e2e test in ADF main repo (#3534)

* move e2e to ADF main repo

* lint e2e test

* enable first set of tests

* enable test

* firs test js-api integrated

* try change name protractor demo shell file

* remove fdescribe

* Update .travis.yml

* exclude failing test and rewrite analytics component with JS-API

* remove fdescribe

* move first part of tests to js-api

* refactor test alfresco-js-api

* replace js-api step 3

* remove adf prefix

* remove unused code

* remove unused part 2

* add option in e2e test for single test and browser

* exclude temp failing test

* refactoring test step 1

* refactoring test step 2

* refactoring test step 3

* refactoring test step 4

* refactoring test step 5

* run against localhost and proxy options

* fix command

* improve configuration

* improve configuration

* use dev configuratio

* fix defering

* comment out not working remotely test

* fix promise login page e2e

* remove console log

* change test

* revert

* improve utils

* improve task list test
util add also numbers in generation of the email

* remove part of the multi selector

* reinsert trashcan test

* uncomment document list test

* try increase delay in search sorting

* improve document list selector

* execute different util methods

* Upload error screenshot

* make oncomplete async

* add z-finish screenshot workaround

* option save

* remove fit
This commit is contained in:
Eugenio Romano
2018-07-09 08:53:16 +01:00
committed by Eugenio Romano
parent 4ecea64e19
commit 3d86044594
182 changed files with 16047 additions and 178 deletions

View File

@@ -192,7 +192,7 @@
],
"e2e": {
"protractor": {
"config": "./demo-shell/protractor.conf.js"
"config": "./protractor.conf.js"
}
},
"lint": [

1
.gitignore vendored
View File

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

View File

@@ -14,6 +14,7 @@ before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3 # give xvfb some time to start
env:
matrix:
@@ -70,7 +71,6 @@ jobs:
script: ./scripts/test-e2e-bc.sh
- # Test expors
script: npm run test-export
- stage: Update Apps dependencies
- # Test Update generator-ng2-alfresco-app
if: tag =~ .*beta.*
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n generator-ng2-alfresco-app
@@ -86,6 +86,8 @@ jobs:
- # Test Update alfresco-modeler-app
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
- 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

@@ -1,30 +0,0 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: './demo-shell/e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@@ -43,7 +43,6 @@ export class AppComponent implements OnInit {
this.router.navigate(['/login']);
}
}
});
}
}

View File

@@ -0,0 +1,46 @@
import path = require('path');
import fs = require('fs');
import TestConfig = require('../../test.config');
export class UploadActions {
async uploadFile(alfrescoJsApi, fileLocation, fileName, parentFolderId) {
let pathFile = path.join(TestConfig.main.rootPath + fileLocation);
let file = fs.createReadStream(pathFile);
return alfrescoJsApi.upload.uploadFile(
file,
'',
parentFolderId,
null,
{
'name': fileName,
'nodeType': 'cm:content'
}
);
}
async createEmptyFiles(alfrescoJsApi, emptyFileNames: string[], parentFolderId) {
let filesRequest = [];
for (let i = 0; i < emptyFileNames.length; i++) {
let jsonItem = {};
jsonItem['name'] = emptyFileNames[i];
jsonItem['nodeType'] = 'cm:content';
filesRequest.push(jsonItem);
}
return alfrescoJsApi.nodes.addNode(parentFolderId, filesRequest, {}, {
filedata: ''
});
}
async uploadFolder(alfrescoJsApi, folderName, parentFolderId) {
return alfrescoJsApi.nodes.addNode(parentFolderId, {
'name': folderName,
'nodeType': 'cm:folder'
}, {}, {});
}
}

View File

@@ -0,0 +1,42 @@
import path = require('path');
import fs = require('fs');
import TestConfig = require('../../test.config');
import AppPublish = require('../../models/APS/AppPublish');
export class AppsActions {
async importPublishDeployApp(alfrescoJsApi, appFileLocation) {
let pathFile = path.join(TestConfig.main.rootPath + appFileLocation);
let file = fs.createReadStream(pathFile);
let appCreated = await alfrescoJsApi.activiti.appsApi.importAppDefinition(file);
let publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish());
let published = await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] });
return appCreated;
}
async startProcess(alfrescoJsApi, app, processName) {
let appDefinitionsList = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
let appDefinition = appDefinitionsList.data.filter((currentApp) => {
return currentApp.name === app.name;
});
let processDefinitionList = await alfrescoJsApi.activiti.processApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId });
let startProcessOptions = { processDefinitionId: processDefinitionList.data[0].id };
if (typeof processName !== 'undefined') {
startProcessOptions.name = processName;
}
return await alfrescoJsApi.activiti.processApi.startNewProcessInstance(startProcessOptions);
}
}

View File

@@ -0,0 +1,38 @@
import Tenant = require('../models/APS/Tenant');
import User = require('../models/APS/User');
import TestConfig = require('../test.config');
import path = require('path');
import fs = require('fs');
export class UsersActions {
async createTenantAndUser(alfrescoJsApi) {
let newTenant = await alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
let user = new User({ tenantId: newTenant.id });
await alfrescoJsApi.activiti.adminUsersApi.createNewUser(user);
return user;
}
async createApsUser(alfrescoJsApi, tenantId) {
let user = new User({ tenantId: tenantId });
await alfrescoJsApi.activiti.adminUsersApi.createNewUser(user);
return user;
}
async cleanupTenant(alfrescoJsApi, tenantId) {
return alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
}
async changeProfilePictureAps(alfrescoJsApi, fileLocation) {
let pathFile = path.join(TestConfig.main.rootPath + fileLocation);
let file = fs.createReadStream(pathFile);
return alfrescoJsApi.activiti.profileApi.uploadProfilePicture(file);
}
}

View File

@@ -0,0 +1,74 @@
/*!
* @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 NavigationBarPage = require('./pages/adf/navigationBarPage');
import AnalyticsPage = require('./pages/adf/process_services/analyticsPage');
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage');
import TestConfig = require('./test.config');
import Tenant = require('./models/APS/Tenant');
import User = require('./models/APS/User');
import AlfrescoApi = require('alfresco-js-api-node');
describe('Analytics Smoke Test', () => {
let loginPage = new LoginPage();
let navigationBarPage = new NavigationBarPage();
let appNavigationBarPage = new AppNavigationBarPage();
let analyticsPage = new AnalyticsPage();
let processServicesPage = new ProcessServicesPage();
let tenantId;
let reportTitle = 'New Title';
beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
let newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
tenantId = newTenant.id;
let procUserModel = new User({ tenantId: tenantId });
await this.alfrescoJsApi.activiti.adminUsersApi.createNewUser(procUserModel);
loginPage.loginToProcessServicesUsingUserModel(procUserModel);
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
done();
});
it('Change name from Process Definition Heat Map', () => {
navigationBarPage.clickProcessServicesButton();
processServicesPage.checkApsContainer();
processServicesPage.goToApp('Task App');
appNavigationBarPage.clickReportsButton();
analyticsPage.checkNoReportMessage();
analyticsPage.getReport('Process definition heat map');
analyticsPage.changeReportTitle(reportTitle);
expect(analyticsPage.getReportTitle()).toEqual(reportTitle);
});
});

70
e2e/apps-section.e2e.ts Normal file
View File

@@ -0,0 +1,70 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import NavigationBarPage = require('./pages/adf/navigationBarPage');
import CONSTANTS = require('./util/constants');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { UsersActions } from './actions/users.actions';
import { AppsActions } from './actions/APS/apps.actions';
describe('Attachment list', () => {
let loginPage = new LoginPage();
let navigationBarPage = new NavigationBarPage();
let processServicesPage = new ProcessServicesPage();
let app = resources.Files.APP_WITH_PROCESSES;
beforeAll(async (done) => {
let apps = new AppsActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
let user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
loginPage.loginToProcessServicesUsingUserModel(user);
done();
});
it('[C260198] Publish on ADF side', () => {
navigationBarPage.clickProcessServicesButton();
processServicesPage.checkApsContainer();
expect(processServicesPage.getAppIconType(app.title)).toEqual('ac_unit');
expect(processServicesPage.getBackgroundColor(app.title)).toEqual(CONSTANTS.APP_COLOR.BLUE);
expect(processServicesPage.getDescription(app.title)).toEqual('Description for app');
});
});

View File

@@ -0,0 +1,104 @@
/*!
* @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 TasksPage = require('./pages/adf/process_services/tasksPage');
import ViewerPage = require('./pages/adf/viewerPage');
import UsingWidget = require('./pages/adf/process_services/widgets/usingWidget');
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import CONSTANTS = require('./util/constants');
import FileModel = require('./models/ACS/fileModel');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
import { AppsActions } from './actions/APS/apps.actions';
import AlfrescoApi = require('alfresco-js-api-node');
import { UsersActions } from './actions/users.actions';
describe('Start Task - Task App', () => {
let loginPage = new LoginPage();
let viewerPage = new ViewerPage();
let usingWidget = new UsingWidget();
let processServicesPage = new ProcessServicesPage();
let taskPage = new TasksPage();
let processUserModel;
let app = resources.Files.WIDGETS_SMOKE_TEST;
let pdfFile = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name });
let appFields = app.form_fields;
beforeAll(async (done) => {
let users = new UsersActions();
let apps = new AppsActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
afterAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
done();
});
it('[C274690] Task List attachment - View file', () => {
processServicesPage.goToProcessServices().goToTaskApp().clickTasksButton();
taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS);
taskPage.createNewTask()
.addName('View file')
.addForm(app.formName)
.clickStartButton()
.then(() => {
usingWidget.usingAttachFileWidget().attachFile(appFields.attachfile_id, pdfFile.location);
usingWidget.usingAttachFileWidget().checkFileIsAttached(appFields.attachfile_id, pdfFile.name);
usingWidget.usingAttachFileWidget().viewFile(pdfFile.name);
viewerPage.checkFileContent('1', pdfFile.firstPageText);
viewerPage.checkCloseButtonIsDisplayed();
viewerPage.clickCloseButton();
taskPage.usingTasksListPage().checkTaskIsDisplayedInTasksList('View file');
});
});
});

View File

@@ -0,0 +1,91 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
import AttachmentListPage = require('./pages/adf/process_services/attachmentListPage');
import FileModel = require('./models/ACS/fileModel');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
import AlfrescoApi = require('alfresco-js-api-node');
import { UsersActions } from './actions/users.actions';
import { AppsActions } from './actions/APS/apps.actions';
describe('Attachment list', () => {
let loginPage = new LoginPage();
let processServicesPage = new ProcessServicesPage();
let attachmentListPage = new AttachmentListPage();
let processFiltersPage = new ProcessFiltersPage();
let processUserModel;
let app = resources.Files.APP_WITH_PROCESSES;
let jpgFile = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.JPG.file_location,
'name': resources.Files.ADF_DOCUMENTS.JPG.file_name
});
let pdfFile = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name });
beforeAll(async (done) => {
let users = new UsersActions();
let apps = new AppsActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
it('[C277296] Attach a file to task app - process list', function () {
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.startProcess().selectFromProcessDropdown(app.process_se_name).clickFormStartProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.selectFromProcessList('My Default Name');
attachmentListPage.clickAttachFileButton(jpgFile.location);
attachmentListPage.checkFileIsAttached(jpgFile.name);
attachmentListPage.clickAttachFileButton(pdfFile.location);
attachmentListPage.checkFileIsAttached(jpgFile.name);
attachmentListPage.checkFileIsAttached(pdfFile.name);
});
it('[C277299] Attach a file to custom app - process list', function () {
processServicesPage.goToProcessServices().goToApp(app.title).clickProcessButton();
processFiltersPage.startProcess().selectFromProcessDropdown(app.process_se_name).clickFormStartProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.selectFromProcessList('My Default Name');
attachmentListPage.clickAttachFileButton(jpgFile.location);
attachmentListPage.checkFileIsAttached(jpgFile.name);
attachmentListPage.clickAttachFileButton(pdfFile.location);
attachmentListPage.checkFileIsAttached(jpgFile.name);
attachmentListPage.checkFileIsAttached(pdfFile.name);
});
});

View File

@@ -0,0 +1,139 @@
/*!
* @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 AdfViewerPage = require('./pages/adf/viewerPage');
import AcsUserModel = require('./models/ACS/acsUserModel');
import FileModel = require('./models/ACS/fileModel');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
import dateFormat = require('dateformat');
import CONSTANTS = require('./util/constants');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions';
describe('Metadata component', () => {
let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage();
let adfViewerPage = new AdfViewerPage();
let cardViewPage;
let acsUser = new AcsUserModel();
let pdfFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF_ALL.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF_ALL.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);
let pdfUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFileModel.location, pdfFileModel.name, '-my-');
Object.assign(pdfFileModel, pdfUploadedFile.entry);
pdfFileModel.update( pdfUploadedFile.entry);
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
it('Properties', () => {
contentServicesPage.navigateToDocumentList();
adfViewerPage.viewFile(pdfFileModel.name);
cardViewPage = adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsDisplayed();
cardViewPage.clickOnPropertiesTab();
expect(cardViewPage.getTitle()).toEqual(CONSTANTS.METADATA.TITLE);
expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.PROPERTY_TAB);
expect(cardViewPage.getExpandedAspectName()).toEqual(CONSTANTS.METADATA.DEFAULT_ASPECT);
expect(cardViewPage.getName()).toEqual(pdfFileModel.name);
expect(cardViewPage.getCreator()).toEqual(pdfFileModel.getCreatedByUser().displayName);
expect(cardViewPage.getCreatedDate()).toEqual(dateFormat(pdfFileModel.createdAt, CONSTANTS.METADATA.DATAFORMAT));
expect(cardViewPage.getModifier()).toEqual(pdfFileModel.getCreatedByUser().displayName);
expect(cardViewPage.getModifiedDate()).toEqual(dateFormat(pdfFileModel.createdAt, CONSTANTS.METADATA.DATAFORMAT));
expect(cardViewPage.getMimetypeName()).toEqual(pdfFileModel.getContent().mimeTypeName);
expect(cardViewPage.getSize()).toEqual(pdfFileModel.getContent().getSizeInBytes());
expect(cardViewPage.getAuthor()).toEqual(pdfFileModel.properties['cm:author']);
cardViewPage.editIconIsDisplayed();
cardViewPage.informationButtonIsDisplayed();
expect(cardViewPage.getInformationButtonText()).toEqual(CONSTANTS.METADATA.MORE_INFO_BUTTON);
expect(cardViewPage.getInformationIconText()).toEqual(CONSTANTS.METADATA.ARROW_DOWN);
});
it('Information button', () => {
contentServicesPage.navigateToDocumentList();
adfViewerPage.viewFile(pdfFileModel.name);
cardViewPage = adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsDisplayed();
cardViewPage.clickOnPropertiesTab();
cardViewPage.informationButtonIsDisplayed();
cardViewPage.clickOnInformationButton();
expect(cardViewPage.getInformationButtonText()).toEqual(CONSTANTS.METADATA.LESS_INFO_BUTTON);
expect(cardViewPage.getInformationIconText()).toEqual(CONSTANTS.METADATA.ARROW_UP);
});
it('Versions', () => {
contentServicesPage.navigateToDocumentList();
adfViewerPage.viewFile(pdfFileModel.name);
cardViewPage = adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsDisplayed();
cardViewPage.clickOnVersionsTab().checkUploadVersionsButtonIsDisplayed();
expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.VERSIONS_TAB);
cardViewPage.checkVersionIsDisplayed(pdfFileModel.name);
});
it('Info icon', () => {
contentServicesPage.navigateToDocumentList();
adfViewerPage.viewFile(pdfFileModel.name);
cardViewPage = adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsDisplayed();
cardViewPage.clickOnVersionsTab().checkUploadVersionsButtonIsDisplayed();
expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.VERSIONS_TAB);
cardViewPage.clickOnPropertiesTab().informationButtonIsDisplayed();
adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsNotDisplayed();
adfViewerPage.clickInfoButton();
adfViewerPage.checkInfoSideBarIsDisplayed();
expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.COMMENTS_TAB);
cardViewPage.clickOnPropertiesTab();
expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.PROPERTY_TAB);
expect(cardViewPage.getEditIconTooltip()).toEqual(CONSTANTS.METADATA.EDIT_BUTTON_TOOLTIP);
});
});

View File

@@ -0,0 +1,92 @@
/*!
* @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 DataTablePage = require('./pages/adf/dataTablePage');
import TestConfig = require('./test.config');
import AcsUserModel = require('./models/ACS/acsUserModel');
import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Datatable component - selection', () => {
let dataTablePage = new DataTablePage();
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
beforeAll(async (done) => {
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);
loginPage.loginToContentServicesUsingUserModel(acsUser);
dataTablePage.goToDatatable();
done();
});
it('1. Data Table Selection Modes', () => {
dataTablePage.selectRow('2');
dataTablePage.checkRowIsSelected('2');
dataTablePage.getNumberOfSelectedRows().then(function (result) {
expect(result).toEqual(1);
});
dataTablePage.selectRow('3');
dataTablePage.checkRowIsSelected('3');
dataTablePage.getNumberOfSelectedRows().then(function (result) {
expect(result).toEqual(1);
});
dataTablePage.selectSelectionMode('Multiple');
dataTablePage.selectRow('1');
dataTablePage.checkRowIsSelected('1');
dataTablePage.selectRowWithKeyboard('3');
dataTablePage.checkRowIsSelected('1');
dataTablePage.checkRowIsSelected('3');
dataTablePage.checkRowIsNotSelected('2');
dataTablePage.checkRowIsNotSelected('4');
dataTablePage.selectSelectionMode('None');
dataTablePage.selectRow('1');
dataTablePage.checkNoRowIsSelected();
});
it('2. Data Table allows the multiselection of rows', () => {
dataTablePage.clickMultiSelect();
dataTablePage.clickCheckbox('1');
dataTablePage.checkRowIsChecked('1');
dataTablePage.clickCheckbox('3');
dataTablePage.checkRowIsChecked('3');
dataTablePage.checkRowIsNotChecked('2');
dataTablePage.checkRowIsNotChecked('4');
dataTablePage.clickCheckbox('3');
dataTablePage.checkRowIsNotChecked('3');
dataTablePage.checkRowIsChecked('1');
});
it('3. Can select all in data table', () => {
dataTablePage.checkAllRows();
dataTablePage.checkRowIsChecked('1');
dataTablePage.checkRowIsChecked('2');
dataTablePage.checkRowIsChecked('3');
dataTablePage.checkRowIsChecked('4');
});
});

View File

@@ -0,0 +1,65 @@
/*!
* @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.js');
import DataTablePage = require('./pages/adf/dataTablePage.js');
import AcsUserModel = require('./models/ACS/acsUserModel.js');
import TestConfig = require('./test.config.js');
import AlfrescoApi = require('alfresco-js-api-node');
describe('Test Datatable component', () => {
let dataTablePage = new DataTablePage();
let loginPage = new LoginPage();
let acsUser = new AcsUserModel();
beforeAll(async (done) => {
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);
loginPage.loginToContentServicesUsingUserModel(acsUser);
dataTablePage.goToDatatable();
done();
});
it('1. DataTable allows extra rows to be added', () => {
dataTablePage.getNumberOfRows().then(function (result) {
dataTablePage.addRow();
expect(dataTablePage.getNumberOfRows()).toEqual(result + 1);
dataTablePage.addRow();
expect(dataTablePage.getNumberOfRows()).toEqual(result + 2);
});
});
it('2. Data Table can replace rows', () => {
dataTablePage.replaceRows(1);
});
it('3. Data Table can replace columns', () => {
dataTablePage.replaceColumns();
});
});

View File

@@ -0,0 +1,182 @@
/*!
* @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 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 Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions';
describe('Test DocumentList component', () => {
let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage();
let acsUser = new AcsUserModel();
let pdfFileModel = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name });
let docxFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
let testFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
let folderOneModel = new FolderModel({ 'name': 'folderOne' + Util.generateRandomString() });
let folderTwoModel = new FolderModel({ 'name': 'folderTwo' + Util.generateRandomString() });
let uploadedFolder;
let rootFolder = 'APP.PERSONAL-FILES', userHomes = 'User Homes', rootFolderName = 'Personal Files';
let fileNames = [], adminFileNames = [], nrOfFiles = 15, adminNrOfFiles = 5;
let files = {
base: 'newFile',
firstFile: 'newFile14.txt',
extension: '.txt'
};
let extensions = {
pdf: 'pdf',
docx: 'word',
test: 'document'
};
beforeAll(async (done) => {
let uploadActions = new UploadActions();
fileNames = Util.generateSeqeunceFiles(1, nrOfFiles, files.base, files.extension);
adminFileNames = Util.generateSeqeunceFiles(nrOfFiles + 1, nrOfFiles + adminNrOfFiles, files.base, files.extension);
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);
await uploadActions.uploadFile(this.alfrescoJsApi, pdfFileModel.location, pdfFileModel.name, '-my-');
await uploadActions.uploadFile(this.alfrescoJsApi, docxFileModel.location, docxFileModel.name, '-my-');
await uploadActions.uploadFile(this.alfrescoJsApi, testFileModel.location, testFileModel.name, '-my-');
uploadedFolder = await uploadActions.uploadFolder(this.alfrescoJsApi, folderOneModel.name, '-my-');
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, uploadedFolder.entry.id);
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await uploadActions.createEmptyFiles(this.alfrescoJsApi, adminFileNames, uploadedFolder.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
done();
});
it('1. File has tooltip', () => {
expect(contentServicesPage.getTooltip(pdfFileModel.name)).toEqual(pdfFileModel.name);
});
it('2. Folder has tooltip', () => {
expect(contentServicesPage.getTooltip(folderOneModel.name)).toEqual(folderOneModel.name);
expect(contentServicesPage.getBreadcrumbTooltip(rootFolderName)).toEqual(rootFolderName);
});
it('4. Sort content ascending by name.', () => {
contentServicesPage.doubleClickRow(folderOneModel.name).checkContentIsDisplayed(files.firstFile);
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(uploadedFolder.entry.name);
expect(contentServicesPage.getCurrentFolderID()).toContain(uploadedFolder.entry.id);
expect(contentServicesPage.sortAndCheckListIsOrderedByName(true)).toEqual(true);
});
it('5. Sort content descending by name.', () => {
expect(contentServicesPage.sortAndCheckListIsOrderedByName(false)).toEqual(true);
});
it('6. Sort content ascending by author.', () => {
expect(contentServicesPage.sortAndCheckListIsOrderedByAuthor(true)).toEqual(true);
});
it('7. Sort content descending by author.', () => {
expect(contentServicesPage.sortAndCheckListIsOrderedByAuthor(false)).toEqual(true);
});
it('8. Sort content ascending by created date.', () => {
expect(contentServicesPage.sortAndCheckListIsOrderedByCreated(true)).toEqual(true);
});
it('9. Sort content descending by created date.', () => {
expect(contentServicesPage.sortAndCheckListIsOrderedByCreated(false)).toEqual(true);
});
it('10. File can be uploaded in a new created folder.', () => {
contentServicesPage.createNewFolder(folderTwoModel.name).checkContentIsDisplayed(folderTwoModel.name);
contentServicesPage.doubleClickRow(folderTwoModel.name).checkEmptyFolderMessageIsDisplayed();
});
it('11. Navigate to child folder via breadcrumbs.', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs(acsUser.getId());
contentServicesPage
.checkContentIsDisplayed(folderOneModel.name)
.doubleClickRow(folderOneModel.name)
.checkContentIsDisplayed(folderTwoModel.name)
.doubleClickRow(folderTwoModel.name);
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(folderTwoModel.name);
});
it('12. Navigate to parent folder via breadcrumbs.', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs(uploadedFolder.entry.name);
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(uploadedFolder.entry.name);
expect(contentServicesPage.getCurrentFolderID()).toContain(uploadedFolder.entry.id);
Util.refreshBrowser();
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(uploadedFolder.entry.name);
expect(contentServicesPage.getCurrentFolderID()).toContain(uploadedFolder.entry.id);
});
it('13. Each known extension has it s own icon.', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs(acsUser.getId());
contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
contentServicesPage.checkContentIsDisplayed(testFileModel.name);
contentServicesPage.checkIconColumn(pdfFileModel.name, extensions.pdf);
contentServicesPage.checkIconColumn(docxFileModel.name, extensions.docx);
contentServicesPage.checkIconColumn(testFileModel.name, extensions.test);
});
it('14. Navigate to root folder via breadcrumbs.', () => {
contentServicesPage.navigateToFolderViaBreadcrumbs(rootFolder);
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(rootFolderName);
});
});

View File

@@ -0,0 +1,365 @@
/*!
* @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 PaginationPage = require('./pages/adf/paginationPage');
import NavigationBarPage = require('./pages/adf/navigationBarPage');
import AcsUserModel = require('./models/ACS/acsUserModel');
import FolderModel = require('./models/ACS/folderModel');
import TestConfig = require('./test.config');
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 () {
let pagination = {
base: 'newFile',
secondSetBase: 'secondSet',
extension: '.txt'
};
let itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
fifteen: '15',
fifteenValue: 15,
twenty: '20',
twentyValue: 20,
default: '25'
};
let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage();
let paginationPage = new PaginationPage();
let navigationBarPage = new NavigationBarPage();
let acsUser = new AcsUserModel();
let newFolderModel = new FolderModel({ 'name': 'newFolder' });
let fileNames = [], nrOfFiles = 20, currentPage = 1, secondSetOfFiles, secondSetNumber = 25;
let folderTwoModel = new FolderModel({ 'name': 'folderTwo' });
let folderThreeModel = new FolderModel({ 'name': 'folderThree' });
beforeAll(async (done) => {
let uploadActions = new UploadActions();
fileNames = Util.generateSeqeunceFiles(10, nrOfFiles + 9, pagination.base, pagination.extension);
secondSetOfFiles = Util.generateSeqeunceFiles(10, secondSetNumber + 9, pagination.secondSetBase, pagination.extension);
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);
let folderThreeUploadedModel = await uploadActions.uploadFolder(this.alfrescoJsApi, folderThreeModel.name, '-my-');
let newFolderUploadeModel = await uploadActions.uploadFolder(this.alfrescoJsApi, newFolderModel.name, '-my-');
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, newFolderUploadeModel.entry.id);
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, folderThreeUploadedModel.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
it('[C260062] Default pagination settings', function () {
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.default);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfFiles + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames)).toEqual(true);
});
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C274713] 20 Items per page', function () {
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfFiles + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames)).toEqual(true);
});
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
});
it('[C260069] 5 Items per page', function () {
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(5, 10))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(10, 15))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
});
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
});
it('[C260067] 10 Items per page', function () {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.ten);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.tenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(0, 10))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.tenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(10, 20))).toEqual(true);
});
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
currentPage = 1;
});
it('[C260065] 15 Items per page', function () {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fifteenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(0, 15))).toEqual(true);
});
currentPage++;
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfFiles + ' of ' + nrOfFiles);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles - itemsPerPage.fifteenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
});
navigationBarPage.clickLogoutButton();
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkAcsContainer();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
});
it('[C91320] Pagination when the content is sorted', function () {
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(fileNames)).toEqual(true);
});
contentServicesPage.sortByName(false);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
fileNames.reverse();
expect(JSON.stringify(list) === JSON.stringify(fileNames)).toEqual(true);
});
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(fileNames.slice(15, 20))).toEqual(true);
});
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(fileNames.slice(10, 15))).toEqual(true);
});
paginationPage.selectItemsPerPage(itemsPerPage.ten);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(fileNames.slice(10, 20))).toEqual(true);
});
});
it('[C260107] Pagination in an empty folder', function () {
contentServicesPage.goToDocumentList();
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
contentServicesPage.navigateToFolder(newFolderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(newFolderModel.name);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
contentServicesPage.createNewFolder(folderTwoModel.name).checkContentIsDisplayed(folderTwoModel.name);
contentServicesPage.navigateToFolder(folderTwoModel.name);
contentServicesPage.checkPaginationIsNotDisplayed();
});
xit('[C260071] Items per page when having 25 files', function () {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.navigateToFolder(folderThreeModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(contentServicesPage.getActiveBreadcrumb()).toEqual(folderThreeModel.name);
paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + secondSetNumber);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fifteenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(0, 15))).toEqual(true);
});
currentPage++;
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + secondSetNumber + ' of ' + secondSetNumber);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - itemsPerPage.fifteenValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(15, 25))).toEqual(true);
});
currentPage = 1;
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.twentyValue * currentPage + ' of ' + secondSetNumber);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.twentyValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(0, 20))).toEqual(true);
});
currentPage++;
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 21-' + secondSetNumber + ' of ' + secondSetNumber);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - itemsPerPage.twentyValue);
contentServicesPage.getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(20, 25))).toEqual(true);
});
});
});

View File

@@ -0,0 +1,213 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import TasksPage = require('./pages/adf/process_services/tasksPage');
import UsingWidget = require('./pages/adf/process_services/widgets/usingWidget');
import CONSTANTS = require('./util/constants');
import FormDefinitionModel = require('./models/APS/FormDefinitionModel');
import Task = require('./models/APS/Task');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
let formInstance = new FormDefinitionModel();
import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions';
describe('Form widgets', () => {
let loginPage = new LoginPage();
let processServicesPage = new ProcessServicesPage();
let processUserModel;
let app = resources.Files.WIDGETS_SMOKE_TEST;
let appFields = app.form_fields;
let taskPage = new TasksPage();
let appModel;
let taskModel;
let newTask = 'First task';
let usingWidget = new UsingWidget();
let procUserModel;
let alfrescoJsApi;
beforeAll(async (done) => {
let users = new UsersActions();
let appsActions = new AppsActions();
alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location);
done();
});
afterAll(async (done) => {
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
done();
});
it('Check text, multiline widgets - label, value and displayed', () => {
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
processServicesPage.goToProcessServices().goToApp(appModel.name)
.clickTasksButton();
taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS);
taskPage.createNewTask().addName(newTask).addDescription('Description').addForm(app.formName).clickStartButton()
.then(() => {
taskPage.usingTasksListPage().checkTaskIsDisplayedInTasksList(newTask);
taskPage.usingFormFields().checkFormIsDisplayed();
expect(taskPage.usingTaskDetails().getTitle()).toEqual('Activities');
})
.then(() => {
return alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
})
.then( (response) => {
return alfrescoJsApi.activiti.taskFormsApi.getTaskForm(response.data[0].id);
})
.then((formDefinition) => {
formInstance.setFields(formDefinition.fields);
formInstance.setAllWidgets(formDefinition.fields);
return formInstance;
})
.then(() => {
expect(taskPage.usingFormFields().getFieldLabel(appFields.text_id))
.toEqual(formInstance.getWidgetBy('id', appFields.text_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.text_id))
.toEqual(formInstance.getWidgetBy('id', appFields.text_id).value || '');
expect(usingWidget.usingMultilineTextWidget().getFieldValue(appFields.multiline_id))
.toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.multiline_id))
.toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).name);
});
});
it('Check number, amount widgets - label, value and displayed', () => {
expect(taskPage.usingFormFields().getFieldValue(appFields.number_id))
.toEqual(formInstance.getWidgetBy('id', appFields.number_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.number_id))
.toEqual(formInstance.getWidgetBy('id', appFields.number_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.amount_id))
.toEqual(formInstance.getWidgetBy('id', appFields.amount_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.amount_id))
.toEqual(formInstance.getWidgetBy('id', appFields.amount_id).name);
});
it('Check attachfolder, attachfile widgets - label and displayed', () => {
expect(taskPage.usingFormFields().getFieldLabel(appFields.attachfolder_id))
.toEqual(formInstance.getWidgetBy('id', appFields.attachfolder_id).name);
expect(taskPage.usingFormFields().getFieldLabel(appFields.attachfile_id))
.toEqual(formInstance.getWidgetBy('id', appFields.attachfile_id).name);
});
it('Check date, date & time widgets - label, value and displayed', () => {
expect(taskPage.usingFormFields().getFieldLabel(appFields.date_id))
.toContain(formInstance.getWidgetBy('id', appFields.date_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.date_id))
.toEqual(formInstance.getWidgetBy('id', appFields.date_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.dateTime_id))
.toContain(formInstance.getWidgetBy('id', appFields.dateTime_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.dateTime_id))
.toEqual(formInstance.getWidgetBy('id', appFields.dateTime_id).value || '');
});
it('Check people, group widgets - label, value and displayed', () => {
expect(taskPage.usingFormFields().getFieldValue(appFields.people_id))
.toEqual(formInstance.getWidgetBy('id', appFields.people_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.people_id))
.toEqual(formInstance.getWidgetBy('id', appFields.people_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.group_id))
.toEqual(formInstance.getWidgetBy('id', appFields.group_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.group_id))
.toEqual(formInstance.getWidgetBy('id', appFields.group_id).name);
});
it('Check displayText, displayValue widgets - value and displayed', () => {
expect(usingWidget.usingDisplayTextWidget().getFieldLabel(appFields.displaytext_id))
.toEqual(formInstance.getWidgetBy('id', appFields.displaytext_id).value);
expect(usingWidget.usingDisplayValueWidget().getFieldLabel(appFields.displayvalue_id))
.toEqual(formInstance.getWidgetBy('id', appFields.displayvalue_id).value || 'Unknown type: readonly');
});
it('Check typeahead, header widgets - label, value and displayed', () => {
expect(usingWidget.usingHeaderWidget().getFieldLabel(appFields.header_id))
.toEqual(formInstance.getWidgetBy('id', appFields.header_id).name);
expect(taskPage.usingFormFields().getFieldValue(appFields.typeahead_id))
.toEqual(formInstance.getWidgetBy('id', appFields.typeahead_id).value || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.typeahead_id))
.toEqual(formInstance.getWidgetBy('id', appFields.typeahead_id).name);
});
it('Check checkbox, radiobuttons widgets - label, value and displayed', () => {
let radioOption = 1;
expect(taskPage.usingFormFields().getFieldLabel(appFields.checkbox_id))
.toContain(formInstance.getWidgetBy('id', appFields.checkbox_id).name);
expect(taskPage.usingFormFields().getFieldLabel(appFields.radiobuttons_id))
.toContain(formInstance.getWidgetBy('id', appFields.radiobuttons_id).name);
expect(usingWidget.usingRadioWidget().getSpecificOptionLabel(appFields.radiobuttons_id, radioOption))
.toContain(formInstance.getWidgetBy('id', appFields.radiobuttons_id).options[radioOption - 1].name);
});
it('Check hyperlink, dropdown, dynamictable widgets - label, value and displayed', () => {
expect(usingWidget.usingHyperlink().getFieldText(appFields.hyperlink_id))
.toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).hyperlinkUrl || '');
expect(taskPage.usingFormFields().getFieldLabel(appFields.hyperlink_id))
.toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).name);
expect(taskPage.usingFormFields().getFieldLabel(appFields.dropdown_id))
.toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).name);
expect(usingWidget.usingDropdown().getSelectedOptionText(appFields.dropdown_id))
.toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).value);
expect(usingWidget.usingDynamicTable().getFieldLabel(appFields.dynamictable_id))
.toContain(formInstance.getWidgetBy('id', appFields.dynamictable_id).name);
expect(usingWidget.usingDynamicTable().getColumnName(appFields.dynamictable_id))
.toContain(formInstance.getWidgetBy('id', appFields.dynamictable_id).columnDefinitions[0].name);
});
});

View File

@@ -0,0 +1,81 @@
/*!
* @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 AcsUserModel = require('./models/ACS/acsUserModel');
import FolderModel = require('./models/ACS/folderModel');
import TestConfig = require('./test.config');
import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions';
describe('Enable infinite scrolling', () => {
let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage();
let acsUser = new AcsUserModel();
let folderModel = new FolderModel({ 'name': 'folderOne' });
let fileNames = [], nrOfFiles = 30;
let fileNum = 0;
let files = {
base: 'newFile',
extension: '.txt'
};
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);
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
fileNames = Util.generateSeqeunceFiles(1, nrOfFiles, files.base, files.extension);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
let folderUploadedModel = await uploadActions.uploadFolder(this.alfrescoJsApi, folderModel.name, '-my-');
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, folderUploadedModel.entry.id);
done();
});
it('Enable infinite scrolling', () => {
contentServicesPage.navigateToFolder(folderModel.name);
contentServicesPage.enableInfiniteScrolling();
contentServicesPage.clickLoadMoreButton();
for (fileNum; fileNum < nrOfFiles; fileNum++) {
contentServicesPage.checkContentIsDisplayed(fileNames[fileNum]);
}
});
});

156
e2e/login_component.e2e.ts Normal file
View File

@@ -0,0 +1,156 @@
/*!
* @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 AdfContentServicesPage = require('./pages/adf/contentServicesPage');
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import NavigationBarPage = require('./pages/adf/navigationBarPage');
import TestConfig = require('./test.config');
import AcsUserModel = require('./models/ACS/acsUserModel');
import AdfSettingsPage = require('./pages/adf/settingsPage');
describe('Test Login component', () => {
let adfSettingsPage = new AdfSettingsPage();
let processServicesPage = new ProcessServicesPage();
let navigationBarPage = new NavigationBarPage();
let adfContentServicesPage = new AdfContentServicesPage();
let loginPage = new LoginPage();
let adminUserModel = new AcsUserModel({
'id': TestConfig.adf.adminUser,
'password': TestConfig.adf.adminPassword
});
let errorMessages = {
username: 'Your username needs to be at least 2 characters.',
invalid_credentials: 'You\'ve entered an unknown username or password',
password: 'Enter your password to sign in',
required: 'Required'
};
beforeAll( (done) => {
adfSettingsPage.setProviderEcmBpm();
done();
});
it('1. Username Required', () => {
loginPage.checkUsernameInactive();
loginPage.checkSignInButtonIsDisabled();
loginPage.enterUsername('A');
loginPage.checkUsernameTooltip(errorMessages.username);
loginPage.clearUsername();
loginPage.checkUsernameTooltip(errorMessages.required);
loginPage.checkUsernameHighlighted();
loginPage.checkSignInButtonIsDisabled();
});
it('2. Enter Password to sign in', () => {
loginPage.checkPasswordInactive();
loginPage.checkSignInButtonIsDisabled();
loginPage.enterPassword('A');
loginPage.checkPasswordTooltipIsNotVisible();
loginPage.clearPassword();
loginPage.checkPasswordTooltip(errorMessages.password);
loginPage.checkPasswordHighlighted();
loginPage.checkSignInButtonIsDisabled();
});
it('3. Username must be at least 2 characters long', () => {
loginPage.checkSignInButtonIsDisabled();
loginPage.enterUsername('A');
loginPage.checkUsernameTooltip(errorMessages.username);
loginPage.enterUsername('AB');
loginPage.checkUsernameTooltipIsNotVisible();
loginPage.checkSignInButtonIsDisabled();
loginPage.clearUsername();
});
it('4. Login button is enabled', () => {
loginPage.enterUsername(adminUserModel.id);
loginPage.checkSignInButtonIsDisabled();
loginPage.enterPassword('a');
loginPage.checkSignInButtonIsEnabled();
loginPage.clearUsername(adminUserModel.id);
loginPage.clearPassword();
});
it('5. You have entered an invalid username or password', () => {
loginPage.checkSignInButtonIsDisabled();
loginPage.enterUsername('test');
loginPage.enterPassword('test');
loginPage.checkSignInButtonIsEnabled();
loginPage.clickSignInButton();
loginPage.checkLoginError(errorMessages.invalid_credentials);
loginPage.clearUsername();
loginPage.clearPassword();
});
it('6. Password field is crypted', () => {
loginPage.checkSignInButtonIsDisabled();
loginPage.enterPassword('test');
loginPage.showPassword();
loginPage.checkPasswordIsShown('test');
loginPage.hidePassword();
loginPage.checkPasswordIsHidden();
loginPage.clearPassword();
});
it('7. Remember Need Help? and Register are displayed and hidden', () => {
loginPage.enableFooter();
loginPage.checkRememberIsDisplayed();
loginPage.checkNeedHelpIsDisplayed();
loginPage.checkRegisterDisplayed();
loginPage.disableFooter();
loginPage.checkRememberIsNotDisplayed();
loginPage.checkNeedHelpIsNotDisplayed();
loginPage.checkRegisterIsNotDisplayed();
});
it('8. Login to Process Services with Content Services disabled', () => {
loginPage.checkSignInButtonIsDisabled();
adfSettingsPage.setProviderBpm();
loginPage.login(adminUserModel.id, adminUserModel.password);
navigationBarPage.clickProcessServicesButton();
processServicesPage.checkApsContainer();
navigationBarPage.clickContentServicesButton();
loginPage.waitForElements();
});
it('9. Login to Content Services with Process Services disabled', () => {
loginPage.checkSignInButtonIsDisabled();
adfSettingsPage.setProviderEcm();
loginPage.login(TestConfig.adf.adminUser, TestConfig.adf.adminPassword);
navigationBarPage.clickContentServicesButton();
adfContentServicesPage.checkAcsContainer();
navigationBarPage.clickProcessServicesButton();
loginPage.waitForElements();
});
it('10. Able to login to both Content Services and Process Services', () => {
loginPage.checkSignInButtonIsDisabled();
adfSettingsPage.setProviderEcmBpm();
loginPage.login(adminUserModel.id, adminUserModel.password);
navigationBarPage.clickProcessServicesButton();
processServicesPage.checkApsContainer();
navigationBarPage.clickContentServicesButton();
adfContentServicesPage.checkAcsContainer();
navigationBarPage.clickLoginButton();
loginPage.waitForElements();
});
});

View File

@@ -0,0 +1,56 @@
/*!
* @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 AcsUserModel = function (details) {
this.firstName = Util.generateRandomString();
this.lastName = Util.generateRandomString();
this.password = Util.generateRandomString();
this.email = Util.generateRandomString();
this.id = Util.generateRandomString();
this.jobTitle = "N/A";
this.getFirstName = function () {
return this.firstName;
};
this.getLastName = function () {
return this.lastName;
};
this.getPassword = function () {
return this.password;
};
this.getEmail = function () {
return this.email;
};
this.getId = function () {
return this.id;
};
this.getJobTitle = function () {
return this.jobTitle;
};
Object.assign(this, details);
};
module.exports = AcsUserModel;

View File

@@ -0,0 +1,51 @@
/*!
* @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 ContentModel = function (details) {
this.mimeType = '';
this.mimeTypeName = '';
this.sizeInBytes = '';
this.encoding = '';
this.getMimeType = function () {
return this.mimeType;
};
this.getMimeTypeName = function () {
return this.mimeTypeName;
};
this.getSizeInBytes = function () {
if (this.sizeInBytes>=1024)
{
var bytes=(this.sizeInBytes/1024).toFixed(2)+' KB';
return bytes;
}
else {
return this.sizeInBytes;
}
};
this.getEncoding = function () {
return this.encoding;
};
Object.assign(this, details);
};
module.exports = ContentModel;

View File

@@ -0,0 +1,38 @@
/*!
* @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 ContentPropertiesModel = function (details) {
this['cm:author'] = '';
this['cm:description'] = '';
this['cm:title'] = '';
this.getAuthor = function () {
return this['cm:author'];
};
this.getDescription = function () {
return this['cm:description'];
};
this.getTitle = function () {
return this['cm:title'];
};
Object.assign(this, details);
};
module.exports = ContentPropertiesModel;

View File

@@ -0,0 +1,36 @@
/*!
* @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 AcsUserModel = function (details) {
this.displayName = Util.generateRandomString();
this.id = Util.generateRandomString();
this.getId = function () {
return this.id;
};
this.getDisplayName = function () {
return this.displayName;
};
Object.assign(this, details);
};
module.exports = AcsUserModel;

116
e2e/models/ACS/fileModel.js Normal file
View File

@@ -0,0 +1,116 @@
/*!
* @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 resources = require('../../util/resources');
var CreatedByModel = require('./createdByModel');
var ContentModel = require('./contentModel');
var ContentPropertiesModel = require('./contentProperties');
var FileModel = function (details) {
this.id = Util.generateRandomString();
this.name = Util.generateRandomString();
this.shortName = this.name;
this.location = resources.Files.ADF_DOCUMENTS.PDF.file_location;
this.tooltip = this.name;
this.version = "";
this.firstPageText = resources.Files.ADF_DOCUMENTS.PDF.first_page_text;
this.lastPageText = resources.Files.ADF_DOCUMENTS.PDF.last_page_text;
this.secondPageText = resources.Files.ADF_DOCUMENTS.PDF.second_page_text;
this.lastPageNumber = resources.Files.ADF_DOCUMENTS.PDF.last_page_number;
this.createdAt = "";
this.createdByUser = {};
this.modifiedByUser = {};
this.content = {};
this.properties = {};
this.getName = function () {
return this.name;
};
this.setVersion = function (ver) {
this.version = "-" + ver;
};
this.getVersionName = function () {
var extension = this.name.split(".")[1];
var name = this.name.split(".")[0];
return name + this.version + "." + extension;
};
this.getShortName = function () {
return this.shortName;
};
this.getLocation = function () {
return this.location;
};
this.getTooltip = function () {
return this.tooltip;
};
this.getId = function () {
return this.id;
};
this.getFirstPageText = function () {
return this.firstPageText;
};
this.getLastPageText = function () {
return this.lastPageText;
};
this.getSecondPageText = function () {
return this.secondPageText;
};
this.getLastPageNumber = function () {
return this.lastPageNumber;
};
this.getCreatedByUser = function () {
return this.createdByUser;
};
this.getModifiedByUser = function () {
return this.modifiedByUser;
};
this.getContent = function () {
return this.content;
};
this.getProperties = function () {
return this.properties;
};
this.update = function(details) {
Object.assign(this, {
createdByUser: new CreatedByModel(details.createdByUser),
modifiedByUser: new CreatedByModel(details.modifiedByUser),
content: new ContentModel(details.content),
properties: new ContentPropertiesModel(details.properties)
})
}
Object.assign(this, details);
};
module.exports = FileModel;

View File

@@ -0,0 +1,34 @@
/*!
* @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 FileModel = require('./fileModel');
var FilesModel = function () {
var files = null;
this.setFiles = function (arr) {
files = arr.map(function(item) {
return new FileModel(item.entry);
});
};
this.getFiles = function () {
return files;
};
};
module.exports = FilesModel;

View File

@@ -0,0 +1,52 @@
/*!
* @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 FolderModel = function (details) {
this.id = Util.generateRandomString();
this.name = Util.generateRandomString();
this.shortName = this.name;
this.tooltip = this.name;
this.location = "";
this.getName = function () {
return this.name;
};
this.getShortName = function () {
return this.shortName;
};
this.getTooltip = function () {
return this.tooltip;
};
this.getId = function () {
return this.id;
};
this.getLocation = function () {
return this.location;
};
Object.assign(this, details);
};
module.exports = FolderModel;

View File

@@ -0,0 +1,39 @@
/*!
* @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.
*/
/**
* App definition representation JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var AppDefinition = function (details) {
this.defaultAppId = "1";
this.deploymentId = "1";
this.description = "App deployment";
this.icon = "default icon";
this.id = 0;
this.modelId = 0;
this.name = "App name";
this.tenantId = 0;
this.theme = "default theme";
Object.assign(this, details);
};
module.exports = AppDefinition;

View File

@@ -0,0 +1,31 @@
/*!
* @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.
*/
/**
* App definition publish representation JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var AppPublish = function (details) {
this.comment = '';
this.force = true;
Object.assign(this, details);
};
module.exports = AppPublish;

View File

@@ -0,0 +1,58 @@
/*!
* @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 FormDefinitionFieldModel = function (details) {
this.fieldType;
this.id;
this.name;
this.value;
this.type;
this.required;
this.readOnly;
this.overrideId;
this.colspan;
this.placeholder;
this.minLength;
this.maxLength;
this.minValue;
this.maxValue;
this.regexPattern;
this.optionType;
this.hasEmptyValue;
this.options;
this.restUrl;
this.restResponsePath;
this.restIdProperty;
this.setRestLabelProperty;
this.tab;
this.className;
this.dateDisplayFormat;
this.layout = {};
this.sizeX;
this.sizeY;
this.row;
this.col;
this.columnDefinitions;
this.visibilityCondition;
this.numberOfColumns;
this.fields = {};
Object.assign(this, details);
};
module.exports = FormDefinitionFieldModel;

View File

@@ -0,0 +1,61 @@
/*!
* @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 FormDefinitionFieldModel = require('./FormDefinitionFieldModel');
var FormDefinitionModel = function (fields) {
var fields = null;
var widgets = null;
this.setFields = function (arr) {
fields = arr.map(function(item) {
return new FormDefinitionFieldModel(item);
})
};
this.setAllWidgets = function (arr) {
widgets = arr.reduce(function(acc, item) {
if(item.type === 'container') {
var children = Object.keys(item.fields).map(function(key) {
return item.fields[key][0];
});
return acc.concat(children);
}
return acc.concat(item);
}, []);
};
this.getWidgets = function () {
return widgets;
};
this.getWidgetBy = function (key, value) {
return widgets.find(function(widget) {
return widget[key]===value;
})
};
this.findFieldBy = function(key, value) {
return fields.find(function(field) {
return field[key]===value;
})
};
}
module.exports = FormDefinitionModel;

View File

@@ -0,0 +1,58 @@
/*!
* @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 FormModel = function (details) {
this.id;
this.name;
this.description;
this.modelId;
this.appDefinitionId;
this.appDeploymentId;
this.tenantId;
this.getName = function () {
return this.name;
};
this.getId = function () {
return this.id;
};
this.getDescription = function () {
return this.description;
};
this.getModelId = function () {
return this.modelId;
};
this.getAppDefinitionId = function () {
return this.appDefinitionId;
};
this.getAppDeploymentId = function () {
return this.appDeploymentId;
};
this.getTenantId = function () {
return this.tenantId;
};
Object.assign(this, details);
};
module.exports = FormModel;

37
e2e/models/APS/Group.js Normal file
View File

@@ -0,0 +1,37 @@
/*!
* @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');
/**
* Create Group Object
*
* @param details - Group object used to overwrite the default values
* @constructor
*/
var Group = function (details) {
this.name = Util.generateRandomString();
this.type = "1";
this.parentGroupId = null;
this.tenantId = "1";
Object.assign(this, details);
};
module.exports = Group;

View File

@@ -0,0 +1,49 @@
/*!
* @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 ProcessCreatedByModel = function (details) {
this.id;
this.firstName;
this.lastName;
this.email;
this.getFirstName = function () {
return this.firstName;
};
this.getId = function () {
return this.id;
};
this.getLastName = function () {
return this.lastName;
};
this.getEmail = function () {
return this.email;
};
this.getEntireName = function() {
return this.firstName + " " + this.getLastName();
};
Object.assign(this, details);
};
module.exports = ProcessCreatedByModel;

View File

@@ -0,0 +1,32 @@
/*!
* @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.
*/
/**
* Process Instance representation JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var ProcessInstance = function (details) {
this.processDefinitionId = 1234;
this.name = "Process started from REST API";
Object.assign(this, details);
};
module.exports = ProcessInstance;

View File

@@ -0,0 +1,83 @@
/*!
* @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 ProcessCreatedByModel = require('./ProcessCreatedByModel');
var ProcessModel = function (details) {
this.id;
this.name;
this.version;
this.modelType;
this.description;
this.createdByFullName;
this.createdBy;
this.lastUpdatedByFullName;
this.lastUpdatedBy;
this.lastUpdated;
this.startedBy = {};
this.getName = function () {
return this.name;
};
this.getId = function () {
return this.id;
};
this.getVersion = function () {
return this.version;
};
this.getModelType = function () {
return this.modelType;
};
this.getDescription = function () {
return this.description;
};
this.getCreatedByFullName = function () {
return this.createdByFullName;
};
this.getCreatedBy = function () {
return this.createdBy;
};
this.getLastUpdatedByFullName = function () {
return this.lastUpdatedByFullName;
};
this.getLastUpdatedBy = function () {
return this.lastUpdatedBy;
};
this.getLastUpdated = function () {
return this.lastUpdated;
};
this.getStartedBy = function () {
return this.startedBy;
};
Object.assign(this, details);
Object.assign(this.startedBy, new ProcessCreatedByModel(details.startedBy));
};
module.exports = ProcessModel;

View File

@@ -0,0 +1,33 @@
/*!
* @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');
/**
* Create Json Object for standalone task
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var StandaloneTask = function (details) {
this.name = Util.generateRandomString();
Object.assign(this, details);
};
module.exports = StandaloneTask;

32
e2e/models/APS/Task.js Normal file
View File

@@ -0,0 +1,32 @@
/*!
* @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.
*/
/**
* Create and manage task JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var Task = function (details) {
this.processInstanceId;
this.sort;
Object.assign(this, details);
};
module.exports = Task;

View File

@@ -0,0 +1,49 @@
/*!
* @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 TaskAssigneeModel = function (details) {
this.id;
this.firstName;
this.lastName;
this.email;
this.getFirstName = function () {
return this.firstName;
};
this.getId = function () {
return this.id;
};
this.getLastName = function () {
return this.lastName;
};
this.getEmail = function () {
return this.email;
};
this.getEntireName = function() {
return this.firstName + " " + this.getLastName();
};
Object.assign(this, details);
};
module.exports = TaskAssigneeModel;

View File

@@ -0,0 +1,76 @@
/*!
* @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 TaskAssigneeModel = require('./TaskAssigneeModel');
var TaskModel = function (details) {
this.id;
this.name;
this.description;
this.category;
this.created;
this.dueDate;
this.priority;
this.parentTaskName;
this.formKey;
this.assignee = {};
this.getName = function () {
return this.name;
};
this.getId = function () {
return this.id;
};
this.getDescription = function () {
return this.description;
};
this.getCategory = function () {
return this.category;
};
this.getCreated = function () {
return this.created;
};
this.getDueDate = function () {
return this.dueDate;
};
this.getPriority = function () {
return this.priority;
};
this.getParentTaskName = function () {
return this.parentTaskName;
};
this.getFormKey = function () {
return this.formKey;
};
this.getAssignee = function () {
return this.assignee;
};
Object.assign(this, details);
Object.assign(this.assignee, new TaskAssigneeModel(details.assignee));
};
module.exports = TaskModel;

36
e2e/models/APS/Tenant.js Normal file
View File

@@ -0,0 +1,36 @@
/*!
* @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');
/**
* Create tenant JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var Tenant = function (details) {
this.active = true;
this.configuration = "DefaultConfig";
this.domain = "DefaultDomain";
this.maxUsers = 10;
this.name = Util.generateRandomString();
Object.assign(this, details);
};
module.exports = Tenant;

39
e2e/models/APS/User.js Normal file
View File

@@ -0,0 +1,39 @@
/*!
* @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');
/**
* Create User JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var User = function (details) {
this.email = Util.generateRandomEmail();
this.firstName = Util.generateRandomString();
this.lastName = Util.generateRandomString();
this.password = Util.generatePasswordString();
this.type = 'enterprise';
this.tenantId = "1";
this.company = null;
Object.assign(this, details);
};
module.exports = User;

View File

@@ -0,0 +1,382 @@
/*!
* @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

@@ -0,0 +1,188 @@
/*!
* @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 CardViewPage = function () {
var title = element(by.css("div[info-drawer-title]"));
var activeTab = element(by.css("div[class*='mat-tab-label-active']"));
var expandedAspect = element(by.css("mat-expansion-panel-header[aria-expanded='true']"));
var aspectTitle = by.css("mat-panel-title");
var name = element(by.css("span[data-automation-id='card-textitem-value-name'] span"));
var creator = element(by.css("span[data-automation-id='card-textitem-value-createdByUser.displayName'] span"));
var createdDate = element(by.css("span[data-automation-id='card-dateitem-createdAt'] span"));
var modifier = element(by.css("span[data-automation-id='card-textitem-value-modifiedByUser.displayName'] span"));
var modifiedDate = element(by.css("span[data-automation-id='card-dateitem-modifiedAt'] span"));
var mimetypeName = element(by.css("span[data-automation-id='card-textitem-value-content.mimeTypeName']"));
var size = element(by.css("span[data-automation-id='card-textitem-value-content.sizeInBytes']"));
var description = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:description'] span"));
var author = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:author'] span"));
var titleProperty = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:title'] span"));
var editIcon = element(by.css("button[data-automation-id='mata-data-card-toggle-edit']"));
var informationButton = element(by.css("button[data-automation-id='mata-data-card-toggle-expand']"));
var informationSpan = element(by.css("span[data-automation-id='mata-data-card-toggle-expand-label']"));
var informationIcon = element(by.css("span[data-automation-id='mata-data-card-toggle-expand-label'] ~ mat-icon"));
var uploadNewVersionButton = element(by.css("input[data-automation-id='upload-single-file']"));
var rightChevron = element(by.css("div[class*='header-pagination-after']"));
this.getTitle = function () {
Util.waitUntilElementIsVisible(title);
return title.getText();
};
this.getActiveTab = function () {
Util.waitUntilElementIsVisible(activeTab);
return activeTab.getText();
};
this.getExpandedAspectName = function () {
Util.waitUntilElementIsVisible(expandedAspect);
return expandedAspect.element(aspectTitle).getText();
};
this.getName = function () {
Util.waitUntilElementIsVisible(name);
return name.getText();
};
this.getCreator = function () {
Util.waitUntilElementIsVisible(creator);
return creator.getText();
};
this.getCreatedDate = function () {
Util.waitUntilElementIsVisible(createdDate);
return createdDate.getText();
};
this.getModifier = function () {
Util.waitUntilElementIsVisible(modifier);
return modifier.getText();
};
this.getModifiedDate = function () {
Util.waitUntilElementIsVisible(modifiedDate);
return modifiedDate.getText();
};
this.getMimetypeName = function () {
Util.waitUntilElementIsVisible(mimetypeName);
return mimetypeName.getText();
};
this.getSize = function () {
Util.waitUntilElementIsVisible(size);
return size.getText();
};
this.getDescription = function () {
Util.waitUntilElementIsVisible(description);
return description.getText();
};
this.getAuthor = function () {
Util.waitUntilElementIsVisible(author);
return author.getText();
};
this.getTitleProperty = function () {
Util.waitUntilElementIsVisible(titleProperty);
return titleProperty.getText();
};
this.editIconIsDisplayed = function() {
Util.waitUntilElementIsVisible(editIcon);
return editIcon.getText();
};
this.informationButtonIsDisplayed = function() {
Util.waitUntilElementIsVisible(informationSpan);
return informationSpan.getText();
};
this.clickOnInformationButton = function() {
Util.waitUntilElementIsVisible(informationButton);
Util.waitUntilElementIsClickable(informationButton);
informationButton.click();
return this;
};
this.getInformationButtonText = function() {
Util.waitUntilElementIsVisible(informationSpan);
return informationSpan.getText();
};
this.getInformationIconText = function() {
Util.waitUntilElementIsVisible(informationIcon);
return informationIcon.getText();
};
this.clickOnVersionsTab = function() {
this.clickRightChevronToGetToTab('Versions');
var versionsTab = element(by.cssContainingText("div[id*='mat-tab-label']", "Versions"));
Util.waitUntilElementIsVisible(versionsTab);
versionsTab.click();
return this;
};
this.clickOnPropertiesTab = function() {
var propertiesTab = element(by.cssContainingText("div[class='mat-tab-labels'] div", "Properties"));
Util.waitUntilElementIsVisible(propertiesTab);
propertiesTab.click();
return this;
};
this.clickRightChevron = function() {
Util.waitUntilElementIsVisible(rightChevron);
rightChevron.click();
return this;
};
this.clickRightChevronToGetToTab = (tabName) => {
element.all(by.css('.mat-tab-label'))
.map((element) => element.getAttribute('innerText'))
.then((texts) => {
for (let text of texts) {
if (text === tabName ) {
break;
}
this.clickRightChevron();
}
});
};
this.checkUploadVersionsButtonIsDisplayed = function() {
Util.waitUntilElementIsVisible(uploadNewVersionButton);
return this;
};
this.checkVersionIsDisplayed = function(version) {
Util.waitUntilElementIsVisible(element(by.cssContainingText("h4[class*='adf-version-list-item-name']", version)));
return this;
};
this.getEditIconTooltip = function () {
return editIcon.getAttribute('title');
};
this.getInformationButtonTooltip = function () {
return informationSpan.getAttribute('title');
};
};
module.exports = CardViewPage;

View File

@@ -0,0 +1,337 @@
/*!
* @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 ContentList = require('./dialog/contentList');
var CreateFolderDialog = require('./dialog/createFolderDialog');
var path = require('path');
var TestConfig = require('../../test.config');
var ContentServicesPage = function (){
var contentList = new ContentList();
var createFolderDialog = new CreateFolderDialog();
var uploadBorder = element(by.css("div[class='document-list-container']"));
var tableBody = element.all(by.css("adf-document-list div[class='adf-datatable-body']")).first();
var contentServices = element(by.css("a[data-automation-id='Content Services']"));
var currentFolder = element(by.css("div[class*='adf-breadcrumb-item active'] div"));
var createFolderButton = element(by.cssContainingText("mat-icon", "create_new_folder"));
var activeBreadcrumb = element(by.css("div[class*='active']"));
var folderID = element.all(by.css("div[class*='settings'] p")).first();
var tooltip = by.css("div[class*='--text full-width'] span");
var uploadFileButton = element(by.css("input[data-automation-id='upload-single-file']"));
var uploadMultipleFileButton = element(by.css("input[data-automation-id='upload-multiple-files']"));
var uploadFolderButton = element(by.css("input[data-automation-id='uploadFolder']"));
var errorSnackBar = element(by.css("simple-snack-bar[class*='mat-simple-snackbar']"));
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']"));
/**
* Check Document List is displayed
* @method checkAcsContainer
*/
this.checkAcsContainer = function (){
Util.waitUntilElementIsVisible(uploadBorder);
return this;
};
this.waitForTableBody = function (){
Util.waitUntilElementIsVisible(tableBody);
};
/**
* Go to Document List Page
* @method goToDocumentList
* */
this.goToDocumentList = function() {
Util.waitUntilElementIsVisible(contentServices);
Util.waitUntilElementIsClickable(contentServices);
contentServices.click();
this.checkAcsContainer();
};
this.navigateToDocumentList = function() {
browser.driver.get(contentServicesURL);
this.checkAcsContainer();
};
this.numberOfResultsDisplayed = function () {
return contentList.getAllDisplayedRows();
};
this.currentFolderName = function() {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(currentFolder);
currentFolder.getText().then(function (result) {
deferred.fulfill(result);
});
return deferred.promise;
};
this.getTooltip = function (content) {
return contentList.getRowByRowName(content).element(tooltip).getAttribute('title');
};
this.getBreadcrumbTooltip = function (content) {
return element(by.css("nav[data-automation-id='breadcrumb'] div[title='" +content +"']")).getAttribute('title');
};
this.getAllRowsNameColumn = function () {
return contentList.getAllRowsNameColumn();
};
/**
* Sort the list by name column.
*
* @param sortOrder : 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByName = function (sortOrder) {
contentList.sortByName(sortOrder);
};
/**
* Sort the list by author column.
*
* @param sortOrder : 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByAuthor = function (sortOrder) {
contentList.sortByAuthor(sortOrder);
};
/**
* Sort the list by created column.
*
* @param sortOrder : 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByCreated = function (sortOrder) {
return contentList.sortByCreated(sortOrder);
};
/**
* Sort by name and check the list is sorted.
*
* @param sortOrder : 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByName = function (sortOrder) {
this.sortByName(sortOrder);
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByNameColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
/**
* Sort by author and check the list is sorted.
*
* @param sortOrder : 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByAuthor = function (sortOrder) {
this.sortByAuthor(sortOrder);
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByAuthorColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
/**
* Sort by created and check the list is sorted.
*
* @param sortOrder : 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByCreated = function (sortOrder) {
this.sortByCreated(sortOrder);
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByCreatedColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
this.navigateToFolder = function (folder) {
contentList.navigateToFolder(folder);
return this;
};
this.doubleClickRow = function (folder) {
contentList.doubleClickRow(folder);
return this;
};
this.doubleClickEntireRow = function (folder) {
contentList.doubleClickEntireRow(folder);
return this;
};
this.createNewFolder = function (folder) {
Util.waitUntilElementIsVisible(createFolderButton);
createFolderButton.click();
createFolderDialog.addFolderName(folder);
createFolderDialog.clickOnCreateButton();
return this;
};
this.checkContentIsDisplayed = function (content) {
contentList.checkContentIsDisplayed(content);
return this;
};
this.checkContentsAreDisplayed = function (content) {
for( i=0; i < content.length; i++) {
this.checkContentIsDisplayed(content[i]);
}
return this;
};
this.checkContentIsNotDisplayed = function (content) {
contentList.checkContentIsNotDisplayed(content);
return this;
};
this.checkContentsAreNotDisplayed = function (content) {
for( i=0; i < content.length; i++) {
this.checkContentIsNotDisplayed(content[i]);
}
return this;
};
this.checkEmptyFolderMessageIsDisplayed = function () {
contentList.checkEmptyFolderMessageIsDisplayed();
return this;
};
this.navigateToFolderViaBreadcrumbs = function (folder) {
contentList.tableIsLoaded();
var breadcrumb = element(by.css("a[data-automation-id='breadcrumb_"+ folder +"']"));
Util.waitUntilElementIsVisible(breadcrumb);
breadcrumb.click();
contentList.tableIsLoaded();
return this;
};
this.getActiveBreadcrumb = function () {
Util.waitUntilElementIsVisible(activeBreadcrumb);
return activeBreadcrumb.getAttribute("title");
};
this.getCurrentFolderID = function() {
Util.waitUntilElementIsVisible(folderID);
return folderID.getText();
};
this.checkIconColumn = function (file, extension) {
contentList.checkIconColumn(file, extension);
return this;
};
this.uploadFile = function (fileLocation) {
this.checkUploadButton();
uploadFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
this.checkUploadButton();
return this;
};
this.uploadMultipleFile = function (files) {
Util.waitUntilElementIsVisible(uploadMultipleFileButton);
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;
};
this.uploadFolder = function (folder) {
Util.waitUntilElementIsVisible(uploadFolderButton);
uploadFolderButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, folder)));
Util.waitUntilElementIsVisible(uploadFolderButton);
return this;
};
this.getSingleFileButtonTooltip = function () {
Util.waitUntilElementIsVisible(uploadFileButton);
return uploadFileButton.getAttribute("title");
};
this.getMultipleFileButtonTooltip = function () {
Util.waitUntilElementIsVisible(uploadMultipleFileButton);
return uploadMultipleFileButton.getAttribute("title");
};
this.getFolderButtonTooltip = function () {
Util.waitUntilElementIsVisible(uploadFolderButton);
return uploadFolderButton.getAttribute("title");
};
this.checkUploadButton = function () {
Util.waitUntilElementIsVisible(uploadFileButton);
Util.waitUntilElementIsClickable(uploadFileButton);
return this;
};
this.deleteContent = function (content) {
contentList.deleteContent(content);
return this;
};
this.deleteContents = function (content) {
for( i=0; i<content.length; i++) {
this.deleteContent(content[i]);
this.checkContentIsNotDisplayed(content[i]);
};
return this;
};
this.getErrorMessage = function() {
Util.waitUntilElementIsVisible(errorSnackBar);
var deferred = protractor.promise.defer();
errorSnackBar.getText().then( function (text) {
deferred.fulfill(text);
});
return deferred.promise;
};
this.checkItemInDocList = function (fileName) {
Util.waitUntilElementIsVisible(element(by.css("div[data-automation-id='text_" + fileName + "']")));
};
this.enableInfiniteScrolling = function () {
var infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
Util.waitUntilElementIsVisible(infiniteScrollButton);
infiniteScrollButton.click();
return this;
};
this.clickLoadMoreButton = function () {
Util.waitUntilElementIsVisible(loadMoreButton);
Util.waitUntilElementIsClickable(loadMoreButton);
loadMoreButton.click();
return this;
};
this.checkPaginationIsNotDisplayed = function (){
Util.waitUntilElementIsVisible(emptyPagination);
};
};
module.exports = ContentServicesPage;

View File

@@ -0,0 +1,250 @@
/*!
* @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 TestConfig = require('../../test.config');
var Util = require('../../util/util');
var DataTablePage = function () {
var dataTableURL = TestConfig.adf.url + TestConfig.adf.port + "/datatable";
var multiSelect = element(by.css("div[data-automation-id='multiselect'] label > div[class='mat-checkbox-inner-container']"));
var selectionButton = element(by.css("div[class='mat-select-arrow']"));
var selectionDropDown = element(by.css("div[class*='ng-trigger-transformPanel']"));
var allSelectedRows = element.all(by.css("div[class*='is-selected']"));
var selectedRowNumber = element(by.css("div[class*='is-selected'] div[data-automation-id*='text_']"));
var selectAll = element(by.css("div[class*='header'] label"));
var list = element.all(by.css("div[class*=adf-datatable-row]"));
var addRow = element(by.xpath("//span[contains(text(),'Add row')]/.."));
var replaceRows = element(by.xpath("//span[contains(text(),'Replace rows')]/.."));
var replaceColumns = element(by.xpath("//span[contains(text(),'Replace columns')]/.."));
var loadNode = element(by.xpath("//span[contains(text(),'Load Node')]/.."));
var createdOnColumn = element(by.css("div[data-automation-id='auto_id_createdOn']"));
var pageLoaded = element(by.css("div[data-automation-id='auto_id_id']"));
var tableBody = element.all(by.css("adf-document-list div[class='adf-datatable-body']")).first();
this.goToDatatable = function () {
browser.driver.get(dataTableURL);
Util.waitUntilElementIsVisible(pageLoaded);
};
/**
* Retrieve row by row number
*
* @param rowNumber
*/
this.getRowByRowNumber = function (rowNumber) {
Util.waitUntilElementIsVisible(element(by.css("div[data-automation-id='text_" + rowNumber +"']")));
return element(by.css("div[data-automation-id='text_" + rowNumber +"']"));
};
/**
* Retrieve the checkbox of the row
*
* @param rowNumber
*/
this.getRowCheckbox = function (rowNumber) {
return this.getRowByRowNumber(rowNumber).element(by.xpath("ancestor::div/div/mat-checkbox[contains(@class, 'mat-checkbox-checked')]"));
};
/**
* Click multiselect option
* @property clickMultiSelect
* */
this.clickMultiSelect = function () {
Util.waitUntilElementIsVisible(multiSelect);
multiSelect.click();
};
/**
* Click specific checkbox in row
* @method clickCheckbox
* @param {String} row number
*/
this.clickCheckbox = function (rowNumber) {
var checkbox = this.getRowByRowNumber(rowNumber).element(by.xpath("ancestor::div[contains(@class, 'adf-datatable-row')]//mat-checkbox/label"));
Util.waitUntilElementIsVisible(checkbox);
checkbox.click();
};
/**
* Select a specific row
* @method selectRow
* @param {String} row number
*/
this.selectRow = function (rowNumber) {
return this.getRowByRowNumber(rowNumber).click();
};
/**
* Select a specific row using command key
* @method selectRow
* @param {String} row number
*/
this.selectRowWithKeyboard = function (rowNumber) {
var row = this.getRowByRowNumber(rowNumber);
browser.actions().sendKeys(protractor.Key.COMMAND).click(row).perform();
};
/**
* Select a specific selection mode
* @method selectSelectionMode
* @param {String} selection mode
*/
this.selectSelectionMode = function (selectionMode) {
var selectMode = element(by.cssContainingText("span[class='mat-option-text']", selectionMode));
selectionButton.click();
Util.waitUntilElementIsVisible(selectionDropDown);
selectMode.click();
};
/**
* Check if a specific row is selected
* @method checkRowIsSelected
* @param {String} row number
*/
this.checkRowIsSelected = function (rowNumber) {
var isRowSelected = this.getRowByRowNumber(rowNumber).element(by.xpath("ancestor::div[contains(@class, 'is-selected')]"));
Util.waitUntilElementIsVisible(isRowSelected);
};
/**
* Check if a specific row is not selected
* @method checkRowIsNotSelected
* @param {String} row number
*/
this.checkRowIsNotSelected = function (rowNumber) {
var isRowSelected = this.getRowByRowNumber(rowNumber).element(by.xpath("ancestor::div[contains(@class, 'adf-datatable-row custom-row-style ng-star-inserted is-selected')]"));
Util.waitUntilElementIsNotOnPage(isRowSelected);
};
/**
* Check no row is selected
* @method checkNoRowIsSelected
*/
this.checkNoRowIsSelected = function () {
Util.waitUntilElementIsNotOnPage(selectedRowNumber);
};
this.checkAllRows = function () {
Util.waitUntilElementIsVisible(selectAll);
selectAll.click();
};
/**
* Check specfic row is checked
* @method checkRowIsChecked
* @param {String} row number
*/
this.checkRowIsChecked = function (rowNumber) {
Util.waitUntilElementIsVisible(this.getRowCheckbox(rowNumber));
};
/**
* Check specfic row is not checked
* @method checkRowIsNotChecked
* @param {String} row number
*/
this.checkRowIsNotChecked = function (rowNumber) {
Util.waitUntilElementIsNotOnPage(this.getRowCheckbox(rowNumber));
};
/**
* Add a row to the table
* @method addRow
*/
this.addRow = function () {
Util.waitUntilElementIsVisible(addRow);
addRow.click();
};
/**
* Get the number of rows of the table
* @method getNumberOfRows
*/
this.getNumberOfRows = function () {
return list.count();
};
/**
* Get the number of selected rows of the table
* @method getNumberOfSelectedRows
*/
this.getNumberOfSelectedRows = function () {
return allSelectedRows.count();
};
/**
* replace rows
* @method replaceRows
* @param {String} id
*/
this.replaceRows = function (id) {
var rowID = this.getRowByRowNumber(id);
Util.waitUntilElementIsVisible(rowID);
replaceRows.click();
Util.waitUntilElementIsNotOnPage(rowID);
};
/**
* replace columns
* @method replaceColumns
*/
this.replaceColumns = function () {
Util.waitUntilElementIsVisible(replaceColumns);
replaceColumns.click();
Util.waitUntilElementIsNotOnPage(createdOnColumn);
};
/**
* check the nodeID is the same with the userHome folder's ID
* @method replaceColumns
*/
this.checkLoadNode = function (userHome) {
var nodeId = element(by.css("div[data-automation-id*='" + userHome + "']"));
Util.waitUntilElementIsVisible(loadNode);
loadNode.click();
Util.waitUntilElementIsVisible(nodeId, 10000);
};
this.navigateToContent = function(content) {
var row = this.getRowByRowName(content);
Util.waitUntilElementIsPresent(row);
row.click();
this.checkRowIsSelected(content);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
};
this.getRowsName = function (content) {
var row = element(by.css("div[data-automation-id*='" + content + "']"));
Util.waitUntilElementIsPresent(row);
return row;
};
this.getRowByRowName = function (content) {
var rowByRowName = by.xpath("ancestor::div[contains(@class, 'adf-datatable-row')]");
Util.waitUntilElementIsPresent(this.getRowsName(content).element(rowByRowName));
return this.getRowsName(content).element(rowByRowName);
};
this.waitForTableBody = function (){
Util.waitUntilElementIsVisible(tableBody);
};
};
module.exports = DataTablePage;

View File

@@ -0,0 +1,301 @@
/*!
* @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 ContentList = function () {
var deleteContent = element(by.css("button[data-automation-id*='DELETE']"));
var moveContent = element(by.css("button[data-automation-id*='MOVE']"));
var copyContent = element(by.css("button[data-automation-id*='COPY']"));
var downloadContent = element(by.css("button[data-automation-id*='DOWNLOAD']"));
var actionMenu = element(by.css("div[role='menu']"));
var optionButton = by.css("button[data-automation-id*='action_menu_']");
var rowByRowName = by.xpath("ancestor::div[contains(@class, 'adf-datatable-row')]");
var nameColumn = by.css("div[class*='document-list-container'] div[class*='adf-datatable-row'] div[class*='--text full-width'] span");
var nameColumnHeader = by.css("div[data-automation-id='auto_id_name']");
var createdByColumn = by.css("div[class*='--text'][title='Created by'] span");
var createdByColumnHeader = by.css("div[data-automation-id*='auto_id_createdByUser']");
var createdColumn = by.css("div[class*='--date'] span");
var createdColumnHeader = by.css("div[data-automation-id*='auto_id_createdAt']");
var rows = by.css("div[class='document-list-container'] div[class*='adf-datatable-body'] div[class*='adf-datatable-row']");
var emptyFolderMessage = element(by.css("div[class='adf-empty-folder-this-space-is-empty']"));
var table = element(by.css("div[class*='upload-border']"));
this.getRowsName = function (content) {
var row = element(by.xpath("//div[@class='document-list-container']//span[@title='" + content + "']"));
Util.waitUntilElementIsVisible(row);
return row;
};
this.getRowByRowName = function (content) {
Util.waitUntilElementIsOnPage(this.getRowsName(content).element(rowByRowName));
Util.waitUntilElementIsVisible(this.getRowsName(content).element(rowByRowName));
return this.getRowsName(content).element(rowByRowName);
};
this.getAllDisplayedRows = function () {
return element.all(rows).count();
};
this.getAllRowsNameColumn = function () {
return this.getAllRowsColumnValues(nameColumn);
};
this.getAllRowsColumnValues = function (locator) {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(element.all(locator).first());
var initialList = [];
element.all(locator).each(function (element) {
element.getText().then(function (text) {
if (text !== '') {
initialList.push(text);
}
;
});
}).then(function () {
deferred.fulfill(initialList);
});
return deferred.promise;
};
this.deleteContent = function (content) {
this.clickOnActionMenu(content);
this.waitForContentOptions();
deleteContent.click();
};
this.moveContent = function (content) {
this.clickOnActionMenu(content);
moveContent.click();
};
this.copyContent = function (content) {
this.clickOnActionMenu(content);
copyContent.click();
};
this.waitForContentOptions = function () {
Util.waitUntilElementIsVisible(copyContent);
Util.waitUntilElementIsVisible(moveContent);
Util.waitUntilElementIsVisible(deleteContent);
Util.waitUntilElementIsVisible(downloadContent);
};
this.clickOnActionMenu = function (content) {
this.getRowByRowName(content).element(optionButton).click();
Util.waitUntilElementIsVisible(actionMenu);
return this;
};
this.sortByColumn = function (sortOrder, locator) {
Util.waitUntilElementIsVisible(element(locator));
return element(locator).getAttribute('class').then(function (result) {
if (sortOrder === true) {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
element(locator).click();
}
}
}
else {
if (result.includes('sorted-asc')) {
element(locator).click();
} else if (result.includes('sortable')) {
element(locator).click();
element(locator).click();
}
}
return Promise.resolve();
});
};
/**
* Sort the list by name column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByName = function (sortOrder) {
this.sortByColumn(sortOrder, nameColumnHeader);
};
/**
* Sort the list by author column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByAuthor = function (sortOrder) {
this.sortByColumn(sortOrder, createdByColumnHeader);
};
/**
* Sort the list by created column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByCreated = function (sortOrder) {
this.sortByColumn(sortOrder, createdColumnHeader);
};
/**
* Check the list is sorted by name column.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return sorted : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.checkListIsOrderedByNameColumn = function (sortOrder) {
var deferred = protractor.promise.defer();
deferred.fulfill(this.checkListIsSorted(sortOrder, nameColumn));
return deferred.promise;
};
/**
* Check the list is sorted by author column.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return sorted : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.checkListIsOrderedByAuthorColumn = function (sortOrder) {
var deferred = protractor.promise.defer();
deferred.fulfill(this.checkListIsSorted(sortOrder, createdByColumn));
return deferred.promise;
};
/**
* Check the list is sorted by created column.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return sorted : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.checkListIsOrderedByCreatedColumn = function (sortOrder) {
var deferred = protractor.promise.defer();
var lastValue;
var sorted = true;
element.all(createdColumn).map(function (element) {
return element.getText();
}).then(function (texts) {
texts.forEach(function (text) {
if (lastValue !== undefined) {
var currentDate = new Date(text);
var lastDate = new Date(lastValue);
if (sortOrder === true && currentDate.getTime() < lastDate.getTime()) {
sorted = false;
}
if (sortOrder === false && currentDate.getTime() > lastDate.getTime()) {
sorted = false;
}
}
lastValue = text;
});
deferred.fulfill(sorted);
});
return deferred.promise;
};
/**
* Check the list is sorted.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @param locator: locator for column
* @return 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.checkListIsSorted = function (sortOrder, locator) {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(element.all(locator).first());
var initialList = [];
element.all(locator).each(function (element) {
element.getText().then(function (text) {
initialList.push(text);
});
}).then(function () {
var sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder === false) {
sortedList = sortedList.reverse();
}
deferred.fulfill(initialList.toString() === sortedList.toString());
});
return deferred.promise;
};
this.navigateToFolder = function (folder) {
var row = this.getRowsName(folder);
Util.waitUntilElementIsVisible(row);
Util.waitUntilElementIsOnPage(row);
row.click();
this.checkRowIsSelected(folder);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
};
this.doubleClickRow = function (selectRow) {
var row = this.getRowsName(selectRow);
Util.waitUntilElementIsVisible(row);
Util.waitUntilElementIsClickable(row);
row.click();
Util.waitUntilElementIsVisible(this.getRowByRowName(selectRow).element(by.css("div[class*='--image'] mat-icon[svgicon*='selected']")));
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
};
this.doubleClickEntireRow = function (selectRow) {
var row = this.getRowByRowName(selectRow);
Util.waitUntilElementIsVisible(row);
Util.waitUntilElementIsClickable(row);
row.click();
Util.waitUntilElementIsVisible(this.getRowByRowName(selectRow).element(by.css("div[class*='--image'] mat-icon[svgicon*='selected']")));
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
};
this.checkRowIsSelected = function (content) {
var isRowSelected = this.getRowsName(content).element(by.xpath("ancestor::div[contains(@class, 'is-selected')]"));
Util.waitUntilElementIsVisible(isRowSelected);
};
this.checkContentIsDisplayed = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content));
return this;
};
this.checkContentIsNotDisplayed = function (content) {
Util.waitUntilElementIsNotVisible(element(by.css("span[title='" + content + "']")));
return this;
};
this.checkEmptyFolderMessageIsDisplayed = function () {
Util.waitUntilElementIsVisible(emptyFolderMessage);
return this;
};
this.tableIsLoaded = function () {
Util.waitUntilElementIsVisible(table);
return this;
};
this.checkIconColumn = function (file, extension) {
var row = this.getRowByRowName(file);
Util.waitUntilElementIsVisible(row);
Util.waitUntilElementIsVisible(row.element(by.css("div[class*='--image'] img[alt*='" + extension + "']")));
};
};
module.exports = ContentList;

View File

@@ -0,0 +1,52 @@
/*!
* @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 CreateFolderDialog = function () {
var folderNameField = element(by.css("input[placeholder='Name']"));
var folderDescriptionField = element(by.css("textarea[placeholder='Description']"));
var createButton = element(by.cssContainingText("button span", "Create"));
var cancelButton = element(by.cssContainingText("button span", "Cancel"));
this.clickOnCreateButton = function () {
Util.waitUntilElementIsVisible(createButton);
createButton.click();
return this;
};
this.clickOnCancelButton = function () {
Util.waitUntilElementIsVisible(cancelButton);
cancelButton.click();
return this;
};
this.addFolderName = function (folderName) {
Util.waitUntilElementIsVisible(folderNameField);
folderNameField.sendKeys(folderName);
return this;
};
this.addFolderDescription = function (folderDescription) {
Util.waitUntilElementIsVisible(folderDescriptionField);
folderDescriptionField.sendKeys(folderDescription);
return this;
};
};
module.exports = CreateFolderDialog;

View File

@@ -0,0 +1,171 @@
/*!
* @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 SearchDialog = function () {
var searchIcon = element(by.css("button[class*='adf-search-button']"));
var searchBar = element(by.css("adf-search-control div[style*='translateX(0%)'] input"));
var searchBarNotExpanded = element(by.css("adf-search-control div[style*='translateX(81%)']"));
var no_result_message = element(by.css("p[class*='adf-search-fixed-text']"));
var rowsAuthor = by.css("div[class='mat-list-text'] p[class*='adf-search-fixed-text']");
var completeName = by.css("h4[class*='adf-search-fixed-text']");
var highlightName = by.css("div[id*='results-content'] span[class='highlight']");
var searchDialog = element(by.css("mat-list[id*='autocomplete-search-result-list']"));
var allRows = element.all(by.css("h4[class*='adf-search-fixed-text']"));
this.clickOnSearchIcon = function () {
Util.waitUntilElementIsVisible(searchIcon);
searchIcon.click();
return this;
};
this.checkSearchIconIsVisible = function () {
Util.waitUntilElementIsVisible(searchIcon);
return this;
};
this.checkSearchBarIsVisible = function () {
Util.waitUntilElementIsVisible(searchBar);
return this;
};
this.checkSearchBarIsNotVisible = function () {
Util.waitUntilElementIsVisible(searchBarNotExpanded);
return this;
};
this.checkNoResultMessageIsDisplayed = function () {
Util.waitUntilElementIsVisible(no_result_message);
return this;
};
this.checkNoResultMessageIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(no_result_message);
return this;
};
this.enterText = function (text) {
Util.waitUntilElementIsVisible(searchBar);
searchBar.click();
searchBar.sendKeys(text);
return this;
};
this.enterTextAndPressEnter = function (text) {
Util.waitUntilElementIsVisible(searchBar);
searchBar.click();
searchBar.sendKeys(text);
searchBar.sendKeys(protractor.Key.ENTER);
return this;
};
this.resultTableContainsRow = function (name) {
Util.waitUntilElementIsVisible(searchDialog);
Util.waitUntilElementIsVisible(this.getRowByRowName(name));
return this;
};
this.clickOnSpecificRow = function (name) {
this.resultTableContainsRow(name);
this.getRowByRowName(name).click();
return this;
};
this.getRowByRowName = function (name) {
return element(by.css("mat-list-item[data-automation-id='autocomplete_for_" + name +"']"));
};
this.getAllRowsValues = function () {
var deferred = protractor.promise.defer();
var array = [], i =0;
allRows.map(function(element) {
return element.getText();
}).then(function (texts) {
texts.forEach(function (text) {
array[i] = text;
i++;
});
});
deferred.fulfill(array);
return deferred.promise;
};
this.getSpecificRowsHighlightName = function (name) {
var deferred = protractor.promise.defer();
this.getRowByRowName(name).element(highlightName).getText().then(function (result) {
deferred.fulfill(result);
})
return deferred.promise;
};
this.getSpecificRowsCompleteName = function (name) {
var deferred = protractor.promise.defer();
this.getRowByRowName(name).element(completeName).getText().then(function (result) {
deferred.fulfill(result);
})
return deferred.promise;
};
this.getSpecificRowsAuthor = function (name) {
var deferred = protractor.promise.defer();
this.getRowByRowName(name).element(rowsAuthor).getText().then(function (result) {
deferred.fulfill(result);
})
return deferred.promise;
};
this.clearText = function () {
Util.waitUntilElementIsVisible(searchBar);
var deferred = protractor.promise.defer();
searchBar.clear().then(function (value) {
searchBar.sendKeys(protractor.Key.ESCAPE);
});
return deferred.promise;
};
this.resultTableContainsRowWithRetry = function (name, retry) {
var isPresent = false;
function run() {
element(by.css("mat-list-item[data-automation-id='autocomplete_for_" + name +"']")).isPresent().then(
function (result) {
if(result === true) {
isPresent = true;
}
else {
retry --;
if(retry > 0) {
// console.log("Retry: " + retry);
run();
};
}
}
);
};
run();
};
};
module.exports = SearchDialog;

View File

@@ -0,0 +1,185 @@
/*!
* @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 UploadDialog = function () {
var closeButton = element.all((by.css("footer[class*='upload-dialog__actions'] button"))).first();
var dialog = element.all(by.css("div[class*='upload-dialog']")).first();
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 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']"));
var minimizeButton = element(by.css("mat-icon[title='Minimize']"));
var maximizeButton = element(by.css("mat-icon[title='Maximize']"));
var sizeUploaded = by.css("span[class='adf-file-uploading-row__status']");
var canUploadConfirmationTitle = element(by.css("p[class='upload-dialog__confirmation--title']"));
var canUploadConfirmationDescription = element(by.css("p[class='upload-dialog__confirmation--text']"));
var confirmationDialogNoButton = element(by.partialButtonText("No"));
var confirmationDialogYesButton = element(by.partialButtonText("Yes"));
var cancelUploads = element(by.partialButtonText("Cancel uploads"));
this.clickOnCloseButton = function () {
this.checkCloseButtonIsDisplayed();
closeButton.click();
return this;
};
this.checkCloseButtonIsDisplayed = function() {
Util.waitUntilElementIsVisible(closeButton);
return this;
};
this.dialogIsDisplayed = function () {
Util.waitUntilElementIsVisible(dialog);
return this;
};
this.dialogIsMinimized = function () {
Util.waitUntilElementIsVisible(minimizedDialog);
return this;
};
this.dialogIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(dialog);
return this;
};
this.getRowsName = function (content) {
var row = element.all(by.css("div[class*='uploading-row'] span[title='" + content +"']")).first();
Util.waitUntilElementIsVisible(row);
return row;
};
this.getRowByRowName = function (content) {
return this.getRowsName(content).element(rowByRowName);
};
this.fileIsUploaded = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content).element(uploadedStatusIcon));
return this;
};
this.filesAreUploaded = function (content) {
for (i=0; i<content.length; i++) {
this.fileIsUploaded(content[i]);
}
return this;
};
this.fileIsNotDisplayedInDialog = function (content) {
Util.waitUntilElementIsNotVisible(element(by.css("div[class*='uploading-row'] span[title='" + content +"']")));
return this;
};
this.cancelUploads = function (content) {
Util.waitUntilElementIsVisible(cancelUploads);
cancelUploads.click();
return this;
};
this.fileIsCancelled = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content).element(cancelledStatusIcon));
return this;
};
this.removeUploadedFile = function (content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content).element(uploadedStatusIcon));
this.getRowByRowName(content).element(uploadedStatusIcon).click();
return this;
};
this.removeFileWhileUploading = function (content) {
browser.driver.actions().mouseMove(this.getRowByRowName(content).element(sizeUploaded)).perform();
this.getRowByRowName(content).element(cancelWhileUploadingIcon).click();
return this;
};
this.getTitleText = function () {
Util.waitUntilElementIsVisible(title);
var deferred = protractor.promise.defer();
title.getText().then( function (text) {
deferred.fulfill(text);
});
return deferred.promise;
};
this.getConfirmationDialogTitleText = function () {
Util.waitUntilElementIsVisible(canUploadConfirmationTitle);
var deferred = protractor.promise.defer();
canUploadConfirmationTitle.getText().then( function (text) {
deferred.fulfill(text);
});
return deferred.promise;
};
this.getConfirmationDialogDescriptionText = function () {
Util.waitUntilElementIsVisible(canUploadConfirmationDescription);
var deferred = protractor.promise.defer();
canUploadConfirmationDescription.getText().then( function (text) {
deferred.fulfill(text);
});
return deferred.promise;
};
this.clickOnConfirmationDialogYesButton = function () {
Util.waitUntilElementIsVisible(confirmationDialogYesButton);
confirmationDialogYesButton.click();
return this;
};
this.clickOnConfirmationDialogNoButton = function () {
Util.waitUntilElementIsVisible(confirmationDialogNoButton);
confirmationDialogNoButton.click();
return this;
};
this.numberOfCurrentFilesUploaded = function () {
var deferred = protractor.promise.defer();
this.getTitleText().then(function (text) {
deferred.fulfill(text.split('Uploaded ')[1].split(' / ')[0]);
});
return deferred.promise;
};
this.numberOfInitialFilesUploaded = function () {
var deferred = protractor.promise.defer();
this.getTitleText().then(function (text) {
deferred.fulfill(text.split('Uploaded ')[1].split(' / ')[1]);
});
return deferred.promise;
};
this.minimizeUploadDialog = function () {
Util.waitUntilElementIsVisible(minimizeButton);
minimizeButton.click();
return this;
};
this.maximizeUploadDialog = function () {
Util.waitUntilElementIsVisible(maximizeButton);
maximizeButton.click();
return this;
};
};
module.exports = UploadDialog;

View File

@@ -0,0 +1,126 @@
/*!
* @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 UploadToggles = function () {
var toggleButton = by.xpath("ancestor::mat-slide-toggle");
var multipleFileUploadToggle = element(by.cssContainingText("span[class*='toggle-content']", "Multiple File Upload"));
var uploadFolderToggle = element(by.cssContainingText("span[class*='toggle-content']", "Folder upload"));
var extensionFilterToggle = element(by.cssContainingText("span[class*='toggle-content']", "Custom extensions filter"));
var maxSizeToggle = element(by.cssContainingText("span[class*='toggle-content']", "Max size filter"));
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']"));
this.enableMultipleFileUpload = function () {
this.enableToggle(multipleFileUploadToggle);
return this;
};
this.disableMultipleFileUpload = function () {
this.disableToggle(multipleFileUploadToggle);
return this;
};
this.enableFolderUpload = function () {
this.enableToggle(uploadFolderToggle);
return this;
};
this.disableFolderUpload = function () {
this.disableToggle(uploadFolderToggle);
return this;
};
this.enableExtensionFilter = function () {
this.enableToggle(extensionFilterToggle);
return this;
};
this.disableExtensionFilter = function () {
this.disableToggle(extensionFilterToggle);
return this;
};
this.enableMaxSize = function () {
this.enableToggle(maxSizeToggle);
return this;
};
this.disableMaxSize = function () {
this.disableToggle(maxSizeToggle);
return this;
};
this.enableVersioning = function () {
this.enableToggle(versioningToggle);
return this;
};
this.disableVersioning = function () {
this.disableToggle(versioningToggle);
return this;
};
this.enableToggle = function (toggle) {
Util.waitUntilElementIsVisible(toggle);
Util.waitUntilElementIsPresent(toggle);
var finalToggleButton = toggle.element(toggleButton);
finalToggleButton.getAttribute('class').then(function (value) {
if (value.indexOf('mat-checked')===-1) {
finalToggleButton.click();
}
});
return this;
};
this.disableToggle = function (toggle) {
Util.waitUntilElementIsVisible(toggle);
var finalToggleButton = toggle.element(toggleButton);
finalToggleButton.getAttribute('class').then(function (value) {
if (value.indexOf('mat-checked')!==-1) {
finalToggleButton.click();
}
});
return this;
};
this.addExtension = function (extension) {
Util.waitUntilElementIsVisible(extensionAcceptedField);
extensionAcceptedField.sendKeys("," + extension);
};
this.addMaxSize = function (size) {
this.clearText();
maxSizeField.sendKeys(size);
};
this.clearText = function () {
Util.waitUntilElementIsVisible(maxSizeField);
var deferred = protractor.promise.defer();
maxSizeField.clear().then(function (value) {
maxSizeField.sendKeys(protractor.Key.ESCAPE);
});
return deferred.promise;
};
};
module.exports = UploadToggles;

View File

@@ -0,0 +1,154 @@
/*!
* @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 UserInfoDialog = function () {
var dialog = element(by.css("mat-card[class*='adf-userinfo-card']"));
var contentServicesTab = element(by.css("div[id*='mat-tab-label-0-0']"));
var processServicesTab = element(by.css("div[id*='mat-tab-label-0-1']"));
var userImage = element(by.css("div[id='user-initial-image']"));
var userInfoEcmHeaderTitle = element(by.css("div[id='ecm-username']"));
var userInfoEcmTitle = element(by.css("mat-card-content span[id='ecm-full-name']"));
var ecmEmail = element(by.css("span[id='ecm-email']"));
var ecmJobTitle = element(by.css("span[id='ecm-job-title']"));
var userInfoProcessHeaderTitle = element(by.css("div[id='bpm-username']"));
var userInfoProcessTitle = element(by.css("mat-card-content span[id='bpm-full-name']"));
var processEmail = element(by.css("span[id='bpm-email']"));
var processTenant = element(by.css("span[class='detail-profile']"));
var apsImage = element(by.css("img[id='bpm-user-detail-image']"));
var acsImage = element(by.css("img[id='ecm-user-detail-image']"));
var initialImage = element.all(by.css("div[id='user-initials-image']")).first();
this.dialogIsDisplayed = function () {
Util.waitUntilElementIsVisible(dialog);
return this;
};
this.dialogIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(dialog);
return this;
};
this.contentServicesTabIsDisplayed = function () {
Util.waitUntilElementIsVisible(contentServicesTab);
return this;
};
this.contentServicesTabIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(contentServicesTab);
return this;
};
this.clickOnContentServicesTab = function () {
this.contentServicesTabIsDisplayed();
contentServicesTab.click();
return this;
};
this.processServicesTabIsDisplayed = function () {
Util.waitUntilElementIsVisible(processServicesTab);
return this;
};
this.processServicesTabIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(processServicesTab);
return this;
};
this.clickOnProcessServicesTab = function () {
this.processServicesTabIsDisplayed();
processServicesTab.click();
return this;
};
this.userImageIsDisplayed = function () {
Util.waitUntilElementIsVisible(userImage);
return this;
};
this.getContentHeaderTitle = function () {
Util.waitUntilElementIsVisible(userInfoEcmHeaderTitle);
return userInfoEcmHeaderTitle.getText();
};
this.getContentTitle = function () {
Util.waitUntilElementIsVisible(userInfoEcmTitle);
return userInfoEcmTitle.getText();
};
this.getContentEmail = function () {
Util.waitUntilElementIsVisible(ecmEmail);
return ecmEmail.getText();
};
this.getContentJobTitle = function () {
Util.waitUntilElementIsVisible(ecmJobTitle);
return ecmJobTitle.getText();
};
this.getProcessHeaderTitle = function () {
Util.waitUntilElementIsVisible(userInfoProcessHeaderTitle);
return userInfoProcessHeaderTitle.getText();
};
this.getProcessTitle = function () {
Util.waitUntilElementIsVisible(userInfoProcessTitle);
return userInfoProcessTitle.getText();
};
this.getProcessEmail = function () {
Util.waitUntilElementIsVisible(processEmail);
return processEmail.getText();
};
this.getProcessTenant = function () {
Util.waitUntilElementIsVisible(processTenant);
return processTenant.getText();
};
this.closeUserProfile = function () {
Util.waitUntilElementIsVisible(dialog);
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
};
this.checkACSProfileImage = function () {
Util.waitUntilElementIsVisible(acsImage);
};
this.checkAPSProfileImage = function () {
Util.waitUntilElementIsVisible(apsImage);
};
this.checkInitialImage = function () {
Util.waitUntilElementIsVisible(initialImage);
};
this.initialImageNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(initialImage);
};
this.ACSProfileImageNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(acsImage);
};
this.APSProfileImageNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(apsImage);
};
};
module.exports = UserInfoDialog;

View File

@@ -0,0 +1,780 @@
/*!
* @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');
var contentServices = element(by.css("a[data-automation-id='files'] span"));
var siteList = element(by.css("md-select[class*='dropdown-list']"));
var folderID = element(by.css('adf-files-component p'));
var folderText = element(by.css("md-input-container[class*='create-folder--name'] input"));
var createButtonDialog = element(by.xpath("//span[contains(text(), 'Create')]/ancestor::button"));
var createFolderButton = element(by.xpath("//md-icon[contains(text(), 'create_new_folder')]"));
var currentFolder = element(by.xpath("//div[@class='adf-breadcrumb-container']/li[last()]/div"));
var deleteContent = element(by.css("button[adf-node-permission='delete']"));
/**
* Provides the Login Page.
* @module pages
* @submodule share
* @class pages.share.LoginPage
*/
module.exports = Page.create({
/**
* Provides the document list.
* @property documentList
* @type protractor.Element
*/
documentList: {
get: function () {
return element(by.css("tr[class='alfresco-datatable__row'] > td"));
}
},
/**
* Provides the upload button.
* @property uploadButton
* @type protractor.Element
*/
uploadButton: {
get: function () {
return element(by.css("input[data-automation-id='upload-single-file']"));
}
},
/**
* Provides the mutiple upload button .
* @property uploadButton
* @type protractor.Elementx
*/
multipleUploadButton: {
get: function () {
return element(by.css("input[data-automation-id='upload-multiple-files']"));
}
},
/**
* Provides the mutiple upload button enabled
* @property multipleUploadEnabled
* @type protractor.Element
*/
multipleUploadEnabled: {
get: function () {
return element(by.css("alfresco-upload-button[data-automation-id='multiple-file-upload'][ng-reflect-multiple-files='true']"));
}
},
/**
* Provides the extensions accepted text field
* @property acceptedFilesText
* @type protractor.Element
*/
acceptedFilesText: {
get: function () {
return element(by.css("input[data-automation-id='accepted-files-type']"));
}
},
/**
* Provides the create folder button
* @property createFolderButton
* @type protractor.Element
*/
createFolderButton: {
get: function () {
return element(by.cssContainingText("button[id='actions'] > i", "add"));
}
},
/**
* Provides the create new folder button in dialog
* @property createFolderButton
* @type protractor.Element
*/
createFolderButtonDialog: {
get: function () {
return element(by.cssContainingText("span[class='mdl-menu__text']", "New Folder"));
}
},
/**
* Provides the longer wait required
* @property goToDocList
* @type protractor.Element
* */
goToDocList: {
value: function () {
Util.waitUntilElementIsVisible(contentServices);
contentServices.click();
Util.waitUntilElementIsVisible(siteList);
}
},
/**
* Provides the longer wait required
* @property waitForElements
* @type protractor.Element
* */
waitForElements: {
value: function () {
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* Creates new folder
* @property createFolder
* */
createFolder: {
value: function (folderName) {
Util.waitUntilElementIsVisible(createFolderButton);
createFolderButton.click();
Util.waitUntilElementIsVisible(folderText);
folderText.sendKeys(folderName);
createButtonDialog.click();
this.checkItemInDocList(folderName);
}
},
/**
* Deletes content
* @property deleteContent
* */
deleteContent: {
value: function (contentName) {
var contentName = element(by.css("div[data-automation-id*='text_"+ contentName+"']"));
Util.waitUntilElementIsVisible(contentName);
contentName.click();
deleteContent.click();
}
},
/**
* Retrieve row by row number
*
* @param rowNumber
*/
getRowByRowNumber: {
value: function (rowNumber) {
return element(by.css("div[data-automation-id='text_" + rowNumber + "']"));
}
},
/**
* Go into folder
* @property goIntoFolder
* */
goIntoFolder: {
value: function (folderName) {
this.checkItemInDocList(folderName);
browser.actions().doubleClick(element(by.css("div[data-automation-id*='text_"+ folderName+"']"))).perform();
}
},
/**
* Go into folder via breadcrumb
* @property goIntoFolderViaBreadcrumbs
* */
goIntoFolderViaBreadcrumbs: {
value: function (folderName) {
var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_"+ folderName +"']", folderName));
Util.waitUntilElementIsVisible(breadcrumb);
breadcrumb.click();
this.waitForElements();
}
},
currentFolderName: {
value: function () {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(currentFolder);
currentFolder.getText().then(function (result) {
deferred.fulfill(result);
})
return deferred.promise;
}
},
/**
* Go into folder
* @property goIntoFolder
* */
checkFolderInBreadcrumbs: {
value: function (folderName) {
var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_"+ folderName +"']", folderName));
Util.waitUntilElementIsVisible(breadcrumb);
}
},
/**
* Check file/fodler in document list
* @property checkItemInDocList
* */
checkItemInDocList: {
value: function (fileName) {
Util.waitUntilElementIsVisible(element(by.cssContainingText("div[data-automation-id='text_" + fileName + "']", fileName)));
}
},
/**
* Check file is not in document list
* @property checkFileIsNotInDocList
* */
checkFileIsNotInDocList: {
value: function (fileName) {
Util.waitUntilElementIsNotOnPage(element(by.cssContainingText("div[data-automation-id='text_" + fileName + "']", fileName)));
}
},
/**
* Check number of times file appears in document list
* @property checkNumberOfFilesInDocList
* */
checkNumberOfFilesInDocList: {
value: function (fileName, numberOfFiles) {
this.checkItemInDocList(fileName);
var file = element.all(by.cssContainingText("div[data-automation-id='text_" + fileName + "']", fileName));
expect(file.count()).toEqual(numberOfFiles);
}
},
/**
* uploads file
* @property uploadFile
* */
uploadFile: {
value: function (fileLocation, fileName) {
var uploadButton = element(by.css("input[data-automation-id='upload-single-file']"));
Util.waitUntilElementIsVisible(uploadButton);
Util.uploadFile(uploadButton, uploadButton, fileLocation);
this.checkItemInDocList(fileName);
}
},
/**
* uploads file without checking document list
* @property uploadFileWithoutCheck
* */
uploadFileWithoutCheck: {
value: function (fileLocation) {
Util.waitUntilElementIsVisible(this.uploadButton);
Util.uploadFile(this.uploadButton, this.uploadButton, fileLocation);
}
},
/**
* Check file in upload dialog
* @property checkFileInUploadDialog
* */
checkFileInUploadDialog: {
value: function (fileName) {
Util.waitUntilElementIsVisible(element(by.cssContainingText("td[data-automation-id='dialog_" + fileName + "'] > div", fileName)));
}
},
/**
* Check all uploads are complete
* @property checkAllUploadsComplete
* */
checkAllUploadsComplete: {
value: function (fileName) {
var dialogUpload = element.all(by.css("td[data-automation-id*='dialog_']"));
var singleUpload = element(by.cssContainingText("div[ng-reflect-klass='file-dialog'] div[class='title'] ", "upload complete"));
var multipleUploads = element(by.cssContainingText("div[ng-reflect-klass='file-dialog'] div[class='title'] ", "uploads complete"));
dialogUpload.count().then(function(count) {
if (count === 1) {
Util.waitUntilElementIsVisible(singleUpload);
}
else if (count > 1) {
Util.waitUntilElementIsVisible(multipleUploads);
}
});
}
},
/**
* Check done icon for file
* @property checkDoneIcon
* */
checkDoneIcon: {
value: function (fileName) {
Util.waitUntilElementIsVisible(element(by.xpath("//i[contains(@data-automation-id, 'done_icon')]/../../../td[contains(@data-automation-id, '" + fileName + "')]")));
}
},
/**
* Check abort icon for file
* @property checkUploadAbortedIcon
* */
checkAbortedIcon: {
value: function (fileName) {
Util.waitUntilElementIsVisible(element(by.xpath("//i[contains(@data-automation-id, 'upload_stopped')]/../../../td[contains(@data-automation-id, '" + fileName + "')]")));
}
},
/**
* Check progress bar in dialog
* @property checkDoneIcon
* */
checkProgressBar: {
value: function (fileName) {
Util.waitUntilElementIsVisible(element(by.css("div[data-automation-id='dialog_progress_" + fileName +"']")));
}
},
/**
* check upload dialog
* @property checkUploadDialog
* */
checkUploadDialog: {
value: function (fileName) {
var uploadDialog = element(by.css("file-uploading-dialog[class='dialog-show'] > div[class='file-dialog show']"));
Util.waitUntilElementIsVisible(uploadDialog);
this.checkFileInUploadDialog(fileName);
this.checkAllUploadsComplete();
this.checkDoneIcon(fileName);
this.checkProgressBar(fileName);
}
},
/**
* Close upload dialog
* @property closeUploadDialog
* */
closeUploadDialog: {
value: function () {
var closeDialog = element(by.css("div[title='close upload list'] > i"));
Util.waitUntilElementIsVisible(closeDialog);
closeDialog.click();
Util.waitUntilElementIsNotOnPage(closeDialog);
}
},
/**
* Minimise upload dialog
* @property minimiseUploadDialog
* */
minimiseUploadDialog: {
value: function () {
var minimiseDialog = element(by.css("div[class='minimize-button'] > i[title='minimize upload list']"));
Util.waitUntilElementIsVisible(minimiseDialog);
minimiseDialog.click();
Util.waitUntilElementIsNotOnPage(minimiseDialog);
}
},
/**
* Maximise upload dialog
* @property maximiseUploadDialog
* */
maximiseUploadDialog: {
value: function () {
var maximiseDialog = element(by.css("div[class='minimize-button active'] > i[title='expand upload list']"));
Util.waitUntilElementIsVisible(maximiseDialog);
maximiseDialog.click();
Util.waitUntilElementIsNotOnPage(maximiseDialog);
}
},
/**
* Click undo upload via message window
* @property clickUndoUploadViaWindow
* */
clickUndoUploadViaWindow: {
value: function () {
var notificationWindow = element(by.css("div[id='undo-notification-bar']"));
var undoButton = element(by.css("alfresco-upload-button div[id='undo-notification-bar'] > button[data-automation-id='undo_upload_button']"));
Util.waitUntilElementIsVisible(notificationWindow);
Util.waitUntilElementIsVisible(undoButton);
undoButton.click();
}
},
/**
* Undo upload via window
* @property undoUploadViaWindow
* */
undoUploadViaWindow: {
value: function (fileName) {
this.clickUndoUploadViaWindow();
this.checkFileIsNotInDocList(fileName);
this.checkAbortedIcon(fileName);
}
},
/**
* Click undo upload via upload dialog
* @property clickUndoUploadViaWindow
* */
clickUndoUploadViaDialog: {
value: function (fileName) {
var dialog = element(by.css("file-uploading-dialog[class='dialog-show']"));
var undoIcon = element(by.xpath("//i[contains(@data-automation-id, 'abort_cancel_upload')]/../../../td[contains(@data-automation-id, '" + fileName + "')]"));
Util.waitUntilElementIsVisible(dialog);
Util.waitUntilElementIsVisible(undoIcon);
undoIcon.click();
}
},
/**
* Undo upload via dialog
* @property undoUploadViaDialog
* */
undoUploadViaDialog: {
value: function (fileName) {
this.clickUndoUploadViaDialog(fileName);
this.checkFileIsNotInDocList(fileName);
this.checkAbortedIcon(fileName);
}
},
/**
* Click cancel upload via upload dialog
* @property clickUndoUploadViaWindow
* */
clickCancelUploadViaDialog: {
value: function () {
var dialog = element(by.css("file-uploading-dialog[class='dialog-show']"));
var cancelButton = element(by.css("a[data-automation-id='cancel_upload_all']"));
Util.waitUntilElementIsVisible(dialog);
Util.waitUntilElementIsVisible(cancelButton);
cancelButton.click();
}
},
/**
* cancel upload via dialog
* @property undoUploadViaDialog
* */
cancelUploadViaDialog: {
value: function (fileName) {
this.clickCancelUploadViaDialog();
this.checkFileIsNotInDocList(fileName);
this.checkAbortedIcon(fileName);
}
},
/**
* Enable multiple file upload
* @property enableMultipleFileUpload
* */
enableMultipleFileUpload: {
value: function () {
var multiFileUploadSwitch = element(by.css("label[for='switch-multiple-file']"));
Util.waitUntilElementIsVisible(multiFileUploadSwitch);
multiFileUploadSwitch.click();
Util.waitUntilElementIsVisible(this.multipleUploadButton);
Util.waitUntilElementIsVisible(this.multipleUploadEnabled);
}
},
/**
* Disable multiple file upload
* @property diableMultipleFileUpload
* */
disableMultipleFileUpload: {
value: function () {
var multiFileUploadSwitch = element(by.css("label[for='switch-multiple-file']"));
Util.waitUntilElementIsVisible(multiFileUploadSwitch);
multiFileUploadSwitch.click();
Util.waitUntilElementIsNotOnPage(this.multipleUploadButton);
Util.waitUntilElementIsNotOnPage(this.multipleUploadEnabled);
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* upload mutiple files, 3
* @property uploadMutipleFiles
* */
uploadMutipleFiles: {
value: function (file1Location, file2Location) {
Util.waitUntilElementIsVisible(this.multipleUploadButton);
Util.waitUntilElementIsVisible(this.multipleUploadEnabled);
var firstFile = Util.uploadParentFolder(file1Location);
var secondFile = Util.uploadParentFolder(file2Location);
Util.uploadFile(this.multipleUploadButton, this.multipleUploadButton, firstFile + "\n" + secondFile);
}
},
/**
* Enable filter on
* @property enableFilter
* */
enableFilter: {
value: function () {
var acceptedFileTypeSwitch = element(by.css("label[for='switch-accepted-file-type']"));
Util.waitUntilElementIsVisible(acceptedFileTypeSwitch);
acceptedFileTypeSwitch.click();
Util.waitUntilElementIsVisible(this.acceptedFilesText);
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* Disable multiple file upload
* @property disableFilter
* */
disableFilter: {
value: function () {
var acceptedFileTypeSwitch = element(by.css("label[for='switch-accepted-file-type']"));
Util.waitUntilElementIsVisible(acceptedFileTypeSwitch);
acceptedFileTypeSwitch.click();
Util.waitUntilElementIsNotOnPage(this.acceptedFilesText);
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* Enter allowed file types
* @property allowedFileTypes
* */
setAllowedFileTypes: {
value: function (allowedFileTypes) {
var uploadButtonRestricted = element(by.css("input[data-automation-id='upload-single-file'][ng-reflect-accept='" + allowedFileTypes + "']"));
Util.waitUntilElementIsVisible(this.acceptedFilesText);
this.acceptedFilesText.clear();
this.acceptedFilesText.sendKeys(allowedFileTypes);
Util.waitUntilElementIsVisible(uploadButtonRestricted);
}
},
/**
* Enable versioning
* @property enableVersioning
* */
enableVersioning: {
value: function () {
var versioningSwitch = element(by.css("label[for='switch-versioning']"));
var versioningEnabled = element(by.css("alfresco-upload-button[data-automation-id='multiple-file-upload'][ng-reflect-versioning='true']"));
Util.waitUntilElementIsVisible(versioningSwitch);
versioningSwitch.click();
Util.waitUntilElementIsVisible(versioningEnabled);
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* Disable versioning
* @property disableVersioning
* */
disableVersioning: {
value: function () {
var versioningSwitch = element(by.css("label[for='switch-versioning']"));
var versioningEnabled = element(by.css("alfresco-upload-button[data-automation-id='multiple-file-upload'][ng-reflect-versioning='true']"));
Util.waitUntilElementIsVisible(versioningSwitch);
versioningSwitch.click();
Util.waitUntilElementIsNotOnPage(versioningEnabled);
Util.waitUntilElementIsVisible(this.uploadButton);
}
},
/**
* adds versioning additon to to filename
* @property versionedFileName
* */
versionedFileName: {
value: function (fileName, versioningAddition) {
var fullFileName = fileName.split(".");
var nameWithoutExtension = fullFileName[0];
var extension = fullFileName[1];
var versionedFileName = nameWithoutExtension + versioningAddition + "." + extension;
return versionedFileName;
}
},
/**
* sort document list by display name, ascending/descending
* @property sortDisplayName
* */
sortDisplayName: {
value: function (sorting) {
var sortingIcon = element(by.css("th[class*='header--sorted-" + sorting + "'][data-automation-id='auto_id_name']"));
Util.waitUntilElementIsVisible(sortingIcon);
sortingIcon.click();
}
},
/**
* check first folder name
* @property checkFirstFolderName
* */
checkFirstFolderName: {
value: function (folderName) {
var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + folderName +"'))]"));
Util.waitUntilElementIsVisible(firstFolder);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFolder.getText()).toEqual(folderName);
}
},
/**
* check first file's name
* @property checkFirstFilesName
* */
checkFirstFilesName: {
value: function (fileName) {
var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + fileName +"'))]"));
Util.waitUntilElementIsVisible(firstFile);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFile.getText()).toEqual(fileName);
}
},
/**
* click created by when no icon is displayed
* @property clickCreatedBy
* */
clickCreatedBy: {
value: function () {
var createdBy = element(by.css("th[data-automation-id='auto_id_createdByUser.displayName']"));
Util.waitUntilElementIsVisible(createdBy);
createdBy.click();
}
},
/**
* sort document list by created by, ascending/descending
* @property sortCreatedBy
* */
sortCreatedBy: {
value: function (sorting) {
var sortingIcon = element(by.css("th[class*='header--sorted-" + sorting + "'][data-automation-id='auto_id_createdByUser.displayName']"));
Util.waitUntilElementIsVisible(sortingIcon);
sortingIcon.click();
}
},
/**
* check first folder creator
* @property checkFirstFolderName
* */
checkFirstFolderCreator: {
value: function (folderName, creator) {
var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator +"'))]"));
Util.waitUntilElementIsVisible(firstFolder);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFolder.getText()).toContain(creator);
}
},
/**
* check first file creator
* @property checkFirstFileName
* */
checkFirstFilesCreator: {
value: function (fileName, creator) {
var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator +"'))]"));
Util.waitUntilElementIsVisible(firstFile);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFile.getText()).toContain(creator);
}
},
/**
* click created on when no icon is displayed
* @property clickCreatedOn
* */
clickCreatedOn: {
value: function () {
var createdOn = element(by.css("th[data-automation-id='auto_id_createdAt']"));
Util.waitUntilElementIsVisible(createdOn);
createdOn.click();
}
},
/**
* sort document list by created on, ascending/descending
* @property sortCreatedBy
* */
sortCreatedBy: {
value: function (sorting) {
var sortingIcon = element(by.css("th[class*='header--sorted-" + sorting + "'][data-automation-id='auto_id_createdAt']"));
Util.waitUntilElementIsVisible(sortingIcon);
sortingIcon.click();
}
},
/**
* check first folder created on date
* @property checkFirstFolderDate
* */
checkFirstFolderDate: {
value: function () {
var firstFolder = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'date_'))]"));
var todaysDate = Util.getCrtDateLongFormat();
Util.waitUntilElementIsVisible(firstFolder);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFolder.getText()).toContain(todaysDate);
}
},
/**
* check first files created on date
* @property checkFirstFilesDate
* */
checkFirstFilesDate: {
value: function () {
var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'date_'))]"));
var todaysDate = Util.getCrtDateLongFormat();
Util.waitUntilElementIsVisible(firstFile);
Util.waitUntilElementIsVisible(this.documentList);
expect(firstFile.getText()).toContain(todaysDate);
}
},
getCurrentFolderID: {
value: function () {
return folderID.getText();
}
},
});

View File

@@ -0,0 +1,475 @@
/*!
* @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');
var documentList = require('./documentListPage');
var pdfTitleFromSearch = element(by.css("span[id='adf-viewer-display-name']"));
var textLayer = element.all(by.css("div[class='textLayer']")).first();
var closeButton = element(by.css("button[class*='adf-viewer-close-button']"));
/**
* Provides the file preview Page.
* @module pages
* @submodule share
* @class pages.adf.filePreviewPage
*/
module.exports = Page.create({
/**
* Wait for elements to appear
* @property waitForElements
* @type protractor.Element
* */
waitForElements: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("i[id='viewer-close-button']")));
}
},
/**
* Click view file
* @property viewFile
* */
viewFile: {
value: function (fileName) {
documentList.checkItemInDocList(fileName);
browser.actions().doubleClick(element(by.cssContainingText("div[data-automation-id='text_" + fileName + "']", fileName))).perform();
this.waitForElements();
}
},
/**
* get file title
* @method getPDFTitle
*/
getPDFTitleFromSearch: {
value: function () {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(pdfTitleFromSearch);
Util.waitUntilElementIsVisible(textLayer);
pdfTitleFromSearch.getText().then(function (result) {
deferred.fulfill(result);
})
return deferred.promise;
}
},
/**
* Check close button is displayed
* @method checkCloseButton
*/
checkCloseButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("i[id='viewer-close-button']")));
}
},
/**
* Check original size button
* @method checkOriginalSizeButton
*/
checkOriginalSizeButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.cssContainingText("div[id='viewer-scale-page-button'] > i ", "zoom_out_map")));
}
},
/**
* Check zoom in button
* @method checkZoomInButton
*/
checkZoomInButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='viewer-zoom-in-button']")));
}
},
/**
* Check zoom out button
* @method checkZoomOutButton
*/
checkZoomOutButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='viewer-zoom-out-button']")));
}
},
/**
* Check previous page button
* @method checkPreviousPageButton
*/
checkPreviousPageButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='viewer-previous-page-button']")));
}
},
/**
* Check next page button
* @method checkNextPageButton
*/
checkNextPageButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("div[id='viewer-next-page-button']")));
}
},
/**
* Check download button on unsupported documents
* @method checkDownloadButton
*/
checkDownloadButton: {
value: function () {
Util.waitUntilElementIsVisible(element(by.css("button[id='viewer-download-button']")));
}
},
/**
* Check current pageNumber
* @method checkCurrentPageNumber
*/
checkCurrentPageNumber: {
value: function (pageNumber) {
Util.waitUntilElementIsVisible(element(by.css("input[id='viewer-pagenumber-input'][ng-reflect-value='" + pageNumber + "']")));
}
},
/**
* Check text in file
* @method checkText
*/
checkText: {
value: function (pageNumber, text) {
var allPages = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
var pageLoaded = element(by.css("div[id='pageContainer" + pageNumber + "'][data-loaded='true']"));
var textLayerLoaded = element(by.css("div[id='pageContainer" + pageNumber + "'] div[class='textLayer'] > div"));
var specificText = element(by.cssContainingText("div[id='pageContainer" + pageNumber + "'] div[class='textLayer'] > div", text));
Util.waitUntilElementIsVisible(allPages);
Util.waitUntilElementIsVisible(pageLoaded);
Util.waitUntilElementIsVisible(textLayerLoaded);
Util.waitUntilElementIsVisible(specificText);
}
},
/**
* Check total amount of pages
* @method checkTitle
*/
checktotalPages: {
value: function (totalPages) {
var totalPages = element(by.cssContainingText("div[id='viewer-total-pages']", totalPages));
Util.waitUntilElementIsVisible(totalPages);
}
},
/**
* Go to next page
* @method goToNextPage
*/
goToNextPage: {
value: function () {
var nextPageIcon = element(by.css("div[id='viewer-next-page-button']"));
Util.waitUntilElementIsVisible(nextPageIcon);
nextPageIcon.click();
}
},
/**
* Go to previous page
* @method goToPreviousPage
*/
goToPreviousPage: {
value: function () {
var previousPageIcon = element(by.css("div[id='viewer-previous-page-button']"));
Util.waitUntilElementIsVisible(previousPageIcon);
previousPageIcon.click();
}
},
/**
* Go to certain page
* @method goToPage
*/
goToPage: {
value: function (page) {
var pageInput = element(by.css("input[id='viewer-pagenumber-input']"));
Util.waitUntilElementIsVisible(pageInput);
pageInput.clear().sendKeys(page);
pageInput.sendKeys(protractor.Key.ENTER);
}
},
/**
* Close preview with close option
* @method closePreviewWithButton
*/
closePreviewWithButton: {
value: function () {
Util.waitUntilElementIsVisible(closeButton);
closeButton.click();
}
},
/**
* Close preview by pressing esc key
* @method closePreviewWithEsc
*/
closePreviewWithEsc: {
value: function (fileName) {
var filePreview = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
documentList.checkItemInDocList(fileName);
Util.waitUntilElementIsNotOnPage(filePreview);
}
},
/**
* Close preview by pressing esc key
* @method clickDownload
*/
clickDownload: {
value: function (fileName) {
var downloadButton = element(by.css("button[id='viewer-download-button']"));
Util.waitUntilElementIsVisible(downloadButton);
downloadButton.click();
}
},
/**
* Click zoom in
* @method clickZoomIn
*/
clickZoomIn: {
value: function () {
var zoomInButton = element(by.css("div[id='viewer-zoom-in-button']"));
Util.waitUntilElementIsVisible(zoomInButton);
zoomInButton.click();
}
},
/**
* Click zoom in
* @method clickZoomIn
*/
clickZoomOut: {
value: function () {
var zoomOutButton = element(by.css("div[id='viewer-zoom-out-button']"));
Util.waitUntilElementIsVisible(zoomOutButton);
zoomOutButton.click();
}
},
/**
* Click actual size
* @method clickActualSize
*/
clickActualSize: {
value: function () {
var actualSizeButton = element(by.css("div[id='viewer-scale-page-button']"));
Util.waitUntilElementIsVisible(actualSizeButton);
actualSizeButton.click();
}
},
/**
* Check canvas width
* @method checkCanvasWidth
*/
checkCanvasWidth: {
value: function () {
return element.all(by.css("div[class='canvasWrapper'] > canvas")).first().getAttribute("width").then(function(width) {
return width;
});
}
},
/**
* Check canvas height
* @method checkCanvasHeight
*/
checkCanvasHeight: {
value: function () {
return element.all(by.css("div[class='canvasWrapper'] > canvas")).first().getAttribute("height").then(function(height) {
return height;
});
}
},
/**
* Zoom in and check
* @method zoomIn
*/
zoomIn: {
value: function () {
var canvasLayer = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
var textLayer = element(by.css("div[id*='pageContainer'] div[class='textLayer'] > div"));
Util.waitUntilElementIsVisible(canvasLayer);
Util.waitUntilElementIsVisible(textLayer);
var actualWidth,
zoomedInWidth,
actualHeight,
zoomedInHeight;
this.checkCanvasWidth().then(function (width) {
actualWidth = width;
if (actualWidth && zoomedInWidth) {
expect(zoomedInWidth).toBeGreaterThan(actualWidth);
}
});
this.checkCanvasHeight().then(function (height) {
actualHeight = height;
if (actualHeight && zoomedInHeight) {
expect(zoomedInHeight).toBeGreaterThan(actualHeight);
}
});
this.clickZoomIn();
this.checkCanvasWidth().then(function (width) {
zoomedInWidth = width;
if (actualWidth && zoomedInWidth) {
expect(zoomedInWidth).toBeGreaterThan(actualWidth);
}
});
this.checkCanvasHeight().then(function (height) {
zoomedInHeight = height;
if (actualHeight && zoomedInHeight) {
expect(zoomedInHeight).toBeGreaterThan(actualHeight);
}
});
}
},
/**
* Check actual size of document, zoom in, actual size
* @method zoomIn
*/
actualSize: {
value: function () {
var canvasLayer = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
var textLayer = element(by.css("div[id*='pageContainer'] div[class='textLayer'] > div"));
Util.waitUntilElementIsVisible(canvasLayer);
Util.waitUntilElementIsVisible(textLayer);
var actualWidth,
actualHeight,
zoomedWidth,
zoomedHeight,
newWidth,
newHeight;
this.checkCanvasWidth().then(function (width) {
actualWidth = width;
});
this.checkCanvasHeight().then(function (height) {
actualHeight = height;
});
this.clickZoomIn();
this.checkCanvasWidth().then(function (width) {
zoomedWidth = width;
});
this.checkCanvasHeight().then(function (height) {
zoomedHeight = height;
});
this.clickActualSize();
this.checkCanvasWidth().then(function (width) {
newWidth = width;
if (actualWidth && zoomedWidth && newWidth) {
expect(newWidth).toBeLessThan(zoomedWidth);
expect(newWidth).toEqual(actualWidth);
}
});
this.checkCanvasHeight().then(function (height) {
newHeight = height;
if (actualHeight && zoomedHeight && newHeight) {
expect(newHeight).toBeLessThan(zoomedHeight);
expect(newHeight).toEqual(actualHeight);
}
});
}
},
/**
* Zoom out and check
* @method zoomOut
*/
zoomOut: {
value: function () {
var canvasLayer = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
var textLayer = element(by.css("div[id*='pageContainer'] div[class='textLayer'] > div"));
Util.waitUntilElementIsVisible(canvasLayer);
Util.waitUntilElementIsVisible(textLayer);
var actualWidth,
zoomedOutWidth,
actualHeight,
zoomedOutHeight;
this.checkCanvasWidth().then(function (width) {
actualWidth = width;
if (actualWidth && zoomedOutWidth) {
expect(zoomedOutWidth).toBeLessThan(actualWidth);
}
});
this.checkCanvasHeight().then(function (height) {
actualHeight = height;
if (actualHeight && zoomedOutHeight) {
expect(zoomedOutHeight).toBeLessThan(actualHeight);
}
});
this.clickZoomOut();
this.checkCanvasWidth().then(function (width) {
zoomedOutWidth = width;
if (actualWidth && zoomedOutWidth) {
expect(zoomedOutWidth).toBeLessThan(actualWidth);
}
});
this.checkCanvasHeight().then(function (height) {
zoomedInHeight = height;
if (actualHeight && zoomedOutHeight) {
expect(zoomedOutHeight).toBeLessThan(actualHeight);
}
});
}
},
});

432
e2e/pages/adf/loginPage.js Normal file
View File

@@ -0,0 +1,432 @@
/*!
* @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 TestConfig = require('../../test.config');
var AdfSettingsPage = require('./settingsPage');
var LoginPage = function (){
var loginURL = TestConfig.adf.url + TestConfig.adf.port + "/login";
var txtUsername = element(by.css("input[id='username']"));
var txtPassword = element(by.css("input[id='password']"));
var usernameTooltip = element(by.css("span[data-automation-id='username-error']"));
var passwordTooltip = element(by.css("span[data-automation-id='password-required']"));
var loginTooltip = element(by.css("span[class='login-error-message']"));
var usernameInactive = element(by.css("input[id='username'][aria-invalid='false']"));
var passwordInactive = element(by.css("input[id='password'][aria-invalid='false']"));
var adfLogo = element(by.css("img[class='adf-img-logo ng-star-inserted']"));
var usernameHighlighted = element(by.css("input[id='username'][aria-invalid='true']"));
var passwordHighlighted = element(by.css("input[id='password'][aria-invalid='true']"));
var signInButton = element(by.id('login-button'));
var showPassword = element(by.css("mat-icon[data-automation-id='show_password']"));
var hidePassword = element(by.css("mat-icon[data-automation-id='hide_password']"));
var rememberMe = element(by.css("mat-checkbox[id='adf-login-remember']"));
var needHelp = element(by.css("div[id='adf-login-action-left']"));
var register = element(by.css("div[id='adf-login-action-right']"));
var footerSwitch = element(by.id("switch4"));
var userPicture = element(by.id("userinfo_container"));
var cardBackground = element(by.css("mat-card[class*='adf-login-card']"));
var adfSettingsPage = new AdfSettingsPage();
/**
* Provides the longer wait required
* @property waitForElements
* @type protractor.Element
* */
this.waitForElements = function (){
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(txtUsername).then(()=>{
Util.waitUntilElementIsVisible(txtPassword).then(()=>{
deferred.fulfill();
},()=>{
deferred.rejected();
})
});
return deferred.promise;
};
/**
* Fills the username input
* @method enterUsername
* @param {String} username
*/
this.enterUsername = function (username){
Util.waitUntilElementIsVisible(txtUsername);
txtUsername.sendKeys('');
txtUsername.clear();
browser.driver.sleep(500);
txtUsername.sendKeys(username);
};
/**
* Fills the password input
* @method enterPassword
* @param {String} password
*/
this.enterPassword = function (password){
Util.waitUntilElementIsVisible(txtPassword);
browser.driver.sleep(500);
txtPassword.clear();
txtPassword.sendKeys(password);
};
/**
* clears username input
* @method clearUsername
* @param {String} username
*/
this.clearUsername = function(){
Util.waitUntilElementIsVisible(txtUsername);
txtUsername.click().clear();
};
/**
* clears password input
* @method clearPassword
* @param {String} password
*/
this.clearPassword = function (){
Util.waitUntilElementIsVisible(txtPassword);
txtPassword.getAttribute('value').then(function (value){
for (var i = value.length; i >= 0; i--) {
txtPassword.sendKeys(protractor.Key.BACK_SPACE);
}
});
};
/**
* checks username tooltips
* @method checkUsernameTooltip
* @param {String} message
*/
this.checkUsernameTooltip = function (message){
Util.waitUntilElementIsVisible(usernameTooltip);
};
/**
* checks password tooltips
* @method checkPasswordTooltip
* @param {String} message
*/
this.checkPasswordTooltip = function (message){
Util.waitUntilElementIsVisible(passwordTooltip);
};
/**
* checks login error tooltips
* @method checkLoginError
* @param {String} message
*/
this.checkLoginError = function (message){
Util.waitUntilElementIsVisible(loginTooltip);
expect(loginTooltip.getText()).toEqual(message);
};
/**
* checks username field is inactive
* @method checkUsernameInactive
*/
this.checkUsernameInactive = function (){
Util.waitUntilElementIsVisible(usernameInactive);
},
/**
* checks password field is inactive
* @method checkPasswordInactive
*/
this.checkPasswordInactive = function (){
Util.waitUntilElementIsVisible(passwordInactive);
};
/**
* checks username field is highlighted
* @method checkUsernameHighlighted
*/
this.checkUsernameHighlighted = function (){
adfLogo.click();
Util.waitUntilElementIsVisible(usernameHighlighted);
};
/**
* checks password field is highlighted
* @method checkPasswordHighlighted
*/
this.checkPasswordHighlighted = function (){
adfLogo.click();
Util.waitUntilElementIsVisible(passwordHighlighted);
};
/**
* check Username tooltip is not visible
* @method checkUsernameTooltipIsNotVisible
*/
this.checkUsernameTooltipIsNotVisible = function (){
Util.waitUntilElementIsNotVisible(usernameTooltip);
};
/**
* checks password tooltip is not visible
* @method checkPasswordTooltipIsNotVisible
*/
this.checkPasswordTooltipIsNotVisible = function (){
Util.waitUntilElementIsNotVisible(passwordTooltip);
};
/**
* checks sign in button is enabled
* @method checkSignInButtonIsEnabled
*/
this.checkSignInButtonIsEnabled = function (){
Util.waitUntilElementIsVisible(signInButton);
expect(signInButton.isEnabled()).toBe(true);
};
/**
* Logs into adf using default host config
* @method defaultLogin
*/
this.defaultLogin = function (){
browser.driver.get(TestConfig.adf.url + TestConfig.adf.login);
this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
};
/**
* Logs into adf using userModel
* @method loginUsingUserModel
*/
this.loginUsingUserModel = function (userModel){
browser.driver.get(TestConfig.adf.url + TestConfig.adf.login);
this.waitForElements();
this.login(userModel.getId(), userModel.getPassword());
};
/**
* Logs into ADF using userModel - only Process Services enabled
* @method loginUsingUserModel
*/
this.loginToProcessServicesUsingUserModel = function (userModel){
adfSettingsPage.setProviderBpm();
this.waitForElements();
this.login(userModel.email, userModel.password);
};
this.loginToProcessServicesUsingDefaultUser = function (){
adfSettingsPage.setProviderBpm();
this.waitForElements();
this.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
};
this.loginToContentServicesUsingUserModel = function (userModel) {
adfSettingsPage.setProviderEcm();
this.waitForElements();
this.login(userModel.getId(), userModel.getPassword());
};
/**
* Go to adf login page
* @method goToLoginPage
*/
this.goToLoginPage = function (){
browser.driver.get(TestConfig.adf.url + TestConfig.adf.port+'/login');
};
/**
* checks sign in button is disabled
* @method checkSignInButtonIsDisabled
*/
this.checkSignInButtonIsDisabled = function (){
Util.waitUntilElementIsVisible(signInButton);
expect(signInButton.isEnabled()).toBe(false);
};
/**
* clicks the sign in button
* @method clickSignInButton
*/
this.clickSignInButton = function (){
Util.waitUntilElementIsVisible(signInButton);
signInButton.click();
};
/**
* clicks icon to show password
* @method showPassword
*/
this.showPassword = function (){
Util.waitUntilElementIsVisible(showPassword);
showPassword.click();
};
this.getShowPasswordIconColor = function (){
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(showPassword);
showPassword.getCssValue('color').then(function (value) {
deferred.fulfill(value);
});
return deferred.promise;
};
this.getSignInButtonColor = function (){
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(signInButton);
signInButton.getCssValue("color").then(function (value) {
deferred.fulfill(value);
});
return deferred.promise;
};
this.getBackgroundColor = function (){
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(cardBackground);
cardBackground.getCssValue("color").then(function (value) {
deferred.fulfill(value);
});
return deferred.promise;
};
/**
* clicks icon to hide password
* @method hidePassword
*/
this.hidePassword = function (){
Util.waitUntilElementIsVisible(hidePassword);
hidePassword.click();
};
/**
* checks if password is shown
* @method checkPasswordIsShown
* @param password
*/
this.checkPasswordIsShown = function (password){
txtPassword.getAttribute('value').then(function (text) {
expect(text).toEqual(password);
});
};
/**
* checks if password is hidden
* @method checkPasswordIsHidden
*/
this.checkPasswordIsHidden = function (){
Util.waitUntilElementIsVisible(txtPassword);
};
/**
* checks 'Remember me' is displayed
* @method checkRememberIsDisplayed
*/
this.checkRememberIsDisplayed = function (){
Util.waitUntilElementIsVisible(rememberMe);
};
/**
* checks 'Remember me' is not displayed
* @method checkRememberIsNotDisplayed
*/
this.checkRememberIsNotDisplayed = function (){
Util.waitUntilElementIsNotVisible(rememberMe);
};
/**
* checks 'Need help' is Displayed
* @method checkNeedHelpIsDisplayed
*/
this.checkNeedHelpIsDisplayed = function (){
Util.waitUntilElementIsVisible(needHelp);
};
/**
* checks 'Need Help' is not displayed
* @method checkNeedHelpIsNotDisplayed
*/
this.checkNeedHelpIsNotDisplayed = function (){
Util.waitUntilElementIsNotVisible(needHelp);
};
/**
* checks 'Register' is displayed
* @method checkRegisterDisplayed
*/
this.checkRegisterDisplayed = function (){
Util.waitUntilElementIsVisible(register);
};
/**
* checks 'Register' is not displayed
* @method checkRegisterIsNotDisplayed
*/
this.checkRegisterIsNotDisplayed = function (){
Util.waitUntilElementIsNotVisible(register);
};
/**
* enables footer switch
* @method enableFooter
*/
this.enableFooter = function (){
Util.waitUntilElementIsVisible(footerSwitch);
footerSwitch.getAttribute('class').then(function (check) {
if (check === 'mat-slide-toggle mat-primary'){
footerSwitch.click();
expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked');
}
})
};
/**
* disables footer switch
* @method disableFooter
*/
this.disableFooter = function (){
Util.waitUntilElementIsVisible(footerSwitch);
footerSwitch.getAttribute('class').then(function (check) {
if (check ==='mat-slide-toggle mat-primary mat-checked'){
footerSwitch.click();
expect(footerSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary');
}
})
};
/**
* logs in with a valid user
* @method login
* @param {String, String} username, password
*/
this.login = function (username, password) {
this.waitForElements();
this.enterUsername(username);
this.enterPassword(password);
this.clickSignInButton();
Util.waitUntilElementIsVisible(userPicture);
};
};
module.exports = LoginPage;

View File

@@ -0,0 +1,92 @@
/*!
* @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 NavigationBarPage = function (){
var contentServicesButton = element(by.css("a[data-automation-id='Content Services']"));
var processServicesButton = element(by.css("a[data-automation-id='Process Services']"));
var loginButton = element(by.css("a[data-automation-id='Login']"));
var trashcanButton = element(by.css("a[data-automation-id='Trashcan']"));
var userProfileButton = element(by.css("div[data-automation-id='user-profile']"));
var themeButton = element(by.css("button[data-automation-id='theme menu']"));
var themeMenuContent = element(by.css("div[class*='mat-menu-panel']"));
var logoutButton = element(by.css("a[adf-logout]"));
/**
* Click Content Services Button
* @method clickContentServicesButton
*/
this.clickContentServicesButton = function (){
Util.waitUntilElementIsVisible(contentServicesButton);
contentServicesButton.click();
};
/**
* Click Process Services Button
* @method clickProcessServicesButton
*/
this.clickProcessServicesButton = function (){
Util.waitUntilElementIsVisible(processServicesButton);
processServicesButton.click();
};
/**
* Click Login Button
* @method clickLoginButton
*/
this.clickLoginButton = function(){
Util.waitUntilElementIsVisible(loginButton);
loginButton.click();
};
this.clickTrashcanButton = function(){
Util.waitUntilElementIsVisible(trashcanButton);
trashcanButton.click();
};
this.clickUserProfile = function () {
Util.waitUntilElementIsVisible(userProfileButton);
userProfileButton.click();
};
this.clickThemeButton = function () {
Util.waitUntilElementIsVisible(themeButton);
themeButton.click();
Util.waitUntilElementIsVisible(themeMenuContent);
};
this.clickOnSpecificThemeButton = function (themeName) {
var themeElement = element(by.css("button[data-automation-id='" + themeName + "']"));
Util.waitUntilElementIsVisible(themeElement);
Util.waitUntilElementIsClickable(themeElement);
themeElement.click();
};
/**
* Click Logout Button
* @method clickLogoutButton
*/
this.clickLogoutButton = function(){
Util.waitUntilElementIsVisible(logoutButton);
logoutButton.click();
};
};
module.exports = NavigationBarPage;

View File

@@ -0,0 +1,135 @@
/*!
* @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 PaginationPage = function () {
var itemsPerPageDropdown = element(by.css("div[class*='adf-pagination__perpage-block'] button"));
var pageSelectorDropDown = element(by.css("div[class*='adf-pagination__page-selector']"));
var itemsPerPage = element(by.css("span[class='adf-pagination__max-items']"));
var currentPage = element(by.css("span[class='adf-pagination__current-page']"));
var totalPages = element(by.css("span[class='adf-pagination__total-pages']"));
var paginationRange = element(by.css("span[class='adf-pagination__range']"));
var nextPageButton = element(by.css("button[class*='adf-pagination__next-button']"));
var previousPageButton = element(by.css("button[class*='adf-pagination__previous-button']"));
var nextButtonDisabled = element(by.css("button[class*='adf-pagination__next-button'][disabled]"));
var previousButtonDisabled = element(by.css("button[class*='adf-pagination__previous-button'][disabled]"));
var pageDropDown = element(by.css("div[class*='adf-pagination__actualinfo-block'] button"));
var pageDropDownOptions = by.css("div[class*='mat-menu-content'] button");
var paginationSection = element(by.css("adf-pagination"));
var paginationSectionEmpty = element(by.css("adf-pagination[class*='adf-pagination__empty ng-star-inserted']"));
this.selectItemsPerPage = function (item) {
Util.waitUntilElementIsVisible(itemsPerPageDropdown);
Util.waitUntilElementIsClickable(itemsPerPageDropdown);
browser.actions().mouseMove(itemsPerPageDropdown).perform();
Util.waitUntilElementIsVisible(itemsPerPageDropdown);
Util.waitUntilElementIsClickable(itemsPerPageDropdown).then(()=>{
browser.driver.sleep(2000);
itemsPerPageDropdown.click();
});
Util.waitUntilElementIsVisible(pageSelectorDropDown);
var itemsPerPage = element.all(by.cssContainingText(".mat-menu-item", item)).first();
Util.waitUntilElementIsClickable(itemsPerPage);
Util.waitUntilElementIsVisible(itemsPerPage);
itemsPerPage.click();
return this;
};
this.checkPaginationIsNotDisplayed = function () {
Util.waitUntilElementIsOnPage(paginationSectionEmpty);
return this;
};
this.getCurrentItemsPerPage = function () {
Util.waitUntilElementIsVisible(itemsPerPage);
return itemsPerPage.getText();
};
this.getCurrentPage = function () {
Util.waitUntilElementIsVisible(paginationSection);
Util.waitUntilElementIsVisible(currentPage);
return currentPage.getText();
};
this.getTotalPages = function () {
Util.waitUntilElementIsVisible(totalPages);
return totalPages.getText();
};
this.getPaginationRange = function () {
Util.waitUntilElementIsVisible(paginationRange);
return paginationRange.getText();
};
this.clickOnNextPage = function () {
Util.waitUntilElementIsVisible(nextPageButton);
Util.waitUntilElementIsClickable(nextPageButton);
return nextPageButton.click();
};
this.clickOnPageDropdown = function () {
Util.waitUntilElementIsVisible(pageDropDown);
Util.waitUntilElementIsClickable(pageDropDown);
return pageDropDown.click();
};
this.clickOnPageDropdownOption = function (item) {
Util.waitUntilElementIsVisible(element.all(pageDropDownOptions).first());
var option = element(by.cssContainingText("div[class*='mat-menu-content'] button", item));
Util.waitUntilElementIsVisible(option);
option.click();
return this;
};
this.getPageDropdownOptions = function() {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(element.all(pageDropDownOptions).first());
var initialList = [];
element.all(pageDropDownOptions).each(function(element) {
element.getText().then(function(text) {
if(text !== '') {
initialList.push(text);
};
});
}).then(function () {
deferred.fulfill(initialList);
});
return deferred.promise;
};
this.checkNextPageButtonIsDisabled = function() {
Util.waitUntilElementIsVisible(nextButtonDisabled);
};
this.checkPreviousPageButtonIsDisabled = function() {
Util.waitUntilElementIsVisible(previousButtonDisabled);
};
this.checkNextPageButtonIsEnabled = function() {
Util.waitUntilElementIsNotOnPage(nextButtonDisabled);
};
this.checkPreviousPageButtonIsEnabled = function() {
Util.waitUntilElementIsNotOnPage(previousButtonDisabled);
};
};
module.exports = PaginationPage;

View File

@@ -0,0 +1,56 @@
/*!
* @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 AnalyticsPage = function () {
var toolbarTitleInput = element(by.css("input[data-automation-id='reportName']"));
var toolbarTitleContainer = element(by.css("div[class='adf-report-title ng-star-inserted']"));
var toolbarTitle = element(by.xpath("//mat-toolbar/adf-toolbar-title/div/h4"));
var reportContainer = element(by.css("div[class='adf-report-report-container']"));
var reportMessage = element(by.css("div[class='ng-star-inserted'] span"));
this.getReport = function (title) {
var reportTitle = element(by.css("mat-icon[data-automation-id='"+ title +"_filter']"));
Util.waitUntilElementIsVisible(reportTitle);
reportTitle.click();
};
this.changeReportTitle = function (title) {
Util.waitUntilElementIsVisible(reportContainer);
Util.waitUntilElementIsVisible(toolbarTitleContainer);
toolbarTitleContainer.click();
Util.waitUntilElementIsVisible(toolbarTitleInput);
toolbarTitleInput.clear();
toolbarTitleInput.sendKeys(title);
toolbarTitleInput.sendKeys(protractor.Key.ENTER);
};
this.getReportTitle = function () {
Util.waitUntilElementIsVisible(toolbarTitle);
return toolbarTitle.getText();
};
this.checkNoReportMessage = function () {
Util.waitUntilElementIsVisible(reportMessage);
};
};
module.exports = AnalyticsPage;

View File

@@ -0,0 +1,47 @@
/*!
* @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 TasksPage = require('./tasksPage');
var AppNavigationBarPage = function () {
var tasksButton = element.all(by.cssContainingText("div[class*='mat-tab-label']", "Tasks")).first();
var processButton = element.all(by.css('div[id*="mat-tab-label"]'));
var reportsButton = element(by.id('mat-tab-label-1-2'));
var reportsButtonSelected = element(by.css("div[id='mat-tab-label-1-2'][aria-selected='true']"))
this.clickTasksButton = function () {
Util.waitUntilElementIsVisible(tasksButton);
tasksButton.click();
return new TasksPage();
};
this.clickProcessButton = function () {
processButton.get(1).click();
};
this.clickReportsButton = function () {
Util.waitUntilElementIsVisible(reportsButton);
reportsButton.click();
Util.waitUntilElementIsVisible(reportsButtonSelected);
};
};
module.exports = AppNavigationBarPage;

View File

@@ -0,0 +1,42 @@
/*!
* @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 TestConfig = require('../../../test.config');
var path = require('path');
var AttachmentListPage = function () {
var attachFileButton = element(by.css("input[type='file']"));
this.clickAttachFileButton = function (fileLocation) {
Util.waitUntilElementIsVisible(attachFileButton);
attachFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
};
this.checkFileIsAttached = function (name) {
var fileAttached = element.all(by.css('div[filename="'+name+'"]')).first();
Util.waitUntilElementIsVisible(fileAttached);
};
this.checkAttachFileButtonIsNotDisplayed = function () {
Util.waitUntilElementIsNotVisible(attachFileButton);
};
};
module.exports = AttachmentListPage;

View File

@@ -0,0 +1,37 @@
/*!
* @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 ChecklistDialog = function () {
var nameField = element(by.css("input[data-automation-id='checklist-name']"));
var checklistButton = element(by.css("button[id='add-check'] span"));
this.addName = function (name) {
Util.waitUntilElementIsVisible(nameField);
nameField.sendKeys(name);
return this;
};
this.clickCreateChecklistButton = function () {
Util.waitUntilElementIsVisible(checklistButton);
checklistButton.click();
};
};
module.exports = ChecklistDialog;

View File

@@ -0,0 +1,100 @@
/*!
* @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 StartTaskDialog = function () {
var name = element(by.css("input[id='name_id']"));
var description = element(by.css("textarea[id='description_id']"));
var assignee = element(by.css("input[data-automation-id='adf-people-search-input']"));
var formDropDown = element(by.css("mat-select[id='form_id']"));
var startButton = element(by.css("button[id='button-start']"));
var startButtonEnabled = element(by.css("button[id='button-start']:not(disabled)"));
var cancelButton = element(by.css("button[id='button-cancle']"));
var removeAssigneeIcon = element(by.css("button[data-automation-id='adf-people-selector-deselect']"));
this.addName = function (userName) {
Util.waitUntilElementIsVisible(name);
name.sendKeys(userName);
return this;
};
this.addDescription = function (userDescription) {
Util.waitUntilElementIsVisible(description);
description.sendKeys(userDescription);
return this;
};
this.addAssignee = function (name) {
Util.waitUntilElementIsVisible(assignee);
assignee.sendKeys(name);
this.selectAssigneeFromList(name);
Util.waitUntilElementIsVisible(removeAssigneeIcon);
return this;
};
this.selectAssigneeFromList = function (name) {
var assigneeRow = element(by.cssContainingText("adf-people-list div[class*='datatable-row'] div", name));
Util.waitUntilElementIsVisible(assigneeRow);
assigneeRow.click();
return this;
};
this.getAssignee = function () {
Util.waitUntilElementIsVisible(assignee);
return assignee.getAttribute('placeholder');
};
this.addForm = function (form) {
Util.waitUntilElementIsVisible(formDropDown);
formDropDown.click();
return this.selectForm(form);
};
this.selectForm = function (form) {
var option = element(by.cssContainingText("span[class*='mat-option-text']", form));
Util.waitUntilElementIsVisible(option);
Util.waitUntilElementIsClickable(option);
option.click();
return this;
};
this.clickStartButton = function () {
Util.waitUntilElementIsVisible(startButton);
Util.waitUntilElementIsClickable(startButton);
return startButton.click();
};
this.checkStartButtonIsEnabled = function () {
Util.waitUntilElementIsVisible(startButtonEnabled);
return this;
};
this.checkStartButtonIsDisabled = function () {
Util.waitUntilElementIsVisible(startButton.getAttribute("disabled"));
return this;
};
this.clickCancelButton = function () {
Util.waitUntilElementIsVisible(cancelButton);
Util.waitUntilElementIsClickable(cancelButton);
return cancelButton.click();
};
};
module.exports = StartTaskDialog;

View File

@@ -0,0 +1,50 @@
/*!
* @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 ContentList = require('../dialog/contentList');
var FiltersPage = function () {
var activeFilter = element(by.css("mat-list-item[class*='active']"));
var nameColumn = by.css("div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[class*='--text'] span");
var contentList = new ContentList();
this.getActiveFilter = function () {
Util.waitUntilElementIsVisible(activeFilter);
return activeFilter.getText();
};
this.goToFilter = function (filterName) {
var filter = element(by.css("span[data-automation-id='" + filterName + "_filter']"));
Util.waitUntilElementIsVisible(filter);
filter.click();
return this;
};
this.sortByName = function (sortOrder) {
contentList.sortByName(sortOrder);
};
this.getAllRowsNameColumn = function () {
return contentList.getAllRowsColumnValues(nameColumn);
};
};
module.exports = FiltersPage;

View File

@@ -0,0 +1,87 @@
/*!
* @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 FormFields = function () {
var formContent = element(by.css("adf-form"));
var refreshButton = element(by.css("div[class*='form-reload-button'] mat-icon"));
var saveButton = element(by.cssContainingText("mat-card-actions[class*='adf-form'] span", "SAVE"));
var valueLocator = by.css("input");
var labelLocator = by.css("label");
this.setFieldValue = function (By, field, value) {
var fieldElement = element(By(field));
Util.waitUntilElementIsVisible(fieldElement);
fieldElement.clear().sendKeys(value);
return this;
};
this.getWidget = function (fieldId) {
var widget = element(by.css("form-field div[id='field-" + fieldId + "-container']"));
Util.waitUntilElementIsVisible(widget);
return widget;
};
this.getFieldValue = function (fieldId, valueLocatorParam) {
var value = this.getWidget(fieldId).element(valueLocatorParam || valueLocator);
Util.waitUntilElementIsVisible(value);
return value.getAttribute('value');
};
this.getFieldLabel = function (fieldId, labelLocatorParam) {
return this.getFieldText(fieldId, labelLocatorParam);
};
this.getFieldText = function (fieldId, labelLocatorParam) {
var label = this.getWidget(fieldId).element(labelLocatorParam || labelLocator);
Util.waitUntilElementIsVisible(label);
return label.getText();
};
this.checkFieldValue = function (By, field, val) {
Util.waitUntilElementHasValue(element(By(field)), val);
return this;
};
this.refreshForm = function () {
Util.waitUntilElementIsVisible(refreshButton);
refreshButton.click();
return this;
};
this.saveForm = function () {
Util.waitUntilElementIsVisible(saveButton);
Util.waitUntilElementIsClickable(saveButton);
saveButton.click();
return this;
};
this.noFormIsDisplayed = function () {
Util.waitUntilElementIsNotOnPage(formContent);
return this;
};
this.checkFormIsDisplayed = function () {
Util.waitUntilElementIsVisible(formContent);
return this;
};
};
module.exports = FormFields;

View File

@@ -0,0 +1,148 @@
/*!
* @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 ProcessDetailsPage = function () {
//Process Details
var processTitle = element(by.css("mat-card-title[class='mat-card-title']"));
var processStatusField = element(by.css("span[data-automation-id='card-textitem-value-status']"));
var processEndDateField = element(by.css("span[data-automation-id='card-dateitem-ended']"));
var processCategoryField = element(by.css("span[data-automation-id='card-textitem-value-category']"));
var processBusinessKeyField = element(by.css("span[data-automation-id='card-textitem-value-businessKey']"));
var processCreatedByField = element(by.css("span[data-automation-id='card-textitem-value-assignee']"));
var processCreatedField = element(by.css("span[data-automation-id='card-dateitem-created']"));
var processIdField = element(by.css("span[data-automation-id='card-textitem-value-id']"));
var processDescription = element(by.css("span[data-automation-id='card-textitem-value-description']"));
var showDiagramButtonDisabled = element(by.css('button[id="show-diagram-button"][disabled]'));
var propertiesList = element(by.css("div[class='adf-property-list']"));
//Show Diagram
var showDiagramButton = element(by.id('show-diagram-button'));
var diagramCanvas = element(by.css('svg[xmlns="http://www.w3.org/2000/svg"]'));
var backButton = element(by.css("app-show-diagram button[class='mat-mini-fab mat-accent']"));
//Comments
var commentInput = element(by.id('comment-input'));
//Audit Log
var auditLogButton = element(by.css("button[adf-process-audit]"));
//Cancel Process button
var cancelProcessButton = element(by.css('div[data-automation-id="header-status"] > button'));
//Tasks
var activeTask = element(by.css('div[data-automation-id="active-tasks"]'));
var taskTitle = element(by.css("h2[class='activiti-task-details__header']"));
this.checkProcessTitleIsDisplayed = function () {
Util.waitUntilElementIsVisible(processTitle);
return processTitle.getText();
};
this.getProcessStatus = function () {
Util.waitUntilElementIsVisible(processStatusField);
return processStatusField.getText();
};
this.getEndDate = function () {
Util.waitUntilElementIsVisible(processEndDateField);
return processEndDateField.getText();
};
this.getProcessCategory = function () {
Util.waitUntilElementIsVisible(processCategoryField);
return processCategoryField.getText();
};
this.getBusinessKey = function () {
Util.waitUntilElementIsVisible(processBusinessKeyField);
return processBusinessKeyField.getText();
};
this.getCreatedBy = function () {
Util.waitUntilElementIsVisible(processCreatedByField);
return processCreatedByField.getText();
};
this.getCreated = function () {
Util.waitUntilElementIsVisible(processCreatedField);
return processCreatedField.getText();
};
this.getId = function () {
Util.waitUntilElementIsVisible(processIdField);
return processIdField.getText();
};
this.getProcessDescription = function () {
Util.waitUntilElementIsVisible(processDescription);
return processDescription.getText();
};
//Show Diagram
this.clickShowDiagram = function () {
Util.waitUntilElementIsVisible(showDiagramButton);
Util.waitUntilElementIsClickable(showDiagramButton);
showDiagramButton.click();
Util.waitUntilElementIsVisible(diagramCanvas);
Util.waitUntilElementIsVisible(backButton);
Util.waitUntilElementIsClickable(backButton);
backButton.click();
};
this.checkShowDiagramIsDisabled = function () {
Util.waitUntilElementIsVisible(showDiagramButtonDisabled);
};
//Add comment
this.addComment = function (comment) {
Util.waitUntilElementIsVisible(commentInput);
commentInput.sendKeys(comment);
commentInput.sendKeys(protractor.Key.ENTER);
return this;
};
this.checkCommentIsDisplayed = function (comment) {
var commentInserted = element(by.cssContainingText("div[id='comment-message']", comment));
Util.waitUntilElementIsVisible(commentInserted);
return this;
};
// Click Audit log
this.clickAuditLogButton = function () {
Util.waitUntilElementIsVisible(auditLogButton);
auditLogButton.click();
};
this.clickCancelProcessButton = function () {
Util.waitUntilElementIsVisible(cancelProcessButton);
Util.waitUntilElementIsClickable(cancelProcessButton);
cancelProcessButton.click();
};
this.clickOnActiveTask = function () {
Util.waitUntilElementIsVisible(activeTask);
activeTask.click();
};
this.checkActiveTaskTitleIsDisplayed = function () {
Util.waitUntilElementIsVisible(taskTitle);
};
this.checkProcessDetailsCard = function () {
Util.waitUntilElementIsVisible(propertiesList);
};
};
module.exports = ProcessDetailsPage;

View File

@@ -0,0 +1,116 @@
/*!
* @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 ContentList = require('../dialog/contentList');
var StartProcessPage = require('./startProcessPage');
var ProcessFiltersPage = function () {
var runningFilter = element(by.css("span[data-automation-id='Running_filter']"));
var completedFilter = element(by.css("div[class='mat-list-text'] > span[data-automation-id='Completed_filter']"));
var allFilter = element(by.css("span[data-automation-id='All_filter']"));
var createProcessButton = element(by.css(".adf-processes-menu button[data-automation-id='create-button'] > span"));
var newProcessButton = element(by.css("div > button[data-automation-id='btn-start-process']"));
var processesPage = element(by.css("div[class='adf-grid'] > div[class='adf-grid-item adf-processes-menu']"));
var accordionMenu = element(by.css(".adf-processes-menu adf-accordion"));
var buttonWindow = element(by.css("div > button[data-automation-id='btn-start-process'] > div"));
var noContentMessage = element(by.css("p[class='adf-empty-content__title']"));
var rows = by.css("adf-process-instance-list div[class='adf-datatable-body'] div[class*='adf-datatable-row']");
var tableBody = element.all(by.css("adf-datatable div[class='adf-datatable-body']")).first();
var contentList = new ContentList();
var nameColumn = by.css("div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[class*='--text'] span");
this.startProcess = function () {
this.clickCreateProcessButton();
this.clickNewProcessDropdown();
return new StartProcessPage();
};
this.clickRunningFilterButton = function () {
Util.waitUntilElementIsVisible(runningFilter);
Util.waitUntilElementIsClickable(runningFilter);
return runningFilter.click();
};
this.clickCompletedFilterButton = function () {
Util.waitUntilElementIsVisible(completedFilter);
Util.waitUntilElementIsClickable(completedFilter);
completedFilter.click();
expect(completedFilter.isEnabled()).toBe(true);
};
this.clickAllFilterButton = function () {
Util.waitUntilElementIsVisible(allFilter);
Util.waitUntilElementIsClickable(allFilter);
allFilter.click();
expect(allFilter.isEnabled()).toBe(true);
};
this.clickCreateProcessButton = function () {
Util.waitUntilElementIsOnPage(accordionMenu);
Util.waitUntilElementIsVisible(processesPage);
Util.waitUntilElementIsPresent(createProcessButton);
createProcessButton.click();
};
this.clickNewProcessDropdown = function () {
Util.waitUntilElementIsOnPage(buttonWindow);
Util.waitUntilElementIsVisible(newProcessButton);
Util.waitUntilElementIsClickable(newProcessButton);
newProcessButton.click();
};
this.checkNoContentMessage = function () {
Util.waitUntilElementIsVisible(noContentMessage);
};
this.selectFromProcessList = function (title) {
var processName = element.all(by.css('div[data-automation-id="text_'+ title +'"]')).first();
Util.waitUntilElementIsVisible(processName);
processName.click();
};
this.checkFilterIsHighlighted = function (filterName) {
var processNameHighlighted = element(by.css("mat-list-item.active span[data-automation-id='" + filterName + "_filter']"));
Util.waitUntilElementIsVisible(processNameHighlighted);
};
this.numberOfProcessRows = function () {
return element.all(rows).count();
};
this.waitForTableBody = function (){
Util.waitUntilElementIsVisible(tableBody);
};
/**
* Sort the list by name column.
*
* @param sortOrder : 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByName = function (sortOrder) {
contentList.sortByName(sortOrder);
};
this.getAllRowsNameColumn = function () {
return contentList.getAllRowsColumnValues(nameColumn);
};
};
module.exports = ProcessFiltersPage;

View File

@@ -0,0 +1,95 @@
/*!
* @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 AppNavigationBarPage = require('./appNavigationBarPage');
var ProcessServicesPage = function(){
var apsAppsContainer = element(by.css("div[class='adf-app-listgrid ng-star-inserted']"));
var processServices = element(by.css("a[data-automation-id='Process Services']"));
var taskApp = element(by.css("mat-card[title='Task App']"));
var iconTypeLocator = by.css("mat-icon[class*='card-logo-icon']");
var descriptionLocator = by.css("mat-card-subtitle[class*='subtitle']");
/**
* Check Process Page Container is displayed
* @method checkApsContainer
*/
this.checkApsContainer = function(){
Util.waitUntilElementIsVisible(apsAppsContainer);
};
/**
* Go to Process Services Page
* @method goToProcessServices
* */
this.goToProcessServices = function() {
Util.waitUntilElementIsVisible(processServices);
processServices.click();
this.checkApsContainer();
return this;
};
/**
* Go to App
* @method goToApp
* */
this.goToApp = function(applicationName) {
var app = element(by.css("mat-card[title='" + applicationName +"']"));
Util.waitUntilElementIsVisible(app);
app.click();
return new AppNavigationBarPage();
};
/**
* Go to Task App
* @method goToTaskApp
* */
this.goToTaskApp = function() {
Util.waitUntilElementIsVisible(taskApp);
taskApp.click();
return new AppNavigationBarPage();
};
this.getAppIconType = function (applicationName) {
var app = element(by.css("mat-card[title='" + applicationName +"']"));
Util.waitUntilElementIsVisible(app);
var iconType = app.element(iconTypeLocator);
Util.waitUntilElementIsVisible(iconType);
return iconType.getText();
};
this.getBackgroundColor = function(applicationName) {
var app = element(by.css("mat-card[title='" + applicationName +"']"));
Util.waitUntilElementIsVisible(app);
return app.getCssValue("color").then(function (value) {
return value;
});
};
this.getDescription = function(applicationName) {
var app = element(by.css("mat-card[title='" + applicationName +"']"));
Util.waitUntilElementIsVisible(app);
var description = app.element(descriptionLocator);
Util.waitUntilElementIsVisible(description);
return description.getText();
};
};
module.exports = ProcessServicesPage;

View File

@@ -0,0 +1,86 @@
/*!
* @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 StartProcessPage = function () {
var defaultProcessName = element(by.css("input[id='processName']"));
var processNameInput = element(by.id('processName'));
var selectProcessDropdownArrow = element(by.css("div[class='mat-select-arrow-wrapper'] div"));
var cancelProcessButton = element(by.id('cancle_process'));
var formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]'));
var startProcessButton = element(by.css("button[data-automation-id='btn-start']"));
var noProcess = element(by.id('no-process-message'));
this.checkNoProcessMessage = function () {
Util.waitUntilElementIsVisible(noProcess);
}
this.getDefaultName = function () {
Util.waitUntilElementIsVisible(defaultProcessName);
return defaultProcessName.getAttribute("value");
};
this.deleteDefaultName = function (value) {
Util.waitUntilElementIsVisible(processNameInput);
processNameInput.getAttribute('value').then(function (value){
for (var i = value.length; i >= 0; i--) {
processNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
};
this.enterProcessName = function (name) {
Util.waitUntilElementIsVisible(processNameInput);
processNameInput.clear();
processNameInput.sendKeys(name);
};
this.selectFromProcessDropdown = function (name) {
Util.waitUntilElementIsVisible(selectProcessDropdownArrow);
Util.waitUntilElementIsClickable(selectProcessDropdownArrow)
selectProcessDropdownArrow.click();
var selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
Util.waitUntilElementIsVisible(selectProcessDropdown);
Util.waitUntilElementIsClickable(selectProcessDropdown);
selectProcessDropdown.click();
return this;
};
this.clickCancelProcessButton = function () {
Util.waitUntilElementIsVisible(cancelProcessButton);
cancelProcessButton.click();
};
this.clickFormStartProcessButton = function () {
Util.waitUntilElementIsVisible(formStartProcessButton);
Util.waitUntilElementIsClickable(formStartProcessButton);
return formStartProcessButton.click();
};
this.checkStartProcessButtonIsEnabled = function () {
expect(startProcessButton.isEnabled()).toBe(true);
};
this.checkStartProcessButtonIsDisabled = function () {
expect(startProcessButton.isEnabled()).toBe(false);
};
};
module.exports = StartProcessPage;

View File

@@ -0,0 +1,172 @@
/*!
* @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 TaskDetailsPage = function () {
var formNameField = element(by.css("span[data-automation-id*='formName'] span"));
var assigneeField = element(by.css("span[data-automation-id*='assignee'] span"));
var statusField = element(by.css("span[data-automation-id*='status'] span"));
var categoryField = element(by.css("span[data-automation-id*='category'] span"));
var parentNameField = element(by.css("span[data-automation-id*='parentName'] span"));
var createdField = element(by.css("span[data-automation-id='card-dateitem-created'] span"));
var idField = element(by.css("span[data-automation-id*='id'] span"));
var descriptionField = element(by.css("span[data-automation-id*='description'] span"));
var dueDateField = element(by.css("span[data-automation-id*='dueDate'] span"));
var activitiesTitle = element(by.css("div[class*='adf-info-drawer-layout-header-title'] div"));
var commentField = element(by.css("input[id='comment-input']"));
var activityTab = element(by.cssContainingText("div[class*='mat-tab-label ']", "Activity"));
var detailsTab = element(by.cssContainingText("div[class*='mat-tab-label ']", "Details"));
var involvePeopleButton = element(by.css("div[class*='add-people']"));
var addPeopleField = element(by.css("input[data-automation-id='adf-people-search-input']"));
var addInvolvedUserButton = element(by.css("button[id='add-people'] span"));
var emailInvolvedUser = by.xpath("following-sibling::div[@class='people-email ng-star-inserted']");
this.getFormName = function () {
Util.waitUntilElementIsVisible(formNameField);
return formNameField.getText();
};
this.getAssignee = function () {
Util.waitUntilElementIsVisible(assigneeField);
return assigneeField.getText();
};
this.getStatus = function () {
Util.waitUntilElementIsVisible(statusField);
return statusField.getText();
};
this.getCategory = function () {
Util.waitUntilElementIsVisible(categoryField);
return categoryField.getText();
};
this.getParentName = function () {
Util.waitUntilElementIsVisible(parentNameField);
return parentNameField.getText();
};
this.getCreated = function () {
Util.waitUntilElementIsVisible(createdField);
return createdField.getText();
};
this.getId = function () {
Util.waitUntilElementIsVisible(idField);
return idField.getText();
};
this.getDescription = function () {
Util.waitUntilElementIsVisible(descriptionField);
return descriptionField.getText();
};
this.getDueDate = function () {
Util.waitUntilElementIsVisible(dueDateField);
return dueDateField.getText();
};
this.getTitle = function () {
Util.waitUntilElementIsVisible(activitiesTitle);
return activitiesTitle.getText();
};
this.selectActivityTab = function () {
Util.waitUntilElementIsVisible(activityTab);
activityTab.getAttribute('aria-selected').then(function (check) {
if (check === 'false') {
activityTab.click();
expect(activityTab.getAttribute('aria-selected')==="true");
}
});
return this;
};
this.selectDetailsTab = function () {
Util.waitUntilElementIsVisible(detailsTab);
detailsTab.getAttribute('aria-selected').then(function (check) {
if (check === 'false') {
detailsTab.click();
expect(detailsTab.getAttribute('aria-selected')==="true");
}
});
return this;
};
this.addComment = function (comment) {
Util.waitUntilElementIsVisible(commentField);
commentField.sendKeys(comment);
commentField.sendKeys(protractor.Key.ENTER);
return this;
};
this.checkCommentIsDisplayed = function (comment) {
var row = element(by.cssContainingText("div[id='comment-message']", comment));
Util.waitUntilElementIsVisible(row);
return this;
};
this.clickInvolvePeopleButton = function () {
Util.waitUntilElementIsVisible(involvePeopleButton);
Util.waitUntilElementIsClickable(involvePeopleButton);
browser.actions().mouseMove(involvePeopleButton).perform();
involvePeopleButton.click();
return this;
};
this.typeUser = function (user) {
Util.waitUntilElementIsVisible(addPeopleField);
addPeopleField.sendKeys(user);
return this;
};
this.selectUserToInvolve = function(user) {
this.getRowsUser(user).click();
return this;
};
this.checkUserIsSelected = function(user) {
var row = element(by.cssContainingText("div[class*='search-list-container'] div[class*='people-full-name']", user));
var selectedRow = this.getRowsUser(user).element(by.css("ancestor::tr[class*='is-selected']"));
Util.waitUntilElementIsVisible(row);
return this;
};
this.clickAddInvolvedUserButton = function () {
Util.waitUntilElementIsVisible(addInvolvedUserButton);
Util.waitUntilElementIsClickable(addInvolvedUserButton);
addInvolvedUserButton.click();
return this;
}
this.getRowsUser = function (user) {
var row = element(by.cssContainingText("div[class*='people-full-name']", user));
Util.waitUntilElementIsVisible(row);
return row;
};
this.getInvolvedUserEmail = function (user) {
var email = this.getRowsUser(user).element(emailInvolvedUser);
Util.waitUntilElementIsVisible(email);
return email.getText();
};
};
module.exports = TaskDetailsPage;

View File

@@ -0,0 +1,57 @@
/*!
* @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 TasksListPage = function () {
var taskList = element(by.css("adf-tasklist"));
var tableBody = element.all(by.css("adf-datatable div[class='adf-datatable-body']")).first();
this.checkTaskIsDisplayedInTasksList = function(taskName) {
var row = by.cssContainingText("span", taskName);
Util.waitUntilElementIsVisible(taskList.element(row));
return this;
};
this.selectTaskFromTasksList = function(taskName) {
var row = by.cssContainingText("span", taskName);
Util.waitUntilElementIsVisible(taskList.element(row));
taskList.element(row).click();
return this;
};
this.checkTaskIsNotDisplayedInTasksList = function(taskName) {
var row = by.cssContainingText("span", taskName);
Util.waitUntilElementIsNotOnPage(taskList.element(row));
return this;
};
this.checkTaskListIsLoaded = function () {
Util.waitUntilElementIsVisible(taskList);
return this;
};
this.waitForTableBody = function (){
Util.waitUntilElementIsVisible(tableBody);
};
};
module.exports = TasksListPage;

View File

@@ -0,0 +1,113 @@
/*!
* @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 StartTaskDialog = require('./dialog/startTaskDialog');
var FormFields = require('./formFields');
var TaskDetails = require('./taskDetailsPage');
var FiltersPage = require('./filtersPage');
var ChecklistDialog = require('./dialog/createChecklistDialog');
var TasksListPage = require('./tasksListPage');
var TasksPage = function () {
var createButton = element(by.css("button[data-automation-id='create-button']"));
var newTaskButton = element(by.css("button[data-automation-id='btn-start-task']"));
var addChecklistButton = element(by.css("button[class*='adf-add-to-checklist-button']"));
var rowByRowName = by.xpath("ancestor::mat-chip");
var checklistContainer = by.css("div[class*='checklist-menu']");
var taskTitle = "h2[class='activiti-task-details__header'] span";
var rows = by.css("div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[class*='adf-data-table-cell']");
this.createNewTask = function () {
this.createButtonIsDisplayed();
this.clickOnCreateButton();
this.newTaskButtonIsDisplayed();
newTaskButton.click();
return new StartTaskDialog();
};
this.createButtonIsDisplayed = function() {
Util.waitUntilElementIsVisible(createButton);
return this;
};
this.newTaskButtonIsDisplayed = function() {
Util.waitUntilElementIsVisible(newTaskButton);
return this;
};
this.clickOnCreateButton = function() {
Util.waitUntilElementIsClickable(createButton);
createButton.click();
return this;
};
this.usingFormFields = function () {
return new FormFields();
};
this.usingTaskDetails = function () {
return new TaskDetails();
};
this.usingFiltersPage = function () {
return new FiltersPage();
};
this.usingTasksListPage = function () {
return new TasksListPage();
};
this.clickOnAddChecklistButton = function () {
Util.waitUntilElementIsClickable(addChecklistButton);
addChecklistButton.click();
return new ChecklistDialog();
};
this.getRowsName = function (name) {
var row = element(checklistContainer).element(by.cssContainingText("span", name));
Util.waitUntilElementIsVisible(row);
return row;
};
this.getChecklistByName = function (checklist) {
var row = this.getRowsName(checklist).element(rowByRowName);
Util.waitUntilElementIsVisible(row);
return row;
};
this.checkChecklistIsDisplayed = function (checklist) {
Util.waitUntilElementIsVisible(this.getChecklistByName(checklist));
return this;
};
this.checkTaskTitle = function(taskName) {
Util.waitUntilElementIsVisible(element(by.css(taskTitle)));
var title = element(by.cssContainingText(taskTitle, taskName));
Util.waitUntilElementIsVisible(title);
return this;
};
this.getAllDisplayedRows= function(){
return element.all(rows).count();
};
};
module.exports = TasksPage;

View File

@@ -0,0 +1,57 @@
/*!
* @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 FormFields = require('../formFields');
var TestConfig = require('../../../../test.config');
var path = require('path');
var Util = require('../../../../util/util');
var AttachFile = function () {
var formFields = new FormFields();
var uploadLocator = by.css("button[id='attachfile']");
var localStorageButton = element(by.css("input[id='attachfile']"));
var filesListLocator = by.css("div[id='adf-attach-widget-readonly-list']");
this.attachFile = function (fieldId, fileLocation) {
var widget = formFields.getWidget(fieldId);
var uploadButton = widget.element(uploadLocator);
Util.waitUntilElementIsVisible(uploadButton);
uploadButton.click();
Util.waitUntilElementIsVisible(localStorageButton);
localStorageButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
return this;
};
this.checkFileIsAttached = function (fieldId, name) {
var widget = formFields.getWidget(fieldId);
var fileAttached = widget.element(filesListLocator).element(by.cssContainingText("mat-list-item span ", name));
Util.waitUntilElementIsVisible(fileAttached);
return this;
};
this.viewFile = function (name) {
var fileView = element(filesListLocator).element(by.cssContainingText("mat-list-item span ", name));
Util.waitUntilElementIsVisible(fileView);
fileView.click();
browser.actions().doubleClick(fileView).perform();
return this;
};
};
module.exports = AttachFile;

View File

@@ -0,0 +1,33 @@
/*!
* @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 FormFields = require('../formFields');
var DisplayText = function () {
var formFields = new FormFields();
var labelLocator = by.css("div[class*='display-text-widget']");
this.getFieldLabel = function (fieldId) {
return formFields.getFieldLabel(fieldId, labelLocator);
};
};
module.exports = DisplayText;

View File

@@ -0,0 +1,34 @@
/*!
* @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 FormFields = require('../formFields');
var DisplayValue = function () {
var formFields = new FormFields();
var labelLocator = by.css("span[class*='unknown-text']");
this.getFieldLabel = function (fieldId) {
return formFields.getFieldLabel(fieldId, labelLocator);
};
};
module.exports = DisplayValue;

View File

@@ -0,0 +1,32 @@
/*!
* @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 FormFields = require('../formFields');
var Dropdown = function () {
var formFields = new FormFields();
var selectedOptionLocator = by.css("mat-select[id='dropdown'] span span");
this.getSelectedOptionText = function (fieldId) {
return formFields.getFieldText(fieldId, selectedOptionLocator);
};
};
module.exports = Dropdown;

View File

@@ -0,0 +1,37 @@
/*!
* @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 FormFields = require('../formFields');
var DynamicTable = function () {
var formFields = new FormFields();
var labelLocator = by.css("dynamic-table-widget div div");
var columnNameLocator = by.css("table[id*='dynamic-table'] th");
this.getFieldLabel = function (fieldId) {
return formFields.getFieldLabel(fieldId, labelLocator);
};
this.getColumnName = function (fieldId) {
return formFields.getFieldText(fieldId, columnNameLocator);
};
};
module.exports = DynamicTable;

View File

@@ -0,0 +1,32 @@
/*!
* @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 FormFields = require('../formFields');
var Header = function () {
var formFields = new FormFields();
var labelLocator = by.css("span[id='container-header-label']");
this.getFieldLabel = function (fieldId) {
return formFields.getFieldLabel(fieldId, labelLocator);
};
};
module.exports = Header;

View File

@@ -0,0 +1,32 @@
/*!
* @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 FormFields = require('../formFields');
var Hyperlink = function () {
var formFields = new FormFields();
var fieldLocator = by.css("div[class='adf-hyperlink-widget '] a");
this.getFieldText = function (fieldId) {
return formFields.getFieldText(fieldId, fieldLocator);
};
};
module.exports = Hyperlink;

View File

@@ -0,0 +1,33 @@
/*!
* @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 FormFields = require('../formFields');
var MultilineText = function () {
var formFields = new FormFields();
var valueLocator = by.css("textarea");
this.getFieldValue = function (fieldId) {
return formFields.getFieldValue(fieldId, valueLocator);
};
};
module.exports = MultilineText;

View File

@@ -0,0 +1,34 @@
/*!
* @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 FormFields = require('../formFields');
var Util = require('../../../../util/util');
var RadioButtons = function () {
var formFields = new FormFields();
this.getSpecificOptionLabel = function (fieldId, optionNumber) {
var optionLocator = by.css("label[for*='radiobuttons-option_" + optionNumber + "'] div[class*='content']");
var option = formFields.getWidget(fieldId).element(optionLocator);
Util.waitUntilElementIsVisible(option);
return option.getText();
};
};
module.exports = RadioButtons;

View File

@@ -0,0 +1,69 @@
/*!
* @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 MultilineText = require('./MultilineText');
var Header = require('./Header');
var DisplayText = require('./DisplayText');
var AttachFile = require('./AttachFile');
var DisplayValue = require('./DisplayValue');
var RadioButtons = require('./RadioButtons');
var Hyperlink = require('./Hyperlink');
var Dropdown = require('./Dropdown');
var DynamicTable = require('./DynamicTable');
var UsingWidget = function () {
this.usingMultilineTextWidget = function () {
return new MultilineText();
};
this.usingHeaderWidget = function () {
return new Header();
};
this.usingDisplayTextWidget = function () {
return new DisplayText();
};
this.usingAttachFileWidget = function () {
return new AttachFile();
};
this.usingDisplayValueWidget = function () {
return new DisplayValue();
};
this.usingRadioWidget = function () {
return new RadioButtons();
};
this.usingHyperlink = function () {
return new Hyperlink();
};
this.usingDropdown = function () {
return new Dropdown();
};
this.usingDynamicTable = function () {
return new DynamicTable();
};
};
module.exports = UsingWidget;

View File

@@ -0,0 +1,187 @@
/*!
* @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 ContentList = require('./dialog/contentList');
var DatatablePage = require('./dataTablePage');
var SearchResultsPage = function () {
var noResultsMessage = element(by.css("div[class='adf-no-result-message']"));
var noResultsMessageBy = by.css("div[class='adf-no-result-message']");
var contentList = new ContentList();
var dataTable = new DatatablePage();
var sortArrowLocator = by.css("adf-sorting-picker button mat-icon");
var sortDropdownLocator = by.css("mat-option span");
var sortingArrow = element(by.css("adf-sorting-picker div[class='mat-select-arrow']"));
this.checkContentIsDisplayed = function (content) {
contentList.checkContentIsDisplayed(content);
return this;
};
this.numberOfResultsDisplayed = function () {
return contentList.getAllDisplayedRows();
};
this.checkContentIsNotDisplayed = function (content) {
Util.waitUntilElementIsNotOnPage(element(by.css("span[title='" + content +"']")));
};
this.checkNoResultMessageIsDisplayed = function() {
Util.waitUntilElementIsPresent(element(noResultsMessageBy));
Util.waitUntilElementIsVisible(element(noResultsMessageBy));
return this;
};
this.checkNoResultMessageIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(noResultsMessage);
return this;
};
this.navigateToFolder = function(content) {
dataTable.navigateToContent(content);
return this;
};
this.deleteContent = function(content) {
contentList.deleteContent(content);
};
this.copyContent = function(content) {
contentList.copyContent(content);
};
this.moveContent = function(content) {
contentList.moveContent(content);
};
/**
* Sort the list by name column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByName = function (sortOrder) {
this.sortBy(sortOrder, "Name");
};
/**
* Sort the list by any option.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
* @param option
*/
this.sortBy = function (sortOrder, option) {
Util.waitUntilElementIsVisible(sortingArrow);
sortingArrow.click();
element.all(sortDropdownLocator).each(function(element) {
element.getText().then(function(text) {
if (text === option) {
element.click();
}
});
});
this.sortByOrder(sortOrder);
};
this.sortByOrder = function(sortOrder) {
Util.waitUntilElementIsVisible(element(sortArrowLocator));
return element(sortArrowLocator).getText().then(function (result) {
if(sortOrder===true) {
if(result !== 'arrow_upward') {
element(sortArrowLocator).click();
};
}
else {
if(result === 'arrow_upward') {
element(sortArrowLocator).click();
};
}
return Promise.resolve();
});
};
/**
* Sort the list by author column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByAuthor = function (sortOrder) {
contentList.sortByAuthor(sortOrder);
};
/**
* Sort the list by created column.
*
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
*/
this.sortByCreated = function (sortOrder) {
return contentList.sortByCreated(sortOrder);
};
/**
* Sort by name and check the list is sorted.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByName = function (sortOrder) {
this.sortByName(sortOrder);
dataTable.waitForTableBody();
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByNameColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
/**
* Sort by author and check the list is sorted.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByAuthor = function (sortOrder) {
this.sortByAuthor(sortOrder);
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByAuthorColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
/**
* Sort by created and check the list is sorted.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
*/
this.sortAndCheckListIsOrderedByCreated = function (sortOrder) {
this.sortByCreated(sortOrder);
var deferred = protractor.promise.defer();
contentList.checkListIsOrderedByCreatedColumn(sortOrder).then(function(result) {
deferred.fulfill(result);
});
return deferred.promise;
};
};
module.exports = SearchResultsPage;

View File

@@ -0,0 +1,131 @@
/*!
* @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 TestConfig = require('../../test.config');
var Util = require('../../util/util');
var SettingsPage = function () {
var settingsURL = TestConfig.adf.url + TestConfig.adf.port + "/settings";
var providerDropdown = element(by.css("mat-select[aria-label='Provider'] div[class='mat-select-arrow-wrapper']"));
var ecmAndBpm = {
option: element(by.xpath("//SPAN[@class='mat-option-text'][contains(text(),'ALL')]")),
text: "ALL"
};
var bpm = {
option: element(by.xpath("//SPAN[@class='mat-option-text'][contains(text(),'BPM') and not (contains(text(),'and'))]")),
text: "BPM"
};
var ecm = {
option: element(by.xpath("//SPAN[@class='mat-option-text'][contains(text(),'ECM') and not (contains(text(),'and'))]")),
text: "ECM"
};
var oauth = {
option: element(by.xpath("//SPAN[@class='mat-option-text'][contains(text(),'OAUTH')]")),
text: "OAUTH"
};
var selectedOption = element.all(by.css("span[class*='ng-star-inserted']")).first();
var ecmText = element(by.css("input[data-automation-id*='ecmHost']"));
var bpmText = element(by.css("input[data-automation-id*='bpmHost']"));
var authHostText = element(by.css("input[id='oauthHost']"));
var silentLoginToggle = element(by.css("mat-slide-toggle[name='silentLogin'] div[class='mat-slide-toggle-thumb']"));
var silentLoginEnabled = element(by.css("mat-slide-toggle[class*='mat-checked'][name='silentLogin'] div[class='mat-slide-toggle-thumb']"));
var backButton = element(by.cssContainingText("span[class='mat-button-wrapper']", "Back"));
var applyButton = element(by.css("button[data-automation-id*='host-button']"));
this.goToSettingsPage = function () {
browser.driver.get(settingsURL);
Util.waitUntilElementIsVisible(providerDropdown);
return this;
};
/**
* Selects provider
* @method setProvider
* @param {String} option, {String} selected
*/
this.setProvider = function (option, selected) {
Util.waitUntilElementIsVisible(providerDropdown);
providerDropdown.click();
Util.waitUntilElementIsVisible(option);
option.click();
return expect(selectedOption.getText()).toEqual(selected);
};
/**
* Sets provider as ECM and BPM
* @method setProviderEcmBpm
*/
this.setProviderEcmBpm = function () {
this.goToSettingsPage();
this.setProvider(ecmAndBpm.option, ecmAndBpm.text);
Util.waitUntilElementIsVisible(bpmText);
Util.waitUntilElementIsVisible(ecmText);
this.clickApply();
return this;
};
/**
* Sets provider as BPM
* @method setProviderBpm
*/
this.setProviderBpm = function () {
this.goToSettingsPage();
this.setProvider(bpm.option, bpm.text);
Util.waitUntilElementIsVisible(bpmText);
expect(ecmText.isPresent()).toBe(false);
this.clickApply();
return this;
};
/**
* Sets provider as ECM
* @method setProviderEcm
*/
this.setProviderEcm = function () {
this.goToSettingsPage();
this.setProvider(ecm.option, ecm.text);
Util.waitUntilElementIsVisible(ecmText);
expect(bpmText.isPresent()).toBe(false);
this.clickApply();
return this;
};
/**
* Sets provider as OAUTH
* @method setProviderOauth
*/
this.setProviderOauth = function () {
this.goToSettingsPage();
this.setProvider(oauth.option, oauth.text);
Util.waitUntilElementIsVisible(bpmText);
Util.waitUntilElementIsVisible(ecmText);
expect(authHostText.isPresent()).toBe(true);
this.clickApply();
return this;
};
/**
* Clicks Apply button
* @method clickApply
*/
this.clickApply = function () {
Util.waitUntilElementIsVisible(applyButton);
applyButton.click();
};
};
module.exports = SettingsPage;

143
e2e/pages/adf/tagPage.js Normal file
View File

@@ -0,0 +1,143 @@
/*!
* @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 TestConfig = require('../../test.config');
var Util = require('../../util/util');
var ContentList = require('./dialog/contentList');
var TagPage = function () {
var tagURL = TestConfig.adf.url + TestConfig.adf.port + "/tag";
var addTagButton = element(by.css("button[id='add-tag']"));
var insertNodeId = element(by.css("input[id='nodeId']"));
var newTagInput = element(by.css("input[id='new-tag-text']"));
var tagListRow = element(by.css("adf-tag-node-actions-list mat-list-item"));
var tagListByNodeIdRow = element(by.css("adf-tag-node-list mat-chip"));
var errorMessage = element(by.css("mat-hint[data-automation-id='errorMessage']"));
var tagListRowLocator = by.css("adf-tag-node-actions-list mat-list-item div");
var tagListByNodeIdRowLocator = by.css("adf-tag-node-list mat-chip span");
var tagListContentServicesRowLocator = by.css("div[class='adf-list-tag']");
this.goToTagPage = function () {
browser.driver.get(tagURL);
Util.waitUntilElementIsVisible(addTagButton);
return this;
};
this.getNodeId = function () {
Util.waitUntilElementIsVisible(insertNodeId);
return insertNodeId.getAttribute('value');
};
this.insertNodeId = function (nodeId) {
Util.waitUntilElementIsVisible(insertNodeId);
insertNodeId.sendKeys(nodeId);
browser.driver.sleep(200);
insertNodeId.sendKeys(' ')
browser.driver.sleep(200);
insertNodeId.sendKeys(protractor.Key.BACK_SPACE);
};
this.addNewTagInput = function (tag) {
Util.waitUntilElementIsVisible(newTagInput);
newTagInput.sendKeys(tag);
return this;
};
this.addTag = function (tag) {
this.addNewTagInput(tag);
Util.waitUntilElementIsVisible(addTagButton);
Util.waitUntilElementIsClickable(addTagButton);
Util.waitUntilElementIsPresent(addTagButton);
addTagButton.click();
return this;
};
this.getNewTagInput = function () {
Util.waitUntilElementIsVisible(newTagInput);
return newTagInput.getAttribute('value');
};
this.getNewTagPlaceholder = function () {
Util.waitUntilElementIsVisible(newTagInput);
return newTagInput.getAttribute("placeholder");
};
this.addTagButtonIsEnabled = function () {
Util.waitUntilElementIsVisible(addTagButton);
return addTagButton.isEnabled();
};
this.checkTagIsDisplayedInTagList = function (tagName) {
var tag = element(by.cssContainingText("div[id*='tag_name']", tagName));
return Util.waitUntilElementIsVisible(tag);
};
this.checkTagIsNotDisplayedInTagList = function (tagName) {
var tag = element(by.cssContainingText("div[id*='tag_name']", tagName));
return Util.waitUntilElementIsNotOnPage(tag);
};
this.checkTagListIsEmpty = function () {
Util.waitUntilElementIsNotOnPage(tagListRow);
};
this.checkTagIsDisplayedInTagListByNodeId = function (tagName) {
var tag = element(by.cssContainingText("span[id*='tag_name']", tagName));
return Util.waitUntilElementIsVisible(tag);
};
this.checkTagListByNodeIdIsEmpty = function () {
return Util.waitUntilElementIsNotOnPage(tagListByNodeIdRow);
};
this.checkTagIsDisplayedInTagListContentServices = function (tagName) {
var tag = element(by.cssContainingText("div[class='adf-list-tag'][id*='tag_name']", tagName));
return Util.waitUntilElementIsVisible(tag);
};
this.getErrorMessage = function () {
Util.waitUntilElementIsPresent(errorMessage);
return errorMessage.getText();
};
this.checkTagListIsOrderedAscending = function () {
var deferred = protractor.promise.defer();
new ContentList().checkListIsSorted(false, tagListRowLocator).then(function (result) {
deferred.fulfill(result);
});
return deferred.promise;
};
this.checkTagListByNodeIdIsOrderedAscending = function () {
var deferred = protractor.promise.defer();
new ContentList().checkListIsSorted(false, tagListByNodeIdRowLocator).then(function (result) {
deferred.fulfill(result);
});
return deferred.promise;
};
this.checkTagListContentServicesIsOrderedAscending = function () {
var deferred = protractor.promise.defer();
new ContentList().checkListIsSorted(false, tagListContentServicesRowLocator).then(function (result) {
deferred.fulfill(result);
});
return deferred.promise;
};
};
module.exports = TagPage;

View File

@@ -0,0 +1,39 @@
/*!
* @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 TrashcanPage = function () {
var rows = by.css("adf-document-list div[class*='adf-datatable-body'] div[class*='adf-datatable-row']");
var tableBody = element.all(by.css("adf-document-list div[class='adf-datatable-body']")).first();
var pagination = element(by.css("adf-pagination"));
this.numberOfResultsDisplayed = function () {
return element.all(rows).count();
};
this.waitForTableBody = function (){
Util.waitUntilElementIsVisible(tableBody);
};
this.waitForPagination = function (){
Util.waitUntilElementIsVisible(pagination);
};
};
module.exports = TrashcanPage;

202
e2e/pages/adf/viewerPage.js Normal file
View File

@@ -0,0 +1,202 @@
/*!
* @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 CardViewPage = require('./cardViewPage');
var ViewerToolbarPage = function () {
var closeButton = element(by.css("button[data-automation-id='toolbar-back']"));
var fileThumbnail = element(by.css("img[class='adf-viewer__mimeicon']"));
var fileName = element(by.id('adf-viewer-display-name'));
var downloadButton = element(by.css("button[data-automation-id='toolbar-download'] > span > mat-icon"));
var infoButton = element(by.css("button[data-automation-id='toolbar-sidebar']"));
var infoSideBar = element(by.css("div[class='adf-info-drawer-layout-header']"));
var previousPageButton = element(by.id('viewer-previous-page-button'));
var nextPageButton = element(by.id('viewer-next-page-button'));
var pageSelectorInput = element(by.css("div[class='adf-pdf-viewer__toolbar-page-selector'] input"));
var zoomInButton = element(by.id('viewer-zoom-in-button'));
var zoomOutButton = element(by.id('viewer-zoom-out-button'));
var scalePageButton = element(by.id('viewer-scale-page-button'));
var imgContainer = element(by.id('viewer-image'));
var pdfContainer = element(by.id('viewer-pdf-container'));
var mediaContainer = element(by.css("adf-media-player[class='adf-media-player ng-star-inserted']"));
var unsupportedFileContainer = element(by.cssContainingText('.label','Document preview could not be loaded'));
var allPages = element.all(by.css("div[class='canvasWrapper'] > canvas")).first();
var pageCanvas = element.all(by.css("div[class='canvasWrapper']")).first();
this.canvasHeight = function () {
var deferred = protractor.promise.defer();
pageCanvas.getAttribute("style").then(function (value) {
var canvasHeight = value.split("height: ")[1].split("px")[0];
deferred.fulfill(canvasHeight);
});
return deferred.promise;
};
this.canvasWidth = function () {
var deferred = protractor.promise.defer();
pageCanvas.getAttribute("style").then(function (value) {
var canvasWidth = value.split("width: ")[1].split("px")[0];
deferred.fulfill(canvasWidth);
});
return deferred.promise;
};
this.viewFile = function (fileName) {
var fileView = element(by.xpath("//div[@class='document-list-container']//span[@title='" + fileName +"']"));
Util.waitUntilElementIsVisible(fileView);
fileView.click();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
};
this.checkCloseButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(closeButton);
};
this.checkDownloadButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(downloadButton);
};
this.checkInfoButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(infoButton);
};
this.clickCloseButton = function () {
Util.waitUntilElementIsVisible(closeButton);
closeButton.click();
};
this.checkFileThumbnailIsDisplayed = function () {
Util.waitUntilElementIsVisible(fileThumbnail);
};
this.checkFileNameIsDisplayed = function (file) {
Util.waitUntilElementIsVisible(fileName);
expect(fileName.getText()).toEqual(file);
};
this.clickDownloadButton = function () {
Util.waitUntilElementIsVisible(downloadButton);
downloadButton.click();
};
this.clickInfoButton = function () {
Util.waitUntilElementIsVisible(infoButton);
infoButton.click();
return new CardViewPage();
};
this.checkInfoSideBarIsNotDisplayed = function () {
Util.waitUntilElementIsNotVisible(infoSideBar);
};
this.checkInfoSideBarIsDisplayed = function () {
Util.waitUntilElementIsVisible(infoSideBar);
};
this.checkInfoSideBarIsNotDisplayed = function () {
Util.waitUntilElementIsNotOnPage(infoSideBar);
};
this.checkPreviousPageButtonIsDisplayed =function () {
Util.waitUntilElementIsVisible(previousPageButton);
};
this.clickPreviousPageButton = function () {
Util.waitUntilElementIsVisible(previousPageButton);
previousPageButton.click();
};
this.checkNextPageButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(nextPageButton);
};
this.clickNextPageButton = function () {
Util.waitUntilElementIsVisible(nextPageButton);
nextPageButton.click();
};
this.checkZoomInButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(zoomInButton);
};
this.clickZoomInButton = function () {
Util.waitUntilElementIsVisible(zoomInButton);
zoomInButton.click();
};
this.checkZoomOutButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(zoomOutButton);
};
this.clickZoomOutButton = function () {
Util.waitUntilElementIsVisible(zoomOutButton);
zoomOutButton.click();
};
this.checkScalePageButtonIsDisplayed = function () {
Util.waitUntilElementIsVisible(scalePageButton);
};
this.clickScalePageButton = function () {
Util.waitUntilElementIsVisible(scalePageButton);
scalePageButton.click();
};
this.checkPageSelectorInputIsDisplayed = function (number) {
Util.waitUntilElementIsVisible(pageSelectorInput);
pageSelectorInput.getAttribute('value').then(function (pageNumber) {
expect(pageNumber).toEqual(number);
})
};
this.enterPage = function (number) {
Util.waitUntilElementIsVisible(pageSelectorInput);
pageSelectorInput.clear();
pageSelectorInput.sendKeys(number);
pageSelectorInput.sendKeys(protractor.Key.ENTER);
};
this.checkImgContainerIsDisplayed = function () {
Util.waitUntilElementIsVisible(imgContainer);
};
this.checkPdfContainerIsDisplayed = function () {
Util.waitUntilElementIsVisible(pdfContainer);
};
this.checkMediaPlayerContainerIsDisplayed = function () {
Util.waitUntilElementIsVisible(mediaContainer);
};
this.checkUnsupportedFileContainerIsDisplayed = function () {
Util.waitUntilElementIsVisible(unsupportedFileContainer);
};
this.checkFileContent = function (pageNumber, text) {
var pageLoaded = element.all(by.css("div[data-page-number='" + pageNumber + "'][data-loaded='true']")).first();
var textLayerLoaded = element.all(by.css("div[data-page-number='" + pageNumber + "'] div[class='textLayer'] > div")).first();
var specificText = element.all(by.cssContainingText("div[data-page-number='" + pageNumber + "'] div[class='textLayer'] > div", text)).first();
Util.waitUntilElementIsVisible(allPages);
Util.waitUntilElementIsVisible(pageLoaded);
Util.waitUntilElementIsVisible(textLayerLoaded);
Util.waitUntilElementIsVisible(specificText);
};
};
module.exports = ViewerToolbarPage;

View File

@@ -0,0 +1,120 @@
/*!
* @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 PaginationPage = require('./pages/adf/paginationPage');
import AcsUserModel = require('./models/ACS/acsUserModel');
import FolderModel = require('./models/ACS/folderModel');
import TestConfig = require('./test.config');
import Util = require('./util/util');
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from './actions/ACS/upload.actions';
describe('Pagination - returns to previous page when current is empty', () => {
let loginPage = new LoginPage();
let contentServicesPage = new ContentServicesPage();
let paginationPage = new PaginationPage();
let acsUser = new AcsUserModel();
let folderModel = new FolderModel({ 'name': 'folderOne' });
let fileNames = [], nrOfFiles = 6;
let lastFile = 'newFile6.txt';
let itemsPerPage = {
five: '5',
fiveValue: 5
};
let files = {
base: 'newFile',
extension: '.txt'
};
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);
fileNames = Util.generateSeqeunceFiles(1, nrOfFiles, files.base, files.extension);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
let folderUploadedModel = await uploadActions.uploadFolder(this.alfrescoJsApi, folderModel.name, '-my-');
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, folderUploadedModel.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
done();
});
xit('Pagination - returns to previous page when current is empty', () => {
contentServicesPage.navigateToFolder(folderModel.name);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then((list) => {
expect(Util.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
});
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
contentServicesPage.getAllRowsNameColumn().then((list) => {
expect(Util.arrayContainsArray(list, fileNames.slice(5, 6))).toEqual(true);
});
contentServicesPage.deleteContent(lastFile);
contentServicesPage.checkContentIsNotDisplayed(lastFile);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
contentServicesPage.getAllRowsNameColumn().then((list) => {
expect(Util.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
});
});
});

View File

@@ -0,0 +1,104 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import PaginationPage = require('./pages/adf/paginationPage');
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
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', () => {
let itemsPerPage = {
fifteen: '15',
fifteenValue: 15
};
let loginPage = new LoginPage();
let processServicesPage = new ProcessServicesPage();
let paginationPage = new PaginationPage();
let processFiltersPage = new ProcessFiltersPage();
let processDetailsPage = new ProcessDetailsPage();
let processUserModel;
let app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
let nrOfProcesses = 25;
let page, totalPages;
beforeAll(async (done) => {
let apps = new AppsActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
let resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
for (let i = 0; i < nrOfProcesses; i++) {
await apps.startProcess(this.alfrescoJsApi, resultApp);
}
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
it('[C261046] Items per page set to 15 and adding of processes', () => {
totalPages = 2;
page = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fifteenValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfProcesses + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(nrOfProcesses - itemsPerPage.fifteenValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
});
});

View File

@@ -0,0 +1,95 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import TasksPage = require('./pages/adf/process_services/tasksPage');
import PaginationPage = require('./pages/adf/paginationPage');
import CONSTANTS = require('./util/constants');
import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions';
import TestConfig = require('./test.config');
import resources = require('./util/resources');
describe('Items per page set to 15 and adding of tasks', () => {
let loginPage = new LoginPage();
let processServicesPage = new ProcessServicesPage();
let taskPage = new TasksPage();
let paginationPage = new PaginationPage();
let processUserModel;
let app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
let currentPage = 1, nrOfTasks = 25, totalPages = 2;
let itemsPerPage = {
fifteen: '15',
fifteenValue: 15
};
beforeAll(async (done) => {
let apps = new AppsActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
let resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
for (let i = 0; i < nrOfTasks; i++) {
await apps.startProcess(this.alfrescoJsApi, resultApp);
}
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
it('Items per page set to 15 and adding of tasks', () => {
processServicesPage.goToProcessServices().goToTaskApp();
taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.INV_TASKS);
paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue + ' of ' + nrOfTasks);
expect(taskPage.getAllDisplayedRows()).toBe(itemsPerPage.fifteenValue);
currentPage++;
paginationPage.clickOnNextPage();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
expect(taskPage.getAllDisplayedRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
});
});

View File

@@ -0,0 +1,125 @@
/*!
* @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 TestConfig = require('./test.config');
import resources = require('./util/resources');
import LoginPage = require('./pages/adf/loginPage');
import NavigationBarPage = require('./pages/adf/navigationBarPage');
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import StartProcessPage = require('./pages/adf/process_services/startProcessPage');
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage');
import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage');
import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from './actions/APS/apps.actions';
import { UsersActions } from './actions/users.actions';
describe('Process Filters Test', () => {
let loginPage = new LoginPage();
let navigationBarPage = new NavigationBarPage();
let processServicesPage = new ProcessServicesPage();
let startProcessPage = new StartProcessPage();
let processFiltersPage = new ProcessFiltersPage();
let appNavigationBarPage = new AppNavigationBarPage();
let processDetailsPage = new ProcessDetailsPage();
let app = resources.Files.APP_WITH_DATE_FIELD_FORM;
let processTitle = {
running: 'Test_running',
completed: 'Test_completed'
};
let processFilter = {
running: 'Running',
all: 'All',
completed: 'Completed'
};
beforeAll(async (done) => {
let apps = new AppsActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
let user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
await loginPage.loginToProcessServicesUsingUserModel(user);
done();
});
it('Navigate to Running filter', () => {
navigationBarPage.clickProcessServicesButton();
processServicesPage.checkApsContainer();
processServicesPage.goToApp(app.title);
appNavigationBarPage.clickProcessButton();
processFiltersPage.clickCreateProcessButton();
processFiltersPage.clickNewProcessDropdown();
startProcessPage.enterProcessName(processTitle.completed);
startProcessPage.selectFromProcessDropdown(app.process_title);
startProcessPage.clickFormStartProcessButton();
processDetailsPage.clickCancelProcessButton();
navigationBarPage.clickProcessServicesButton();
processServicesPage.goToApp(app.title);
appNavigationBarPage.clickProcessButton();
processFiltersPage.clickCreateProcessButton();
processFiltersPage.clickNewProcessDropdown();
startProcessPage.enterProcessName(processTitle.running);
startProcessPage.selectFromProcessDropdown(app.process_title);
startProcessPage.clickFormStartProcessButton();
processFiltersPage.checkFilterIsHighlighted(processFilter.running);
processFiltersPage.selectFromProcessList(processTitle.running);
processDetailsPage.checkProcessDetailsCard();
});
it('Navigate to All filter', () => {
processFiltersPage.clickAllFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilter.all);
processFiltersPage.selectFromProcessList(processTitle.running);
processFiltersPage.selectFromProcessList(processTitle.completed);
processDetailsPage.checkProcessDetailsCard();
});
it('Navigate to Completed filter', () => {
processFiltersPage.clickCompletedFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilter.completed);
processFiltersPage.selectFromProcessList(processTitle.completed);
processDetailsPage.checkProcessDetailsCard();
});
});

View File

@@ -0,0 +1,357 @@
/*!
* @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 ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
import PaginationPage = require('./pages/adf/paginationPage');
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage');
import NavigationBarPage = require('./pages/adf/navigationBarPage');
import TestConfig = require('./test.config');
import resources = require('./util/resources');
import Util = require('./util/util');
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 () {
let itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
fifteen: '15',
fifteenValue: 15,
twenty: '20',
twentyValue: 20,
default: '25'
};
let processFilterRunning = 'Running';
let loginPage = new LoginPage();
let processServicesPage = new ProcessServicesPage();
let paginationPage = new PaginationPage();
let processFiltersPage = new ProcessFiltersPage();
let processDetailsPage = new ProcessDetailsPage();
let navigationBarPage = new NavigationBarPage();
let processUserModel;
let app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
let nrOfProcesses = 20;
let page, totalPages, processNameBase = 'process';
let processNames = Util.generateSeqeunceFiles(10, nrOfProcesses + 9, processNameBase, '');
beforeAll(async (done) => {
let apps = new AppsActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
let resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
for (let i = 0; i < nrOfProcesses; i++) {
await apps.startProcess(this.alfrescoJsApi, resultApp);
}
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
xit('[C261042] Default pagination', function () {
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.checkNoContentMessage();
paginationPage.checkPaginationIsNotDisplayed();
page = 1;
totalPages = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfProcesses + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(nrOfProcesses);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
});
xit('[C261043] Items per page set to 15', function () {
page = 1;
totalPages = 2;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fifteenValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfProcesses + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(nrOfProcesses - itemsPerPage.fifteenValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
page = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
});
xit('[C261044] Items per page set to 10', function () {
page = 1;
totalPages = 2;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.ten);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.tenValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + nrOfProcesses + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.tenValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
page = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
});
it('[C261047] Items per page set to 20', function () {
page = 1;
totalPages = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfProcesses + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(nrOfProcesses);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
});
it('[C261045] 5 Items per page', function () {
page = 1;
totalPages = 4;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.five);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.five * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fiveValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.five * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fiveValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsEnabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.five * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fiveValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsEnabled();
page++;
paginationPage.clickOnNextPage();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.five * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.fiveValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
page = 1;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
});
it('[C261049] Page number dropdown', function () {
page = 1;
totalPages = 2;
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.ten);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.tenValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
paginationPage.clickOnPageDropdown();
expect(paginationPage.getPageDropdownOptions()).toEqual(['1', '2']);
page = 2;
paginationPage.clickOnPageDropdownOption('2');
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.tenValue);
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsEnabled();
paginationPage.clickOnPageDropdown();
expect(paginationPage.getPageDropdownOptions()).toEqual(['1', '2']);
page = 1;
paginationPage.clickOnPageDropdownOption('1');
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + page);
expect(paginationPage.getTotalPages()).toEqual('of ' + totalPages);
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * page + ' of ' + nrOfProcesses);
expect(processFiltersPage.numberOfProcessRows()).toBe(itemsPerPage.tenValue);
paginationPage.checkNextPageButtonIsEnabled();
paginationPage.checkPreviousPageButtonIsDisabled();
});
xit('[C261048] Sorting by Name', function () {
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
processFiltersPage.clickRunningFilterButton();
processFiltersPage.checkFilterIsHighlighted(processFilterRunning);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
processFiltersPage.sortByName(true);
processFiltersPage.waitForTableBody();
processFiltersPage.getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(processNames)).toEqual(true);
});
processFiltersPage.sortByName(false);
processFiltersPage.getAllRowsNameColumn().then(function (list) {
processNames.reverse();
expect(JSON.stringify(list) === JSON.stringify(processNames)).toEqual(true);
});
});
});

28
e2e/proxy.conf.js Normal file
View File

@@ -0,0 +1,28 @@
var PROXY_HOST_ADF = process.env.PROXY_HOST_ADF;
var HOST = process.env.URL_HOST_ADF;
module.exports = {
"/alfresco": {
"target": "http://" + (PROXY_HOST_ADF || HOST),
"secure": false,
"pathRewrite": {
"^/alfresco/alfresco": ""
},
"changeOrigin": true,
// workaround for REPO-2260
onProxyRes: function (proxyRes, req, res) {
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
},
"/activiti-app": {
"target": "http://" + (PROXY_HOST_ADF || HOST),
"secure": false,
"pathRewrite": {
"^/activiti-app/activiti-app": ""
},
"changeOrigin": true
}
};

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Some files were not shown because too many files have changed in this diff Show More