mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-23 18:05:09 +00:00
[ADF-3652][ADF-3653] Automated tests for people widget (#3880)
* [ADF-3652] Automated test for starting a process with people widget * Fixing failing tests * [ADF-3653] Automated test for people widget in completed task
This commit is contained in:
parent
85c022730b
commit
858584bcf0
@ -43,6 +43,7 @@ var ProcessDetailsPage = function () {
|
||||
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 completedTask = element(by.css('div[data-automation-id="completed-tasks"]'));
|
||||
var taskTitle = element(by.css("h2[class='activiti-task-details__header']"));
|
||||
|
||||
this.checkProcessTitleIsDisplayed = function () {
|
||||
@ -134,7 +135,12 @@ var ProcessDetailsPage = function () {
|
||||
|
||||
this.clickOnActiveTask = function () {
|
||||
Util.waitUntilElementIsVisible(activeTask);
|
||||
activeTask.click();
|
||||
return activeTask.click();
|
||||
};
|
||||
|
||||
this.clickOnCompletedTask = function () {
|
||||
Util.waitUntilElementIsClickable(completedTask);
|
||||
return completedTask.click();
|
||||
};
|
||||
|
||||
this.checkActiveTaskTitleIsDisplayed = function () {
|
||||
|
@ -46,6 +46,7 @@ export class TaskDetailsPage {
|
||||
taskDetailsSection = element(by.css('div[data-automation-id="adf-tasks-details"]'));
|
||||
taskDetailsEmptySection = element(by.css('div[data-automation-id="adf-tasks-details--empty"]'));
|
||||
completeTask = element(by.css('button[id="adf-no-form-complete-button"]'));
|
||||
completeFormTask = element(by.css('button[id="adf-form-complete"]'));
|
||||
taskDetailsTitle = element(by.css('h2[class="activiti-task-details__header"] span'));
|
||||
auditLogButton = element(by.css('button[adf-task-audit]'));
|
||||
noPeopleInvolved = element(by.id('no-people-label'));
|
||||
@ -254,7 +255,6 @@ export class TaskDetailsPage {
|
||||
|
||||
checkUserIsSelected(user) {
|
||||
let row = element(by.cssContainingText('div[class*="search-list-container"] div[class*="people-full-name"]', user));
|
||||
let selectedRow = this.getRowsUser(user).element(by.css('ancestor::tr[class*="is-selected"]'));
|
||||
Util.waitUntilElementIsVisible(row);
|
||||
return this;
|
||||
}
|
||||
@ -383,4 +383,14 @@ export class TaskDetailsPage {
|
||||
return this.completeTask.click();
|
||||
}
|
||||
|
||||
checkCompleteFormButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.completeFormTask);
|
||||
return this.completeFormTask;
|
||||
}
|
||||
|
||||
clickCompleteFormTask() {
|
||||
Util.waitUntilElementIsClickable(this.completeFormTask);
|
||||
return this.completeFormTask.click();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ var TaskFiltersPage = function () {
|
||||
};
|
||||
|
||||
this.clickCompletedTaskFilter = function() {
|
||||
Util.waitUntilElementIsVisible(completedTask);
|
||||
Util.waitUntilElementIsClickable(completedTask);
|
||||
return completedTask.click();
|
||||
};
|
||||
|
||||
|
40
e2e/pages/adf/process_services/widgets/people.ts
Normal file
40
e2e/pages/adf/process_services/widgets/people.ts
Normal file
@ -0,0 +1,40 @@
|
||||
/*!
|
||||
* @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 { element, by } from 'protractor';
|
||||
import Util = require('../../../../util/util');
|
||||
|
||||
export class People {
|
||||
|
||||
peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
|
||||
firstResult = element(by.id('adf-people-widget-user-0'));
|
||||
|
||||
checkPeopleFieldIsDisplayed() {
|
||||
return Util.waitUntilElementIsVisible(this.peopleField);
|
||||
}
|
||||
|
||||
fillPeopleField(value) {
|
||||
Util.waitUntilElementIsClickable(this.peopleField);
|
||||
return this.peopleField.sendKeys(value);
|
||||
}
|
||||
|
||||
selectUserFromDropdown() {
|
||||
Util.waitUntilElementIsVisible(this.firstResult);
|
||||
return this.firstResult.click();
|
||||
}
|
||||
|
||||
}
|
@ -24,6 +24,7 @@ import { RadioButtons } from './radioButtons';
|
||||
import { Hyperlink } from './hyperlink';
|
||||
import { Dropdown } from './dropdown';
|
||||
import { DynamicTable } from './dynamicTable';
|
||||
import { People } from './people';
|
||||
|
||||
export class Widget {
|
||||
|
||||
@ -63,4 +64,8 @@ export class Widget {
|
||||
return new DynamicTable();
|
||||
}
|
||||
|
||||
peopleWidget() {
|
||||
return new People();
|
||||
}
|
||||
|
||||
}
|
||||
|
127
e2e/process-services/form_people_widget.e2e.ts
Normal file
127
e2e/process-services/form_people_widget.e2e.ts
Normal file
@ -0,0 +1,127 @@
|
||||
/*!
|
||||
* @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 } from '../pages/adf/loginPage';
|
||||
import { ProcessServicesPage } from '../pages/adf/process_services/processServicesPage';
|
||||
import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage');
|
||||
import { Widget } from '../pages/adf/process_services/widgets/widget';
|
||||
import StartProcess = require('../pages/adf/process_services/startProcessPage');
|
||||
import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage');
|
||||
import { TaskDetailsPage } from '../pages/adf/process_services/taskDetailsPage';
|
||||
import { AppNavigationBarPage } from '../pages/adf/process_services/appNavigationBarPage';
|
||||
|
||||
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';
|
||||
import { browser } from 'protractor';
|
||||
|
||||
describe('Form widgets - People', () => {
|
||||
|
||||
let loginPage = new LoginPage();
|
||||
let processServicesPage = new ProcessServicesPage();
|
||||
let processUserModel;
|
||||
let app = resources.Files.APP_WITH_USER_WIDGET;
|
||||
let processFiltersPage = new ProcessFiltersPage();
|
||||
let appModel;
|
||||
let alfrescoJsApi;
|
||||
let widget = new Widget();
|
||||
let startProcess = new StartProcess();
|
||||
let processDetailsPage = new ProcessDetailsPage();
|
||||
let taskDetails = new TaskDetailsPage();
|
||||
let appNavigationBar = new AppNavigationBarPage();
|
||||
|
||||
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);
|
||||
|
||||
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
|
||||
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
processServicesPage.goToProcessServices().goToApp(appModel.name)
|
||||
.clickProcessButton();
|
||||
processFiltersPage.clickCreateProcessButton();
|
||||
processFiltersPage.clickNewProcessDropdown();
|
||||
|
||||
widget.peopleWidget().checkPeopleFieldIsDisplayed();
|
||||
widget.peopleWidget().fillPeopleField(processUserModel.firstName);
|
||||
widget.peopleWidget().selectUserFromDropdown();
|
||||
});
|
||||
|
||||
it('[C286577] Should be able to start a process with people widget', async () => {
|
||||
|
||||
startProcess.clickFormStartProcessButton();
|
||||
processDetailsPage.clickOnActiveTask();
|
||||
|
||||
browser.controlFlow().execute(async () => {
|
||||
let taskId = await taskDetails.getId();
|
||||
let taskForm = await alfrescoJsApi.activiti.taskApi.getTaskForm(taskId);
|
||||
let userEmail = taskForm['fields'][0].fields['1'][0].value.email;
|
||||
expect(userEmail).toEqual(processUserModel.email);
|
||||
});
|
||||
});
|
||||
|
||||
it('[C286576] Should be able to see user in completed task', async () => {
|
||||
|
||||
startProcess.enterProcessName(app.processName);
|
||||
startProcess.clickFormStartProcessButton();
|
||||
|
||||
processDetailsPage.clickOnActiveTask();
|
||||
taskDetails.checkCompleteFormButtonIsDisplayed();
|
||||
taskDetails.clickCompleteFormTask();
|
||||
|
||||
appNavigationBar.clickProcessButton();
|
||||
processFiltersPage.clickCompletedFilterButton();
|
||||
processFiltersPage.selectFromProcessList(app.processName);
|
||||
|
||||
processDetailsPage.clickOnCompletedTask();
|
||||
|
||||
browser.controlFlow().execute(async () => {
|
||||
let taskId = await taskDetails.getId();
|
||||
let taskForm = await alfrescoJsApi.activiti.taskApi.getTaskForm(taskId);
|
||||
let userEmail = taskForm['fields'][0].fields['1'][0].value.email;
|
||||
expect(userEmail).toEqual(processUserModel.email);
|
||||
});
|
||||
});
|
||||
});
|
BIN
e2e/resources/apps/appWithUser.zip
Normal file
BIN
e2e/resources/apps/appWithUser.zip
Normal file
Binary file not shown.
@ -51,6 +51,16 @@ exports.Files = {
|
||||
processName: "Process3576"
|
||||
},
|
||||
|
||||
APP_WITH_USER_WIDGET:{
|
||||
file_location:"/resources/apps/appWithUser.zip",
|
||||
title: "appWithUser",
|
||||
description: "Description for app",
|
||||
processName: "ProcessWithUser",
|
||||
startForm: "user",
|
||||
taskForm: "displayUser",
|
||||
peopleWidgetId: "label1"
|
||||
},
|
||||
|
||||
SIMPLE_APP: {
|
||||
file_location: "/resources/Simple App.zip",
|
||||
title: "Simple App",
|
||||
|
Loading…
x
Reference in New Issue
Block a user