[ADF-5078] Start Task e2e (#5485)

* [ADF-5078] Start Task e2e

* * improved test

* * fixed import
This commit is contained in:
dhrn
2020-02-19 16:13:43 +05:30
committed by GitHub
parent 2f89787b7a
commit c12eee1f59
17 changed files with 289 additions and 255 deletions

View File

@@ -49,8 +49,8 @@ export class AppsActions {
return appDefinitionId; return appDefinitionId;
} }
async importPublishDeployApp(alfrescoJsApi, appFileLocation) { async importPublishDeployApp(alfrescoJsApi, appFileLocation, option = {}) {
const appCreated = await this.importApp(alfrescoJsApi, appFileLocation); const appCreated = await this.importApp(alfrescoJsApi, appFileLocation, option);
const publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish()); const publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish());
@@ -59,13 +59,13 @@ export class AppsActions {
return appCreated; return appCreated;
} }
async importApp(alfrescoJsApi, appFileLocation) { async importApp(alfrescoJsApi, appFileLocation, options = {}) {
browser.setFileDetector(new remote.FileDetector()); browser.setFileDetector(new remote.FileDetector());
const pathFile = path.join(browser.params.testConfig.main.rootPath + appFileLocation); const pathFile = path.join(browser.params.testConfig.main.rootPath + appFileLocation);
const file = fs.createReadStream(pathFile); const file = fs.createReadStream(pathFile);
return alfrescoJsApi.activiti.appsApi.importAppDefinition(file); return alfrescoJsApi.activiti.appsDefinitionApi.importAppDefinition(file, options);
} }
async publishDeployApp(alfrescoJsApi, appId) { async publishDeployApp(alfrescoJsApi, appId) {

View File

@@ -30,7 +30,7 @@ export class User {
lastName = StringUtil.generateRandomString(); lastName = StringUtil.generateRandomString();
password = StringUtil.generatePasswordString(); password = StringUtil.generatePasswordString();
type = 'enterprise'; type = 'enterprise';
tenantId = '1'; tenantId = 1;
company = null; company = null;
constructor(details?: any) { constructor(details?: any) {

View File

@@ -138,4 +138,10 @@ export class StartProcessPage {
formFields(): FormFields { formFields(): FormFields {
return new FormFields(); return new FormFields();
} }
async startProcess({name, processName }) {
await this.enterProcessName(name);
await this.selectFromProcessDropdown(processName);
await this.clickStartProcessButton();
}
} }

View File

@@ -45,7 +45,7 @@ export class TasksPage {
return new StartTaskDialog(); return new StartTaskDialog();
} }
async createTask({ name, description, dueDate, formName }): Promise<void> { async createTask({ name, description = '', dueDate = '', formName = 'None'}): Promise<void> {
await this.clickOnCreateButton(); await this.clickOnCreateButton();
await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]'); await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
const dialog = new StartTaskDialog(); const dialog = new StartTaskDialog();

View File

@@ -0,0 +1,108 @@
/*!
* @license
* Copyright 2019 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 '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { ProcessServicesPage } from '../pages/adf/process-services/processServicesPage';
import { StartProcessPage } from '../pages/adf/process-services/startProcessPage';
import { ProcessFiltersPage } from '../pages/adf/process-services/processFiltersPage';
import { ProcessServiceTabBarPage } from '../pages/adf/process-services/processServiceTabBarPage';
import { ProcessDetailsPage } from '../pages/adf/process-services/processDetailsPage';
import { ProcessListPage } from '../pages/adf/process-services/processListPage';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { AppsActions } from '../actions/APS/apps.actions';
import { UsersActions } from '../actions/users.actions';
import { browser } from 'protractor';
import { User } from '../models/APS/user';
import { TasksPage } from '../pages/adf/process-services/tasksPage';
import CONSTANTS = require('../util/constants');
describe('Task Assignee', () => {
const loginPage = new LoginPage();
const processListPage = new ProcessListPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const startProcessPage = new StartProcessPage();
const processFiltersPage = new ProcessFiltersPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const processDetailsPage = new ProcessDetailsPage();
const taskPage = new TasksPage();
const app = browser.params.resources.Files.TEST_ASSIGNEE;
let user: User;
beforeAll(async () => {
const apps = new AppsActions();
const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host
});
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location, { renewIdmEntries: true });
await loginPage.loginToProcessServicesUsingUserModel(user);
});
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
});
it('[C260387] Should the running process be displayed when clicking on Running filter', async () => {
await processServicesPage.goToApp(app.title);
await processServiceTabBarPage.clickProcessButton();
await processListPage.checkProcessListIsDisplayed();
await processFiltersPage.clickCreateProcessButton();
await processFiltersPage.clickNewProcessDropdown();
await startProcessPage.startProcess({name: 'sample-process-one', processName: app.processName });
await processFiltersPage.selectFromProcessList('sample-process-one');
await processDetailsPage.clickOnActiveTask();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.one);
await taskPage.tasksListPage().selectRow(app.userTasks.one);
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.two);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.two);
await processServiceTabBarPage.clickProcessButton();
await processListPage.checkProcessListIsDisplayed();
});
});

View File

@@ -59,18 +59,14 @@ describe('Attachment list action menu for tasks', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
const user = await users.createTenantAndUser(this.alfrescoJsApi); const user = await users.createTenantAndUser(this.alfrescoJsApi);
tenantId = user.tenantId; tenantId = user.tenantId;
await this.alfrescoJsApi.login(user.email, user.password); await this.alfrescoJsApi.login(user.email, user.password);
const { id } = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); appId = id;
appId = importedApp.id;
await loginPage.loginToProcessServicesUsingUserModel(user); await loginPage.loginToProcessServicesUsingUserModel(user);
}); });
afterAll(async () => { afterAll(async () => {
@@ -84,9 +80,7 @@ describe('Attachment list action menu for tasks', () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton(); await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask(); await taskPage.createTask({name: taskName.active});
await task.addName(taskName.active);
await task.clickStartButton();
await attachmentListPage.clickAttachFileButton(pngFile.location); await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.viewFile(pngFile.name); await attachmentListPage.viewFile(pngFile.name);

View File

@@ -47,24 +47,23 @@ describe('Task Audit', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); processUserModel = await users.createApsUser(this.alfrescoJsApi, id);
processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
this.alfrescoJsApi.activiti.taskApi.createNewTask({ name: taskTaskApp }); this.alfrescoJsApi.activiti.taskApi.createNewTask({ name: taskTaskApp });
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
await loginPage.loginToProcessServicesUsingUserModel(processUserModel); await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
});
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
}); });
beforeEach(async () => { beforeEach(async () => {
await BrowserActions.getUrl(browser.params.testConfig.adf.url + '/activiti'); await BrowserActions.getUrl(browser.params.testConfig.adf.url + '/activiti');
}); });
it('[C260386] Should Audit file be downloaded when clicking on Task Audit log icon on a standalone running task', async () => { it('[C260386] Should Audit file be downloaded when clicking on Task Audit log icon on a standalone running task', async () => {
@@ -95,9 +94,7 @@ describe('Task Audit', () => {
it('[C263944] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone completed task', async () => { it('[C263944] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone completed task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
const task = await taskPage.createNewTask(); await taskPage.createTask({name: taskCompleteCustomApp});
await task.addName(taskCompleteCustomApp);
await task.clickStartButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskCompleteCustomApp); await taskPage.tasksListPage().checkContentIsDisplayed(taskCompleteCustomApp);
@@ -114,9 +111,7 @@ describe('Task Audit', () => {
it('[C263943] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone running task', async () => { it('[C263943] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone running task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
const task = await taskPage.createNewTask(); await taskPage.createTask({name: taskCustomApp});
await task.addName(taskCustomApp);
await task.clickStartButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskCustomApp); await taskPage.tasksListPage().checkContentIsDisplayed(taskCustomApp);

View File

@@ -65,41 +65,36 @@ describe('Task Details - Form', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
user = await users.createTenantAndUser(this.alfrescoJsApi); user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password); await this.alfrescoJsApi.login(user.email, user.password);
attachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(attachedFormModel); attachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(attachedFormModel);
newForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(newFormModel); newForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(newFormModel);
const otherEmptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(otherTaskModel); const otherEmptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(otherTaskModel);
otherAttachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(otherAttachedFormModel); otherAttachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(otherAttachedFormModel);
await this.alfrescoJsApi.activiti.taskApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id }); await this.alfrescoJsApi.activiti.taskApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id });
otherTask = await this.alfrescoJsApi.activiti.taskApi.getTask(otherEmptyTask.id); otherTask = await this.alfrescoJsApi.activiti.taskApi.getTask(otherEmptyTask.id);
await loginPage.loginToProcessServicesUsingUserModel(user); await loginPage.loginToProcessServicesUsingUserModel(user);
}); });
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
beforeEach(async () => { beforeEach(async () => {
const taskModel = new StandaloneTask(); const emptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(new StandaloneTask());
const emptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(taskModel);
await this.alfrescoJsApi.activiti.taskApi.attachForm(emptyTask.id, { 'formId': attachedForm.id }); await this.alfrescoJsApi.activiti.taskApi.attachForm(emptyTask.id, { 'formId': attachedForm.id });
task = await this.alfrescoJsApi.activiti.taskApi.getTask(emptyTask.id); task = await this.alfrescoJsApi.activiti.taskApi.getTask(emptyTask.id);
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp(); await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await tasksListPage.checkTaskListIsLoaded(); await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Involved Tasks'); await filtersPage.goToFilter('Involved Tasks');
await tasksListPage.checkTaskListIsLoaded(); await tasksListPage.checkTaskListIsLoaded();
}); });
it('[C280018] Should be able to change the form in a task', async () => { it('[C280018] Should be able to change the form in a task', async () => {

View File

@@ -38,28 +38,27 @@ describe('Task Details - No form', () => {
beforeAll(async () => { beforeAll(async () => {
const users = new UsersActions(); const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({ this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM', provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host hostBpm: browser.params.testConfig.adf_aps.host
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); processUserModel = await users.createApsUser(this.alfrescoJsApi, id);
processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
await apps.startProcess(this.alfrescoJsApi, importedApp); await apps.startProcess(this.alfrescoJsApi, importedApp);
await loginPage.loginToProcessServicesUsingUserModel(processUserModel); await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
}); });
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
it('[C289311] Should attach form and complete buttons to be displayed when no form is attached', async () => { it('[C289311] Should attach form and complete buttons to be displayed when no form is attached', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton(); await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);

View File

@@ -59,17 +59,17 @@ describe('Task Details component', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); processUserModel = await users.createApsUser(this.alfrescoJsApi, id);
processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
await loginPage.loginToProcessServicesUsingUserModel(processUserModel); await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
});
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
}); });
beforeEach(async () => { beforeEach(async () => {
@@ -80,12 +80,8 @@ describe('Task Details component', () => {
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[1]);
await task.addDescription('Description');
await task.addForm(app.formName);
await task.clickStartButton();
await taskPage.createTask({name: tasks[1], description: 'Description', formName: app.formName});
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities'); await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
@@ -114,12 +110,7 @@ describe('Task Details component', () => {
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask(); await taskPage.createTask({name: tasks[1], description: 'Description', formName: app.formName});
await task.addName(tasks[1]);
await task.addDescription('Description');
await task.addForm(app.formName);
await task.clickStartButton();
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities'); await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
@@ -185,13 +176,11 @@ describe('Task Details component', () => {
await apps.startProcess(this.alfrescoJsApi, appModel); await apps.startProcess(this.alfrescoJsApi, appModel);
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities'); await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]); const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName()); await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
@@ -292,7 +281,6 @@ describe('Task Details component', () => {
it('[C286709] Should display task details for completed task - Task App', async () => { it('[C286709] Should display task details for completed task - Task App', async () => {
const taskName = 'TaskAppCompleted'; const taskName = 'TaskAppCompleted';
const taskId = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName }); const taskId = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName });
await (await processServices.goToTaskApp()).clickTasksButton(); await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);

View File

@@ -28,6 +28,7 @@ import { AlfrescoApiCompatibility as AlfrescoApi, UserProcessInstanceFilterRepre
import { AppsActions } from '../actions/APS/apps.actions'; import { AppsActions } from '../actions/APS/apps.actions';
import { UsersActions } from '../actions/users.actions'; import { UsersActions } from '../actions/users.actions';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { User } from '../models/APS/user';
describe('Task', () => { describe('Task', () => {
@@ -42,15 +43,13 @@ describe('Task', () => {
const taskFiltersDemoPage = new TaskFiltersDemoPage(); const taskFiltersDemoPage = new TaskFiltersDemoPage();
const app = browser.params.resources.Files.APP_WITH_DATE_FIELD_FORM; const app = browser.params.resources.Files.APP_WITH_DATE_FIELD_FORM;
let appId, tenantId; let appId: number, user: User;
beforeAll(async () => { beforeAll(async () => {
this.alfrescoJsApi = new AlfrescoApi({ this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM', provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host hostBpm: browser.params.testConfig.adf_aps.host
}); });
}); });
beforeEach(async () => { beforeEach(async () => {
@@ -59,34 +58,23 @@ describe('Task', () => {
const users = new UsersActions(); const users = new UsersActions();
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
user = await users.createTenantAndUser(this.alfrescoJsApi);
const user = await users.createTenantAndUser(this.alfrescoJsApi);
tenantId = user.tenantId;
await this.alfrescoJsApi.login(user.email, user.password); await this.alfrescoJsApi.login(user.email, user.password);
const { id } = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
const appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); appId = id;
appId = appModel.id;
await loginPage.loginToProcessServicesUsingUserModel(user); await loginPage.loginToProcessServicesUsingUserModel(user);
await navigationBarPage.navigateToProcessServicesPage(); await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer(); await processServicesPage.checkApsContainer();
await processServicesPage.goToApp(app.title); await processServicesPage.goToApp(app.title);
}); });
afterEach(async () => { afterEach(async () => {
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId); await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
}); });
it('[C279967] Should display default filters when an app is deployed', async () => { it('[C279967] Should display default filters when an app is deployed', async () => {
@@ -97,9 +85,7 @@ describe('Task', () => {
}); });
it('[C260330] Should display Task Filter List when app is in Task Tab', async () => { it('[C260330] Should display Task Filter List when app is in Task Tab', async () => {
const task = await tasksPage.createNewTask(); await tasksPage.createTask({name: 'Test'});
await task.addName('Test');
await task.clickStartButton();
await taskFiltersDemoPage.myTasksFilter().clickTaskFilter(); await taskFiltersDemoPage.myTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test'); await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('My Tasks'); await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('My Tasks');
@@ -157,25 +143,14 @@ describe('Task', () => {
}); });
it('[C260349] Should sort task by name when Name sorting is clicked', async () => { it('[C260349] Should sort task by name when Name sorting is clicked', async () => {
const task = await tasksPage.createNewTask(); await tasksPage.createTask({name: 'Test1'});
await task.addName('Test1');
await task.clickStartButton();
await taskDetailsPage.clickCompleteTask(); await taskDetailsPage.clickCompleteTask();
const task2 = await tasksPage.createNewTask(); await tasksPage.createTask({name: 'Test2'});
await task2.addName('Test2');
await task2.clickStartButton();
await taskDetailsPage.clickCompleteTask(); await taskDetailsPage.clickCompleteTask();
const task3 = await tasksPage.createNewTask(); await tasksPage.createTask({name: 'Test3'});
await task3.addName('Test3'); await tasksPage.createTask({name: 'Test4'});
await task3.clickStartButton();
const task4 = await tasksPage.createNewTask();
await task4.addName('Test4');
await task4.clickStartButton();
await tasksListPage.checkContentIsDisplayed('Test4'); await tasksListPage.checkContentIsDisplayed('Test4');
await tasksListPage.checkRowIsSelected('Test4'); await tasksListPage.checkRowIsSelected('Test4');
@@ -201,9 +176,7 @@ describe('Task', () => {
}); });
it('[C277264] Should display task filter results when task filter is selected', async () => { it('[C277264] Should display task filter results when task filter is selected', async () => {
const task = await tasksPage.createNewTask(); await tasksPage.createTask({name: 'Test'});
await task.addName('Test');
await task.clickStartButton();
await taskFiltersDemoPage.myTasksFilter().clickTaskFilter(); await taskFiltersDemoPage.myTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test'); await tasksListPage.checkContentIsDisplayed('Test');
@@ -221,10 +194,7 @@ describe('Task', () => {
const taskFiltersDemoPage = new TaskFiltersDemoPage(); const taskFiltersDemoPage = new TaskFiltersDemoPage();
let user; let user;
let appId; let appId: number;
let importedApp;
let taskFilterId;
const app = browser.params.resources.Files.APP_WITH_PROCESSES; const app = browser.params.resources.Files.APP_WITH_PROCESSES;
@@ -238,21 +208,19 @@ describe('Task', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
user = await users.createTenantAndUser(this.alfrescoJsApi); user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password); await this.alfrescoJsApi.login(user.email, user.password);
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions(); const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions();
appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id;
appId = appDefinitions.data.find((currentApp) => {
return currentApp.modelId === importedApp.id;
}).id;
await loginPage.loginToProcessServicesUsingUserModel(user); await loginPage.loginToProcessServicesUsingUserModel(user);
});
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
}); });
beforeEach(async () => { beforeEach(async () => {
@@ -262,33 +230,27 @@ describe('Task', () => {
}); });
it('[C260350] Should display a new filter when a filter is added', async () => { it('[C260350] Should display a new filter when a filter is added', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'New Task Filter'; name: 'New Task Filter',
newFilter.appId = appId; appId,
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
const result = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); const { id } = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
taskFilterId = result.id;
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter('New Task Filter').checkTaskFilterIsDisplayed(); await taskFiltersDemoPage.customTaskFilter('New Task Filter').checkTaskFilterIsDisplayed();
await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(id);
await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(taskFilterId);
}); });
it('[C286447] Should display the task filter icon when a custom filter is added', async () => { it('[C286447] Should display the task filter icon when a custom filter is added', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'New Task Filter with icon'; name : 'New Task Filter with icon',
newFilter.appId = appId; appId,
newFilter.icon = 'glyphicon-cloud'; icon: 'glyphicon-cloud',
newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
const result = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); const { id } = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
taskFilterId = result.id;
await browser.refresh(); await browser.refresh();
await processServiceTabBarPage.clickSettingsButton(); await processServiceTabBarPage.clickSettingsButton();
@@ -298,8 +260,7 @@ describe('Task', () => {
await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').checkTaskFilterIsDisplayed(); await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').checkTaskFilterIsDisplayed();
await expect(await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').getTaskFilterIcon()).toEqual('cloud'); await expect(await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').getTaskFilterIcon()).toEqual('cloud');
await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(id);
await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(taskFilterId);
}); });
it('[C286449] Should display task filter icons only when showIcon property is set on true', async () => { it('[C286449] Should display task filter icons only when showIcon property is set on true', async () => {

View File

@@ -39,7 +39,6 @@ describe('Task Filters Sorting', () => {
let user; let user;
let appId; let appId;
let importedApp;
const app = browser.params.resources.Files.APP_WITH_PROCESSES; const app = browser.params.resources.Files.APP_WITH_PROCESSES;
@@ -61,74 +60,48 @@ describe('Task Filters Sorting', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
user = await users.createTenantAndUser(this.alfrescoJsApi); user = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(user.email, user.password); await this.alfrescoJsApi.login(user.email, user.password);
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions(); const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions();
appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id;
appId = appDefinitions.data.find((currentApp) => {
return currentApp.modelId === importedApp.id;
}).id;
await loginPage.loginToProcessServicesUsingUserModel(user); await loginPage.loginToProcessServicesUsingUserModel(user);
await navigationBarPage.navigateToProcessServicesPage(); await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer(); await processServicesPage.checkApsContainer();
await processServicesPage.goToApp(app.title); await processServicesPage.goToApp(app.title);
const task = await tasksPage.createNewTask(); await tasksPage.createTask({name: tasks[0].name, dueDate: tasks[0].dueDate});
await task.addName(tasks[0].name);
await task.addDueDate(tasks[0].dueDate);
await task.clickStartButton();
await taskDetailsPage.clickCompleteTask(); await taskDetailsPage.clickCompleteTask();
const task2 = await tasksPage.createNewTask(); await tasksPage.createTask({name: tasks[1].name, dueDate: tasks[1].dueDate});
await task2.addName(tasks[1].name);
await task2.addDueDate(tasks[1].dueDate);
await task2.clickStartButton();
await taskDetailsPage.clickCompleteTask(); await taskDetailsPage.clickCompleteTask();
const task3 = await tasksPage.createNewTask(); await tasksPage.createTask({name: tasks[2].name, dueDate: tasks[2].dueDate});
await task3.addName(tasks[2].name);
await task3.addDueDate(tasks[2].dueDate);
await task3.clickStartButton();
await taskDetailsPage.clickCompleteTask(); await taskDetailsPage.clickCompleteTask();
const task4 = await tasksPage.createNewTask(); await tasksPage.createTask({name: tasks[3].name, dueDate: tasks[3].dueDate});
await task4.addName(tasks[3].name); await tasksPage.createTask({name: tasks[4].name, dueDate: tasks[4].dueDate});
await task4.addDueDate(tasks[3].dueDate); await tasksPage.createTask({name: tasks[5].name, dueDate: tasks[5].dueDate});
await task4.clickStartButton(); });
const task5 = await tasksPage.createNewTask();
await task5.addName(tasks[4].name);
await task5.addDueDate(tasks[4].dueDate);
await task5.clickStartButton();
const task6 = await tasksPage.createNewTask();
await task6.addName(tasks[5].name);
await task6.addDueDate(tasks[5].dueDate);
await task6.clickStartButton();
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
}); });
it('[C277254] Should display tasks under new filter from newest to oldest when they are completed', async () => { it('[C277254] Should display tasks under new filter from newest to oldest when they are completed', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Newest first'; appId,
newFilter.appId = appId; name : 'Newest first',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Newest first').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
@@ -137,17 +110,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277255] Should display tasks under new filter from oldest to newest when they are completed', async () => { it('[C277255] Should display tasks under new filter from oldest to newest when they are completed', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Newest last'; appId,
newFilter.appId = appId; name : 'Newest last',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'created-asc', state: 'completed', assignment: 'involved' }; filter: { sort: 'created-asc', state: 'completed', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Newest last').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
@@ -155,17 +127,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277256] Should display tasks under new filter from closest due date to farthest when they are completed', async () => { it('[C277256] Should display tasks under new filter from closest due date to farthest when they are completed', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Due first'; appId,
newFilter.appId = appId; name : 'Due first',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'due-desc', state: 'completed', assignment: 'involved' }; filter: { sort: 'due-desc', state: 'completed', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Due first').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
@@ -173,17 +144,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277257] Should display tasks under new filter from farthest due date to closest when they are completed', async () => { it('[C277257] Should display tasks under new filter from farthest due date to closest when they are completed', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Due last'; appId,
newFilter.appId = appId; name : 'Due last',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'due-asc', state: 'completed', assignment: 'involved' }; filter: { sort: 'due-asc', state: 'completed', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Due last').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
@@ -191,17 +161,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277258] Should display tasks under new filter from newest to oldest when they are open ', async () => { it('[C277258] Should display tasks under new filter from newest to oldest when they are open ', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Newest first Open'; appId,
newFilter.appId = appId; name : 'Newest first Open',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'created-desc', state: 'open', assignment: 'involved' }; filter: { sort: 'created-desc', state: 'open', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Newest first Open').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
@@ -209,17 +178,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277259] Should display tasks under new filter from oldest to newest when they are open', async () => { it('[C277259] Should display tasks under new filter from oldest to newest when they are open', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Newest last Open'; appId,
newFilter.appId = appId; name : 'Newest last Open',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'created-asc', state: 'open', assignment: 'involved' }; filter: { sort: 'created-asc', state: 'open', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Newest last Open').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
@@ -227,17 +195,16 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277260] Should display tasks under new filter from closest due date to farthest when they are open', async () => { it('[C277260] Should display tasks under new filter from closest due date to farthest when they are open', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Due first Open'; appId,
newFilter.appId = appId; name : 'Due first Open',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'due-desc', state: 'open', assignment: 'involved' }; filter: { sort: 'due-desc', state: 'open', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Due first Open').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
@@ -245,21 +212,19 @@ describe('Task Filters Sorting', () => {
}); });
it('[C277261] Should display tasks under new filter from farthest due date to closest when they are open', async () => { it('[C277261] Should display tasks under new filter from farthest due date to closest when they are open', async () => {
const newFilter: any = new UserProcessInstanceFilterRepresentation(); const newFilter = new UserProcessInstanceFilterRepresentation({
newFilter.name = 'Due last Open'; appId,
newFilter.appId = appId; name : 'Due last Open',
newFilter.icon = 'glyphicon-filter'; icon: 'glyphicon-filter',
newFilter.filter = { sort: 'due-asc', state: 'open', assignment: 'involved' }; filter: { sort: 'due-asc', state: 'open', assignment: 'involved' }
});
await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh(); await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await taskFiltersDemoPage.customTaskFilter('Due last Open').clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name); await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[5].name); await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[5].name);
}); });
}); });

View File

@@ -23,6 +23,7 @@ import { UsersActions } from '../actions/users.actions';
import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksPage } from '../pages/adf/process-services/tasksPage'; import { TasksPage } from '../pages/adf/process-services/tasksPage';
import CONSTANTS = require('../util/constants'); import CONSTANTS = require('../util/constants');
import { User } from '../models/APS/user';
describe('Task List Pagination', () => { describe('Task List Pagination', () => {
@@ -31,7 +32,7 @@ describe('Task List Pagination', () => {
const taskPage = new TasksPage(); const taskPage = new TasksPage();
const paginationPage = new PaginationPage(); const paginationPage = new PaginationPage();
let processUserModel, processUserModelEmpty; let processUserModel: User;
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
let currentPage = 1; let currentPage = 1;
const nrOfTasks = 20; const nrOfTasks = 20;
@@ -59,12 +60,9 @@ describe('Task List Pagination', () => {
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi); processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
processUserModelEmpty = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
const resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); const resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
for (let i = 0; i < nrOfTasks; i++) { for (let i = 0; i < nrOfTasks; i++) {
@@ -72,7 +70,11 @@ describe('Task List Pagination', () => {
} }
await loginPage.loginToProcessServicesUsingUserModel(processUserModel); await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
});
afterAll( async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
}); });
it('[C260301] Should display default pagination', async () => { it('[C260301] Should display default pagination', async () => {
@@ -192,11 +194,4 @@ describe('Task List Pagination', () => {
await paginationPage.checkPreviousPageButtonIsDisabled(); await paginationPage.checkPreviousPageButtonIsDisabled();
}); });
it('Pagination in an empty task list', async () => {
await loginPage.loginToProcessServicesUsingUserModel(processUserModelEmpty);
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await paginationPage.checkPaginationIsNotDisplayed();
});
}); });

Binary file not shown.

View File

@@ -74,6 +74,12 @@ exports.TASK_FILTERS = {
COMPLETED_TASKS: 'Completed Tasks' COMPLETED_TASKS: 'Completed Tasks'
}; };
exports.PROCESS_FILTERS = {
RUNNING: 'Running',
COMPLETED: 'Completed',
ALL: 'All'
};
exports.TASK_DETAILS = { exports.TASK_DETAILS = {
NO_FORM: 'No form', NO_FORM: 'No form',
NO_PARENT: 'No parent', NO_PARENT: 'No parent',

View File

@@ -52,6 +52,14 @@ exports.Files = {
processName: "Process3576" processName: "Process3576"
}, },
TEST_ASSIGNEE: {
file_location: "/resources/apps/Test Assignee.zip",
title: "Test Assignee",
description: "Description for app",
processName: "Sample",
userTasks: { one: 'Form1', two: 'Form2' }
},
APP_WITH_USER_WIDGET: { APP_WITH_USER_WIDGET: {
file_location: "/resources/apps/appWithUser.zip", file_location: "/resources/apps/appWithUser.zip",
title: "appWithUser", title: "appWithUser",

View File

@@ -332,5 +332,19 @@ describe('PaginationComponent', () => {
expect(component.current).toBe(1); expect(component.current).toBe(1);
}); });
it('should not show pagination when external component count is zero', () => {
const pagination: Pagination = {};
const customComponent = <PaginatedComponent> {
pagination: new BehaviorSubject<Pagination>({ count: 0, maxItems: 5, totalItems: 5 })
};
component.target = customComponent;
component.ngOnInit();
customComponent.pagination.next(pagination);
fixture.detectChanges();
expect(fixture.debugElement.nativeElement.querySelector('.adf-pagination__block')).toBeNull();
});
}); });
}); });