From 5c5bb7f9b74de008b940d519b28cb9cbdf938cd6 Mon Sep 17 00:00:00 2001 From: cristinaj Date: Wed, 26 Jun 2019 21:47:09 +0300 Subject: [PATCH] [ADF-4576]Add new tests for application cloud component (#4873) * Add a new test * Revert file * Fix lint errors * Add a wait * fix roles constant uppercase * fix lint --- cspell.json | 3 +- .../apps-section-cloud.e2e.ts | 32 ++++++++++++-- .../edit-process-filters-component.e2e.ts | 2 +- .../edit-task-filters-component.e2e.ts | 2 +- .../form-field/dropdown-widget.e2e.ts | 2 +- .../people-group-cloud-component.e2e.ts | 44 +++++++++---------- ...people-group-cloud-filter-component.e2e.ts | 26 +++++------ .../process-custom-filters.e2e.ts | 2 +- .../process-filter-results.e2e.ts | 4 +- .../process-filters-cloud.e2e.ts | 2 +- .../process-header-cloud.e2e.ts | 2 +- .../process-list-cloud-component.e2e.ts | 2 +- .../process-list-selection-cloud.e2e.ts | 2 +- .../start-process-cloud.e2e.ts | 2 +- .../start-task-custom-app-cloud.e2e.ts | 4 +- .../start-task-form-cloud.e2e.ts | 2 +- .../task-filters-cloud.e2e.ts | 2 +- .../task-header-cloud.e2e.ts | 2 +- .../task-list-properties.e2e.ts | 2 +- .../task-list-selection.e2e.ts | 2 +- .../tasks-custom-filters.e2e.ts | 2 +- .../actions/identity/applications.service.ts | 42 ++++++++++++++++++ .../core/actions/identity/identity.service.ts | 11 ++--- .../lib/core/actions/identity/public-api.ts | 1 + .../app/app-list-cloud.page.ts | 12 +++++ 25 files changed, 146 insertions(+), 63 deletions(-) create mode 100644 lib/testing/src/lib/core/actions/identity/applications.service.ts diff --git a/cspell.json b/cspell.json index 473b064741..0d69f62980 100644 --- a/cspell.json +++ b/cspell.json @@ -126,7 +126,8 @@ "uncheck", "subfolders", "ECMBPM", - "processwithvariables" + "processwithvariables", + "devops" ], "dictionaries": [ "html", diff --git a/e2e/process-services-cloud/apps-section-cloud.e2e.ts b/e2e/process-services-cloud/apps-section-cloud.e2e.ts index a5e12182f9..c9eb37b9cc 100644 --- a/e2e/process-services-cloud/apps-section-cloud.e2e.ts +++ b/e2e/process-services-cloud/apps-section-cloud.e2e.ts @@ -16,7 +16,7 @@ */ import { browser } from 'protractor'; -import { ApiService, IdentityService, LoginSSOPage, SettingsPage } from '@alfresco/adf-testing'; +import { ApiService, IdentityService, LoginSSOPage, SettingsPage, LocalStorageUtil, ApplicationsService } from '@alfresco/adf-testing'; import { AppListCloudPage } from '@alfresco/adf-testing'; import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import resources = require('../util/resources'); @@ -29,18 +29,31 @@ describe('Applications list', () => { const appListCloudPage = new AppListCloudPage(); const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name; let identityService: IdentityService; + let applicationsService: ApplicationsService; let testUser; + const appNames = []; + let applications; const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, 'BPM'); beforeAll(async (done) => { await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password); identityService = new IdentityService(apiService); - testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER, identityService.ROLES.APS_DEVOPS_USER]); await settingsPage.setProviderBpmSso( browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.identityHost); loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password); + await apiService.login(testUser.email, testUser.password); + applicationsService = new ApplicationsService(apiService); + applications = await applicationsService.getApplicationsByStatus('RUNNING'); + + applications.list.entries.forEach(async (app) => { + appNames.push(app.entry.name.toLowerCase()); + }); + + await LocalStorageUtil.setConfigField('alfresco-deployed-apps', '[]'); + done(); }); @@ -50,11 +63,24 @@ describe('Applications list', () => { done(); }); + it('[C310373] Should all the app with running state be displayed on dashboard when alfresco-deployed-apps is not used in config file', async () => { + navigationBarPage.navigateToProcessServicesCloudPage(); + appListCloudPage.checkApsContainer(); + + appListCloudPage.getNameOfTheApplications().then((list) => { + expect(JSON.stringify(list) === JSON.stringify(appNames)).toEqual(true); + }); + }); + it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => { + browser.refresh(); navigationBarPage.navigateToProcessServicesCloudPage(); appListCloudPage.checkApsContainer(); appListCloudPage.checkAppIsDisplayed(simpleApp); - appListCloudPage.goToApp(simpleApp); + appListCloudPage.checkAppIsDisplayed(resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.name); + appListCloudPage.checkAppIsDisplayed(resources.ACTIVITI7_APPS.SUB_PROCESS_APP.name); + + expect(appListCloudPage.countAllApps()).toEqual(3); }); }); diff --git a/e2e/process-services-cloud/edit-process-filters-component.e2e.ts b/e2e/process-services-cloud/edit-process-filters-component.e2e.ts index 3b0826153c..50d79e9a85 100644 --- a/e2e/process-services-cloud/edit-process-filters-component.e2e.ts +++ b/e2e/process-services-cloud/edit-process-filters-component.e2e.ts @@ -43,7 +43,7 @@ describe('Edit process filters cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/edit-task-filters-component.e2e.ts b/e2e/process-services-cloud/edit-task-filters-component.e2e.ts index 3f72f7a338..b94c50c038 100644 --- a/e2e/process-services-cloud/edit-task-filters-component.e2e.ts +++ b/e2e/process-services-cloud/edit-task-filters-component.e2e.ts @@ -44,7 +44,7 @@ describe('Edit task filters cloud', () => { identityService = new IdentityService(apiService); groupIdentityService = new GroupIdentityService(apiService); tasksService = new TasksService(apiService); - testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts b/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts index 28e213a3bb..a4802b0d3c 100644 --- a/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts +++ b/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts @@ -56,7 +56,7 @@ describe('Form Field Component - Dropdown Widget', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/people-group-cloud-component.e2e.ts b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts index becdb10e0b..ec6183d4a5 100644 --- a/e2e/process-services-cloud/people-group-cloud-component.e2e.ts +++ b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts @@ -62,27 +62,27 @@ describe('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, identityService.roles.activiti_admin); - clientActivitiUserRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, identityService.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); - 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]); + 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, identityService.roles.activiti_admin); - await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiUserRoleId, identityService.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(identityService.roles.aps_admin); - apsUserRoleId = await rolesService.getRoleIdByRoleName(identityService.roles.aps_user); - await groupIdentityService.assignRole(groupAps.id, apsAdminRoleId, identityService.roles.aps_admin); - await groupIdentityService.assignRole(groupAps.id, apsUserRoleId, identityService.roles.aps_user); - activitiAdminRoleId = await rolesService.getRoleIdByRoleName(identityService.roles.activiti_admin); - await groupIdentityService.assignRole(groupActiviti.id, activitiAdminRoleId, identityService.roles.activiti_admin); + apsAdminRoleId = await rolesService.getRoleIdByRoleName(identityService.ROLES.APS_ADMIN); + apsUserRoleId = await rolesService.getRoleIdByRoleName(identityService.ROLES.APS_USER); + await groupIdentityService.assignRole(groupAps.id, apsAdminRoleId, identityService.ROLES.APS_ADMIN); + await groupIdentityService.assignRole(groupAps.id, apsUserRoleId, identityService.ROLES.APS_USER); + 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, identityService.roles.activiti_admin); - await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, identityService.roles.activiti_admin); + 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}`]; @@ -134,7 +134,7 @@ describe('People Groups Cloud Component', () => { }); it('One role filtering', () => { - peopleGroupCloudComponentPage.enterPeopleRoles(`["${identityService.roles.aps_user}"]`); + peopleGroupCloudComponentPage.enterPeopleRoles(`["${identityService.ROLES.APS_USER}"]`); peopleCloudComponent.searchAssignee(apsUser.lastName); peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`); peopleCloudComponent.searchAssignee(activitiUser.lastName); @@ -144,7 +144,7 @@ describe('People Groups Cloud Component', () => { }); it('Multiple roles filtering', () => { - peopleGroupCloudComponentPage.enterPeopleRoles(`["${identityService.roles.aps_user}", "${identityService.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); @@ -172,7 +172,7 @@ describe('People Groups Cloud Component', () => { }); it('One role filtering', () => { - peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.aps_admin}"]`); + peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.ROLES.APS_ADMIN}"]`); groupCloudComponentPage.searchGroups(groupAps.name); groupCloudComponentPage.checkGroupIsDisplayed(groupAps.name); groupCloudComponentPage.searchGroups(groupActiviti.name); @@ -182,7 +182,7 @@ describe('People Groups Cloud Component', () => { }); it('[C309996] Should be able to filter groups based on composite roles Activit_Admin', () => { - peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.activiti_admin}"]`); + peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.ROLES.ACTIVITI_ADMIN}"]`); groupCloudComponentPage.searchGroups(groupActiviti.name); groupCloudComponentPage.checkGroupIsDisplayed(groupActiviti.name); groupCloudComponentPage.searchGroups(groupNoRole.name); @@ -192,7 +192,7 @@ describe('People Groups Cloud Component', () => { }); it('[C309996] Should be able to filter groups based on composite roles Aps_User', () => { - peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.aps_user}"]`); + peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.ROLES.APS_USER}"]`); groupCloudComponentPage.searchGroups(groupActiviti.name); groupCloudComponentPage.checkGroupIsNotDisplayed(groupActiviti.name); groupCloudComponentPage.searchGroups(groupNoRole.name); @@ -202,7 +202,7 @@ describe('People Groups Cloud Component', () => { }); it('[C309996] Should be able to filter groups based on composite roles Activiti_User', () => { - peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.activiti_user}"]`); + peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.ROLES.ACTIVITI_USER}"]`); groupCloudComponentPage.searchGroups(groupActiviti.name); groupCloudComponentPage.checkGroupIsNotDisplayed(groupActiviti.name); groupCloudComponentPage.searchGroups(groupNoRole.name); @@ -212,7 +212,7 @@ describe('People Groups Cloud Component', () => { }); it('Multiple roles filtering', () => { - peopleGroupCloudComponentPage.enterGroupRoles(`["${identityService.roles.aps_admin}", "${identityService.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); diff --git a/e2e/process-services-cloud/people-group-cloud-filter-component.e2e.ts b/e2e/process-services-cloud/people-group-cloud-filter-component.e2e.ts index ea8cbfaec1..c7bd2f2a92 100644 --- a/e2e/process-services-cloud/people-group-cloud-filter-component.e2e.ts +++ b/e2e/process-services-cloud/people-group-cloud-filter-component.e2e.ts @@ -60,25 +60,25 @@ describe('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, identityService.roles.activiti_admin); - clientActivitiUserRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, identityService.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); - 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]); + 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, identityService.roles.activiti_admin); - await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiUserRoleId, identityService.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(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); + 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, identityService.roles.activiti_admin ); - await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, identityService.roles.activiti_admin ); + 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}`]; diff --git a/e2e/process-services-cloud/process-custom-filters.e2e.ts b/e2e/process-services-cloud/process-custom-filters.e2e.ts index d462f2a24f..aeb2c8d73b 100644 --- a/e2e/process-services-cloud/process-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/process-custom-filters.e2e.ts @@ -61,7 +61,7 @@ describe('Process list cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/process-filter-results.e2e.ts b/e2e/process-services-cloud/process-filter-results.e2e.ts index 74475c0ea1..139f804cc0 100644 --- a/e2e/process-services-cloud/process-filter-results.e2e.ts +++ b/e2e/process-services-cloud/process-filter-results.e2e.ts @@ -67,8 +67,8 @@ describe('Process filters cloud', () => { 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]); - anotherUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); + anotherUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/process-filters-cloud.e2e.ts b/e2e/process-services-cloud/process-filters-cloud.e2e.ts index ba0d5a89ce..4f9eeef252 100644 --- a/e2e/process-services-cloud/process-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/process-filters-cloud.e2e.ts @@ -61,7 +61,7 @@ describe('Process filters cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/process-header-cloud.e2e.ts b/e2e/process-services-cloud/process-header-cloud.e2e.ts index 4a71693b78..696500f04c 100644 --- a/e2e/process-services-cloud/process-header-cloud.e2e.ts +++ b/e2e/process-services-cloud/process-header-cloud.e2e.ts @@ -73,7 +73,7 @@ describe('Process Header cloud component', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/process-list-cloud-component.e2e.ts b/e2e/process-services-cloud/process-list-cloud-component.e2e.ts index f43276d776..7568c79ff6 100644 --- a/e2e/process-services-cloud/process-list-cloud-component.e2e.ts +++ b/e2e/process-services-cloud/process-list-cloud-component.e2e.ts @@ -55,7 +55,7 @@ describe('Process list cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/process-list-selection-cloud.e2e.ts b/e2e/process-services-cloud/process-list-selection-cloud.e2e.ts index e3e8cf2295..580b9f8d0d 100644 --- a/e2e/process-services-cloud/process-list-selection-cloud.e2e.ts +++ b/e2e/process-services-cloud/process-list-selection-cloud.e2e.ts @@ -52,7 +52,7 @@ describe('Process list cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/start-process-cloud.e2e.ts b/e2e/process-services-cloud/start-process-cloud.e2e.ts index aee66a6203..1af4bff66d 100644 --- a/e2e/process-services-cloud/start-process-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-process-cloud.e2e.ts @@ -51,7 +51,7 @@ describe('Start Process', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); await settingsPage.setProviderBpmSso( diff --git a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts index f90d9dc89b..00f4a79262 100644 --- a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts @@ -58,8 +58,8 @@ describe('Start Task', () => { identityService = new IdentityService(apiService); groupIdentityService = new GroupIdentityService(apiService); - testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); - apsUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user, identityService.roles.activiti_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); + apsUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER, identityService.ROLES.ACTIVITI_USER]); activitiUser = await identityService.createIdentityUser(); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); diff --git a/e2e/process-services-cloud/start-task-form-cloud.e2e.ts b/e2e/process-services-cloud/start-task-form-cloud.e2e.ts index 12e70eae4d..0eb5ac0d17 100644 --- a/e2e/process-services-cloud/start-task-form-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-form-cloud.e2e.ts @@ -70,7 +70,7 @@ describe('Start Task Form', () => { identityService = new IdentityService(apiService); groupIdentityService = new GroupIdentityService(apiService); - testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); await apiService.login(testUser.email, testUser.password); diff --git a/e2e/process-services-cloud/task-filters-cloud.e2e.ts b/e2e/process-services-cloud/task-filters-cloud.e2e.ts index 6096af3f4d..c9791119e7 100644 --- a/e2e/process-services-cloud/task-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/task-filters-cloud.e2e.ts @@ -43,7 +43,7 @@ describe('Task filters cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/task-header-cloud.e2e.ts b/e2e/process-services-cloud/task-header-cloud.e2e.ts index 4c3d66bf6f..3a39c031d3 100644 --- a/e2e/process-services-cloud/task-header-cloud.e2e.ts +++ b/e2e/process-services-cloud/task-header-cloud.e2e.ts @@ -57,7 +57,7 @@ describe('Task Header cloud component', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/task-list-properties.e2e.ts b/e2e/process-services-cloud/task-list-properties.e2e.ts index 9e58510e25..3b0a16adc8 100644 --- a/e2e/process-services-cloud/task-list-properties.e2e.ts +++ b/e2e/process-services-cloud/task-list-properties.e2e.ts @@ -64,7 +64,7 @@ describe('Edit task filters and task list properties', () => { tasksService = new TasksService(apiService); const settingsPage = new SettingsPage(); - testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.roles.aps_user]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/task-list-selection.e2e.ts b/e2e/process-services-cloud/task-list-selection.e2e.ts index be4d40612f..39d9a1a8c7 100644 --- a/e2e/process-services-cloud/task-list-selection.e2e.ts +++ b/e2e/process-services-cloud/task-list-selection.e2e.ts @@ -50,7 +50,7 @@ describe('Task list cloud - selection', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts index 824a284aa6..19f87f1c67 100644 --- a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts @@ -64,7 +64,7 @@ describe('Task filters cloud', () => { 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]); + testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); diff --git a/lib/testing/src/lib/core/actions/identity/applications.service.ts b/lib/testing/src/lib/core/actions/identity/applications.service.ts new file mode 100644 index 0000000000..3c22ac6c13 --- /dev/null +++ b/lib/testing/src/lib/core/actions/identity/applications.service.ts @@ -0,0 +1,42 @@ +/*! + * @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 } from '../api.service'; + +export class ApplicationsService { + + api: ApiService; + + constructor(api: ApiService) { + this.api = api; + } + + async getApplicationsByStatus(status) { + try { + const path = '/deployment-service/v1/applications'; + const method = 'GET'; + + const queryParams = {'status': status}, postBody = {}; + + return await this.api.performBpmOperation(path, method, queryParams, postBody); + } catch (error) { + // tslint:disable-next-line:no-console + console.log('Get Applications - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text); + } + } + +} diff --git a/lib/testing/src/lib/core/actions/identity/identity.service.ts b/lib/testing/src/lib/core/actions/identity/identity.service.ts index 79dd66773c..2f0fe63259 100644 --- a/lib/testing/src/lib/core/actions/identity/identity.service.ts +++ b/lib/testing/src/lib/core/actions/identity/identity.service.ts @@ -28,11 +28,12 @@ export class IdentityService { this.api = api; } - roles = { - aps_user: 'APS_USER', - activiti_user: 'ACTIVITI_USER', - aps_admin: 'APS_ADMIN', - activiti_admin: 'ACTIVITI_ADMIN' + ROLES = { + APS_USER: 'APS_USER', + ACTIVITI_USER: 'ACTIVITI_USER', + APS_ADMIN: 'APS_ADMIN', + ACTIVITI_ADMIN: 'ACTIVITI_ADMIN', + APS_DEVOPS_USER: 'APS_DEVOPS' }; async createIdentityUserWithRole(apiService: ApiService, roles: string[]) { diff --git a/lib/testing/src/lib/core/actions/identity/public-api.ts b/lib/testing/src/lib/core/actions/identity/public-api.ts index 1a5fe24bc1..0cb1aa3229 100644 --- a/lib/testing/src/lib/core/actions/identity/public-api.ts +++ b/lib/testing/src/lib/core/actions/identity/public-api.ts @@ -15,6 +15,7 @@ * limitations under the License. */ +export * from './applications.service'; export * from './identity.service'; export * from './group-identity.service'; export * from './roles.service'; diff --git a/lib/testing/src/lib/process-services-cloud/app/app-list-cloud.page.ts b/lib/testing/src/lib/process-services-cloud/app/app-list-cloud.page.ts index 9619014d2a..97d5238235 100644 --- a/lib/testing/src/lib/process-services-cloud/app/app-list-cloud.page.ts +++ b/lib/testing/src/lib/process-services-cloud/app/app-list-cloud.page.ts @@ -22,15 +22,27 @@ import { BrowserActions } from '../../core/utils/browser-actions'; export class AppListCloudPage { apsAppsContainer = element(by.css('adf-cloud-app-list')); + allApps = element.all(by.css('adf-cloud-app-details')); + nameOfAllApps = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')); + firstApp = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')).first(); checkApsContainer() { BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer); + BrowserVisibility.waitUntilElementIsVisible(this.firstApp); } goToApp(applicationName) { BrowserActions.clickExecuteScript('mat-card[title="' + applicationName + '"]'); } + countAllApps() { + return this.allApps.count(); + } + + getNameOfTheApplications() { + return this.nameOfAllApps.getText(); + } + checkAppIsNotDisplayed(applicationName) { const app = element(by.css('mat-card[title="' + applicationName + '"]')); return BrowserVisibility.waitUntilElementIsNotOnPage(app);