mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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:
@@ -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
|
||||
|
Reference in New Issue
Block a user