mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-7246] fix eslint warnings for Testing project (#7490)
* fix eslint warnings for Testing project * fix lint issue
This commit is contained in:
@@ -20,19 +20,6 @@
|
|||||||
"eslint-plugin-rxjs"
|
"eslint-plugin-rxjs"
|
||||||
],
|
],
|
||||||
"rules": {
|
"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": [
|
"@angular-eslint/component-selector": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@@ -53,6 +53,7 @@ export class UploadActions {
|
|||||||
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
|
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
|
||||||
const filesRequest = [];
|
const filesRequest = [];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||||
for (let i = 0; i < emptyFileNames.length; i++) {
|
for (let i = 0; i < emptyFileNames.length; i++) {
|
||||||
const jsonItem = {};
|
const jsonItem = {};
|
||||||
jsonItem['name'] = emptyFileNames[i];
|
jsonItem['name'] = emptyFileNames[i];
|
||||||
@@ -60,7 +61,7 @@ export class UploadActions {
|
|||||||
filesRequest.push(jsonItem);
|
filesRequest.push(jsonItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.nodesApi.createNode(parentFolderId, <any> filesRequest, {});
|
return this.nodesApi.createNode(parentFolderId, filesRequest as any, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
async createFolder(folderName, parentFolderId): Promise<NodeEntry> {
|
async createFolder(folderName, parentFolderId): Promise<NodeEntry> {
|
||||||
|
@@ -20,10 +20,7 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
|||||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||||
|
|
||||||
export class RatePage {
|
export class RatePage {
|
||||||
|
|
||||||
private ratingsCounter = $(`div[id="adf-rating-counter"]`);
|
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) {
|
async rateComponent(rateValue: number) {
|
||||||
const unratedStar = await this.coloredStar(rateValue);
|
const unratedStar = await this.coloredStar(rateValue);
|
||||||
@@ -64,4 +61,6 @@ export class RatePage {
|
|||||||
return BrowserActions.getColor(coloredStar);
|
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}"]`);
|
||||||
}
|
}
|
||||||
|
@@ -20,10 +20,10 @@ import { ApiService } from '../../../shared/api/api.service';
|
|||||||
import { Logger } from '../utils/logger';
|
import { Logger } from '../utils/logger';
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
export function createApiService(
|
export const createApiService = (
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
appConfigOverride: Partial<AlfrescoApiConfig> = {}
|
appConfigOverride: Partial<AlfrescoApiConfig> = {}
|
||||||
) {
|
) => {
|
||||||
const patchedAppConfig = {
|
const patchedAppConfig = {
|
||||||
...browser.params.testConfig.appConfig,
|
...browser.params.testConfig.appConfig,
|
||||||
oauth2: {
|
oauth2: {
|
||||||
@@ -44,4 +44,4 @@ export function createApiService(
|
|||||||
},
|
},
|
||||||
Logger
|
Logger
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
@@ -20,11 +20,11 @@ import * as path from 'path';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { BrowserActions } from '../utils/browser-actions';
|
import { BrowserActions } from '../utils/browser-actions';
|
||||||
|
|
||||||
const JS_BIND_INPUT = function(target) {
|
const JS_BIND_INPUT = (target) => {
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
input.style.display = 'none';
|
input.style.display = 'none';
|
||||||
input.addEventListener('change', function() {
|
input.addEventListener('change', () => {
|
||||||
target.scrollIntoView(true);
|
target.scrollIntoView(true);
|
||||||
|
|
||||||
const rect = target.getBoundingClientRect();
|
const rect = target.getBoundingClientRect();
|
||||||
@@ -32,7 +32,7 @@ const JS_BIND_INPUT = function(target) {
|
|||||||
const y = rect.top + (rect.height >> 1);
|
const y = rect.top + (rect.height >> 1);
|
||||||
const data = { files: input.files };
|
const data = { files: input.files };
|
||||||
|
|
||||||
['dragenter', 'dragover', 'drop'].forEach(function(name) {
|
['dragenter', 'dragover', 'drop'].forEach((name) => {
|
||||||
const mouseEvent: any = document.createEvent('MouseEvent');
|
const mouseEvent: any = document.createEvent('MouseEvent');
|
||||||
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
|
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
|
||||||
mouseEvent.dataTransfer = data;
|
mouseEvent.dataTransfer = data;
|
||||||
@@ -46,13 +46,13 @@ const JS_BIND_INPUT = function(target) {
|
|||||||
return input;
|
return input;
|
||||||
};
|
};
|
||||||
|
|
||||||
const JS_BIND_INPUT_FOLDER = function(target) {
|
const JS_BIND_INPUT_FOLDER = (target) => {
|
||||||
const input: any = document.createElement('input');
|
const input: any = document.createElement('input');
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
input.style.display = 'none';
|
input.style.display = 'none';
|
||||||
input.multiple = true;
|
input.multiple = true;
|
||||||
input.webkitdirectory = true;
|
input.webkitdirectory = true;
|
||||||
input.addEventListener('change', function() {
|
input.addEventListener('change', () => {
|
||||||
target.scrollIntoView(true);
|
target.scrollIntoView(true);
|
||||||
|
|
||||||
const rect = target.getBoundingClientRect();
|
const rect = target.getBoundingClientRect();
|
||||||
@@ -60,7 +60,7 @@ const JS_BIND_INPUT_FOLDER = function(target) {
|
|||||||
const y = rect.top + (rect.height >> 1);
|
const y = rect.top + (rect.height >> 1);
|
||||||
const data = { files: input.files };
|
const data = { files: input.files };
|
||||||
|
|
||||||
['dragenter', 'dragover', 'drop'].forEach(function(name) {
|
['dragenter', 'dragover', 'drop'].forEach((name) => {
|
||||||
const mouseEvent: any = document.createEvent('MouseEvent');
|
const mouseEvent: any = document.createEvent('MouseEvent');
|
||||||
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
|
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
|
||||||
mouseEvent.dataTransfer = data;
|
mouseEvent.dataTransfer = data;
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
import { ApiService } from '../../../../shared/api/api.service';
|
import { ApiService } from '../../../../shared/api/api.service';
|
||||||
import { UserModel } from '../../models/user.model';
|
import { UserModel } from '../../models/user.model';
|
||||||
import { RolesService } from './roles.service';
|
import { RolesService } from './roles.service';
|
||||||
@@ -33,6 +35,7 @@ export class IdentityService {
|
|||||||
async createIdentityUserWithRole(roles: string[]): Promise<any> {
|
async createIdentityUserWithRole(roles: string[]): Promise<any> {
|
||||||
const rolesService = new RolesService(this.api);
|
const rolesService = new RolesService(this.api);
|
||||||
const user = await this.createIdentityUser();
|
const user = await this.createIdentityUser();
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||||
for (let i = 0; i < roles.length; i++) {
|
for (let i = 0; i < roles.length; i++) {
|
||||||
const roleId = await rolesService.getRoleIdByRoleName(roles[i]);
|
const roleId = await rolesService.getRoleIdByRoleName(roles[i]);
|
||||||
await this.assignRole(user.idIdentityService, roleId, roles[i]);
|
await this.assignRole(user.idIdentityService, roleId, roles[i]);
|
||||||
|
@@ -122,6 +122,7 @@ export class QueryService {
|
|||||||
const postBody = {};
|
const postBody = {};
|
||||||
|
|
||||||
const data = await this.api.performBpmOperation(path, method, queryParams, 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++) {
|
for (let i = 0; i < data.list.entries.length; i++) {
|
||||||
if (data.list.entries[i].entry.name === taskName) {
|
if (data.list.entries[i].entry.name === taskName) {
|
||||||
return data.list.entries[i];
|
return data.list.entries[i];
|
||||||
@@ -148,6 +149,7 @@ export class QueryService {
|
|||||||
const postBody = {};
|
const postBody = {};
|
||||||
|
|
||||||
const data = await this.api.performBpmOperation(path, method, queryParams, 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++) {
|
for (let i = 0; i < data.list.entries.length; i++) {
|
||||||
if (data.list.entries[i].entry.name === taskName) {
|
if (data.list.entries[i].entry.name === taskName) {
|
||||||
return data.list.entries[i];
|
return data.list.entries[i];
|
||||||
@@ -170,6 +172,7 @@ export class QueryService {
|
|||||||
const postBody = {};
|
const postBody = {};
|
||||||
|
|
||||||
const data = await this.api.performBpmOperation(path, method, queryParams, 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++) {
|
for (let i = 0; i < data.list.entries.length; i++) {
|
||||||
if (data.list.entries[i].entry.name === taskName) {
|
if (data.list.entries[i].entry.name === taskName) {
|
||||||
const task = data.list.entries[i];
|
const task = data.list.entries[i];
|
||||||
|
@@ -32,10 +32,7 @@ export class SearchService {
|
|||||||
|
|
||||||
async isSearchable(name: string): Promise<any> {
|
async isSearchable(name: string): Promise<any> {
|
||||||
const query = this.createSearchQuery(name);
|
const query = this.createSearchQuery(name);
|
||||||
|
const predicate = (result: ResultSetPaging) => !!result?.list?.entries?.find(({ entry }) => entry.name === name);
|
||||||
const predicate = (result: ResultSetPaging) => {
|
|
||||||
return !!result?.list?.entries?.find(({ entry }) => entry.name === name);
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.performSearch(query, predicate, 'Failed to search folder');
|
return this.performSearch(query, predicate, 'Failed to search folder');
|
||||||
}
|
}
|
||||||
@@ -56,29 +53,27 @@ export class SearchService {
|
|||||||
async isUserSearchable(user: UserModel): Promise<any> {
|
async isUserSearchable(user: UserModel): Promise<any> {
|
||||||
const query = this.createUserSearchQuery(user);
|
const query = this.createUserSearchQuery(user);
|
||||||
|
|
||||||
const predicate = (result: ResultSetPaging) => {
|
const predicate = (result: ResultSetPaging) => result.list && result.list.entries.length > 0 && !!result.list.entries.find(({ entry }) => entry.properties['cm:email'] === user.email);
|
||||||
return 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');
|
return this.performSearch(query, predicate, 'Failed to search user');
|
||||||
}
|
}
|
||||||
|
|
||||||
private createUserSearchQuery(user: UserModel) {
|
private createUserSearchQuery(user: UserModel) {
|
||||||
return {
|
return {
|
||||||
'query': {
|
query: {
|
||||||
'query': `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*`
|
query: `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*`
|
||||||
},
|
},
|
||||||
'include': [
|
include: [
|
||||||
'aspectNames',
|
'aspectNames',
|
||||||
'properties'
|
'properties'
|
||||||
],
|
],
|
||||||
'paging': {
|
paging: {
|
||||||
'maxItems': 1,
|
maxItems: 1,
|
||||||
'skipCount': 0
|
skipCount: 0
|
||||||
},
|
},
|
||||||
'filterQueries': [
|
filterQueries: [
|
||||||
{
|
{
|
||||||
'query': `TYPE:'cm:authority'`
|
query: `TYPE:'cm:authority'`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@@ -86,28 +81,28 @@ export class SearchService {
|
|||||||
|
|
||||||
private createSearchQuery(name: string) {
|
private createSearchQuery(name: string) {
|
||||||
return {
|
return {
|
||||||
'query': {
|
query: {
|
||||||
'query': `${name}*`
|
query: `${name}*`
|
||||||
},
|
},
|
||||||
'include': [
|
include: [
|
||||||
'path',
|
'path',
|
||||||
'allowableOperations',
|
'allowableOperations',
|
||||||
'properties'
|
'properties'
|
||||||
],
|
],
|
||||||
'paging': {
|
paging: {
|
||||||
'maxItems': 20,
|
maxItems: 20,
|
||||||
'skipCount': 0
|
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': {
|
scope: {
|
||||||
'locations': [
|
locations: [
|
||||||
'nodes'
|
'nodes'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -118,7 +118,7 @@ export class UsersActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createUserWithName(firstName: string, lastName: string): Promise<UserModel> {
|
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);
|
return this.createUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,8 @@ import { BrowserVisibility } from '../utils/browser-visibility';
|
|||||||
import { BrowserActions } from '../utils/browser-actions';
|
import { BrowserActions } from '../utils/browser-actions';
|
||||||
import { Logger } from '../utils/logger';
|
import { Logger } from '../utils/logger';
|
||||||
|
|
||||||
|
const MAX_LOADING_TIME = 120000;
|
||||||
|
|
||||||
export class DataTableComponentPage {
|
export class DataTableComponentPage {
|
||||||
|
|
||||||
rootElement: ElementFinder;
|
rootElement: ElementFinder;
|
||||||
@@ -38,8 +40,6 @@ export class DataTableComponentPage {
|
|||||||
|
|
||||||
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
|
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
|
||||||
|
|
||||||
MAX_LOADING_TIME = 120000;
|
|
||||||
|
|
||||||
constructor(rootElement = $$('adf-datatable').first()) {
|
constructor(rootElement = $$('adf-datatable').first()) {
|
||||||
this.rootElement = rootElement;
|
this.rootElement = rootElement;
|
||||||
this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
|
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()) {
|
if (await this.isSpinnerPresent()) {
|
||||||
Logger.log('wait datatable loading spinner disappear');
|
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()) {
|
if (await this.isEmpty()) {
|
||||||
Logger.log('empty page');
|
Logger.log('empty page');
|
||||||
@@ -389,7 +389,7 @@ export class DataTableComponentPage {
|
|||||||
try {
|
try {
|
||||||
Logger.log('wait datatable loading spinner is present');
|
Logger.log('wait datatable loading spinner is present');
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), 2000);
|
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) {
|
} 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> {
|
async waitTillContentLoadedInfinitePagination(): Promise<void> {
|
||||||
await browser.sleep(500);
|
await browser.sleep(500);
|
||||||
|
|
||||||
@@ -615,4 +582,37 @@ export class DataTableComponentPage {
|
|||||||
}
|
}
|
||||||
return '';
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,6 @@ import { Locator, by, element, protractor, $, $$ } from 'protractor';
|
|||||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||||
|
|
||||||
export class DynamicTableWidgetPage {
|
export class DynamicTableWidgetPage {
|
||||||
|
|
||||||
formFields = new FormFields();
|
formFields = new FormFields();
|
||||||
|
|
||||||
labelLocator: Locator = by.css('dynamic-table-widget div div');
|
labelLocator: Locator = by.css('dynamic-table-widget div div');
|
||||||
@@ -36,8 +35,6 @@ export class DynamicTableWidgetPage {
|
|||||||
dateWidget = $$('mat-datepicker-toggle button').first();
|
dateWidget = $$('mat-datepicker-toggle button').first();
|
||||||
tableRow = $$('tbody tr');
|
tableRow = $$('tbody tr');
|
||||||
|
|
||||||
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
|
|
||||||
|
|
||||||
getFieldLabel(fieldId: string): Promise<string> {
|
getFieldLabel(fieldId: string): Promise<string> {
|
||||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||||
}
|
}
|
||||||
@@ -125,4 +122,6 @@ export class DynamicTableWidgetPage {
|
|||||||
const present = await BrowserVisibility.waitUntilElementIsVisible(row);
|
const present = await BrowserVisibility.waitUntilElementIsVisible(row);
|
||||||
await expect(present).toBe(true);
|
await expect(present).toBe(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,19 @@ export class DatePickerCalendarPage {
|
|||||||
await this.checkDatePickerIsNotDisplayed();
|
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) {
|
private async setDateUsingPeriodButton(date: Date) {
|
||||||
const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
|
const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
@@ -97,17 +110,4 @@ export class DatePickerCalendarPage {
|
|||||||
await BrowserActions.click(monthElement);
|
await BrowserActions.click(monthElement);
|
||||||
await BrowserActions.click(dayElement);
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -139,10 +139,12 @@ export class UserInfoPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.initialImage);
|
await BrowserVisibility.waitUntilElementIsNotVisible(this.initialImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
async ACSProfileImageNotDisplayed(): Promise<void> {
|
async ACSProfileImageNotDisplayed(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.acsImage);
|
await BrowserVisibility.waitUntilElementIsNotVisible(this.acsImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
async APSProfileImageNotDisplayed(): Promise<void> {
|
async APSProfileImageNotDisplayed(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.apsImage);
|
await BrowserVisibility.waitUntilElementIsNotVisible(this.apsImage);
|
||||||
}
|
}
|
||||||
|
@@ -22,10 +22,9 @@ import { BrowserVisibility } from '../utils/browser-visibility';
|
|||||||
import { element, by, browser, protractor, $, $$ } from 'protractor';
|
import { element, by, browser, protractor, $, $$ } from 'protractor';
|
||||||
import { Logger } from '../utils/logger';
|
import { Logger } from '../utils/logger';
|
||||||
|
|
||||||
|
const MAX_LOADING_TIME = 120000;
|
||||||
|
|
||||||
export class ViewerPage {
|
export class ViewerPage {
|
||||||
|
|
||||||
MAX_LOADING_TIME = 120000;
|
|
||||||
|
|
||||||
tabsPage = new TabsPage();
|
tabsPage = new TabsPage();
|
||||||
togglePage = new TogglePage();
|
togglePage = new TogglePage();
|
||||||
|
|
||||||
@@ -121,29 +120,17 @@ export class ViewerPage {
|
|||||||
|
|
||||||
if (await this.isSpinnerPresent()) {
|
if (await this.isSpinnerPresent()) {
|
||||||
Logger.log('wait spinner disappear');
|
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 {
|
} else {
|
||||||
try {
|
try {
|
||||||
Logger.log('wait spinner is present');
|
Logger.log('wait spinner is present');
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner')));
|
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) {
|
} 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> {
|
async clearPageNumber(): Promise<void> {
|
||||||
await BrowserActions.clearSendKeys(this.pageSelectorInput);
|
await BrowserActions.clearSendKeys(this.pageSelectorInput);
|
||||||
}
|
}
|
||||||
@@ -678,4 +665,16 @@ export class ViewerPage {
|
|||||||
async expectUrlToContain(text: string): Promise<void> {
|
async expectUrlToContain(text: string): Promise<void> {
|
||||||
await expect(browser.getCurrentUrl()).toContain(text);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ export class TestElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance with the element located by the id
|
* Create a new instance with the element located by the id
|
||||||
|
*
|
||||||
* @param id The id of the element
|
* @param id The id of the element
|
||||||
*/
|
*/
|
||||||
static byId(id: string): TestElement {
|
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
|
* Create a new instance with the element located by the CSS class name
|
||||||
|
*
|
||||||
* @param selector The CSS class name to lookup
|
* @param selector The CSS class name to lookup
|
||||||
*/
|
*/
|
||||||
static byCss(selector: string): TestElement {
|
static byCss(selector: string): TestElement {
|
||||||
@@ -44,6 +46,7 @@ export class TestElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance with the element that contains specific text
|
* Create a new instance with the element that contains specific text
|
||||||
|
*
|
||||||
* @param selector the CSS selector
|
* @param selector the CSS selector
|
||||||
* @param text the text within the target element
|
* @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
|
* Create a new instance with the element with specific HTML tag name
|
||||||
|
*
|
||||||
* @param selector the HTML tag name
|
* @param selector the HTML tag name
|
||||||
*/
|
*/
|
||||||
static byTag(selector: string): TestElement {
|
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
|
* 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
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async isVisible(waitTimeout?: number): Promise<boolean> {
|
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
|
* 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
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async waitVisible(waitTimeout?: number): Promise<any> {
|
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
|
* 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
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async waitNotVisible(waitTimeout?: number): Promise<any> {
|
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
|
* Checks that an element is present on the DOM of a page
|
||||||
|
*
|
||||||
* @param waitTimeout How long to wait for the condition to be true
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async isPresent(waitTimeout?: number): Promise<boolean> {
|
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
|
* Waits until the element is present on the DOM of a page
|
||||||
|
*
|
||||||
* @param waitTimeout How long to wait for the condition to be true
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async waitPresent(waitTimeout?: number): Promise<any> {
|
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
|
* 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
|
* @param waitTimeout How long to wait for the condition to be true
|
||||||
*/
|
*/
|
||||||
async waitNotPresent(waitTimeout?: number): Promise<any> {
|
async waitNotPresent(waitTimeout?: number): Promise<any> {
|
||||||
@@ -126,6 +136,7 @@ export class TestElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits until the given text is present in the element’s value
|
* Waits until the given text is present in the element’s value
|
||||||
|
*
|
||||||
* @param value the text to check
|
* @param value the text to check
|
||||||
*/
|
*/
|
||||||
async waitHasValue(value: string): Promise<any> {
|
async waitHasValue(value: string): Promise<any> {
|
||||||
@@ -159,6 +170,7 @@ export class TestElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query for the value of the given attribute of the element.
|
* Query for the value of the given attribute of the element.
|
||||||
|
*
|
||||||
* @param attributeName The name of the attribute to query.
|
* @param attributeName The name of the attribute to query.
|
||||||
*/
|
*/
|
||||||
async getAttribute(attributeName: string): Promise<string> {
|
async getAttribute(attributeName: string): Promise<string> {
|
||||||
@@ -181,6 +193,7 @@ export class TestElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter the text
|
* Enter the text
|
||||||
|
*
|
||||||
* @param text the text to enter
|
* @param text the text to enter
|
||||||
*/
|
*/
|
||||||
async typeText(text: string): Promise<void> {
|
async typeText(text: string): Promise<void> {
|
||||||
|
@@ -28,8 +28,6 @@ export class ArrayUtil {
|
|||||||
if (0 === subset.length) {
|
if (0 === subset.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return subset.every(function (value) {
|
return subset.every((value) => (superset.indexOf(value) >= 0));
|
||||||
return (superset.indexOf(value) >= 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,7 @@ export class BrowserActions {
|
|||||||
|
|
||||||
static async clickUntilIsNotVisible(elementToClick: ElementFinder, elementToFind: ElementFinder): Promise<void> {
|
static async clickUntilIsNotVisible(elementToClick: ElementFinder, elementToFind: ElementFinder): Promise<void> {
|
||||||
Logger.info(`Click until element is not present: ${elementToClick.locator().toString()}`);
|
Logger.info(`Click until element is not present: ${elementToClick.locator().toString()}`);
|
||||||
|
const predicate = (isVisible: boolean) => isVisible;
|
||||||
const predicate = (isVisible: boolean) => {
|
|
||||||
return isVisible;
|
|
||||||
};
|
|
||||||
|
|
||||||
const apiCall = async () => {
|
const apiCall = async () => {
|
||||||
await this.click(elementToClick);
|
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> {
|
static async getInputValue(elementFinder: ElementFinder): Promise<string> {
|
||||||
Logger.info(`Get Input value ${elementFinder.locator().toString()}`);
|
Logger.info(`Get Input value ${elementFinder.locator().toString()}`);
|
||||||
|
|
||||||
@@ -170,6 +162,7 @@ export class BrowserActions {
|
|||||||
if (sleepTime === 0) {
|
if (sleepTime === 0) {
|
||||||
await elementFinder.sendKeys(text);
|
await elementFinder.sendKeys(text);
|
||||||
} else {
|
} else {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
await elementFinder.sendKeys(text[i]);
|
await elementFinder.sendKeys(text[i]);
|
||||||
await browser.sleep(sleepTime);
|
await browser.sleep(sleepTime);
|
||||||
@@ -215,4 +208,9 @@ export class BrowserActions {
|
|||||||
stream.write(Buffer.from(pngData, 'base64'));
|
stream.write(Buffer.from(pngData, 'base64'));
|
||||||
stream.end();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,9 @@ import { Logger } from './logger';
|
|||||||
import { falseIfMissing } from 'protractor/built/util';
|
import { falseIfMissing } from 'protractor/built/util';
|
||||||
|
|
||||||
export class BrowserVisibility {
|
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;
|
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 DEFAULT_TIMEOUT = BrowserVisibility.getVisibleTimeout() ? browser.params.testConfig.timeouts.visible_timeout : 10000;
|
||||||
|
|
||||||
static getVisibleTimeout() {
|
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()}`);
|
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
|
* Wait for element to have text
|
||||||
*/
|
*/
|
||||||
@@ -124,4 +116,10 @@ export class BrowserVisibility {
|
|||||||
await this.waitUntilElementIsNotPresent(dialog);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,10 +23,7 @@ export class FileBrowserUtil {
|
|||||||
|
|
||||||
static async isFileDownloaded(fileName: string): Promise<boolean> {
|
static async isFileDownloaded(fileName: string): Promise<boolean> {
|
||||||
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
|
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
|
||||||
|
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000);
|
||||||
const file = await browser.driver.wait(() => {
|
|
||||||
return fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName));
|
|
||||||
}, 30000);
|
|
||||||
|
|
||||||
await expect(file).toBe(true, `${fileName} not downloaded`);
|
await expect(file).toBe(true, `${fileName} not downloaded`);
|
||||||
|
|
||||||
|
@@ -47,8 +47,6 @@ export class FormUtil {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const forms: any = await this.editorApi.getForms();
|
const forms: any = await this.editorApi.getForms();
|
||||||
|
|
||||||
return forms.data.find((currentForm) => {
|
return forms.data.find((currentForm) => currentForm.name === name);
|
||||||
return currentForm.name === name;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,14 +19,12 @@ import { ElementFinder, browser } from 'protractor';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tagged template to convert a sting to an `ElementFinder`.
|
* Tagged template to convert a sting to an `ElementFinder`.
|
||||||
|
*
|
||||||
* @example ```const item = byCss`.adf-breadcrumb-item-current`;```
|
* @example ```const item = byCss`.adf-breadcrumb-item-current`;```
|
||||||
* @example ```const item = byCss`${variable}`;```
|
* @example ```const item = byCss`${variable}`;```
|
||||||
* @returns Instance of `ElementFinder` type.
|
* @returns Instance of `ElementFinder` type.
|
||||||
*/
|
*/
|
||||||
export function byCss(
|
export const byCss = (literals: TemplateStringsArray, ...placeholders: string[]): ElementFinder => {
|
||||||
literals: TemplateStringsArray,
|
|
||||||
...placeholders: string[]
|
|
||||||
): ElementFinder {
|
|
||||||
const selector = literals[0] || placeholders[0];
|
const selector = literals[0] || placeholders[0];
|
||||||
return browser.$(selector);
|
return browser.$(selector);
|
||||||
}
|
};
|
||||||
|
@@ -20,9 +20,8 @@ import { ApiService } from '../../../shared/api/api.service';
|
|||||||
import { ApiUtil } from '../../../shared/api/api.util';
|
import { ApiUtil } from '../../../shared/api/api.util';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
|
|
||||||
|
const DELAY_API_CALL = 5000;
|
||||||
export class WaitActions {
|
export class WaitActions {
|
||||||
|
|
||||||
DELAY_API_CALL = 5000;
|
|
||||||
apiService: ApiService;
|
apiService: ApiService;
|
||||||
nodesApi: NodesApi;
|
nodesApi: NodesApi;
|
||||||
|
|
||||||
@@ -32,13 +31,9 @@ export class WaitActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async nodeIsPresent(nodeId: string): Promise<NodeEntry | null> {
|
async nodeIsPresent(nodeId: string): Promise<NodeEntry | null> {
|
||||||
|
const predicate = (result) => result.entry.id === nodeId;
|
||||||
const predicate = (result) => {
|
|
||||||
return result.entry.id === nodeId;
|
|
||||||
};
|
|
||||||
|
|
||||||
const apiCall = async () => {
|
const apiCall = async () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return this.nodesApi.getNode(nodeId);
|
return this.nodesApi.getNode(nodeId);
|
||||||
} catch (error) {
|
} 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> {
|
async nodeIsUnlock(nodeId: string): Promise<NodeEntry | null> {
|
||||||
|
const predicate = (result) => result.entry.isLocked === false;
|
||||||
const predicate = (result) => {
|
|
||||||
return result.entry.isLocked === false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const apiCall = async () => {
|
const apiCall = async () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return this.nodesApi.getNode(nodeId);
|
return this.nodesApi.getNode(nodeId);
|
||||||
} catch (error) {
|
} 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ export class Application {
|
|||||||
async getApplicationsByStatus(status: string): Promise<ResultSetPaging> {
|
async getApplicationsByStatus(status: string): Promise<ResultSetPaging> {
|
||||||
Logger.info(`[Application] Return application by status: ${status}`);
|
Logger.info(`[Application] Return application by status: ${status}`);
|
||||||
return this.requestApiHelper.get<ResultSetPaging>(this.endPoint, {
|
return this.requestApiHelper.get<ResultSetPaging>(this.endPoint, {
|
||||||
queryParams: { status: status, sort: 'name' }
|
queryParams: { status, sort: 'name' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,9 +33,9 @@ export class MessageEventsService {
|
|||||||
|
|
||||||
const queryParams = {};
|
const queryParams = {};
|
||||||
const postBody = {
|
const postBody = {
|
||||||
'name': startMessage,
|
name: startMessage,
|
||||||
'variables': {},
|
variables: {},
|
||||||
'payloadType': 'StartMessagePayload',
|
payloadType: 'StartMessagePayload',
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,9 +54,9 @@ export class MessageEventsService {
|
|||||||
|
|
||||||
const queryParams = {};
|
const queryParams = {};
|
||||||
const postBody = {
|
const postBody = {
|
||||||
'name': receiveMessage,
|
name: receiveMessage,
|
||||||
'variables': {},
|
variables: {},
|
||||||
'payloadType': 'ReceiveMessagePayload',
|
payloadType: 'ReceiveMessagePayload',
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,5 +66,4 @@ export class MessageEventsService {
|
|||||||
Logger.error('Receive Message Event Service not working', error.message);
|
Logger.error('Receive Message Event Service not working', error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,12 +25,12 @@ import { StringUtil } from '../../../shared/utils/string.util';
|
|||||||
import { Logger } from '../../core/utils/logger';
|
import { Logger } from '../../core/utils/logger';
|
||||||
|
|
||||||
export class ProcessServices {
|
export class ProcessServices {
|
||||||
|
processInstancesService: ProcessInstancesService;
|
||||||
|
processDefinitionsService: ProcessDefinitionsService;
|
||||||
|
tasksService: TasksService;
|
||||||
|
queryService: QueryService;
|
||||||
|
|
||||||
private api: ApiService;
|
private api: ApiService;
|
||||||
public processInstancesService: ProcessInstancesService;
|
|
||||||
public processDefinitionsService: ProcessDefinitionsService;
|
|
||||||
public tasksService: TasksService;
|
|
||||||
public queryService: QueryService;
|
|
||||||
|
|
||||||
constructor(api: ApiService) {
|
constructor(api: ApiService) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
@@ -40,7 +40,7 @@ export class ProcessServices {
|
|||||||
this.queryService = new QueryService(this.api);
|
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 processInstance = await this.createProcessInstance(processDefName, appName, processInstanceName);
|
||||||
const task = await this.queryService.getProcessInstanceTasks(processInstance.entry.id, appName);
|
const task = await this.queryService.getProcessInstanceTasks(processInstance.entry.id, appName);
|
||||||
await this.tasksService.claimTask(task.list.entries[taskIndex].entry.id, appName);
|
await this.tasksService.claimTask(task.list.entries[taskIndex].entry.id, appName);
|
||||||
@@ -48,7 +48,7 @@ export class ProcessServices {
|
|||||||
return processInstance;
|
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 processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName);
|
||||||
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
|
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
|
||||||
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
|
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
|
||||||
@@ -58,12 +58,12 @@ export class ProcessServices {
|
|||||||
return processInstance;
|
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 processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName);
|
||||||
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
|
const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, {
|
||||||
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
|
name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(),
|
||||||
businessKey: StringUtil.generateRandomString(),
|
businessKey: StringUtil.generateRandomString(),
|
||||||
variables: variables
|
variables
|
||||||
});
|
});
|
||||||
|
|
||||||
return processInstance;
|
return processInstance;
|
||||||
|
@@ -42,34 +42,22 @@ export class EditProcessFilterCloudComponentPage {
|
|||||||
deleteButton = $('button[data-automation-id="adf-filter-action-delete"]');
|
deleteButton = $('button[data-automation-id="adf-filter-action-delete"]');
|
||||||
filter = $(`adf-cloud-edit-process-filter mat-expansion-panel-header`);
|
filter = $(`adf-cloud-edit-process-filter mat-expansion-panel-header`);
|
||||||
|
|
||||||
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`);
|
appNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`));
|
||||||
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`);
|
statusDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`));
|
||||||
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`);
|
sortDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`));
|
||||||
private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`);
|
orderDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`));
|
||||||
private locatorProcessDefinitionNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`);
|
processDefinitionNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`));
|
||||||
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
|
suspendedDateRangeDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`));
|
||||||
private locatorSuspendedDateRangeDropdown = $(`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']`));
|
||||||
private locatorStartedDateRangeDropdown = $(`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']`));
|
||||||
private locatorCompletedDateRangeDropdown = $(`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']`));
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
peopleCloudComponent = new PeopleCloudComponentPage();
|
peopleCloudComponent = new PeopleCloudComponentPage();
|
||||||
|
|
||||||
editProcessFilterDialogPage = new EditProcessFilterDialogPage();
|
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 {
|
editProcessFilterDialog(): EditProcessFilterDialogPage {
|
||||||
return this.editProcessFilterDialogPage;
|
return this.editProcessFilterDialogPage;
|
||||||
}
|
}
|
||||||
|
@@ -45,22 +45,13 @@ export class EditTaskFilterCloudComponentPage {
|
|||||||
deleteButton = $('[data-automation-id="adf-filter-action-delete"]');
|
deleteButton = $('[data-automation-id="adf-filter-action-delete"]');
|
||||||
filter = $(`adf-cloud-edit-task-filter mat-expansion-panel-header`);
|
filter = $(`adf-cloud-edit-task-filter mat-expansion-panel-header`);
|
||||||
|
|
||||||
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`);
|
appNameDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`));
|
||||||
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`);
|
statusDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`));
|
||||||
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`);
|
sortDropdown = new DropdownPage($(`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);
|
|
||||||
priorityDropdown = new DropdownPage(this.priority);
|
priorityDropdown = new DropdownPage(this.priority);
|
||||||
orderDropdown = new DropdownPage(this.locatorOrderDropdown);
|
orderDropdown = new DropdownPage($(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`));
|
||||||
completedDateDropdown = new DropdownPage(this.locatorCompletedDateDropdown);
|
completedDateDropdown = new DropdownPage($(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`));
|
||||||
assignmentDropdown = new DropdownPage(this.locatorAssignmentDropdown);
|
assignmentDropdown = new DropdownPage($(`.adf-task-assignment-filter`));
|
||||||
|
|
||||||
editTaskFilterDialogPage = new EditTaskFilterDialogPage();
|
editTaskFilterDialogPage = new EditTaskFilterDialogPage();
|
||||||
peopleCloudComponent = new PeopleCloudComponentPage();
|
peopleCloudComponent = new PeopleCloudComponentPage();
|
||||||
@@ -68,6 +59,9 @@ export class EditTaskFilterCloudComponentPage {
|
|||||||
|
|
||||||
dataTable = new DataTableComponentPage( $('adf-cloud-task-list'));
|
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 {
|
editTaskFilterDialog(): EditTaskFilterDialogPage {
|
||||||
return this.editTaskFilterDialogPage;
|
return this.editTaskFilterDialogPage;
|
||||||
}
|
}
|
||||||
|
@@ -34,9 +34,7 @@ export class AttachFileWidgetCloudPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsVisible(this.widget.$(this.filesListLocator));
|
await BrowserVisibility.waitUntilElementIsVisible(this.widget.$(this.filesListLocator));
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileAttachedLocatorByContainingText = async(text: string): Promise<ElementFinder> => {
|
getFileAttachedLocatorByContainingText = async (text: string): Promise<ElementFinder> => this.widget.$(this.filesListLocator).element(by.cssContainingText('table tbody tr td span ', text));
|
||||||
return this.widget.$(this.filesListLocator).element(by.cssContainingText('table tbody tr td span ', text));
|
|
||||||
};
|
|
||||||
|
|
||||||
assignWidget(fieldId: string): void {
|
assignWidget(fieldId: string): void {
|
||||||
this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`);
|
this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`);
|
||||||
|
@@ -79,7 +79,7 @@ export class GroupCloudComponentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkGroupWidgetIsReadOnly (): Promise <boolean> {
|
async checkGroupWidgetIsReadOnly(): Promise <boolean> {
|
||||||
try {
|
try {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
|
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
|
||||||
return true;
|
return true;
|
||||||
@@ -101,5 +101,4 @@ export class GroupCloudComponentPage {
|
|||||||
const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]');
|
const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]');
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
|
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,9 +20,9 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
|||||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||||
|
|
||||||
const FILTERS = {
|
const FILTERS = {
|
||||||
ALL: 'all-processes',
|
all: 'all-processes',
|
||||||
COMPLETED: 'completed-processes',
|
completed: 'completed-processes',
|
||||||
RUNNING: 'running-processes'
|
running: 'running-processes'
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ProcessFiltersCloudComponentPage {
|
export class ProcessFiltersCloudComponentPage {
|
||||||
@@ -44,32 +44,32 @@ export class ProcessFiltersCloudComponentPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickAllProcessesFilter(): Promise<void> {
|
async clickAllProcessesFilter(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.ALL);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all);
|
||||||
await BrowserActions.click(filter);
|
await BrowserActions.click(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCompletedProcessesFilter(): Promise<void> {
|
async clickCompletedProcessesFilter(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.COMPLETED);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed);
|
||||||
await BrowserActions.click(filter);
|
await BrowserActions.click(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickRunningProcessesFilter(): Promise<void> {
|
async clickRunningProcessesFilter(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.RUNNING);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running);
|
||||||
await BrowserActions.click(filter);
|
await BrowserActions.click(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkAllProcessesFilterIsDisplayed(): Promise<void> {
|
async checkAllProcessesFilterIsDisplayed(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.ALL);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkCompletedProcessesFilterIsDisplayed(): Promise<void> {
|
async checkCompletedProcessesFilterIsDisplayed(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.COMPLETED);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkRunningProcessesFilterIsDisplayed(): Promise<void> {
|
async checkRunningProcessesFilterIsDisplayed(): Promise<void> {
|
||||||
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.RUNNING);
|
const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
await BrowserVisibility.waitUntilElementIsVisible(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
export const ACTIVITI_CLOUD_APPS = {
|
export const ACTIVITI_CLOUD_APPS = {
|
||||||
CANDIDATE_BASE_APP: {
|
CANDIDATE_BASE_APP: {
|
||||||
name: 'candidatebaseapp',
|
name: 'candidatebaseapp',
|
||||||
|
@@ -104,9 +104,7 @@ export class ApplicationsUtil {
|
|||||||
async getAppDefinitionByName(appName: string): Promise<AppDefinitionRepresentation> {
|
async getAppDefinitionByName(appName: string): Promise<AppDefinitionRepresentation> {
|
||||||
try {
|
try {
|
||||||
const appDefinitionsList = await this.appsApi.getAppDefinitions();
|
const appDefinitionsList = await this.appsApi.getAppDefinitions();
|
||||||
return appDefinitionsList.data.find((currentApp) => {
|
return appDefinitionsList.data.find((currentApp) => currentApp.name === appName);
|
||||||
return currentApp.name === appName;
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Get AppDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text);
|
Logger.error('Get AppDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text);
|
||||||
return {};
|
return {};
|
||||||
|
@@ -90,10 +90,8 @@ export class ProcessUtil {
|
|||||||
|
|
||||||
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<any> {
|
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<any> {
|
||||||
try {
|
try {
|
||||||
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId: deploymentId });
|
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId });
|
||||||
const chosenProcess = processDefinitionList.data.find( (processDefinition) => {
|
const chosenProcess = processDefinitionList.data.find( (processDefinition) => processDefinition.name === processName);
|
||||||
return processDefinition.name === processName;
|
|
||||||
});
|
|
||||||
return chosenProcess;
|
return chosenProcess;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Get ProcessDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(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> {
|
async getProcessTaskId(processId: string): Promise<TaskRepresentation> {
|
||||||
const taskList = await this.tasksApi.listTasks({});
|
const taskList = await this.tasksApi.listTasks({});
|
||||||
let wantedtask;
|
let wantedTask;
|
||||||
|
|
||||||
taskList.data.forEach((task) => {
|
taskList.data.forEach((task) => {
|
||||||
if (task.processInstanceId === processId) {
|
if (task.processInstanceId === processId) {
|
||||||
wantedtask = task;
|
wantedTask = task;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return wantedtask ? wantedtask : 'null';
|
return wantedTask ? wantedTask : 'null';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ export class UserFiltersUtil {
|
|||||||
async createATaskFilter(newTaskFilterName: string, sortType?: string, stateType?: string, assignmentType?: string, iconName?: string, appId?: number): Promise<any> {
|
async createATaskFilter(newTaskFilterName: string, sortType?: string, stateType?: string, assignmentType?: string, iconName?: string, appId?: number): Promise<any> {
|
||||||
try {
|
try {
|
||||||
return this.userFiltersApi.createUserTaskFilter(new UserTaskFilterRepresentation(
|
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) {
|
} catch (error) {
|
||||||
Logger.error('Create Task Filter - Service error, Response: ', 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> {
|
async orderUserTaskFilters(filtersIdOrder: number[], appId?: number): Promise<any> {
|
||||||
try {
|
try {
|
||||||
return this.userFiltersApi.orderUserTaskFilters(new UserFilterOrderRepresentation({appId: appId, order: filtersIdOrder}));
|
return this.userFiltersApi.orderUserTaskFilters(new UserFilterOrderRepresentation({appId, order: filtersIdOrder}));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Re-order the list of user task filters - Service error, Response: ', 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> {
|
async getUserTaskFilters(appId?: number): Promise<any> {
|
||||||
try {
|
try {
|
||||||
return this.userFiltersApi.getUserTaskFilters({appId: appId});
|
return this.userFiltersApi.getUserTaskFilters({appId});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('List task filters - Service error, Response: ', error);
|
Logger.error('List task filters - Service error, Response: ', error);
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ export class UserFiltersUtil {
|
|||||||
|
|
||||||
async getUserProcessFilters(appId?: number): Promise<ResultListDataRepresentationUserProcessInstanceFilterRepresentation> {
|
async getUserProcessFilters(appId?: number): Promise<ResultListDataRepresentationUserProcessInstanceFilterRepresentation> {
|
||||||
try {
|
try {
|
||||||
return this.userFiltersApi.getUserProcessInstanceFilters({ appId: appId });
|
return this.userFiltersApi.getUserProcessInstanceFilters({ appId });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('List process filters - Service error, Response: ', error);
|
Logger.error('List process filters - Service error, Response: ', error);
|
||||||
return new ResultListDataRepresentationUserProcessInstanceFilterRepresentation();
|
return new ResultListDataRepresentationUserProcessInstanceFilterRepresentation();
|
||||||
@@ -73,10 +73,8 @@ export class UserFiltersUtil {
|
|||||||
|
|
||||||
async getUserTaskFilterByName(taskFilterName: string, appId?: number): Promise<any> {
|
async getUserTaskFilterByName(taskFilterName: string, appId?: number): Promise<any> {
|
||||||
try {
|
try {
|
||||||
const taskFiltersList = this.userFiltersApi.getUserTaskFilters({appId: appId});
|
const taskFiltersList = this.userFiltersApi.getUserTaskFilters({appId});
|
||||||
const chosenTaskFilter = (await taskFiltersList).data.find( (taskFilter) => {
|
const chosenTaskFilter = (await taskFiltersList).data.find( (taskFilter) => taskFilter.name === taskFilterName);
|
||||||
return taskFilter.name === taskFilterName;
|
|
||||||
});
|
|
||||||
return chosenTaskFilter;
|
return chosenTaskFilter;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Get user task filters by name - Service error, Response: ', 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> {
|
async updateUserTaskFilter(filterId: number, updatedTaskFilterName?: string, updatedSortType?: string, updatedStateType?: string, updatedAssignmentType?: string, updatedIconName?: string, appId?: number): Promise<any> {
|
||||||
try {
|
try {
|
||||||
return this.userFiltersApi.updateUserTaskFilter(filterId, new UserTaskFilterRepresentation(
|
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) {
|
} catch (error) {
|
||||||
Logger.error('Update a task filter - Service error, Response: ', error);
|
Logger.error('Update a task filter - Service error, Response: ', error);
|
||||||
}
|
}
|
||||||
|
@@ -74,6 +74,7 @@ export class ApiService {
|
|||||||
const accepts = ['application/json'];
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
const headerParams = {
|
const headerParams = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ export class ApiService {
|
|||||||
const accepts = ['application/json'];
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
const headerParams = {
|
const headerParams = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,6 +116,7 @@ export class ApiService {
|
|||||||
const accepts = ['application/json'];
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
const headerParams = {
|
const headerParams = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -34,10 +34,7 @@ export class ApiUtil {
|
|||||||
|
|
||||||
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
|
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
|
||||||
const pause = duration => new Promise(res => setTimeout(res, duration));
|
const pause = duration => new Promise(res => setTimeout(res, duration));
|
||||||
|
const run = retries => fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
|
||||||
const run = retries => {
|
|
||||||
return fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
|
|
||||||
};
|
|
||||||
|
|
||||||
return run(retry);
|
return run(retry);
|
||||||
}
|
}
|
||||||
|
@@ -31,18 +31,16 @@ export interface E2eRequestApiHelperOptions {
|
|||||||
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultOptions(): E2eRequestApiHelperOptions {
|
const getDefaultOptions = (): E2eRequestApiHelperOptions => ({
|
||||||
return {
|
pathParams: {},
|
||||||
pathParams: {},
|
queryParams: {},
|
||||||
queryParams: {},
|
headerParams: {},
|
||||||
headerParams: {},
|
formParams: {},
|
||||||
formParams: {},
|
bodyParam: {},
|
||||||
bodyParam: {},
|
contentTypes: ['application/json'],
|
||||||
contentTypes: ['application/json'],
|
accepts: ['application/json'],
|
||||||
accepts: ['application/json'],
|
returnType: undefined
|
||||||
returnType: undefined
|
});
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export class E2eRequestApiHelper {
|
export class E2eRequestApiHelper {
|
||||||
|
|
||||||
@@ -52,14 +50,6 @@ export class E2eRequestApiHelper {
|
|||||||
this.api = backend.apiService;
|
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> {
|
public get<T>(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike<T> {
|
||||||
return this.request<T>('GET', endPoint, overriddenOptions);
|
return this.request<T>('GET', endPoint, overriddenOptions);
|
||||||
}
|
}
|
||||||
@@ -76,6 +66,14 @@ export class E2eRequestApiHelper {
|
|||||||
return this.request<T>('DELETE', endPoint, overriddenOptions);
|
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> {
|
private request<T>(httpMethod: string, endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike<T> {
|
||||||
const options = {
|
const options = {
|
||||||
...getDefaultOptions(),
|
...getDefaultOptions(),
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
export const infoColor = '\x1b[36m%s\x1b[0m';
|
export const infoColor = '\x1b[36m%s\x1b[0m';
|
||||||
export const logColor = '\x1b[35m%s\x1b[0m';
|
export const logColor = '\x1b[35m%s\x1b[0m';
|
||||||
export const warnColor = '\x1b[33m%s\x1b[0m';
|
export const warnColor = '\x1b[33m%s\x1b[0m';
|
||||||
@@ -31,7 +33,7 @@ export class LogLevelsEnum extends Number {
|
|||||||
static SILENT: number = 0;
|
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.TRACE, name: 'TRACE' },
|
||||||
{ level: LogLevelsEnum.DEBUG, name: 'DEBUG' },
|
{ level: LogLevelsEnum.DEBUG, name: 'DEBUG' },
|
||||||
{ level: LogLevelsEnum.INFO, name: 'INFO' },
|
{ level: LogLevelsEnum.INFO, name: 'INFO' },
|
||||||
|
Reference in New Issue
Block a user