mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Log class in e2e plus check PS cloud CS works before run test (#5057)
* check cs work on ps cloud add log class * fix env config
This commit is contained in:
parent
f698892973
commit
327bc56c02
@ -1,6 +1,7 @@
|
||||
git:
|
||||
depth: 3
|
||||
quiet: true
|
||||
|
||||
language: node_js
|
||||
dist: trusty
|
||||
sudo: required
|
||||
|
@ -3,15 +3,7 @@
|
||||
* @class config.test.config
|
||||
*/
|
||||
|
||||
let load_env_file = function () {
|
||||
let ENV_FILE = process.env.ENV_FILE;
|
||||
|
||||
if (ENV_FILE) {
|
||||
require('dotenv').config({path: ENV_FILE});
|
||||
}
|
||||
};
|
||||
|
||||
load_env_file();
|
||||
require('dotenv').config({path: process.env.ENV_FILE});
|
||||
|
||||
const HOST = process.env.URL_HOST_ADF;
|
||||
const HOST_BPM = process.env.URL_HOST_BPM_ADF;
|
||||
@ -62,10 +54,12 @@ if (LOG) {
|
||||
|
||||
module.exports = {
|
||||
|
||||
projectName :'ADF',
|
||||
projectName: 'ADF',
|
||||
|
||||
appConfig: appConfig,
|
||||
|
||||
log: LOG,
|
||||
|
||||
main: {
|
||||
timeout: TIMEOUT,
|
||||
rootPath: __dirname
|
||||
@ -211,4 +205,5 @@ module.exports = {
|
||||
|
||||
clientIdSso: "activiti"
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ApiService } from '../api.service';
|
||||
import { Logger } from '../../utils/logger';
|
||||
|
||||
export class ApplicationsService {
|
||||
|
||||
@ -34,8 +35,7 @@ export class ApplicationsService {
|
||||
|
||||
return 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);
|
||||
Logger.error('Get Applications - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import { ApiService } from '../api.service';
|
||||
import { UserModel } from '../../models/user.model';
|
||||
import { PersonBodyCreate } from '@alfresco/js-api';
|
||||
import { RolesService } from './roles.service';
|
||||
import { Logger } from '../../utils/logger';
|
||||
|
||||
export class IdentityService {
|
||||
|
||||
@ -101,8 +102,7 @@ export class IdentityService {
|
||||
|
||||
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Create User - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Create User - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,8 +140,7 @@ export class IdentityService {
|
||||
|
||||
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Add User To Group - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
Logger.error('Add User To Group - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ApiService } from '../api.service';
|
||||
import { Logger } from '../../utils/logger';
|
||||
|
||||
export class QueryService {
|
||||
|
||||
@ -34,8 +35,7 @@ export class QueryService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('get process-instances Service error');
|
||||
Logger.error('get process-instances Service error');
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +48,7 @@ export class QueryService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, {});
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('get subprocesses process-instances Service error');
|
||||
Logger.error('get subprocesses process-instances Service error');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ApiService } from '../api.service';
|
||||
import { Logger } from '../../utils/logger';
|
||||
|
||||
export class TasksService {
|
||||
|
||||
@ -38,8 +39,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
Logger.error('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,8 +57,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Create FormTask - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
Logger.error('Create FormTask - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +70,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
|
||||
}
|
||||
@ -86,8 +84,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Claim Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Claim Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,8 +97,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +117,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Get Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Get Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,8 +131,7 @@ export class TasksService {
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
return data.list.entries && data.list.entries.length > 0 ? data.list.entries[0].entry.id : null;
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Get Task Id - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Get Task Id - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,8 +145,7 @@ export class TasksService {
|
||||
|
||||
return this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
Logger.error('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
48
lib/testing/src/lib/core/utils/logger.ts
Normal file
48
lib/testing/src/lib/core/utils/logger.ts
Normal file
@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* @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 { browser } from 'protractor';
|
||||
|
||||
const infoColor = '\x1b[36m%s\x1b[0m',
|
||||
logColor = '\x1b[35m%s\x1b[0m',
|
||||
warnColor = '\x1b[33m%s\x1b[0m',
|
||||
errorColor = '\x1b[31m%s\x1b[0m';
|
||||
|
||||
/* tslint:disable:no-console */
|
||||
export class Logger {
|
||||
static info(...messages): void {
|
||||
if (browser.params.config.log) {
|
||||
console.log(infoColor, messages.join(''));
|
||||
}
|
||||
}
|
||||
|
||||
static log(...messages): void {
|
||||
if (browser.params.config.log) {
|
||||
console.log(logColor, messages.join(''));
|
||||
}
|
||||
}
|
||||
|
||||
static warn(...messages): void {
|
||||
if (browser.params.config.log) {
|
||||
console.log(warnColor, messages.join(''));
|
||||
}
|
||||
}
|
||||
|
||||
static error(...messages): void {
|
||||
console.log(errorColor, messages.join(''));
|
||||
}
|
||||
}
|
@ -23,3 +23,4 @@ export * from './local-storage.util';
|
||||
export * from './file-browser.util';
|
||||
export * from './form.util';
|
||||
export * from './date-util';
|
||||
export * from './logger';
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ApiService } from '../../core/actions/api.service';
|
||||
import { Logger } from '../../core/utils/logger';
|
||||
|
||||
export class ProcessDefinitionsService {
|
||||
|
||||
@ -35,11 +36,9 @@ export class ProcessDefinitionsService {
|
||||
return this.api.performBpmOperation(path, method, queryParams, {});
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`${appName} not present`);
|
||||
Logger.error(`${appName} not present`);
|
||||
} else if (error.status === 403) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`Access to the requested resource has been denied ${appName}`);
|
||||
Logger.error(`Access to the requested resource has been denied ${appName}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ApiService } from '../../core/actions/api.service';
|
||||
import { Logger } from '../../core/utils/logger';
|
||||
|
||||
export class ProcessInstancesService {
|
||||
|
||||
@ -40,7 +41,7 @@ export class ProcessInstancesService {
|
||||
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('create process-instances Service not working', error.message);
|
||||
Logger.error('create process-instances Service not working', error.message);
|
||||
}
|
||||
|
||||
}
|
||||
@ -56,7 +57,7 @@ export class ProcessInstancesService {
|
||||
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('suspend process-instances Service not working', error.message);
|
||||
Logger.error('suspend process-instances Service not working', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +72,7 @@ export class ProcessInstancesService {
|
||||
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('delete process-instances Service not working', error.message);
|
||||
Logger.error('delete process-instances Service not working', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ export class ProcessInstancesService {
|
||||
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('complete process-instances Service not working', error.message);
|
||||
Logger.error('complete process-instances Service not working', error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ export interface TestConfiguration {
|
||||
|
||||
appConfig: any;
|
||||
|
||||
log: boolean;
|
||||
|
||||
identityAdmin: {
|
||||
email: string,
|
||||
password: string
|
||||
|
@ -12,15 +12,11 @@ const argv = require('yargs').argv;
|
||||
const projectRoot = path.resolve(__dirname);
|
||||
const width = 1366, height = 768;
|
||||
|
||||
let load_env_file = function () {
|
||||
let ENV_FILE = process.env.ENV_FILE;
|
||||
let ENV_FILE = process.env.ENV_FILE;
|
||||
|
||||
if (ENV_FILE) {
|
||||
require('dotenv').config({ path: ENV_FILE });
|
||||
}
|
||||
};
|
||||
|
||||
load_env_file();
|
||||
if (ENV_FILE) {
|
||||
require('dotenv').config({ path: ENV_FILE });
|
||||
}
|
||||
|
||||
let HOST = process.env.URL_HOST_ADF;
|
||||
let BROWSER_RUN = !!process.env.BROWSER_RUN;
|
||||
@ -44,22 +40,10 @@ if (LOG) {
|
||||
console.log('SELENIUM_SERVER : ' + SELENIUM_SERVER);
|
||||
}
|
||||
|
||||
let browser_options = function () {
|
||||
let args_options = ['--incognito', `--window-size=${width},${height}`, '--disable-gpu', '--disable-web-security', '--disable-browser-side-navigation'];
|
||||
|
||||
if (BROWSER_RUN !== true) {
|
||||
args_options.push('--headless') ;
|
||||
}
|
||||
|
||||
return args_options;
|
||||
};
|
||||
|
||||
let args_options = browser_options();
|
||||
|
||||
let downloadFolder = path.join(__dirname, 'e2e/downloads');
|
||||
|
||||
let specs = () => {
|
||||
let specsToRun = './**/e2e/' + FOLDER + '/**/*.e2e.ts';
|
||||
let specsToRun = FOLDER ? './**/e2e/' + FOLDER + '/**/*.e2e.ts' : './**/e2e/**/*.e2e.ts';
|
||||
|
||||
if (LIST_SPECS.length === 0) {
|
||||
arraySpecs = [specsToRun];
|
||||
@ -100,7 +84,12 @@ exports.config = {
|
||||
'default_directory': downloadFolder
|
||||
}
|
||||
},
|
||||
args: args_options
|
||||
args: ['--incognito',
|
||||
`--window-size=${width},${height}`,
|
||||
'--disable-gpu',
|
||||
'--disable-web-security',
|
||||
'--disable-browser-side-navigation',
|
||||
...(BROWSER_RUN === true ? [] : ['--headless'])]
|
||||
}
|
||||
},
|
||||
|
||||
@ -162,6 +151,7 @@ exports.config = {
|
||||
require('ts-node').register({
|
||||
project: 'e2e/tsconfig.e2e.json'
|
||||
});
|
||||
|
||||
require("tsconfig-paths").register({
|
||||
project: 'e2e/tsconfig.e2e.json',
|
||||
baseUrl: 'e2e/',
|
||||
|
@ -16,6 +16,8 @@ RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2
|
||||
if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || $TRAVIS_PULL_REQUEST == "false" ]];
|
||||
then
|
||||
node ./scripts/check-env/check-activiti-env.js --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --client 'activiti' || exit 1
|
||||
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1
|
||||
|
||||
$RUN_E2E --folder $CONTEXT_ENV
|
||||
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
|
||||
then
|
||||
|
Loading…
x
Reference in New Issue
Block a user