[ADF-3885]Change auth host path in cloud e2e tests (#4123)

This commit is contained in:
cristinaj 2019-01-09 16:55:41 +02:00 committed by Eugenio Romano
parent a19d2c99be
commit 968c65ff70
13 changed files with 72 additions and 37 deletions

View File

@ -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

View File

@ -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'];

View File

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

View File

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

View File

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

View File

@ -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) {

View File

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

View File

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

View File

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

View File

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

View File

@ -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
},

View File

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

View File

@ -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