mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3885]Change auth host path in cloud e2e tests (#4123)
This commit is contained in:
committed by
Eugenio Romano
parent
a19d2c99be
commit
968c65ff70
@@ -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'];
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
});
|
||||
});
|
||||
|
@@ -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);
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
});
|
||||
|
@@ -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
|
||||
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user