[ADF-3993] Automation for Start Task - Group Cloud (#4879)

This commit is contained in:
Marouan Bentaleb 2019-07-14 13:26:09 +01:00 committed by Eugenio Romano
parent db0a7842a8
commit 6b84ecf47c
3 changed files with 210 additions and 3 deletions

View File

@ -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', () => {

View File

@ -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);
});
});

View File

@ -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);
}
}