[AAE-7246] fix eslint warnings for Testing project (#7490)

* fix eslint warnings for Testing project

* fix lint issue
This commit is contained in:
Denys Vuika
2022-02-08 13:34:56 +00:00
committed by GitHub
parent 670d2befdc
commit 765badc721
38 changed files with 237 additions and 285 deletions

View File

@@ -20,19 +20,6 @@
"eslint-plugin-rxjs"
],
"rules": {
"jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"no-underscore-dangle": "warn",
"no-shadow": "warn",
"quote-props": "warn",
"object-shorthand": "warn",
"prefer-const": "warn",
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "warn",
"space-before-function-paren": "warn",
"@angular-eslint/component-selector": [
"error",
{

View File

@@ -53,6 +53,7 @@ export class UploadActions {
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
const filesRequest = [];
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < emptyFileNames.length; i++) {
const jsonItem = {};
jsonItem['name'] = emptyFileNames[i];
@@ -60,7 +61,7 @@ export class UploadActions {
filesRequest.push(jsonItem);
}
return this.nodesApi.createNode(parentFolderId, <any> filesRequest, {});
return this.nodesApi.createNode(parentFolderId, filesRequest as any, {});
}
async createFolder(folderName, parentFolderId): Promise<NodeEntry> {

View File

@@ -20,10 +20,7 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class RatePage {
private ratingsCounter = $(`div[id="adf-rating-counter"]`);
private coloredStar = async (rateValue: number) => $(`span[id="adf-rate-${rateValue}"] mat-icon`);
private greyStar = async (rateValue: number) => $(`mat-icon[id="adf-grey-star-${rateValue}"]`);
async rateComponent(rateValue: number) {
const unratedStar = await this.coloredStar(rateValue);
@@ -64,4 +61,6 @@ export class RatePage {
return BrowserActions.getColor(coloredStar);
}
private coloredStar = async (rateValue: number) => $(`span[id="adf-rate-${rateValue}"] mat-icon`);
private greyStar = async (rateValue: number) => $(`mat-icon[id="adf-grey-star-${rateValue}"]`);
}

View File

@@ -20,10 +20,10 @@ import { ApiService } from '../../../shared/api/api.service';
import { Logger } from '../utils/logger';
import { browser } from 'protractor';
export function createApiService(
export const createApiService = (
/** @deprecated */
appConfigOverride: Partial<AlfrescoApiConfig> = {}
) {
) => {
const patchedAppConfig = {
...browser.params.testConfig.appConfig,
oauth2: {
@@ -44,4 +44,4 @@ export function createApiService(
},
Logger
);
}
};

View File

@@ -20,11 +20,11 @@ import * as path from 'path';
import * as fs from 'fs';
import { BrowserActions } from '../utils/browser-actions';
const JS_BIND_INPUT = function(target) {
const JS_BIND_INPUT = (target) => {
const input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.addEventListener('change', function() {
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
@@ -32,7 +32,7 @@ const JS_BIND_INPUT = function(target) {
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach(function(name) {
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
@@ -46,13 +46,13 @@ const JS_BIND_INPUT = function(target) {
return input;
};
const JS_BIND_INPUT_FOLDER = function(target) {
const JS_BIND_INPUT_FOLDER = (target) => {
const input: any = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.multiple = true;
input.webkitdirectory = true;
input.addEventListener('change', function() {
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
@@ -60,7 +60,7 @@ const JS_BIND_INPUT_FOLDER = function(target) {
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach(function(name) {
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;

View File

@@ -15,6 +15,8 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { ApiService } from '../../../../shared/api/api.service';
import { UserModel } from '../../models/user.model';
import { RolesService } from './roles.service';
@@ -33,6 +35,7 @@ export class IdentityService {
async createIdentityUserWithRole(roles: string[]): Promise<any> {
const rolesService = new RolesService(this.api);
const user = await this.createIdentityUser();
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < roles.length; i++) {
const roleId = await rolesService.getRoleIdByRoleName(roles[i]);
await this.assignRole(user.idIdentityService, roleId, roles[i]);

View File

@@ -122,6 +122,7 @@ export class QueryService {
const postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < data.list.entries.length; i++) {
if (data.list.entries[i].entry.name === taskName) {
return data.list.entries[i];
@@ -148,6 +149,7 @@ export class QueryService {
const postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < data.list.entries.length; i++) {
if (data.list.entries[i].entry.name === taskName) {
return data.list.entries[i];
@@ -170,6 +172,7 @@ export class QueryService {
const postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < data.list.entries.length; i++) {
if (data.list.entries[i].entry.name === taskName) {
const task = data.list.entries[i];

View File

@@ -32,10 +32,7 @@ export class SearchService {
async isSearchable(name: string): Promise<any> {
const query = this.createSearchQuery(name);
const predicate = (result: ResultSetPaging) => {
return !!result?.list?.entries?.find(({ entry }) => entry.name === name);
};
const predicate = (result: ResultSetPaging) => !!result?.list?.entries?.find(({ entry }) => entry.name === name);
return this.performSearch(query, predicate, 'Failed to search folder');
}
@@ -56,29 +53,27 @@ export class SearchService {
async isUserSearchable(user: UserModel): Promise<any> {
const query = this.createUserSearchQuery(user);
const predicate = (result: ResultSetPaging) => {
return result.list && result.list.entries.length > 0 && !!result.list.entries.find(({ entry }) => entry.properties['cm:email'] === user.email);
};
const predicate = (result: ResultSetPaging) => result.list && result.list.entries.length > 0 && !!result.list.entries.find(({ entry }) => entry.properties['cm:email'] === user.email);
return this.performSearch(query, predicate, 'Failed to search user');
}
private createUserSearchQuery(user: UserModel) {
return {
'query': {
'query': `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*`
query: {
query: `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*`
},
'include': [
include: [
'aspectNames',
'properties'
],
'paging': {
'maxItems': 1,
'skipCount': 0
paging: {
maxItems: 1,
skipCount: 0
},
'filterQueries': [
filterQueries: [
{
'query': `TYPE:'cm:authority'`
query: `TYPE:'cm:authority'`
}
]
};
@@ -86,28 +81,28 @@ export class SearchService {
private createSearchQuery(name: string) {
return {
'query': {
'query': `${name}*`
query: {
query: `${name}*`
},
'include': [
include: [
'path',
'allowableOperations',
'properties'
],
'paging': {
'maxItems': 20,
'skipCount': 0
paging: {
maxItems: 20,
skipCount: 0
},
'filterQueries': [
filterQueries: [
{
'query': `TYPE:'cm:folder' OR TYPE:'cm:content'`
query: `TYPE:'cm:folder' OR TYPE:'cm:content'`
},
{
'query': 'NOT cm:creator:System'
query: 'NOT cm:creator:System'
}
],
'scope': {
'locations': [
scope: {
locations: [
'nodes'
]
}

View File

@@ -118,7 +118,7 @@ export class UsersActions {
}
async createUserWithName(firstName: string, lastName: string): Promise<UserModel> {
const user = new UserModel({ firstName: firstName, lastName: lastName });
const user = new UserModel({ firstName, lastName });
return this.createUser(user);
}

View File

@@ -20,6 +20,8 @@ import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
const MAX_LOADING_TIME = 120000;
export class DataTableComponentPage {
rootElement: ElementFinder;
@@ -38,8 +40,6 @@ export class DataTableComponentPage {
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
MAX_LOADING_TIME = 120000;
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
@@ -375,7 +375,7 @@ export class DataTableComponentPage {
if (await this.isSpinnerPresent()) {
Logger.log('wait datatable loading spinner disappear');
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
if (await this.isEmpty()) {
Logger.log('empty page');
@@ -389,7 +389,7 @@ export class DataTableComponentPage {
try {
Logger.log('wait datatable loading spinner is present');
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), 2000);
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
} catch (error) {
}
@@ -401,39 +401,6 @@ export class DataTableComponentPage {
}
}
private async isSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-spinner')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async isInfiniteSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-bar')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async waitFirstElementPresent(): Promise<void> {
try {
Logger.log('wait first element is present');
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
} catch (error) {
Logger.log('Possible empty page');
}
}
async waitTillContentLoadedInfinitePagination(): Promise<void> {
await browser.sleep(500);
@@ -615,4 +582,37 @@ export class DataTableComponentPage {
}
return '';
}
private async isSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-spinner')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async isInfiniteSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-bar')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async waitFirstElementPresent(): Promise<void> {
try {
Logger.log('wait first element is present');
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
} catch (error) {
Logger.log('Possible empty page');
}
}
}

View File

@@ -20,7 +20,6 @@ import { Locator, by, element, protractor, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DynamicTableWidgetPage {
formFields = new FormFields();
labelLocator: Locator = by.css('dynamic-table-widget div div');
@@ -36,8 +35,6 @@ export class DynamicTableWidgetPage {
dateWidget = $$('mat-datepicker-toggle button').first();
tableRow = $$('tbody tr');
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
getFieldLabel(fieldId: string): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
@@ -125,4 +122,6 @@ export class DynamicTableWidgetPage {
const present = await BrowserVisibility.waitUntilElementIsVisible(row);
await expect(present).toBe(true);
}
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
}

View File

@@ -83,6 +83,19 @@ export class DatePickerCalendarPage {
await this.checkDatePickerIsNotDisplayed();
}
async selectExactDate(date: Date): Promise<void> {
await this.checkDatePickerIsDisplayed();
await this.setDateUsingPeriodButton(date);
await this.checkDatePickerIsNotDisplayed();
}
async selectExactDateRange(start: Date, end: Date): Promise<void> {
await this.checkDatePickerIsDisplayed();
await this.setDateUsingPeriodButton(start);
await this.setDateUsingPeriodButton(end);
await this.checkDatePickerIsNotDisplayed();
}
private async setDateUsingPeriodButton(date: Date) {
const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
const year = date.getFullYear();
@@ -97,17 +110,4 @@ export class DatePickerCalendarPage {
await BrowserActions.click(monthElement);
await BrowserActions.click(dayElement);
}
async selectExactDate(date: Date): Promise<void> {
await this.checkDatePickerIsDisplayed();
await this.setDateUsingPeriodButton(date);
await this.checkDatePickerIsNotDisplayed();
}
async selectExactDateRange(start: Date, end: Date): Promise<void> {
await this.checkDatePickerIsDisplayed();
await this.setDateUsingPeriodButton(start);
await this.setDateUsingPeriodButton(end);
await this.checkDatePickerIsNotDisplayed();
}
}

View File

@@ -139,10 +139,12 @@ export class UserInfoPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.initialImage);
}
// eslint-disable-next-line @typescript-eslint/naming-convention
async ACSProfileImageNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.acsImage);
}
// eslint-disable-next-line @typescript-eslint/naming-convention
async APSProfileImageNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.apsImage);
}

View File

@@ -22,10 +22,9 @@ import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by, browser, protractor, $, $$ } from 'protractor';
import { Logger } from '../utils/logger';
const MAX_LOADING_TIME = 120000;
export class ViewerPage {
MAX_LOADING_TIME = 120000;
tabsPage = new TabsPage();
togglePage = new TogglePage();
@@ -121,29 +120,17 @@ export class ViewerPage {
if (await this.isSpinnerPresent()) {
Logger.log('wait spinner disappear');
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
} else {
try {
Logger.log('wait spinner is present');
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner')));
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
} catch (error) {
}
}
}
private async isSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await element(by.tagName('mat-progress-spinner')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
async clearPageNumber(): Promise<void> {
await BrowserActions.clearSendKeys(this.pageSelectorInput);
}
@@ -678,4 +665,16 @@ export class ViewerPage {
async expectUrlToContain(text: string): Promise<void> {
await expect(browser.getCurrentUrl()).toContain(text);
}
private async isSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await element(by.tagName('mat-progress-spinner')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
}

View File

@@ -28,6 +28,7 @@ export class TestElement {
/**
* Create a new instance with the element located by the id
*
* @param id The id of the element
*/
static byId(id: string): TestElement {
@@ -36,6 +37,7 @@ export class TestElement {
/**
* Create a new instance with the element located by the CSS class name
*
* @param selector The CSS class name to lookup
*/
static byCss(selector: string): TestElement {
@@ -44,6 +46,7 @@ export class TestElement {
/**
* Create a new instance with the element that contains specific text
*
* @param selector the CSS selector
* @param text the text within the target element
*/
@@ -53,6 +56,7 @@ export class TestElement {
/**
* Create a new instance with the element with specific HTML tag name
*
* @param selector the HTML tag name
*/
static byTag(selector: string): TestElement {
@@ -68,6 +72,7 @@ export class TestElement {
/**
* Checks that an element is present on the DOM of a page and visible
*
* @param waitTimeout How long to wait for the condition to be true
*/
async isVisible(waitTimeout?: number): Promise<boolean> {
@@ -81,6 +86,7 @@ export class TestElement {
/**
* Waits until the element is present on the DOM of a page and visible
*
* @param waitTimeout How long to wait for the condition to be true
*/
async waitVisible(waitTimeout?: number): Promise<any> {
@@ -89,6 +95,7 @@ export class TestElement {
/**
* Waits until the element is either invisible or not present on the DOM
*
* @param waitTimeout How long to wait for the condition to be true
*/
async waitNotVisible(waitTimeout?: number): Promise<any> {
@@ -97,6 +104,7 @@ export class TestElement {
/**
* Checks that an element is present on the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
*/
async isPresent(waitTimeout?: number): Promise<boolean> {
@@ -110,6 +118,7 @@ export class TestElement {
/**
* Waits until the element is present on the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
*/
async waitPresent(waitTimeout?: number): Promise<any> {
@@ -118,6 +127,7 @@ export class TestElement {
/**
* Waits until the element is not attached to the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
*/
async waitNotPresent(waitTimeout?: number): Promise<any> {
@@ -126,6 +136,7 @@ export class TestElement {
/**
* Waits until the given text is present in the elements value
*
* @param value the text to check
*/
async waitHasValue(value: string): Promise<any> {
@@ -159,6 +170,7 @@ export class TestElement {
/**
* Query for the value of the given attribute of the element.
*
* @param attributeName The name of the attribute to query.
*/
async getAttribute(attributeName: string): Promise<string> {
@@ -181,6 +193,7 @@ export class TestElement {
/**
* Enter the text
*
* @param text the text to enter
*/
async typeText(text: string): Promise<void> {

View File

@@ -28,8 +28,6 @@ export class ArrayUtil {
if (0 === subset.length) {
return false;
}
return subset.every(function (value) {
return (superset.indexOf(value) >= 0);
});
return subset.every((value) => (superset.indexOf(value) >= 0));
}
}

View File

@@ -27,10 +27,7 @@ export class BrowserActions {
static async clickUntilIsNotVisible(elementToClick: ElementFinder, elementToFind: ElementFinder): Promise<void> {
Logger.info(`Click until element is not present: ${elementToClick.locator().toString()}`);
const predicate = (isVisible: boolean) => {
return isVisible;
};
const predicate = (isVisible: boolean) => isVisible;
const apiCall = async () => {
await this.click(elementToClick);
@@ -119,11 +116,6 @@ export class BrowserActions {
}
}
// Don't make it pub,ic use getText
private static async getTextScript(elementFinder: ElementFinder): Promise<string> {
return browser.executeScript(`return arguments[0].textContent`, elementFinder);
}
static async getInputValue(elementFinder: ElementFinder): Promise<string> {
Logger.info(`Get Input value ${elementFinder.locator().toString()}`);
@@ -170,6 +162,7 @@ export class BrowserActions {
if (sleepTime === 0) {
await elementFinder.sendKeys(text);
} else {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < text.length; i++) {
await elementFinder.sendKeys(text[i]);
await browser.sleep(sleepTime);
@@ -215,4 +208,9 @@ export class BrowserActions {
stream.write(Buffer.from(pngData, 'base64'));
stream.end();
}
// Don't make it pub,ic use getText
private static async getTextScript(elementFinder: ElementFinder): Promise<string> {
return browser.executeScript(`return arguments[0].textContent`, elementFinder);
}
}

View File

@@ -20,8 +20,9 @@ import { Logger } from './logger';
import { falseIfMissing } from 'protractor/built/util';
export class BrowserVisibility {
// eslint-disable-next-line @typescript-eslint/naming-convention
static NOT_VISIBLE_DEFAULT_TIMEOUT = BrowserVisibility.getNoVisibleTimeout() ? browser.params.testConfig.timeouts.no_visible_timeout : 10000;
// eslint-disable-next-line @typescript-eslint/naming-convention
static DEFAULT_TIMEOUT = BrowserVisibility.getVisibleTimeout() ? browser.params.testConfig.timeouts.visible_timeout : 10000;
static getVisibleTimeout() {
@@ -93,15 +94,6 @@ export class BrowserVisibility {
return browser.wait(BrowserVisibility.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, `Element doesn\'t have a value ${elementValue} ${elementToCheck.locator()}`);
}
private static textToBePresentInElementValue(elementFinder: ElementFinder, text: string) {
const hasText = async () => {
return browser.executeScript(`return arguments[0].value`, elementFinder).then((actualText: string) => {
return actualText.indexOf(text) > -1;
}, falseIfMissing);
};
return protractor.ExpectedConditions.and(protractor.ExpectedConditions.presenceOf(elementFinder), hasText);
}
/*
* Wait for element to have text
*/
@@ -124,4 +116,10 @@ export class BrowserVisibility {
await this.waitUntilElementIsNotPresent(dialog);
}
private static textToBePresentInElementValue(elementFinder: ElementFinder, text: string) {
const hasText = async () => browser.executeScript(`return arguments[0].value`, elementFinder).then(
(actualText: string) => actualText.indexOf(text) > -1, falseIfMissing
);
return protractor.ExpectedConditions.and(protractor.ExpectedConditions.presenceOf(elementFinder), hasText);
}
}

View File

@@ -23,10 +23,7 @@ export class FileBrowserUtil {
static async isFileDownloaded(fileName: string): Promise<boolean> {
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
const file = await browser.driver.wait(() => {
return fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName));
}, 30000);
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000);
await expect(file).toBe(true, `${fileName} not downloaded`);

View File

@@ -47,8 +47,6 @@ export class FormUtil {
// @ts-ignore
const forms: any = await this.editorApi.getForms();
return forms.data.find((currentForm) => {
return currentForm.name === name;
});
return forms.data.find((currentForm) => currentForm.name === name);
}
}

View File

@@ -19,14 +19,12 @@ import { ElementFinder, browser } from 'protractor';
/**
* Tagged template to convert a sting to an `ElementFinder`.
*
* @example ```const item = byCss`.adf-breadcrumb-item-current`;```
* @example ```const item = byCss`${variable}`;```
* @returns Instance of `ElementFinder` type.
*/
export function byCss(
literals: TemplateStringsArray,
...placeholders: string[]
): ElementFinder {
export const byCss = (literals: TemplateStringsArray, ...placeholders: string[]): ElementFinder => {
const selector = literals[0] || placeholders[0];
return browser.$(selector);
}
};

View File

@@ -20,9 +20,8 @@ import { ApiService } from '../../../shared/api/api.service';
import { ApiUtil } from '../../../shared/api/api.util';
import { Logger } from './logger';
const DELAY_API_CALL = 5000;
export class WaitActions {
DELAY_API_CALL = 5000;
apiService: ApiService;
nodesApi: NodesApi;
@@ -32,13 +31,9 @@ export class WaitActions {
}
async nodeIsPresent(nodeId: string): Promise<NodeEntry | null> {
const predicate = (result) => {
return result.entry.id === nodeId;
};
const predicate = (result) => result.entry.id === nodeId;
const apiCall = async () => {
try {
return this.nodesApi.getNode(nodeId);
} catch (error) {
@@ -47,17 +42,13 @@ export class WaitActions {
}
};
return ApiUtil.waitForApi(apiCall, predicate, this.DELAY_API_CALL);
return ApiUtil.waitForApi(apiCall, predicate, DELAY_API_CALL);
}
async nodeIsUnlock(nodeId: string): Promise<NodeEntry | null> {
const predicate = (result) => {
return result.entry.isLocked === false;
};
const predicate = (result) => result.entry.isLocked === false;
const apiCall = async () => {
try {
return this.nodesApi.getNode(nodeId);
} catch (error) {
@@ -66,7 +57,6 @@ export class WaitActions {
}
};
return ApiUtil.waitForApi(apiCall, predicate, this.DELAY_API_CALL);
return ApiUtil.waitForApi(apiCall, predicate, DELAY_API_CALL);
}
}

View File

@@ -75,7 +75,7 @@ export class Application {
async getApplicationsByStatus(status: string): Promise<ResultSetPaging> {
Logger.info(`[Application] Return application by status: ${status}`);
return this.requestApiHelper.get<ResultSetPaging>(this.endPoint, {
queryParams: { status: status, sort: 'name' }
queryParams: { status, sort: 'name' }
});
}
}

View File

@@ -33,9 +33,9 @@ export class MessageEventsService {
const queryParams = {};
const postBody = {
'name': startMessage,
'variables': {},
'payloadType': 'StartMessagePayload',
name: startMessage,
variables: {},
payloadType: 'StartMessagePayload',
...options
};
@@ -54,9 +54,9 @@ export class MessageEventsService {
const queryParams = {};
const postBody = {
'name': receiveMessage,
'variables': {},
'payloadType': 'ReceiveMessagePayload',
name: receiveMessage,
variables: {},
payloadType: 'ReceiveMessagePayload',
...options
};
@@ -66,5 +66,4 @@ export class MessageEventsService {
Logger.error('Receive Message Event Service not working', error.message);
}
}
}

View File

@@ -25,12 +25,12 @@ import { StringUtil } from '../../../shared/utils/string.util';
import { Logger } from '../../core/utils/logger';
export class ProcessServices {
processInstancesService: ProcessInstancesService;
processDefinitionsService: ProcessDefinitionsService;
tasksService: TasksService;
queryService: QueryService;
private api: ApiService;
public processInstancesService: ProcessInstancesService;
public processDefinitionsService: ProcessDefinitionsService;
public tasksService: TasksService;
public queryService: QueryService;
constructor(api: ApiService) {
this.api = api;
@@ -40,7 +40,7 @@ export class ProcessServices {
this.queryService = new QueryService(this.api);
}
async createProcessInstanceAndClaimFirstTask(processDefName, appName, taskIndex: number = 0, processInstanceName?: string) {
async createProcessInstanceAndClaimFirstTask(processDefName: string, appName: string, taskIndex: number = 0, processInstanceName?: string) {
const processInstance = await this.createProcessInstance(processDefName, appName, processInstanceName);
const task = await this.queryService.getProcessInstanceTasks(processInstance.entry.id, appName);
await this.tasksService.claimTask(task.list.entries[taskIndex].entry.id, appName);
@@ -48,7 +48,7 @@ export class ProcessServices {
return processInstance;
}
async createProcessInstance(processDefName, appName, processInstanceName?: string) {
async createProcessInstance(processDefName: string, appName: string, processInstanceName?: string) {
const processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName);
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
@@ -58,12 +58,12 @@ export class ProcessServices {
return processInstance;
}
async createProcessInstanceWithVariables(processDefName, appName, variables: any, processInstanceName?: string) {
async createProcessInstanceWithVariables(processDefName: string, appName: string, variables: any, processInstanceName?: string) {
const processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName);
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString(),
variables: variables
variables
});
return processInstance;

View File

@@ -42,34 +42,22 @@ export class EditProcessFilterCloudComponentPage {
deleteButton = $('button[data-automation-id="adf-filter-action-delete"]');
filter = $(`adf-cloud-edit-process-filter mat-expansion-panel-header`);
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`);
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`);
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`);
private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`);
private locatorProcessDefinitionNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`);
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private locatorSuspendedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`);
private locatorStartedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`);
private locatorCompletedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`);
private locatorSuspendedDateRangeWithin = $(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`);
private content = TestElement.byCss('adf-cloud-edit-process-filter mat-expansion-panel [style*="visible"]');
appNameDropdown = new DropdownPage(this.locatorAppNameDropdown);
statusDropdown = new DropdownPage(this.locatorStatusDropdown);
sortDropdown = new DropdownPage(this.locatorSortDropdown);
orderDropdown = new DropdownPage(this.locatorOrderDropdown);
processDefinitionNameDropdown = new DropdownPage(this.locatorProcessDefinitionNameDropdown);
suspendedDateRangeDropdown = new DropdownPage(this.locatorSuspendedDateRangeDropdown);
startedDateRangeDropdown = new DropdownPage(this.locatorStartedDateRangeDropdown);
completedDateRangeDropdown = new DropdownPage(this.locatorCompletedDateRangeDropdown);
suspendedDateRangeWithin = new DatePickerPage(this.locatorSuspendedDateRangeWithin);
appNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`));
statusDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`));
sortDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`));
orderDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`));
processDefinitionNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`));
suspendedDateRangeDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`));
startedDateRangeDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`));
completedDateRangeDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`));
suspendedDateRangeWithin = new DatePickerPage($(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`));
peopleCloudComponent = new PeopleCloudComponentPage();
editProcessFilterDialogPage = new EditProcessFilterDialogPage();
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private content = TestElement.byCss('adf-cloud-edit-process-filter mat-expansion-panel [style*="visible"]');
editProcessFilterDialog(): EditProcessFilterDialogPage {
return this.editProcessFilterDialogPage;
}

View File

@@ -45,22 +45,13 @@ export class EditTaskFilterCloudComponentPage {
deleteButton = $('[data-automation-id="adf-filter-action-delete"]');
filter = $(`adf-cloud-edit-task-filter mat-expansion-panel-header`);
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`);
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`);
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`);
private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`);
private locatorCompletedDateDropdown = $(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`);
private locatorAssignmentDropdown = $(`.adf-task-assignment-filter`);
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]');
appNameDropdown = new DropdownPage(this.locatorAppNameDropdown);
statusDropdown = new DropdownPage(this.locatorStatusDropdown);
sortDropdown = new DropdownPage(this.locatorSortDropdown);
appNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`));
statusDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`));
sortDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`));
priorityDropdown = new DropdownPage(this.priority);
orderDropdown = new DropdownPage(this.locatorOrderDropdown);
completedDateDropdown = new DropdownPage(this.locatorCompletedDateDropdown);
assignmentDropdown = new DropdownPage(this.locatorAssignmentDropdown);
orderDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`));
completedDateDropdown = new DropdownPage($(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`));
assignmentDropdown = new DropdownPage($(`.adf-task-assignment-filter`));
editTaskFilterDialogPage = new EditTaskFilterDialogPage();
peopleCloudComponent = new PeopleCloudComponentPage();
@@ -68,6 +59,9 @@ export class EditTaskFilterCloudComponentPage {
dataTable = new DataTableComponentPage( $('adf-cloud-task-list'));
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]');
editTaskFilterDialog(): EditTaskFilterDialogPage {
return this.editTaskFilterDialogPage;
}

View File

@@ -34,9 +34,7 @@ export class AttachFileWidgetCloudPage {
await BrowserVisibility.waitUntilElementIsVisible(this.widget.$(this.filesListLocator));
}
getFileAttachedLocatorByContainingText = async(text: string): Promise<ElementFinder> => {
return this.widget.$(this.filesListLocator).element(by.cssContainingText('table tbody tr td span ', text));
};
getFileAttachedLocatorByContainingText = async (text: string): Promise<ElementFinder> => this.widget.$(this.filesListLocator).element(by.cssContainingText('table tbody tr td span ', text));
assignWidget(fieldId: string): void {
this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`);

View File

@@ -79,7 +79,7 @@ export class GroupCloudComponentPage {
}
}
async checkGroupWidgetIsReadOnly (): Promise <boolean> {
async checkGroupWidgetIsReadOnly(): Promise <boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
return true;
@@ -101,5 +101,4 @@ export class GroupCloudComponentPage {
const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]');
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
}
}

View File

@@ -20,9 +20,9 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
const FILTERS = {
ALL: 'all-processes',
COMPLETED: 'completed-processes',
RUNNING: 'running-processes'
all: 'all-processes',
completed: 'completed-processes',
running: 'running-processes'
};
export class ProcessFiltersCloudComponentPage {
@@ -44,32 +44,32 @@ export class ProcessFiltersCloudComponentPage {
}
async clickAllProcessesFilter(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.ALL);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all);
await BrowserActions.click(filter);
}
async clickCompletedProcessesFilter(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.COMPLETED);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed);
await BrowserActions.click(filter);
}
async clickRunningProcessesFilter(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.RUNNING);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running);
await BrowserActions.click(filter);
}
async checkAllProcessesFilterIsDisplayed(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.ALL);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all);
await BrowserVisibility.waitUntilElementIsVisible(filter);
}
async checkCompletedProcessesFilterIsDisplayed(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.COMPLETED);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed);
await BrowserVisibility.waitUntilElementIsVisible(filter);
}
async checkRunningProcessesFilterIsDisplayed(): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.RUNNING);
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running);
await BrowserVisibility.waitUntilElementIsVisible(filter);
}

View File

@@ -15,6 +15,8 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
export const ACTIVITI_CLOUD_APPS = {
CANDIDATE_BASE_APP: {
name: 'candidatebaseapp',

View File

@@ -104,9 +104,7 @@ export class ApplicationsUtil {
async getAppDefinitionByName(appName: string): Promise<AppDefinitionRepresentation> {
try {
const appDefinitionsList = await this.appsApi.getAppDefinitions();
return appDefinitionsList.data.find((currentApp) => {
return currentApp.name === appName;
});
return appDefinitionsList.data.find((currentApp) => currentApp.name === appName);
} catch (error) {
Logger.error('Get AppDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text);
return {};

View File

@@ -90,10 +90,8 @@ export class ProcessUtil {
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<any> {
try {
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId: deploymentId });
const chosenProcess = processDefinitionList.data.find( (processDefinition) => {
return processDefinition.name === processName;
});
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId });
const chosenProcess = processDefinitionList.data.find( (processDefinition) => processDefinition.name === processName);
return chosenProcess;
} catch (error) {
Logger.error('Get ProcessDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error)));
@@ -110,14 +108,14 @@ export class ProcessUtil {
async getProcessTaskId(processId: string): Promise<TaskRepresentation> {
const taskList = await this.tasksApi.listTasks({});
let wantedtask;
let wantedTask;
taskList.data.forEach((task) => {
if (task.processInstanceId === processId) {
wantedtask = task;
wantedTask = task;
}
});
return wantedtask ? wantedtask : 'null';
return wantedTask ? wantedTask : 'null';
}
}

View File

@@ -32,7 +32,7 @@ export class UserFiltersUtil {
async createATaskFilter(newTaskFilterName: string, sortType?: string, stateType?: string, assignmentType?: string, iconName?: string, appId?: number): Promise<any> {
try {
return this.userFiltersApi.createUserTaskFilter(new UserTaskFilterRepresentation(
{appId: appId, name: newTaskFilterName, icon: iconName, filter: {sort: sortType, state: stateType, assignment: assignmentType}}));
{appId, name: newTaskFilterName, icon: iconName, filter: {sort: sortType, state: stateType, assignment: assignmentType}}));
} catch (error) {
Logger.error('Create Task Filter - Service error, Response: ', error);
}
@@ -48,7 +48,7 @@ export class UserFiltersUtil {
async orderUserTaskFilters(filtersIdOrder: number[], appId?: number): Promise<any> {
try {
return this.userFiltersApi.orderUserTaskFilters(new UserFilterOrderRepresentation({appId: appId, order: filtersIdOrder}));
return this.userFiltersApi.orderUserTaskFilters(new UserFilterOrderRepresentation({appId, order: filtersIdOrder}));
} catch (error) {
Logger.error('Re-order the list of user task filters - Service error, Response: ', error);
}
@@ -56,7 +56,7 @@ export class UserFiltersUtil {
async getUserTaskFilters(appId?: number): Promise<any> {
try {
return this.userFiltersApi.getUserTaskFilters({appId: appId});
return this.userFiltersApi.getUserTaskFilters({appId});
} catch (error) {
Logger.error('List task filters - Service error, Response: ', error);
}
@@ -64,7 +64,7 @@ export class UserFiltersUtil {
async getUserProcessFilters(appId?: number): Promise<ResultListDataRepresentationUserProcessInstanceFilterRepresentation> {
try {
return this.userFiltersApi.getUserProcessInstanceFilters({ appId: appId });
return this.userFiltersApi.getUserProcessInstanceFilters({ appId });
} catch (error) {
Logger.error('List process filters - Service error, Response: ', error);
return new ResultListDataRepresentationUserProcessInstanceFilterRepresentation();
@@ -73,10 +73,8 @@ export class UserFiltersUtil {
async getUserTaskFilterByName(taskFilterName: string, appId?: number): Promise<any> {
try {
const taskFiltersList = this.userFiltersApi.getUserTaskFilters({appId: appId});
const chosenTaskFilter = (await taskFiltersList).data.find( (taskFilter) => {
return taskFilter.name === taskFilterName;
});
const taskFiltersList = this.userFiltersApi.getUserTaskFilters({appId});
const chosenTaskFilter = (await taskFiltersList).data.find( (taskFilter) => taskFilter.name === taskFilterName);
return chosenTaskFilter;
} catch (error) {
Logger.error('Get user task filters by name - Service error, Response: ', error);
@@ -94,7 +92,7 @@ export class UserFiltersUtil {
async updateUserTaskFilter(filterId: number, updatedTaskFilterName?: string, updatedSortType?: string, updatedStateType?: string, updatedAssignmentType?: string, updatedIconName?: string, appId?: number): Promise<any> {
try {
return this.userFiltersApi.updateUserTaskFilter(filterId, new UserTaskFilterRepresentation(
{appId: appId, name: updatedTaskFilterName, icon: updatedIconName, filter: {sort: updatedSortType, state: updatedStateType, assignment: updatedAssignmentType}}));
{appId, name: updatedTaskFilterName, icon: updatedIconName, filter: {sort: updatedSortType, state: updatedStateType, assignment: updatedAssignmentType}}));
} catch (error) {
Logger.error('Update a task filter - Service error, Response: ', error);
}

View File

@@ -74,6 +74,7 @@ export class ApiService {
const accepts = ['application/json'];
const headerParams = {
// eslint-disable-next-line @typescript-eslint/naming-convention
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
@@ -94,6 +95,7 @@ export class ApiService {
const accepts = ['application/json'];
const headerParams = {
// eslint-disable-next-line @typescript-eslint/naming-convention
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
@@ -114,6 +116,7 @@ export class ApiService {
const accepts = ['application/json'];
const headerParams = {
// eslint-disable-next-line @typescript-eslint/naming-convention
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};

View File

@@ -34,10 +34,7 @@ export class ApiUtil {
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
const pause = duration => new Promise(res => setTimeout(res, duration));
const run = retries => {
return fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
};
const run = retries => fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
return run(retry);
}

View File

@@ -31,18 +31,16 @@ export interface E2eRequestApiHelperOptions {
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
}
function getDefaultOptions(): E2eRequestApiHelperOptions {
return {
pathParams: {},
queryParams: {},
headerParams: {},
formParams: {},
bodyParam: {},
contentTypes: ['application/json'],
accepts: ['application/json'],
returnType: undefined
};
}
const getDefaultOptions = (): E2eRequestApiHelperOptions => ({
pathParams: {},
queryParams: {},
headerParams: {},
formParams: {},
bodyParam: {},
contentTypes: ['application/json'],
accepts: ['application/json'],
returnType: undefined
});
export class E2eRequestApiHelper {
@@ -52,14 +50,6 @@ export class E2eRequestApiHelper {
this.api = backend.apiService;
}
private buildUrl(endPoint: string): string {
const trimSlash = (str: string) => str.replace(/^\/|\/$/g, '');
const host = this.api.config.hostBpm;
const path = '/' + trimSlash(endPoint);
return `${host}${path}`;
}
public get<T>(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike<T> {
return this.request<T>('GET', endPoint, overriddenOptions);
}
@@ -76,6 +66,14 @@ export class E2eRequestApiHelper {
return this.request<T>('DELETE', endPoint, overriddenOptions);
}
private buildUrl(endPoint: string): string {
const trimSlash = (str: string) => str.replace(/^\/|\/$/g, '');
const host = this.api.config.hostBpm;
const path = '/' + trimSlash(endPoint);
return `${host}${path}`;
}
private request<T>(httpMethod: string, endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike<T> {
const options = {
...getDefaultOptions(),

View File

@@ -15,6 +15,8 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
export const infoColor = '\x1b[36m%s\x1b[0m';
export const logColor = '\x1b[35m%s\x1b[0m';
export const warnColor = '\x1b[33m%s\x1b[0m';
@@ -31,7 +33,7 @@ export class LogLevelsEnum extends Number {
static SILENT: number = 0;
}
export let logLevels: { level: LogLevelsEnum; name: LOG_LEVEL }[] = [
export const logLevels: { level: LogLevelsEnum; name: LOG_LEVEL }[] = [
{ level: LogLevelsEnum.TRACE, name: 'TRACE' },
{ level: LogLevelsEnum.DEBUG, name: 'DEBUG' },
{ level: LogLevelsEnum.INFO, name: 'INFO' },