diff --git a/demo-shell/src/app/components/app-layout/cloud/cloud-filters-demo.component.html b/demo-shell/src/app/components/app-layout/cloud/cloud-filters-demo.component.html index 6ae18ae0a5..a2baed957a 100644 --- a/demo-shell/src/app/components/app-layout/cloud/cloud-filters-demo.component.html +++ b/demo-shell/src/app/components/app-layout/cloud/cloud-filters-demo.component.html @@ -1,5 +1,5 @@ - + Task Filters @@ -14,7 +14,7 @@ - + Process Filters diff --git a/e2e/actions/APS-cloud/process-definitions.ts b/e2e/actions/APS-cloud/process-definitions.ts new file mode 100644 index 0000000000..aa8bb1e2f8 --- /dev/null +++ b/e2e/actions/APS-cloud/process-definitions.ts @@ -0,0 +1,40 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ApiService } from './apiservice'; + +export class ProcessDefinitions { + + api: ApiService = new ApiService(); + + constructor() { + } + + async init(username, password) { + await this.api.login(username, password); + } + + async getProcessDefinitions(appName) { + const path = '/' + appName + '-rb/v1/process-definitions'; + const method = 'GET'; + + const queryParams = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, {}); + return data; + } +} diff --git a/e2e/actions/APS-cloud/process-instances.ts b/e2e/actions/APS-cloud/process-instances.ts new file mode 100644 index 0000000000..b113b01f9d --- /dev/null +++ b/e2e/actions/APS-cloud/process-instances.ts @@ -0,0 +1,73 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ApiService } from './apiservice'; + +export class ProcessInstances { + + api: ApiService = new ApiService(); + + constructor() { + } + + async init(username, password) { + await this.api.login(username, password); + } + + async createProcessInstance(processDefKey, appName) { + const path = '/' + appName + '-rb/v1/process-instances'; + const method = 'POST'; + + const queryParams = {}, postBody = { + 'processDefinitionKey': processDefKey, + 'payloadType': 'StartProcessPayload' + }; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data; + } + + async suspendProcessInstance(processInstanceId, appName) { + const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/suspend'; + const method = 'POST'; + + const queryParams = {}, postBody = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data; + } + + async deleteProcessInstance(processInstanceId, appName) { + const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId; + const method = 'DELETE'; + + const queryParams = {}, postBody = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data; + } + + async completeProcessInstance(processInstanceId, appName) { + const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/complete'; + const method = 'POST'; + + const queryParams = {}, postBody = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data; + } +} diff --git a/e2e/actions/APS-cloud/query.ts b/e2e/actions/APS-cloud/query.ts new file mode 100644 index 0000000000..23b99499a6 --- /dev/null +++ b/e2e/actions/APS-cloud/query.ts @@ -0,0 +1,41 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ApiService } from './apiservice'; + +export class Query { + + api: ApiService = new ApiService(); + + constructor() { + } + + async init(username, password) { + await this.api.login(username, password); + } + + async getProcessInstanceTasks(processInstanceId, appName) { + const path = '/' + appName + '-query/v1/process-instances/' + processInstanceId + '/tasks'; + const method = 'GET'; + + const queryParams = {}, postBody = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data; + } + +} diff --git a/e2e/pages/adf/dataTablePage.ts b/e2e/pages/adf/dataTablePage.ts index 4cc8041345..d2a1750950 100644 --- a/e2e/pages/adf/dataTablePage.ts +++ b/e2e/pages/adf/dataTablePage.ts @@ -44,7 +44,6 @@ export class DataTablePage { constructor(rootElement: ElementFinder = element(by.css('adf-datatable'))) { this.rootElement = rootElement; this.list = this.rootElement.all(by.css(`div[class*=adf-datatable-body] div[class*=adf-datatable-row]`)); - } getAllDisplayedRows() { diff --git a/e2e/pages/adf/demo-shell/processCloudDemoPage.ts b/e2e/pages/adf/demo-shell/processCloudDemoPage.ts new file mode 100644 index 0000000000..1c7d5c45da --- /dev/null +++ b/e2e/pages/adf/demo-shell/processCloudDemoPage.ts @@ -0,0 +1,67 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Util } from '../../../util/util'; + +import { ProcessFiltersCloudComponent } from '../process_cloud/processFiltersCloudComponent'; +import { ProcessListCloudComponent } from '../process_cloud/processListCloudComponent'; +import { element, by } from 'protractor'; + +export class ProcessCloudDemoPage { + + allProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.ALL_PROCESSES_filter"]')); + runningProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.RUNNING_PROCESSES_filter"]')); + completedProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.COMPLETED_PROCESSES_filter"]')); + activeFilter = element(by.css("mat-list-item[class*='active'] span")); + processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']")); + + processListCloud = new ProcessListCloudComponent(); + + processFiltersCloudComponent(filter) { + return new ProcessFiltersCloudComponent(filter); + } + + processListCloudComponent() { + return this.processListCloud; + } + + allProcessesFilter() { + return new ProcessFiltersCloudComponent(this.allProcesses); + } + + runningProcessesFilter() { + return new ProcessFiltersCloudComponent(this.runningProcesses); + } + + completedProcessesFilter() { + return new ProcessFiltersCloudComponent(this.completedProcesses); + } + + customProcessFilter(filterName) { + return new ProcessFiltersCloudComponent(element(by.css(`span[data-automation-id="${filterName}_filter"]`))); + } + + checkActiveFilterActive() { + Util.waitUntilElementIsVisible(this.activeFilter); + return this.activeFilter.getText(); + } + + clickOnProcessFilters() { + Util.waitUntilElementIsVisible(this.processFilters); + return this.processFilters.click(); + } +} diff --git a/e2e/pages/adf/process_cloud/processFiltersCloudComponent.ts b/e2e/pages/adf/process_cloud/processFiltersCloudComponent.ts new file mode 100644 index 0000000000..39b5653dee --- /dev/null +++ b/e2e/pages/adf/process_cloud/processFiltersCloudComponent.ts @@ -0,0 +1,58 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Util } from '../../../util/util'; +import { by } from 'protractor'; + +export class ProcessFiltersCloudComponent { + + filter; + filterIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon"); + + constructor(filter) { + this.filter = filter; + } + + checkProcessFilterIsDisplayed() { + Util.waitUntilElementIsVisible(this.filter); + return this; + } + + getProcessFilterIcon() { + Util.waitUntilElementIsVisible(this.filter); + let icon = this.filter.element(this.filterIcon); + Util.waitUntilElementIsVisible(icon); + return icon.getText(); + } + + checkProcessFilterHasNoIcon() { + Util.waitUntilElementIsVisible(this.filter); + Util.waitUntilElementIsNotOnPage(this.filter.element(this.filterIcon)); + } + + clickProcessFilter() { + Util.waitUntilElementIsVisible(this.filter); + Util.waitUntilElementIsClickable(this.filter); + return this.filter.click(); + } + + checkProcessFilterNotDisplayed() { + Util.waitUntilElementIsNotVisible(this.filter); + return this.filter; + } + +} diff --git a/e2e/pages/adf/process_cloud/processListCloudComponent.ts b/e2e/pages/adf/process_cloud/processListCloudComponent.ts new file mode 100644 index 0000000000..c5684c6b15 --- /dev/null +++ b/e2e/pages/adf/process_cloud/processListCloudComponent.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Util } from '../../../util/util'; +import { DataTablePage } from '../dataTablePage'; +import { element, by } from 'protractor'; + +export class ProcessListCloudComponent { + + processList = element(by.css('adf-cloud-process-list')); + noProcessFound = element.all(by.css("p[class='adf-empty-content__title']")).first(); + + dataTable = new DataTablePage(this.processList); + + getDataTable() { + return this.dataTable; + } + + checkProcessListIsLoaded() { + Util.waitUntilElementIsVisible(this.processList); + return this; + } + + getNoProcessFoundMessage() { + Util.waitUntilElementIsVisible(this.noProcessFound); + return this.noProcessFound.getText(); + } + +} diff --git a/e2e/pages/adf/process_cloud/taskListCloudComponent.ts b/e2e/pages/adf/process_cloud/taskListCloudComponent.ts index 8f2aa12356..da405dc285 100644 --- a/e2e/pages/adf/process_cloud/taskListCloudComponent.ts +++ b/e2e/pages/adf/process_cloud/taskListCloudComponent.ts @@ -21,7 +21,7 @@ import { element, by } from 'protractor'; export class TaskListCloudComponent { - taskList = element(by.css('adf-tasklist')); + taskList = element(by.css('adf-cloud-task-list')); noTasksFound = element.all(by.css("p[class='adf-empty-content__title']")).first(); dataTable = new DataTablePage(this.taskList); diff --git a/e2e/process-services-cloud/process_filters_cloud.e2e.ts b/e2e/process-services-cloud/process_filters_cloud.e2e.ts new file mode 100644 index 0000000000..f54050e42f --- /dev/null +++ b/e2e/process-services-cloud/process_filters_cloud.e2e.ts @@ -0,0 +1,122 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import TestConfig = require('../test.config'); + +import { LoginSSOPage } from '../pages/adf/loginSSOPage'; +import { SettingsPage } from '../pages/adf/settingsPage'; +import { NavigationBarPage } from '../pages/adf/navigationBarPage'; +import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/processCloudDemoPage'; +import { TasksCloudDemoPage } from '../pages/adf/demo-shell/tasksCloudDemoPage'; +import { AppListCloudComponent } from '../pages/adf/process_cloud/appListCloudComponent'; + +import { ProcessDefinitions } from '../actions/APS-cloud/process-definitions'; +import { ProcessInstances } from '../actions/APS-cloud/process-instances'; +import { Tasks } from '../actions/APS-cloud/tasks'; +import { Query } from '../actions/APS-cloud/query'; + +describe('Process filters cloud', () => { + + describe('Process Filters', () => { + const settingsPage = new SettingsPage(); + const loginSSOPage = new LoginSSOPage(); + const navigationBarPage = new NavigationBarPage(); + let appListCloudComponent = new AppListCloudComponent(); + let processCloudDemoPage = new ProcessCloudDemoPage(); + let tasksCloudDemoPage = new TasksCloudDemoPage(); + + const tasksService: Tasks = new Tasks(); + const processDefinitionService: ProcessDefinitions = new ProcessDefinitions(); + const processInstancesService: ProcessInstances = new ProcessInstances(); + const queryService: Query = new Query(); + + const path = '/auth/realms/springboot'; + let silentLogin; + let runningProcess, completedProcess; + const simpleApp = 'candidateuserapp'; + const user = TestConfig.adf.adminEmail, password = TestConfig.adf.adminPassword; + + beforeAll(async () => { + silentLogin = false; + settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + loginSSOPage.clickOnSSOButton(); + loginSSOPage.loginAPS(user, password); + + await processDefinitionService.init(user, password); + let processDefinition = await processDefinitionService.getProcessDefinitions(simpleApp); + await processInstancesService.init(user, password); + runningProcess = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key, simpleApp); + + completedProcess = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key, simpleApp); + await queryService.init(user, password); + let task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, simpleApp); + await tasksService.init(user, password); + let claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, simpleApp); + await tasksService.completeTask(claimedTask.entry.id, simpleApp); + }); + + beforeEach((done) => { + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudComponent.checkApsContainer(); + appListCloudComponent.goToApp(simpleApp); + tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded(); + processCloudDemoPage.clickOnProcessFilters(); + done(); + }); + + it('[C290021] Should be able to view default filters', () => { + processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed(); + processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed(); + processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed(); + }); + + it('[C290043] Should display process in Running Processes List when process is started', () => { + processCloudDemoPage.runningProcessesFilter().clickProcessFilter(); + processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Running Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(runningProcess.entry.id); + + processCloudDemoPage.completedProcessesFilter().clickProcessFilter(); + processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Completed Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsNotDisplayed(runningProcess.entry.id); + + processCloudDemoPage.allProcessesFilter().clickProcessFilter(); + processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('All Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(runningProcess.entry.id); + }); + + it('[C290044] Should display process in Completed Processes List when process is completed', () => { + processCloudDemoPage.runningProcessesFilter().clickProcessFilter(); + processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Running Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsNotDisplayed(completedProcess.entry.id); + + processCloudDemoPage.completedProcessesFilter().clickProcessFilter(); + processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Completed Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(completedProcess.entry.id); + + processCloudDemoPage.allProcessesFilter().clickProcessFilter(); + processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed(); + expect(processCloudDemoPage.checkActiveFilterActive()).toBe('All Processes'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(completedProcess.entry.id); + }); + }); + +}); diff --git a/e2e/process-services-cloud/task_filters_cloud.e2e.ts b/e2e/process-services-cloud/task_filters_cloud.e2e.ts index 44e249e71d..8888a5418e 100644 --- a/e2e/process-services-cloud/task_filters_cloud.e2e.ts +++ b/e2e/process-services-cloud/task_filters_cloud.e2e.ts @@ -27,7 +27,7 @@ import { Tasks } from '../actions/APS-cloud/tasks'; describe('Task filters cloud', () => { - describe('Filters', () => { + describe('Task Filters', () => { const settingsPage = new SettingsPage(); const loginSSOPage = new LoginSSOPage(); const navigationBarPage = new NavigationBarPage(); @@ -56,6 +56,7 @@ describe('Task filters cloud', () => { it('[C290011] Should display default filters when an app is deployed', () => { tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed(); + tasksCloudDemoPage.completedTasksFilter().checkTaskFilterIsDisplayed(); }); xit('[C290009] Should display default filters and created task', () => {