diff --git a/e2e/actions/APS/apps.actions.ts b/e2e/actions/APS/apps.actions.ts index cfff1272d9..a8edf70ca6 100644 --- a/e2e/actions/APS/apps.actions.ts +++ b/e2e/actions/APS/apps.actions.ts @@ -49,8 +49,8 @@ export class AppsActions { return appDefinitionId; } - async importPublishDeployApp(alfrescoJsApi, appFileLocation) { - const appCreated = await this.importApp(alfrescoJsApi, appFileLocation); + async importPublishDeployApp(alfrescoJsApi, appFileLocation, option = {}) { + const appCreated = await this.importApp(alfrescoJsApi, appFileLocation, option); const publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish()); @@ -59,13 +59,13 @@ export class AppsActions { return appCreated; } - async importApp(alfrescoJsApi, appFileLocation) { + async importApp(alfrescoJsApi, appFileLocation, options = {}) { browser.setFileDetector(new remote.FileDetector()); const pathFile = path.join(browser.params.testConfig.main.rootPath + appFileLocation); const file = fs.createReadStream(pathFile); - return alfrescoJsApi.activiti.appsApi.importAppDefinition(file); + return alfrescoJsApi.activiti.appsDefinitionApi.importAppDefinition(file, options); } async publishDeployApp(alfrescoJsApi, appId) { diff --git a/e2e/models/APS/user.ts b/e2e/models/APS/user.ts index 00dde1aebc..1d0d322db2 100644 --- a/e2e/models/APS/user.ts +++ b/e2e/models/APS/user.ts @@ -30,7 +30,7 @@ export class User { lastName = StringUtil.generateRandomString(); password = StringUtil.generatePasswordString(); type = 'enterprise'; - tenantId = '1'; + tenantId = 1; company = null; constructor(details?: any) { diff --git a/e2e/pages/adf/process-services/startProcessPage.ts b/e2e/pages/adf/process-services/startProcessPage.ts index 072bf2b035..203906b2de 100644 --- a/e2e/pages/adf/process-services/startProcessPage.ts +++ b/e2e/pages/adf/process-services/startProcessPage.ts @@ -138,4 +138,10 @@ export class StartProcessPage { formFields(): FormFields { return new FormFields(); } + + async startProcess({name, processName }) { + await this.enterProcessName(name); + await this.selectFromProcessDropdown(processName); + await this.clickStartProcessButton(); + } } diff --git a/e2e/pages/adf/process-services/tasksPage.ts b/e2e/pages/adf/process-services/tasksPage.ts index 02d3d122cf..09db2dcfa7 100644 --- a/e2e/pages/adf/process-services/tasksPage.ts +++ b/e2e/pages/adf/process-services/tasksPage.ts @@ -45,7 +45,7 @@ export class TasksPage { return new StartTaskDialog(); } - async createTask({ name, description, dueDate, formName }): Promise { + async createTask({ name, description = '', dueDate = '', formName = 'None'}): Promise { await this.clickOnCreateButton(); await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]'); const dialog = new StartTaskDialog(); diff --git a/e2e/process-services/task-assignee.e2e.ts b/e2e/process-services/task-assignee.e2e.ts new file mode 100644 index 0000000000..62300eb135 --- /dev/null +++ b/e2e/process-services/task-assignee.e2e.ts @@ -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(); + }); + +}); diff --git a/e2e/process-services/task-attachmentList-actionMenu.e2e.ts b/e2e/process-services/task-attachmentList-actionMenu.e2e.ts index 18ed2705b1..48ca3ff51d 100644 --- a/e2e/process-services/task-attachmentList-actionMenu.e2e.ts +++ b/e2e/process-services/task-attachmentList-actionMenu.e2e.ts @@ -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); - const user = await users.createTenantAndUser(this.alfrescoJsApi); - tenantId = user.tenantId; await this.alfrescoJsApi.login(user.email, user.password); - - const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - appId = importedApp.id; + const { id } = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + appId = id; await loginPage.loginToProcessServicesUsingUserModel(user); - }); afterAll(async () => { @@ -84,9 +80,7 @@ describe('Attachment list action menu for tasks', () => { await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton(); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); - const task = await taskPage.createNewTask(); - await task.addName(taskName.active); - await task.clickStartButton(); + await taskPage.createTask({name: taskName.active}); await attachmentListPage.clickAttachFileButton(pngFile.location); await attachmentListPage.viewFile(pngFile.name); diff --git a/e2e/process-services/task-audit.e2e.ts b/e2e/process-services/task-audit.e2e.ts index 6570df6a9a..129fe60157 100644 --- a/e2e/process-services/task-audit.e2e.ts +++ b/e2e/process-services/task-audit.e2e.ts @@ -47,24 +47,23 @@ describe('Task Audit', () => { }); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); - - const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); - - processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id); + const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); + processUserModel = await users.createApsUser(this.alfrescoJsApi, id); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); - this.alfrescoJsApi.activiti.taskApi.createNewTask({ name: taskTaskApp }); - await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); 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 () => { 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 () => { @@ -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 () => { await (await processServices.goToTaskApp()).clickTasksButton(); - const task = await taskPage.createNewTask(); - await task.addName(taskCompleteCustomApp); - await task.clickStartButton(); + await taskPage.createTask({name: taskCompleteCustomApp}); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); 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 () => { await (await processServices.goToTaskApp()).clickTasksButton(); - const task = await taskPage.createNewTask(); - await task.addName(taskCustomApp); - await task.clickStartButton(); + await taskPage.createTask({name: taskCustomApp}); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await taskPage.tasksListPage().checkContentIsDisplayed(taskCustomApp); diff --git a/e2e/process-services/task-details-form.e2e.ts b/e2e/process-services/task-details-form.e2e.ts index 24965b5f91..4fd8df7a79 100644 --- a/e2e/process-services/task-details-form.e2e.ts +++ b/e2e/process-services/task-details-form.e2e.ts @@ -65,41 +65,36 @@ describe('Task Details - Form', () => { }); 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); attachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(attachedFormModel); - newForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(newFormModel); const otherEmptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(otherTaskModel); - otherAttachedForm = await this.alfrescoJsApi.activiti.modelsApi.createModel(otherAttachedFormModel); await this.alfrescoJsApi.activiti.taskApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id }); - otherTask = await this.alfrescoJsApi.activiti.taskApi.getTask(otherEmptyTask.id); 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 () => { - const taskModel = new StandaloneTask(); - - const emptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(taskModel); - + const emptyTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask(new StandaloneTask()); await this.alfrescoJsApi.activiti.taskApi.attachForm(emptyTask.id, { 'formId': attachedForm.id }); - task = await this.alfrescoJsApi.activiti.taskApi.getTask(emptyTask.id); await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp(); await tasksListPage.checkTaskListIsLoaded(); await filtersPage.goToFilter('Involved Tasks'); await tasksListPage.checkTaskListIsLoaded(); - }); it('[C280018] Should be able to change the form in a task', async () => { diff --git a/e2e/process-services/task-details-no-form.e2e.ts b/e2e/process-services/task-details-no-form.e2e.ts index 969f0f5a3e..9a35c8d341 100644 --- a/e2e/process-services/task-details-no-form.e2e.ts +++ b/e2e/process-services/task-details-no-form.e2e.ts @@ -38,28 +38,27 @@ describe('Task Details - No form', () => { beforeAll(async () => { 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); - - const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); - - processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id); + const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); + processUserModel = await users.createApsUser(this.alfrescoJsApi, id); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); - importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - await apps.startProcess(this.alfrescoJsApi, importedApp); - 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 () => { await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton(); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); diff --git a/e2e/process-services/task-details.e2e.ts b/e2e/process-services/task-details.e2e.ts index a17a8c00cb..2f6837eeb3 100644 --- a/e2e/process-services/task-details.e2e.ts +++ b/e2e/process-services/task-details.e2e.ts @@ -59,17 +59,17 @@ describe('Task Details component', () => { }); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); - - const newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); - - processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id); + const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); + processUserModel = await users.createApsUser(this.alfrescoJsApi, id); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); - appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - 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 () => { @@ -80,12 +80,8 @@ describe('Task Details component', () => { await (await processServices.goToTaskApp()).clickTasksButton(); 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'); 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 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'); 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 (await processServices.goToTaskApp()).clickTasksButton(); - await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities'); const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); - const taskModel = new TaskModel(allTasks.data[0]); 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 () => { const taskName = 'TaskAppCompleted'; const taskId = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName }); - await (await processServices.goToTaskApp()).clickTasksButton(); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); diff --git a/e2e/process-services/task-filters-component.e2e.ts b/e2e/process-services/task-filters-component.e2e.ts index 295ba4ae89..b6fe348c44 100644 --- a/e2e/process-services/task-filters-component.e2e.ts +++ b/e2e/process-services/task-filters-component.e2e.ts @@ -28,6 +28,7 @@ import { AlfrescoApiCompatibility as AlfrescoApi, UserProcessInstanceFilterRepre import { AppsActions } from '../actions/APS/apps.actions'; import { UsersActions } from '../actions/users.actions'; import { browser } from 'protractor'; +import { User } from '../models/APS/user'; describe('Task', () => { @@ -42,15 +43,13 @@ describe('Task', () => { const taskFiltersDemoPage = new TaskFiltersDemoPage(); const app = browser.params.resources.Files.APP_WITH_DATE_FIELD_FORM; - let appId, tenantId; + let appId: number, user: User; beforeAll(async () => { - this.alfrescoJsApi = new AlfrescoApi({ provider: 'BPM', hostBpm: browser.params.testConfig.adf_aps.host }); - }); beforeEach(async () => { @@ -59,34 +58,23 @@ describe('Task', () => { const users = new UsersActions(); await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); - - const user = await users.createTenantAndUser(this.alfrescoJsApi); - - tenantId = user.tenantId; + user = await users.createTenantAndUser(this.alfrescoJsApi); await this.alfrescoJsApi.login(user.email, user.password); - - const appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - - appId = appModel.id; + const { id } = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + appId = id; await loginPage.loginToProcessServicesUsingUserModel(user); - await navigationBarPage.navigateToProcessServicesPage(); - await processServicesPage.checkApsContainer(); await processServicesPage.goToApp(app.title); }); afterEach(async () => { - await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId); - await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); - - await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId); - + await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId); }); 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 () => { - const task = await tasksPage.createNewTask(); - await task.addName('Test'); - await task.clickStartButton(); + await tasksPage.createTask({name: 'Test'}); await taskFiltersDemoPage.myTasksFilter().clickTaskFilter(); await tasksListPage.checkContentIsDisplayed('Test'); 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 () => { - const task = await tasksPage.createNewTask(); - await task.addName('Test1'); - await task.clickStartButton(); - + await tasksPage.createTask({name: 'Test1'}); await taskDetailsPage.clickCompleteTask(); - const task2 = await tasksPage.createNewTask(); - await task2.addName('Test2'); - await task2.clickStartButton(); - + await tasksPage.createTask({name: 'Test2'}); await taskDetailsPage.clickCompleteTask(); - const task3 = await tasksPage.createNewTask(); - await task3.addName('Test3'); - await task3.clickStartButton(); - - const task4 = await tasksPage.createNewTask(); - await task4.addName('Test4'); - await task4.clickStartButton(); + await tasksPage.createTask({name: 'Test3'}); + await tasksPage.createTask({name: 'Test4'}); await tasksListPage.checkContentIsDisplayed('Test4'); await tasksListPage.checkRowIsSelected('Test4'); @@ -201,9 +176,7 @@ describe('Task', () => { }); it('[C277264] Should display task filter results when task filter is selected', async () => { - const task = await tasksPage.createNewTask(); - await task.addName('Test'); - await task.clickStartButton(); + await tasksPage.createTask({name: 'Test'}); await taskFiltersDemoPage.myTasksFilter().clickTaskFilter(); await tasksListPage.checkContentIsDisplayed('Test'); @@ -221,10 +194,7 @@ describe('Task', () => { const taskFiltersDemoPage = new TaskFiltersDemoPage(); let user; - let appId; - let importedApp; - - let taskFilterId; + let appId: number; 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); - user = await users.createTenantAndUser(this.alfrescoJsApi); await this.alfrescoJsApi.login(user.email, user.password); - - importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - + const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions(); - - appId = appDefinitions.data.find((currentApp) => { - return currentApp.modelId === importedApp.id; - }).id; + appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id; 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 () => { @@ -262,33 +230,27 @@ describe('Task', () => { }); it('[C260350] Should display a new filter when a filter is added', async () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'New Task Filter'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; - - const result = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); - - taskFilterId = result.id; + const newFilter = new UserProcessInstanceFilterRepresentation({ + name: 'New Task Filter', + appId, + icon: 'glyphicon-filter', + filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' } + }); + const { id } = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - await taskFiltersDemoPage.customTaskFilter('New Task Filter').checkTaskFilterIsDisplayed(); - - await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(taskFilterId); + await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(id); }); it('[C286447] Should display the task filter icon when a custom filter is added', async () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'New Task Filter with icon'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-cloud'; - newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; - - const result = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); - - taskFilterId = result.id; + const newFilter = new UserProcessInstanceFilterRepresentation({ + name : 'New Task Filter with icon', + appId, + icon: 'glyphicon-cloud', + filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' } + }); + const { id } = await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); await processServiceTabBarPage.clickSettingsButton(); @@ -298,8 +260,7 @@ describe('Task', () => { await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').checkTaskFilterIsDisplayed(); await expect(await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').getTaskFilterIcon()).toEqual('cloud'); - - await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(taskFilterId); + await this.alfrescoJsApi.activiti.userFiltersApi.deleteUserTaskFilter(id); }); it('[C286449] Should display task filter icons only when showIcon property is set on true', async () => { diff --git a/e2e/process-services/task-filters-sorting.e2e.ts b/e2e/process-services/task-filters-sorting.e2e.ts index 96427c8a25..172beba542 100644 --- a/e2e/process-services/task-filters-sorting.e2e.ts +++ b/e2e/process-services/task-filters-sorting.e2e.ts @@ -39,7 +39,6 @@ describe('Task Filters Sorting', () => { let user; let appId; - let importedApp; 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); - user = await users.createTenantAndUser(this.alfrescoJsApi); await this.alfrescoJsApi.login(user.email, user.password); - - importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - + const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); const appDefinitions = await this.alfrescoJsApi.activiti.appsApi.getAppDefinitions(); - - appId = appDefinitions.data.find((currentApp) => { - return currentApp.modelId === importedApp.id; - }).id; + appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id; await loginPage.loginToProcessServicesUsingUserModel(user); - await navigationBarPage.navigateToProcessServicesPage(); await processServicesPage.checkApsContainer(); await processServicesPage.goToApp(app.title); - const task = await tasksPage.createNewTask(); - await task.addName(tasks[0].name); - await task.addDueDate(tasks[0].dueDate); - await task.clickStartButton(); - + await tasksPage.createTask({name: tasks[0].name, dueDate: tasks[0].dueDate}); await taskDetailsPage.clickCompleteTask(); - const task2 = await tasksPage.createNewTask(); - - await task2.addName(tasks[1].name); - await task2.addDueDate(tasks[1].dueDate); - await task2.clickStartButton(); + await tasksPage.createTask({name: tasks[1].name, dueDate: tasks[1].dueDate}); await taskDetailsPage.clickCompleteTask(); - const task3 = await tasksPage.createNewTask(); - await task3.addName(tasks[2].name); - await task3.addDueDate(tasks[2].dueDate); - await task3.clickStartButton(); + await tasksPage.createTask({name: tasks[2].name, dueDate: tasks[2].dueDate}); await taskDetailsPage.clickCompleteTask(); - const task4 = await tasksPage.createNewTask(); - await task4.addName(tasks[3].name); - await task4.addDueDate(tasks[3].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(); + await tasksPage.createTask({name: tasks[3].name, dueDate: tasks[3].dueDate}); + await tasksPage.createTask({name: tasks[4].name, dueDate: tasks[4].dueDate}); + await tasksPage.createTask({name: tasks[5].name, dueDate: tasks[5].dueDate}); + }); + 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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Newest first'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'created-desc', state: 'completed', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Newest first', + icon: 'glyphicon-filter', + filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Newest first').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Newest last'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'created-asc', state: 'completed', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Newest last', + icon: 'glyphicon-filter', + filter: { sort: 'created-asc', state: 'completed', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Newest last').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Due first'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'due-desc', state: 'completed', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Due first', + icon: 'glyphicon-filter', + filter: { sort: 'due-desc', state: 'completed', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Due first').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Due last'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'due-asc', state: 'completed', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Due last', + icon: 'glyphicon-filter', + filter: { sort: 'due-asc', state: 'completed', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Due last').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Newest first Open'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'created-desc', state: 'open', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Newest first Open', + icon: 'glyphicon-filter', + filter: { sort: 'created-desc', state: 'open', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Newest first Open').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Newest last Open'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'created-asc', state: 'open', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Newest last Open', + icon: 'glyphicon-filter', + filter: { sort: 'created-asc', state: 'open', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Newest last Open').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Due first Open'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'due-desc', state: 'open', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Due first Open', + icon: 'glyphicon-filter', + filter: { sort: 'due-desc', state: 'open', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Due first Open').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].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 () => { - const newFilter: any = new UserProcessInstanceFilterRepresentation(); - newFilter.name = 'Due last Open'; - newFilter.appId = appId; - newFilter.icon = 'glyphicon-filter'; - newFilter.filter = { sort: 'due-asc', state: 'open', assignment: 'involved' }; - + const newFilter = new UserProcessInstanceFilterRepresentation({ + appId, + name : 'Due last Open', + icon: 'glyphicon-filter', + filter: { sort: 'due-asc', state: 'open', assignment: 'involved' } + }); await this.alfrescoJsApi.activiti.userFiltersApi.createUserTaskFilter(newFilter); await browser.refresh(); - - await taskFiltersDemoPage.customTaskFilter('Due last Open').clickTaskFilter(); + await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); 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(3)).toBe(tasks[5].name); - }); }); diff --git a/e2e/process-services/task-list-pagination.e2e.ts b/e2e/process-services/task-list-pagination.e2e.ts index 1b65a4365e..e81ccacb98 100644 --- a/e2e/process-services/task-list-pagination.e2e.ts +++ b/e2e/process-services/task-list-pagination.e2e.ts @@ -23,6 +23,7 @@ import { UsersActions } from '../actions/users.actions'; import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { TasksPage } from '../pages/adf/process-services/tasksPage'; import CONSTANTS = require('../util/constants'); +import { User } from '../models/APS/user'; describe('Task List Pagination', () => { @@ -31,7 +32,7 @@ describe('Task List Pagination', () => { const taskPage = new TasksPage(); const paginationPage = new PaginationPage(); - let processUserModel, processUserModelEmpty; + let processUserModel: User; const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; let currentPage = 1; 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); - processUserModel = await users.createTenantAndUser(this.alfrescoJsApi); - processUserModelEmpty = await users.createTenantAndUser(this.alfrescoJsApi); await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); - const resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); for (let i = 0; i < nrOfTasks; i++) { @@ -72,7 +70,11 @@ describe('Task List Pagination', () => { } 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 () => { @@ -192,11 +194,4 @@ describe('Task List Pagination', () => { await paginationPage.checkPreviousPageButtonIsDisabled(); }); - it('Pagination in an empty task list', async () => { - await loginPage.loginToProcessServicesUsingUserModel(processUserModelEmpty); - - await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp(); - await paginationPage.checkPaginationIsNotDisplayed(); - }); - }); diff --git a/e2e/resources/apps/Test Assignee.zip b/e2e/resources/apps/Test Assignee.zip new file mode 100644 index 0000000000..23b7f22275 Binary files /dev/null and b/e2e/resources/apps/Test Assignee.zip differ diff --git a/e2e/util/constants.js b/e2e/util/constants.js index c5182a8f72..b7534b490a 100644 --- a/e2e/util/constants.js +++ b/e2e/util/constants.js @@ -74,6 +74,12 @@ exports.TASK_FILTERS = { COMPLETED_TASKS: 'Completed Tasks' }; +exports.PROCESS_FILTERS = { + RUNNING: 'Running', + COMPLETED: 'Completed', + ALL: 'All' +}; + exports.TASK_DETAILS = { NO_FORM: 'No form', NO_PARENT: 'No parent', diff --git a/e2e/util/resources.js b/e2e/util/resources.js index 5c043d4d78..401439153d 100644 --- a/e2e/util/resources.js +++ b/e2e/util/resources.js @@ -52,6 +52,14 @@ exports.Files = { 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: { file_location: "/resources/apps/appWithUser.zip", title: "appWithUser", diff --git a/lib/core/pagination/pagination.component.spec.ts b/lib/core/pagination/pagination.component.spec.ts index b9505e0e5b..744d294633 100644 --- a/lib/core/pagination/pagination.component.spec.ts +++ b/lib/core/pagination/pagination.component.spec.ts @@ -332,5 +332,19 @@ describe('PaginationComponent', () => { expect(component.current).toBe(1); }); + + it('should not show pagination when external component count is zero', () => { + const pagination: Pagination = {}; + const customComponent = { + pagination: new BehaviorSubject({ 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(); + }); + }); });