From 6b84ecf47c92df1f52ecabae7940f9e140c84b4a Mon Sep 17 00:00:00 2001 From: Marouan Bentaleb <38426175+marouanbentaleb@users.noreply.github.com> Date: Sun, 14 Jul 2019 13:26:09 +0100 Subject: [PATCH] [ADF-3993] Automation for Start Task - Group Cloud (#4879) --- .../start-task-custom-app-cloud.e2e.ts | 6 +- .../start-task/start-task-group-cloud.e2e.ts | 197 ++++++++++++++++++ .../pages/group-cloud-component.page.ts | 10 + 3 files changed, 210 insertions(+), 3 deletions(-) rename e2e/process-services-cloud/{ => start-task}/start-task-custom-app-cloud.e2e.ts (97%) create mode 100644 e2e/process-services-cloud/start-task/start-task-group-cloud.e2e.ts diff --git a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts b/e2e/process-services-cloud/start-task/start-task-custom-app-cloud.e2e.ts similarity index 97% rename from e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts rename to e2e/process-services-cloud/start-task/start-task-custom-app-cloud.e2e.ts index 00f4a79262..9109e0f863 100644 --- a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task/start-task-custom-app-cloud.e2e.ts @@ -16,13 +16,13 @@ */ import { browser } from 'protractor'; -import { NavigationBarPage } from '../pages/adf/navigationBarPage'; -import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; +import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; +import { TasksCloudDemoPage } from '../../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; import { LoginSSOPage, AppListCloudPage, StringUtil, TaskHeaderCloudPage, StartTasksCloudPage, PeopleCloudComponentPage, TasksService, ApiService, IdentityService, SettingsPage, GroupIdentityService } from '@alfresco/adf-testing'; -import resources = require('../util/resources'); +import resources = require('../../util/resources'); describe('Start Task', () => { diff --git a/e2e/process-services-cloud/start-task/start-task-group-cloud.e2e.ts b/e2e/process-services-cloud/start-task/start-task-group-cloud.e2e.ts new file mode 100644 index 0000000000..a4bbdeaa1d --- /dev/null +++ b/e2e/process-services-cloud/start-task/start-task-group-cloud.e2e.ts @@ -0,0 +1,197 @@ +/*! + * @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 { browser } from 'protractor'; +import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; +import { TasksCloudDemoPage } from '../../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; +import { + LoginSSOPage, AppListCloudPage, StringUtil, GroupCloudComponentPage, + StartTasksCloudPage, PeopleCloudComponentPage, TasksService, ApiService, IdentityService, SettingsPage, GroupIdentityService +} from '@alfresco/adf-testing'; +import resources = require('../../util/resources'); + +describe('Start Task - Group Cloud Component', () => { + + const loginSSOPage = new LoginSSOPage(); + const navigationBarPage = new NavigationBarPage(); + const appListCloudComponent = new AppListCloudPage(); + const tasksCloudDemoPage = new TasksCloudDemoPage(); + const startTask = new StartTasksCloudPage(); + const peopleCloudComponent = new PeopleCloudComponentPage(); + const settingsPage = new SettingsPage(); + const apiService = new ApiService( + browser.params.config.oauth2.clientId, + browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers + ); + const groupCloud = new GroupCloudComponentPage(); + + const bothGroupsTaskName = StringUtil.generateRandomString(5); + const oneGroupTaskName = StringUtil.generateRandomString(5); + let apsUser, testUser, hrGroup, testGroup; + const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name; + + let identityService: IdentityService; + let groupIdentityService: GroupIdentityService; + + beforeAll(async (done) => { + await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password); + + identityService = new IdentityService(apiService); + groupIdentityService = new GroupIdentityService(apiService); + testUser = await identityService.createIdentityUser(); + apsUser = await identityService.createIdentityUser(); + + hrGroup = await groupIdentityService.getGroupInfoByGroupName('hr'); + testGroup = await groupIdentityService.getGroupInfoByGroupName('testgroup'); + await identityService.addUserToGroup(testUser.idIdentityService, testGroup.id); + await identityService.addUserToGroup(apsUser.idIdentityService, hrGroup.id); + + await settingsPage.setProviderBpmSso( + browser.params.config.bpmHost, + browser.params.config.oauth2.host, + browser.params.config.identityHost); + done(); + }); + + afterAll(async (done) => { + try { + await apiService.login(testUser.email, testUser.password); + const tasksService = new TasksService(apiService); + + const bothGroupsTaskId = await tasksService.getTaskId(bothGroupsTaskName, simpleApp); + await tasksService.deleteTask(bothGroupsTaskId, simpleApp); + + const oneGroupTaskId = await tasksService.getTaskId(oneGroupTaskName, simpleApp); + await tasksService.deleteTask(oneGroupTaskId, simpleApp); + + await identityService.deleteIdentityUser(apsUser.idIdentityService); + await identityService.deleteIdentityUser(testUser.idIdentityService); + } catch (error) { + } + done(); + }); + + beforeEach(() => { + loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password); + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudComponent.checkApsContainer(); + appListCloudComponent.checkAppIsDisplayed(simpleApp); + appListCloudComponent.goToApp(simpleApp); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody(); + tasksCloudDemoPage.openNewTaskForm(); + startTask.checkFormIsDisplayed(); + }); + + afterEach(() => { + navigationBarPage.clickLogoutButton(); + }); + + it('[C291954] Should be able to select/delete an group for a standalone task', () => { + peopleCloudComponent.clearAssignee(); + + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsDisplayed(testGroup.name); + groupCloud.selectGroupFromList(testGroup.name); + groupCloud.checkSelectedGroup(testGroup.name); + + groupCloud.searchGroups(hrGroup.name); + groupCloud.checkGroupIsDisplayed(hrGroup.name); + groupCloud.selectGroupFromList(hrGroup.name); + groupCloud.checkSelectedGroup(hrGroup.name); + + groupCloud.removeSelectedGroup(testGroup.name); + groupCloud.checkGroupNotSelected(testGroup.name); + + startTask.addName(oneGroupTaskName); + startTask.clickStartButton(); + + navigationBarPage.clickLogoutButton(); + loginSSOPage.loginSSOIdentityService(apsUser.email, apsUser.password); + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudComponent.checkApsContainer(); + appListCloudComponent.checkAppIsDisplayed(simpleApp); + appListCloudComponent.goToApp(simpleApp); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody(); + + tasksCloudDemoPage.editTaskFilterCloudComponent() + .clickCustomiseFilterHeader() + .clearAssignee() + .setStatusFilterDropDown('CREATED'); + + tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody(); + tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(oneGroupTaskName); + }); + + it('[C291955] Should be able to select multiple groups when the selection mode=multiple', () => { + peopleCloudComponent.clearAssignee(); + + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsDisplayed(testGroup.name); + groupCloud.selectGroupFromList(testGroup.name); + groupCloud.checkSelectedGroup(testGroup.name); + + groupCloud.searchGroups(hrGroup.name); + groupCloud.checkGroupIsDisplayed(hrGroup.name); + groupCloud.selectGroupFromList(hrGroup.name); + groupCloud.checkSelectedGroup(hrGroup.name); + + startTask.addName(bothGroupsTaskName); + startTask.clickStartButton(); + + navigationBarPage.clickLogoutButton(); + loginSSOPage.loginSSOIdentityService(apsUser.email, apsUser.password); + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudComponent.checkApsContainer(); + appListCloudComponent.checkAppIsDisplayed(simpleApp); + appListCloudComponent.goToApp(simpleApp); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody(); + + tasksCloudDemoPage.editTaskFilterCloudComponent() + .clickCustomiseFilterHeader() + .clearAssignee() + .setStatusFilterDropDown('CREATED'); + + tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody(); + tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(bothGroupsTaskName); + }); + + it('[C291993] Should NOT be able to find a group already selected', () => { + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsDisplayed(testGroup.name); + groupCloud.selectGroupFromList(testGroup.name); + groupCloud.checkSelectedGroup(testGroup.name); + + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsNotDisplayed(testGroup.name); + }); + + it('[C291995] Should be able to add a group previously removed', async () => { + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsDisplayed(testGroup.name); + groupCloud.selectGroupFromList(testGroup.name); + groupCloud.checkSelectedGroup(testGroup.name); + + groupCloud.removeSelectedGroup(testGroup.name); + groupCloud.checkGroupNotSelected(testGroup.name); + + groupCloud.searchGroups(testGroup.name); + groupCloud.checkGroupIsDisplayed(testGroup.name); + groupCloud.selectGroupFromList(testGroup.name); + groupCloud.checkSelectedGroup(testGroup.name); + }); + +}); diff --git a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts index 0bd4ab7b75..97dd90bf02 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts @@ -77,4 +77,14 @@ export class GroupCloudComponentPage { return this; } + checkGroupNotSelected(group) { + BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); + return this; + } + + removeSelectedGroup(group) { + const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`)); + BrowserActions.click(locator); + } + }