diff --git a/.travis.yml b/.travis.yml index 8f2dc8eba7..395247eacb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,7 +132,7 @@ jobs: AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "core$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then - (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder core --skip-lint --use-dist || exit 1;); + (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" --host_bpm "$E2E_HOST_BPM" --host_identity "$E2E_HOST_IDENTITY" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder core --skip-lint --use-dist || exit 1;); fi - stage: e2e Test # Test process-services name: process-services @@ -168,7 +168,7 @@ jobs: AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then - (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services-cloud --skip-lint --use-dist || exit 1;); + (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" --host_bpm "$E2E_HOST_BPM" --host_identity "$E2E_HOST_IDENTITY" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services-cloud --skip-lint --use-dist || exit 1;); fi - stage: e2e Test # Test insights name: insights diff --git a/e2e/actions/APS-cloud/apiservice.ts b/e2e/actions/APS-cloud/apiservice.ts index 83410737d4..1d75b3c5cb 100644 --- a/e2e/actions/APS-cloud/apiservice.ts +++ b/e2e/actions/APS-cloud/apiservice.ts @@ -21,12 +21,16 @@ import TestConfig = require('../../test.config'); export class ApiService { HOST_SSO = TestConfig.adf.hostSso; + HOST_BPM = TestConfig.adf.hostBPM; + HOST_IDENTITY = TestConfig.adf.hostIdentity; apiService = new AlfrescoApi({ provider: 'BPM', + bpmHost: `${this.HOST_BPM}`, + identityHost: `${this.HOST_IDENTITY}`, authType: 'OAUTH', oauth2: { - host: `${this.HOST_SSO}/auth/realms/springboot`, + host: `${this.HOST_SSO}`, authType: '/protocol/openid-connect/token', clientId: 'activiti', scope: 'openid', @@ -44,7 +48,25 @@ export class ApiService { } async performBpmOperation(path, method, queryParams, postBody) { - const uri = this.HOST_SSO + path; + const uri = this.HOST_BPM + path; + const pathParams = {}, formParams = {}; + const authNames = []; + const contentTypes = ['application/json']; + const accepts = ['application/json']; + + const headerParams = { + 'Authorization': 'bearer ' + this.apiService.oauth2Auth.token + }; + + return this.apiService.bpmClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, {}) + .catch((error) => { + throw (error); + }); + } + + async performIdentityOperation(path, method, queryParams, postBody) { + const uri = this.HOST_IDENTITY + path; const pathParams = {}, formParams = {}; const authNames = []; const contentTypes = ['application/json']; diff --git a/e2e/actions/APS-cloud/identity.ts b/e2e/actions/APS-cloud/identity.ts index 18a8755908..0137f7f696 100644 --- a/e2e/actions/APS-cloud/identity.ts +++ b/e2e/actions/APS-cloud/identity.ts @@ -42,7 +42,7 @@ export class Identity { } async createUser(username) { - const path = '/auth/admin/realms/springboot/users'; + const path = '/users'; const method = 'POST'; const queryParams = {}, postBody = { 'username': username, @@ -51,55 +51,55 @@ export class Identity { 'enabled': true, 'email': username + '@alfresco.com' }; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } async deleteUser(userId) { - const path = `/auth/admin/realms/springboot/users/${userId}`; + const path = `/users/${userId}`; const method = 'DELETE'; const queryParams = {}, postBody = { }; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } async getUserInfoByUsername(username) { - const path = `/auth/admin/realms/springboot/users`; + const path = `/users`; const method = 'GET'; const queryParams = { 'username' : username }, postBody = {}; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } async resetPassword(id, password) { - const path = `/auth/admin/realms/springboot/users/${id}/reset-password`; + const path = `/users/${id}/reset-password`; const method = 'PUT'; const queryParams = {}, postBody = {'type': 'password', 'value': password, 'temporary': false}; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } async getRoleByName(roleName) { - const path = `/auth/admin/realms/springboot/roles/${roleName}`; + const path = `/roles/${roleName}`; const method = 'GET'; const queryParams = {}, postBody = {}; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } async assignRole(userId, roleId, roleName) { - const path = `/auth/admin/realms/springboot/users/${userId}/role-mappings/realm`; + const path = `/users/${userId}/role-mappings/realm`; const method = 'POST'; const queryParams = {}, postBody = [{'id': roleId, 'name': roleName}]; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } diff --git a/e2e/core/login/login-sso/login-sso.e2e.ts b/e2e/core/login/login-sso/login-sso.e2e.ts index 26e88ae557..cf3248ed6d 100644 --- a/e2e/core/login/login-sso/login-sso.e2e.ts +++ b/e2e/core/login/login-sso/login-sso.e2e.ts @@ -26,7 +26,6 @@ describe('Login component - SSO', () => { const settingsPage = new SettingsPage(); const loginApsPage = new LoginSSOPage(); const navigationBarPage = new NavigationBarPage(); - const path = '/auth/realms/springboot'; let silentLogin; afterEach(() => { @@ -37,13 +36,13 @@ describe('Login component - SSO', () => { it('[C261050] Should be possible login in the PS with SSO', () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); loginApsPage.clickOnSSOButton(); loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); }); it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', () => { - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso); loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); }); }); diff --git a/e2e/core/user-info-component-cloud.e2e.ts b/e2e/core/user-info-component-cloud.e2e.ts index 8377afc59b..b13004fc81 100644 --- a/e2e/core/user-info-component-cloud.e2e.ts +++ b/e2e/core/user-info-component-cloud.e2e.ts @@ -30,14 +30,13 @@ describe('User Info - SSO', () => { const navigationBarPage = new NavigationBarPage(); const userInfoDialog = new UserInfoDialog(); const identityService: Identity = new Identity(); - const path = '/auth/realms/springboot'; let silentLogin, identityUser; beforeAll(async () => { await identityService.init(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); identityUser = await identityService.createIdentityUser(); silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); loginSSOPage.clickOnSSOButton(); browser.ignoreSynchronization = true; loginSSOPage.loginAPS(identityUser['0'].username, identityUser['0'].password); diff --git a/e2e/pages/adf/loginSSOPage.ts b/e2e/pages/adf/loginSSOPage.ts index 990bab9d4c..e91fe9e48c 100644 --- a/e2e/pages/adf/loginSSOPage.ts +++ b/e2e/pages/adf/loginSSOPage.ts @@ -23,7 +23,7 @@ export class LoginSSOPage { ssoButton = element(by.css(`[data-automation-id="login-button-sso"]`)); usernameField = element(by.id('username')); passwordField = element(by.id('password')); - loginButton = element(by.id('kc-login')); + loginButton = element(by.css('input[class="submit"]')); header = element(by.id('adf-header')); loginAPS(username, password) { diff --git a/e2e/process-services-cloud/apps-section-cloud.e2e.ts b/e2e/process-services-cloud/apps-section-cloud.e2e.ts index 718b4a5f1d..67cfd38b2e 100644 --- a/e2e/process-services-cloud/apps-section-cloud.e2e.ts +++ b/e2e/process-services-cloud/apps-section-cloud.e2e.ts @@ -27,12 +27,10 @@ describe('Applications list', () => { const loginSSOPage = new LoginSSOPage(); const navigationBarPage = new NavigationBarPage(); const appListCloudComponent = new AppListCloudComponent(); - const path = '/auth/realms/springboot'; - const appName = 'task-app'; + const appName = 'simple-app'; it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => { - - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso); loginSSOPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); navigationBarPage.navigateToProcessServicesCloudPage(); appListCloudComponent.checkApsContainer(); diff --git a/e2e/process-services-cloud/process-custom-filters.e2e.ts b/e2e/process-services-cloud/process-custom-filters.e2e.ts index 6fa5e83ad4..623498f747 100644 --- a/e2e/process-services-cloud/process-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/process-custom-filters.e2e.ts @@ -44,7 +44,6 @@ describe('Process list cloud', () => { const processInstancesService: ProcessInstances = new ProcessInstances(); const queryService: Query = new Query(); - const path = '/auth/realms/springboot'; let silentLogin; let runningProcess, completedProcess; const simpleApp = 'candidateuserapp'; @@ -52,7 +51,7 @@ describe('Process list cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); diff --git a/e2e/process-services-cloud/process-filters-cloud.e2e.ts b/e2e/process-services-cloud/process-filters-cloud.e2e.ts index 0002ab0f59..9bdda6c63c 100644 --- a/e2e/process-services-cloud/process-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/process-filters-cloud.e2e.ts @@ -44,7 +44,6 @@ describe('Process filters cloud', () => { const processInstancesService: ProcessInstances = new ProcessInstances(); const queryService: Query = new Query(); - const path = '/auth/realms/springboot'; let silentLogin; let runningProcess, completedProcess; const simpleApp = 'candidateuserapp'; @@ -52,7 +51,7 @@ describe('Process filters cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); diff --git a/e2e/process-services-cloud/task-filters-cloud.e2e.ts b/e2e/process-services-cloud/task-filters-cloud.e2e.ts index 3a0c586afe..83a03b797a 100644 --- a/e2e/process-services-cloud/task-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/task-filters-cloud.e2e.ts @@ -35,14 +35,13 @@ describe('Task filters cloud', () => { const tasksService: Tasks = new Tasks(); const user = TestConfig.adf.adminEmail, password = TestConfig.adf.adminPassword; - const path = '/auth/realms/springboot'; let silentLogin; const newTask = 'newTask', completedTask = 'completedTask1'; const simpleApp = 'simple-app'; beforeAll(() => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); }); diff --git a/e2e/test.config.js b/e2e/test.config.js index 2a4e0d63e0..b4b2109874 100644 --- a/e2e/test.config.js +++ b/e2e/test.config.js @@ -4,7 +4,9 @@ */ var HOST = process.env.URL_HOST_ADF; +const HOST_BPM = process.env.URL_HOST_BPM_ADF; const HOST_SSO = process.env.URL_HOST_SSO_ADF; +const HOST_IDENTITY = process.env.URL_HOST_IDENTITY; var USERNAME = process.env.USERNAME_ADF; var PASSWORD = process.env.PASSWORD_ADF; var EMAIL = process.env.EMAIL_ADF; @@ -48,7 +50,11 @@ module.exports = { */ adminPassword: PASSWORD, - hostSso: "http://" + HOST_SSO + hostBPM: "http://" + HOST_BPM, + + hostSso: "http://" + HOST_SSO, + + hostIdentity: "http://" + HOST_IDENTITY }, diff --git a/lib/core/userinfo/services/identity-user.service.ts b/lib/core/userinfo/services/identity-user.service.ts index 18820c9459..28ed775bbc 100644 --- a/lib/core/userinfo/services/identity-user.service.ts +++ b/lib/core/userinfo/services/identity-user.service.ts @@ -142,11 +142,11 @@ export class IdentityUserService { } private buildUserUrl(): any { - return `${this.appConfigService.get('bpmHost')}/auth/admin/realms/springboot/users`; + return `${this.appConfigService.get('identityHost')}/users`; } private buildRolesUrl(userId: string): any { - return `${this.appConfigService.get('bpmHost')}/auth/admin/realms/springboot/users/${userId}/role-mappings/realm/composite`; + return `${this.appConfigService.get('identityHost')}/users/${userId}/role-mappings/realm/composite`; } } diff --git a/scripts/test-e2e-lib.sh b/scripts/test-e2e-lib.sh index e902715ac1..ad43a018e8 100755 --- a/scripts/test-e2e-lib.sh +++ b/scripts/test-e2e-lib.sh @@ -22,7 +22,9 @@ show_help() { echo "-proxy or --proxy proxy Back end URL to use only possibel to use with -dev option" echo "-dev or --dev run it against local development environment it will deploy on localhost:4200 the current version of your branch" echo "-host or --host URL of the Front end to test" - echo "-host_sso or --host URL of the Back end to test" + echo "-host_bpm URL of the Back end to test" + echo "-host_identity URL of the identity service backend to test" + echo "-host_sso the entire path including the name of the realm" echo "-save save the error screenshot in the remote env" echo "-timeout or --timeout override the timeout foe the wait utils" echo "-sl --skip-lint skip lint" @@ -44,10 +46,18 @@ set_host(){ HOST=$1 } +set_host_bpm(){ + HOST_BPM=$1 +} + set_host_sso(){ HOST_SSO=$1 } +set_host_identity(){ + HOST_IDENTITY=$1 +} + set_test(){ SINGLE_TEST=true NAME_TEST=$1 @@ -122,7 +132,9 @@ while [[ $1 == -* ]]; do -proxy|--proxy) set_proxy $2; shift 2;; -s|--seleniumServer) set_selenium $2; shift 2;; -host|--host) set_host $2; shift 2;; - -host_sso|--host_sso) set_host_sso $2; shift 2;; + -host_bpm|--host_bpm) set_host_bpm $2; shift 2;; + -host_sso|--host_sso) set_host_sso $2; shift 2;; + -host_identity|--host_identity) set_host_identity $2; shift 2;; -sl|--skip-lint) skip_lint; shift;; -m|--maxInstances) max_instances $2; shift 2;; -vjsapi) version_js_api $2; shift 2;; @@ -133,7 +145,9 @@ done rm -rf ./e2e/downloads/ rm -rf ./e2e-output/screenshots/ +export URL_HOST_BPM_ADF=$HOST_BPM export URL_HOST_SSO_ADF=$HOST_SSO +export URL_HOST_IDENTITY=$HOST_IDENTITY export URL_HOST_ADF=$HOST export USERNAME_ADF=$USERNAME export PASSWORD_ADF=$PASSWORD