mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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
This commit is contained in:
committed by
Eugenio Romano
parent
3d73e94b5d
commit
e65e32e0cf
@@ -20,10 +20,9 @@ import { PeopleGroupCloudComponentPage } from '../pages/adf/demo-shell/process-s
|
||||
import { GroupCloudComponentPage, PeopleCloudComponentPage, SettingsPage } from '@alfresco/adf-testing';
|
||||
import { browser } from 'protractor';
|
||||
import { LoginSSOPage, IdentityService, GroupIdentityService, RolesService, ApiService } from '@alfresco/adf-testing';
|
||||
import CONSTANTS = require('../util/constants');
|
||||
import resources = require('../util/resources');
|
||||
|
||||
xdescribe('People Groups Cloud Component', () => {
|
||||
describe('People Groups Cloud Component', () => {
|
||||
|
||||
describe('People Groups Cloud Component', () => {
|
||||
const loginSSOPage = new LoginSSOPage();
|
||||
@@ -35,15 +34,17 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
let groupIdentityService: GroupIdentityService;
|
||||
let rolesService: RolesService;
|
||||
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
|
||||
);
|
||||
|
||||
let apsUser;
|
||||
let apsUser, testUser;
|
||||
let activitiUser;
|
||||
let noRoleUser;
|
||||
let groupAps;
|
||||
let groupActiviti;
|
||||
let groupNoRole;
|
||||
let apsUserRoleId;
|
||||
let activitiUserRoleId;
|
||||
let apsAdminRoleId;
|
||||
let activitiAdminRoleId;
|
||||
let clientActivitiAdminRoleId, clientActivitiUserRoleId;
|
||||
@@ -52,10 +53,7 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
let clientId;
|
||||
|
||||
beforeAll(async (done) => {
|
||||
const apiService = new ApiService(
|
||||
browser.params.config.oauth2.clientId,
|
||||
browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers
|
||||
);
|
||||
|
||||
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
||||
|
||||
identityService = new IdentityService(apiService);
|
||||
@@ -63,40 +61,38 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
groupIdentityService = new GroupIdentityService(apiService);
|
||||
clientId = await groupIdentityService.getClientIdByApplicationName(resources.ACTIVITI7_APPS.SIMPLE_APP.name);
|
||||
groupActiviti = await groupIdentityService.createIdentityGroup();
|
||||
clientActivitiAdminRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
clientActivitiUserRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, CONSTANTS.ROLES.ACTIVITI_USER);
|
||||
clientActivitiAdminRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, identityService.roles.activiti_admin);
|
||||
clientActivitiUserRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, identityService.roles.activiti_user);
|
||||
|
||||
apsUser = await identityService.createIdentityUser();
|
||||
apsUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.APS_USER);
|
||||
await identityService.assignRole(apsUser.idIdentityService, apsUserRoleId, CONSTANTS.ROLES.APS_USER);
|
||||
activitiUser = await identityService.createIdentityUser();
|
||||
activitiUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.ACTIVITI_USER);
|
||||
await identityService.assignRole(activitiUser.idIdentityService, activitiUserRoleId, CONSTANTS.ROLES.ACTIVITI_USER);
|
||||
testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]);
|
||||
apsUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]);
|
||||
activitiUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.activiti_user]);
|
||||
noRoleUser = await identityService.createIdentityUser();
|
||||
await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiUserRoleId, CONSTANTS.ROLES.ACTIVITI_USER);
|
||||
await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiAdminRoleId, identityService.roles.activiti_admin);
|
||||
await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiUserRoleId, identityService.roles.activiti_user);
|
||||
|
||||
groupAps = await groupIdentityService.createIdentityGroup();
|
||||
apsAdminRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.APS_ADMIN);
|
||||
await groupIdentityService.assignRole(groupAps.id, apsAdminRoleId, CONSTANTS.ROLES.APS_ADMIN);
|
||||
activitiAdminRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
await groupIdentityService.assignRole(groupActiviti.id, activitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
apsAdminRoleId = await rolesService.getRoleIdByRoleName(identityService.roles.aps_admin);
|
||||
await groupIdentityService.assignRole(groupAps.id, apsAdminRoleId, identityService.roles.aps_admin);
|
||||
activitiAdminRoleId = await rolesService.getRoleIdByRoleName(identityService.roles.activiti_admin);
|
||||
await groupIdentityService.assignRole(groupActiviti.id, activitiAdminRoleId, identityService.roles.activiti_admin);
|
||||
groupNoRole = await groupIdentityService.createIdentityGroup();
|
||||
|
||||
await groupIdentityService.addClientRole(groupAps.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
|
||||
users = [`${apsUser.idIdentityService}`, `${activitiUser.idIdentityService}`, `${noRoleUser.idIdentityService}`];
|
||||
await groupIdentityService.addClientRole(groupAps.id, clientId, clientActivitiAdminRoleId, identityService.roles.activiti_admin);
|
||||
await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, identityService.roles.activiti_admin);
|
||||
users = [`${apsUser.idIdentityService}`, `${activitiUser.idIdentityService}`, `${noRoleUser.idIdentityService}`, `${testUser.idIdentityService}`];
|
||||
groups = [`${groupAps.id}`, `${groupActiviti.id}`, `${groupNoRole.id}`];
|
||||
|
||||
await settingsPage.setProviderBpmSso(
|
||||
browser.params.config.bpmHost,
|
||||
browser.params.config.oauth2.host,
|
||||
browser.params.config.identityHost);
|
||||
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
|
||||
loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
await identityService.deleteIdentityUser(users[i]);
|
||||
}
|
||||
@@ -135,7 +131,7 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
});
|
||||
|
||||
it('One role filtering', () => {
|
||||
peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}"]`);
|
||||
peopleGroupCloudComponentPage.enterPeopleRoles(`["${identityService.roles.aps_user}"]`);
|
||||
peopleCloudComponent.searchAssignee(apsUser.lastName);
|
||||
peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`);
|
||||
peopleCloudComponent.searchAssignee(activitiUser.lastName);
|
||||
@@ -145,7 +141,7 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
});
|
||||
|
||||
it('Multiple roles filtering', () => {
|
||||
peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}", "${CONSTANTS.ROLES.ACTIVITI_USER}"]`);
|
||||
peopleGroupCloudComponentPage.enterPeopleRoles(`["${identityService.roles.aps_user}", "${identityService.roles.activiti_user}"]`);
|
||||
peopleCloudComponent.searchAssignee(apsUser.lastName);
|
||||
peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`);
|
||||
peopleCloudComponent.searchAssignee(activitiUser.lastName);
|
||||
@@ -173,7 +169,7 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
});
|
||||
|
||||
it('One role filtering', () => {
|
||||
peopleGroupCloudComponentPage.enterGroupRoles(`["${CONSTANTS.ROLES.APS_ADMIN}"]`);
|
||||
peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.aps_admin}"]`);
|
||||
groupCloudComponentPage.searchGroups(groupAps.name);
|
||||
groupCloudComponentPage.checkGroupIsDisplayed(`${groupAps.name}`);
|
||||
groupCloudComponentPage.searchGroups(groupActiviti.name);
|
||||
@@ -183,7 +179,7 @@ xdescribe('People Groups Cloud Component', () => {
|
||||
});
|
||||
|
||||
it('Multiple roles filtering', () => {
|
||||
peopleGroupCloudComponentPage.enterGroupRoles(`["${CONSTANTS.ROLES.APS_ADMIN}", "${CONSTANTS.ROLES.ACTIVITI_ADMIN}"]`);
|
||||
peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.aps_admin}", "${identityService.roles.activiti_admin}"]`);
|
||||
groupCloudComponentPage.searchGroups(groupActiviti.name);
|
||||
groupCloudComponentPage.checkGroupIsDisplayed(`${groupActiviti.name}`);
|
||||
groupCloudComponentPage.searchGroups(groupAps.name);
|
||||
|
Reference in New Issue
Block a user