From 81ec4ed441394abdbc8d84c94a2ddb8760cdcc66 Mon Sep 17 00:00:00 2001 From: gmandakini <45559635+gmandakini@users.noreply.github.com> Date: Tue, 19 Feb 2019 13:12:54 +0000 Subject: [PATCH] [ADF-4012] Should be able to set default columns in adf-process-list-cloud (#4323) * in progress * in progress * ADF-4012 pull request ready * crc's * crc's - moved the methods ProcessListCloudComponent to dataTablePage, to keep it common. * crc's - moved the methods ProcessListCloudComponent to dataTablePage, to keep it common. * changed the locator to use data-automation-id * linting fix --- e2e/pages/adf/configEditorPage.ts | 7 ++ e2e/pages/adf/dataTablePage.ts | 10 ++ .../processList-cloud-component.e2e.ts | 104 +++++++++++++++++ .../processListCloud.config.ts | 110 ++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 e2e/process-services-cloud/processList-cloud-component.e2e.ts create mode 100644 e2e/process-services-cloud/processListCloud.config.ts diff --git a/e2e/pages/adf/configEditorPage.ts b/e2e/pages/adf/configEditorPage.ts index fee2d8b7dd..c31bc7b068 100644 --- a/e2e/pages/adf/configEditorPage.ts +++ b/e2e/pages/adf/configEditorPage.ts @@ -62,4 +62,11 @@ export class ConfigEditorPage { Util.waitUntilElementIsClickable(button); return button.click(); } + + clickProcessListCloudConfiguration() { + let button = element(by.id('adf-process-list-cloud-conf')); + Util.waitUntilElementIsVisible(button); + Util.waitUntilElementIsClickable(button); + return button.click(); + } } diff --git a/e2e/pages/adf/dataTablePage.ts b/e2e/pages/adf/dataTablePage.ts index 18b1bfaf4e..6f355536b5 100644 --- a/e2e/pages/adf/dataTablePage.ts +++ b/e2e/pages/adf/dataTablePage.ts @@ -38,6 +38,7 @@ export class DataTablePage { tableBody = element.all(by.css(`div[class='adf-datatable-body']`)).first(); spinner = element(by.css('mat-progress-spinner')); rows = by.css(`adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`); + allColumns = element.all(by.css('div[data-automation-id*="auto_id_entry."]')); constructor(rootElement: ElementFinder = element(by.css('adf-datatable'))) { this.rootElement = rootElement; @@ -264,4 +265,13 @@ export class DataTablePage { return element.all(by.css(`div[title='Name'][filename="${filename}"]`)).count(); } + checkColumnIsDisplayed(column) { + Util.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`))); + return this; + } + + getNoOfColumns() { + return this.allColumns.count(); + } + } diff --git a/e2e/process-services-cloud/processList-cloud-component.e2e.ts b/e2e/process-services-cloud/processList-cloud-component.e2e.ts new file mode 100644 index 0000000000..445b0dfc5f --- /dev/null +++ b/e2e/process-services-cloud/processList-cloud-component.e2e.ts @@ -0,0 +1,104 @@ +/*! + * @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 TestConfig = require('../test.config'); +import { LoginSSOPage } from '../pages/adf/loginSSOPage'; +import { SettingsPage } from '../pages/adf/settingsPage'; +import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage'; +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 { NavigationBarPage } from '../pages/adf/navigationBarPage'; +import { ConfigEditorPage } from '../pages/adf/configEditorPage'; +import { ProcessListCloudConfiguration } from './processListCloud.config'; + +describe('Process list cloud', () => { + + describe('Process List', () => { + const settingsPage = new SettingsPage(); + const loginSSOPage = new LoginSSOPage(); + const navigationBarPage = new NavigationBarPage(); + const configEditor = new ConfigEditorPage(); + let appListCloudComponent = new AppListCloudComponent(); + let processCloudDemoPage = new ProcessCloudDemoPage(); + + const processDefinitionService: ProcessDefinitions = new ProcessDefinitions(); + const processInstancesService: ProcessInstances = new ProcessInstances(); + + let silentLogin; + const simpleApp = 'candidateuserapp'; + const user = TestConfig.adf.adminEmail, password = TestConfig.adf.adminPassword; + let jsonFile; + let runningProcess; + + beforeAll(async () => { + silentLogin = false; + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, 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); + + }); + + beforeEach(async (done) => { + let processListCloudConfiguration = new ProcessListCloudConfiguration(); + jsonFile = processListCloudConfiguration.getConfiguration(); + done(); + navigationBarPage.clickConfigEditorButton(); + configEditor.clickProcessListCloudConfiguration(); + configEditor.clickClearButton(); + configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudComponent.checkApsContainer(); + appListCloudComponent.goToApp(simpleApp); + processCloudDemoPage.clickOnProcessFilters(); + processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed(); + processCloudDemoPage.runningProcessesFilter().clickProcessFilter(); + expect(processCloudDemoPage.getActiveFilterName()).toBe('Running Processes'); + processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded(); + processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(runningProcess.entry.id); + done(); + }); + + it('[C291997] Should be able to change the default columns', async() => { + + expect(processCloudDemoPage.processListCloudComponent().getDataTable().getNoOfColumns()).toBe(13); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('id'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('name'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('status'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('startDate'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('appName'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('businessKey'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('description'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('initiator'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('lastModified'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('processName'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('processId'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('processDefinitionId'); + processCloudDemoPage.processListCloudComponent().getDataTable().checkColumnIsDisplayed('processDefinitionKey'); + + }); + + }); + +}); diff --git a/e2e/process-services-cloud/processListCloud.config.ts b/e2e/process-services-cloud/processListCloud.config.ts new file mode 100644 index 0000000000..3ee5d439b5 --- /dev/null +++ b/e2e/process-services-cloud/processListCloud.config.ts @@ -0,0 +1,110 @@ +/*! + * @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. + */ + +export class ProcessListCloudConfiguration { + + constructor() { + } + + getConfiguration() { + return { + 'presets': { + 'default': [ + { + 'key': 'entry.id', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID', + 'sortable': true + }, + { + 'key': 'entry.name', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME', + 'sortable': true + }, + { + 'key': 'entry.status', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS', + 'sortable': true + }, + { + 'key': 'entry.startDate', + 'type': 'date', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE', + 'sortable': true, + 'format': 'timeAgo' + }, + { + 'key': 'entry.appName', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME', + 'sortable': true + }, + { + 'key': 'entry.businessKey', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY', + 'sortable': true + }, + { + 'key': 'entry.description', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.DESCRIPTION', + 'sortable': true + }, + { + 'key': 'entry.initiator', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.INITIATOR', + 'sortable': true + }, + { + 'key': 'entry.lastModified', + 'type': 'date', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED', + 'sortable': true + }, + { + 'key': 'entry.processName', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_NAME', + 'sortable': true + }, + { + 'key': 'entry.processId', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_ID', + 'sortable': true + }, + { + 'key': 'entry.processDefinitionId', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEFINITION_ID', + 'sortable': true + }, + { + 'key': 'entry.processDefinitionKey', + 'type': 'text', + 'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEFINITION_KEY', + 'sortable': true + } + ] + } +}; + } +}