Files
alfresco-ng2-components/e2e/process-services-cloud/start-process-cloud.e2e.ts
Geeta Mandakini Ayyalasomayajula e65e32e0cf Enable tests and add a newly created user to run the tests. (#4796)
* enabled tests and added the new user to run the tests.

* lint fix

* adding a new user and add the user to hr group which will be used when deploying the apps.

* Test commit

* adding a new user and add the user to hr group which will be used when deploying the apps.

* linting fixes

* crc's moved the roles constants to identityService.

* crc's moved the roles constants to identityService.

* wrapped the createIdentityUser and assign Role calls into 1 method and used in the tests.

* wrapped the createIdentityUser and assign Role calls into 1 method and used in the tests.

* Added a method in identityService to pass the required roles to be added in a string array.

* linting fixes

* added the command line arguments to run the e2e tests -identity_admin_email and -identity_admin_password

* added the command line arguments to run the e2e tests -identity_admin_email and -identity_admin_password

* crc's, removed the step to add user to the hr group, as not needed in this test.

* renamed the E2E travis variable to end with identity.

* replaced the candidateuserapp with candidatebaseapp

* replaced candidateuserapp with candidatebaseapp

* replaced candidateuserapp with candidatebaseapp

* replaced candidateuserapp with candidatebaseapp

* timeout wait for the test to pass.

* crc's
2019-06-06 11:12:05 +01:00

131 lines
6.1 KiB
TypeScript

/*!
* @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 { ApiService, GroupIdentityService, IdentityService, LoginSSOPage, SettingsPage } from '@alfresco/adf-testing';
import { AppListCloudPage, StartProcessCloudPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
import { StringUtil } from '@alfresco/adf-testing';
import resources = require('../util/resources');
describe('Start Process', () => {
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const startProcessPage = new StartProcessCloudPage();
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 processDefinitionWithoutName = 'process-bc59fd64-d0b1-4eda-8b02-2ef38062cf39';
const processName = StringUtil.generateRandomString(10);
const processName255Characters = StringUtil.generateRandomString(255);
const processNameBiggerThen255Characters = StringUtil.generateRandomString(256);
const lengthValidationError = 'Length exceeded, 255 characters max.';
const requiredError = 'Process Name is required';
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
let identityService: IdentityService;
let groupIdentityService: GroupIdentityService;
let testUser, groupInfo;
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.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await settingsPage.setProviderBpmSso(
browser.params.config.bpmHost,
browser.params.config.oauth2.host,
browser.params.config.identityHost);
loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
done();
});
afterAll(async(done) => {
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await identityService.deleteIdentityUser(testUser.idIdentityService);
done();
});
afterEach((done) => {
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
done();
});
it('[C291857] Should be possible to cancel a process', () => {
appListCloudComponent.checkAppIsDisplayed(simpleApp);
appListCloudComponent.goToApp(simpleApp);
processCloudDemoPage.openNewProcessForm();
startProcessPage.clearField(startProcessPage.processNameInput);
startProcessPage.blur(startProcessPage.processNameInput);
startProcessPage.checkValidationErrorIsDisplayed(requiredError);
startProcessPage.checkStartProcessButtonIsDisabled();
startProcessPage.clickCancelProcessButton();
});
it('[C291842] Should be displayed an error message if process name exceed 255 characters', () => {
appListCloudComponent.checkAppIsDisplayed(simpleApp);
appListCloudComponent.goToApp(simpleApp);
processCloudDemoPage.openNewProcessForm();
startProcessPage.enterProcessName(processName255Characters);
startProcessPage.checkStartProcessButtonIsEnabled();
startProcessPage.enterProcessName(processNameBiggerThen255Characters);
startProcessPage.blur(startProcessPage.processNameInput);
startProcessPage.checkValidationErrorIsDisplayed(lengthValidationError);
startProcessPage.checkStartProcessButtonIsDisabled();
});
it('[C291860] Should be able to start a process', () => {
appListCloudComponent.checkAppIsDisplayed(simpleApp);
appListCloudComponent.goToApp(simpleApp);
processCloudDemoPage.openNewProcessForm();
startProcessPage.clearField(startProcessPage.processNameInput);
startProcessPage.enterProcessName(processName);
startProcessPage.checkStartProcessButtonIsEnabled();
startProcessPage.clickStartProcessButton();
processCloudDemoPage.clickOnProcessFilters();
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
expect(processCloudDemoPage.getActiveFilterName()).toBe('Running Processes');
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(processName);
});
it('[C309875] Should display the processId when Process Definition has process name missing', async () => {
appListCloudComponent.checkAppIsDisplayed(simpleApp);
appListCloudComponent.goToApp(simpleApp);
processCloudDemoPage.openNewProcessForm();
startProcessPage.clearField(startProcessPage.processNameInput);
startProcessPage.enterProcessName(processName);
startProcessPage.selectFromProcessDropdown(processDefinitionWithoutName);
startProcessPage.checkStartProcessButtonIsEnabled();
});
});