From 0c13f3d87915d3c4f91b67ba490f591471d6305b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 8 Nov 2019 14:02:05 +0000 Subject: [PATCH] add missing typing information (#5227) * add missing typing information * typing fixes * revert return type * typing fixes --- .../process-attachment-list.component.ts | 4 +- .../task-attachment-list.component.ts | 2 +- .../people-list/people-list.component.ts | 20 ++++----- .../people-search-field.component.ts | 12 +++--- .../people-search/people-search.component.ts | 4 +- .../components/people/people.component.ts | 20 +++------ .../lib/task-list/models/user-event.model.ts | 11 ++--- .../lib/task-list/models/user-group.model.ts | 12 +----- .../task-list/services/tasklist.service.ts | 13 +++--- .../validators/task-description.validator.ts | 2 +- .../identity/group-identity.service.ts | 34 ++++++++------- .../core/actions/identity/identity.service.ts | 23 +++++----- .../core/actions/identity/tasks.service.ts | 30 +++++++------ .../core/pages/data-table-component.page.ts | 42 +++++++++---------- .../src/lib/core/pages/form/formFields.ts | 2 +- lib/testing/src/lib/core/utils/logger.ts | 8 ++-- .../actions/message-events.service.ts | 10 +++-- .../actions/process-definitions.service.ts | 2 +- .../dialog/edit-process-filter-dialog.page.ts | 4 +- .../dialog/edit-task-filter-dialog.page.ts | 4 +- ...dit-process-filter-cloud-component.page.ts | 8 ++-- .../edit-task-filter-cloud-component.page.ts | 28 ++++++------- .../pages/group-cloud-component.page.ts | 14 +++---- .../pages/people-cloud-component.page.ts | 14 +++---- .../process-list-cloud-component.page.ts | 10 ++--- .../start-process-cloud-component.page.ts | 16 +++---- .../pages/start-tasks-cloud-component.page.ts | 16 +++---- .../pages/task-list-cloud-component.page.ts | 32 +++++++------- .../pages/form-fields.page.ts | 31 +++++++------- 29 files changed, 208 insertions(+), 220 deletions(-) diff --git a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts index 740553931d..a96fa82eee 100644 --- a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts @@ -56,7 +56,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn * (eg, following a network error). */ @Output() - error: EventEmitter = new EventEmitter(); + error = new EventEmitter(); hasCustomTemplate: boolean = false; @@ -91,7 +91,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn }); } - hasCustomEmptyTemplate() { + hasCustomEmptyTemplate(): boolean { return !!this.emptyTemplate; } diff --git a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts index 4dac6c2552..3e8995a841 100644 --- a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts @@ -64,7 +64,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit /** Emitted when an error occurs while fetching the attachments. */ @Output() - error: EventEmitter = new EventEmitter(); + error = new EventEmitter(); hasCustomTemplate: boolean = false; diff --git a/lib/process-services/src/lib/people/components/people-list/people-list.component.ts b/lib/process-services/src/lib/people/components/people-list/people-list.component.ts index 1d080fb23a..f848074dc2 100644 --- a/lib/process-services/src/lib/people/components/people-list/people-list.component.ts +++ b/lib/process-services/src/lib/people/components/people-list/people-list.component.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { DataTableComponent } from '@alfresco/adf-core'; +import { DataTableComponent, DataCellEvent } from '@alfresco/adf-core'; import { DataColumnListComponent, UserProcessModel } from '@alfresco/adf-core'; -import { AfterContentInit, AfterViewInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core'; +import { AfterContentInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { UserEventModel } from '../../../task-list/models/user-event.model'; @Component({ @@ -26,9 +26,10 @@ import { UserEventModel } from '../../../task-list/models/user-event.model'; styleUrls: ['./people-list.component.scss'] }) -export class PeopleListComponent implements AfterViewInit, AfterContentInit { +export class PeopleListComponent implements AfterContentInit { - @ContentChild(DataColumnListComponent) columnList: DataColumnListComponent; + @ContentChild(DataColumnListComponent) + columnList: DataColumnListComponent; @ViewChild('dataTable') peopleDataTable: DataTableComponent; @@ -43,11 +44,11 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit { /** Emitted when the user clicks a row in the people list. */ @Output() - clickRow: EventEmitter = new EventEmitter(); + clickRow = new EventEmitter(); /** Emitted when the user clicks in the 'Three Dots' drop down menu for a row. */ @Output() - clickAction: EventEmitter = new EventEmitter(); + clickAction = new EventEmitter(); user: UserProcessModel; @@ -55,9 +56,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit { this.peopleDataTable.columnList = this.columnList; } - ngAfterViewInit() { - } - selectUser(event: any) { this.user = event.value.obj; this.clickRow.emit(this.user); @@ -67,7 +65,7 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit { return this.actions; } - onShowRowActionsMenu(event: any) { + onShowRowActionsMenu(event: DataCellEvent) { const removeAction = { title: 'Remove', @@ -82,6 +80,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit { onExecuteRowAction(event: any) { const args = event.value; const action = args.action; - this.clickAction.emit(new UserEventModel({type: action.name, value: args.row.obj})); + this.clickAction.emit({type: action.name, value: args.row.obj}); } } diff --git a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts index b0182761d1..1fd1884047 100644 --- a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts +++ b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts @@ -40,7 +40,7 @@ export class PeopleSearchFieldComponent { placeholder: string; @Output() - rowClick: EventEmitter = new EventEmitter(); + rowClick = new EventEmitter(); users$: Observable; searchUser: FormControl = new FormControl(); @@ -64,23 +64,23 @@ export class PeopleSearchFieldComponent { this.defaultPlaceholder = this.translationService.instant(this.defaultPlaceholder); } - public reset() { + reset() { this.searchUser.reset(); } - get searchPlaceholder() { + get searchPlaceholder(): string { return this.placeholder || this.defaultPlaceholder; } - onRowClick(event) { - this.rowClick.emit(event); + onRowClick(model: UserProcessModel) { + this.rowClick.emit(model); } getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string { return getDisplayUser(firstName, lastName, delimiter); } - getInitialUserName(firstName: string, lastName: string) { + getInitialUserName(firstName: string, lastName: string): string { firstName = (firstName !== null && firstName !== '' ? firstName[0] : ''); lastName = (lastName !== null && lastName !== '' ? lastName[0] : ''); return this.getDisplayUser(firstName, lastName, ''); diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.ts index 1e6f9a9af6..0df384017f 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.ts @@ -39,11 +39,11 @@ export class PeopleSearchComponent implements OnInit { /** Emitted when a search is performed with a new keyword. */ @Output() - searchPeople: EventEmitter = new EventEmitter(); + searchPeople = new EventEmitter(); /** Emitted when a user is selected and the action button is clicked. */ @Output() - success: EventEmitter = new EventEmitter(); + success = new EventEmitter(); /** Emitted when the "close" button is clicked. */ @Output() diff --git a/lib/process-services/src/lib/people/components/people/people.component.ts b/lib/process-services/src/lib/people/components/people/people.component.ts index acef582e59..442d45a0da 100644 --- a/lib/process-services/src/lib/people/components/people/people.component.ts +++ b/lib/process-services/src/lib/people/components/people/people.component.ts @@ -17,7 +17,7 @@ import { LogService, UserProcessModel } from '@alfresco/adf-core'; import { PeopleProcessService } from '@alfresco/adf-core'; -import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, ViewChild } from '@angular/core'; import { Observable, Observer } from 'rxjs'; import { UserEventModel } from '../../../task-list/models/user-event.model'; import { PeopleSearchComponent } from '../people-search/people-search.component'; @@ -28,7 +28,7 @@ import { share } from 'rxjs/operators'; templateUrl: './people.component.html', styleUrls: ['./people.component.scss'] }) -export class PeopleComponent implements OnInit, AfterViewInit { +export class PeopleComponent { /** The array of User objects to display. */ @Input() @@ -57,12 +57,6 @@ export class PeopleComponent implements OnInit, AfterViewInit { ); } - ngOnInit() { - } - - ngAfterViewInit() { - } - involveUserAndCloseSearch() { if (this.peopleSearch) { this.peopleSearch.involveUserAndClose(); @@ -98,9 +92,7 @@ export class PeopleComponent implements OnInit, AfterViewInit { .removeInvolvedUser(this.taskId, user.id.toString()) .subscribe( () => { - this.people = this.people.filter((involvedUser) => { - return involvedUser.id !== user.id; - }); + this.people = this.people.filter(involvedUser => involvedUser.id !== user.id); }, () => this.logService.error('Impossible to remove involved user from task')); } @@ -122,16 +114,16 @@ export class PeopleComponent implements OnInit, AfterViewInit { } onClickAction(event: UserEventModel) { - if (event.type === 'remove') { + if (event && event.value && event.type === 'remove') { this.removeInvolvedUser(event.value); } } - hasPeople() { + hasPeople(): boolean { return this.people && this.people.length > 0; } - isEditMode() { + isEditMode(): boolean { return !this.readOnly; } diff --git a/lib/process-services/src/lib/task-list/models/user-event.model.ts b/lib/process-services/src/lib/task-list/models/user-event.model.ts index 786b58644a..038dbadc09 100644 --- a/lib/process-services/src/lib/task-list/models/user-event.model.ts +++ b/lib/process-services/src/lib/task-list/models/user-event.model.ts @@ -18,12 +18,7 @@ /** * This object represent the User Event. */ -export class UserEventModel { - type: string = ''; - value: any = {}; - - constructor(obj?: any) { - this.type = obj && obj.type; - this.value = obj && obj.value || {}; - } +export interface UserEventModel { + type: string; + value: any; } diff --git a/lib/process-services/src/lib/task-list/models/user-group.model.ts b/lib/process-services/src/lib/task-list/models/user-group.model.ts index 5177cc49bc..189259a66c 100644 --- a/lib/process-services/src/lib/task-list/models/user-group.model.ts +++ b/lib/process-services/src/lib/task-list/models/user-group.model.ts @@ -19,18 +19,10 @@ * This object represent the process service user group.* */ -export class UserGroupModel { +export interface UserGroupModel { id?: number; name?: string; externalId?: string; status?: string; - groups?: any = {}; - - constructor(obj?: any) { - this.id = obj && obj.id; - this.name = obj && obj.name; - this.externalId = obj && obj.externalId; - this.status = obj && obj.status; - this.groups = obj && obj.groups; - } + groups?: any; } diff --git a/lib/process-services/src/lib/task-list/services/tasklist.service.ts b/lib/process-services/src/lib/task-list/services/tasklist.service.ts index 4e7f4e6dc6..d0c51908ad 100644 --- a/lib/process-services/src/lib/task-list/services/tasklist.service.ts +++ b/lib/process-services/src/lib/task-list/services/tasklist.service.ts @@ -77,7 +77,7 @@ export class TaskListService { const requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel); return from(this.callApiTasksFiltered(requestNodeForFilter)) .pipe( - map((res: any) => { + map(res => { return res.data.find((element) => element.id === taskId) ? filterModel : null; }), catchError((err) => this.handleError(err)) @@ -155,7 +155,7 @@ export class TaskListService { getTaskDetails(taskId: string): Observable { return from(this.callApiTaskDetails(taskId)) .pipe( - map((details: any) => { + map(details => { return new TaskDetailsModel(details); }), catchError((err) => this.handleError(err)) @@ -170,7 +170,7 @@ export class TaskListService { getTaskChecklist(id: string): Observable { return from(this.callApiTaskChecklist(id)) .pipe( - map((response: any) => { + map(response => { const checklists: TaskDetailsModel[] = []; response.data.forEach((checklist) => { checklists.push(new TaskDetailsModel(checklist)); @@ -194,7 +194,7 @@ export class TaskListService { return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts)) .pipe( - map((response: any) => { + map(response => { const forms: Form[] = []; response.data.forEach((form) => { forms.push(new Form(form.id, form.name)); @@ -278,9 +278,6 @@ export class TaskListService { requestNode.size = 0; return from(this.callApiTasksFiltered(requestNode)) .pipe( - map((res: any) => { - return res; - }), catchError((err) => this.handleError(err)) ); } @@ -364,7 +361,7 @@ export class TaskListService { * @param updated Data to update the task (as a `TaskUpdateRepresentation` instance). * @returns Updated task details */ - updateTask(taskId: any, updated: TaskUpdateRepresentation): Observable { + updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable { return from(this.apiService.taskApi.updateTask(taskId, updated)) .pipe( map((result) => result), diff --git a/lib/process-services/src/lib/task-list/validators/task-description.validator.ts b/lib/process-services/src/lib/task-list/validators/task-description.validator.ts index 43bc5f0c6f..14a5dd2d80 100644 --- a/lib/process-services/src/lib/task-list/validators/task-description.validator.ts +++ b/lib/process-services/src/lib/task-list/validators/task-description.validator.ts @@ -21,7 +21,7 @@ export class TaskDescriptionValidator implements CardViewItemValidator { message: string = 'ADF_CLOUD_TASK_HEADER.FORM_VALIDATION.INVALID_FIELD'; - isValid(value: any): boolean { + isValid(value: string): boolean { const isWhitespace = (value || '').trim().length === 0; return value.length === 0 || !isWhitespace; } diff --git a/lib/testing/src/lib/core/actions/identity/group-identity.service.ts b/lib/testing/src/lib/core/actions/identity/group-identity.service.ts index 178d937c2d..2d6849cbb4 100644 --- a/lib/testing/src/lib/core/actions/identity/group-identity.service.ts +++ b/lib/testing/src/lib/core/actions/identity/group-identity.service.ts @@ -37,25 +37,27 @@ export class GroupIdentityService { await this.deleteGroup(groupId); } - async createGroup(groupName): Promise { + async createGroup(groupName: string): Promise { const path = '/groups'; const method = 'POST'; - const queryParams = {}, postBody = { + const queryParams = {}; + const postBody = { name: `${groupName}-${browser.params.groupSuffix}` }; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } - async deleteGroup(groupId): Promise { + async deleteGroup(groupId: string): Promise { const path = `/groups/${groupId}`; const method = 'DELETE'; - const queryParams = {}, postBody = {}; + const queryParams = {}; + const postBody = {}; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } - async getGroupInfoByGroupName(groupName): Promise { + async getGroupInfoByGroupName(groupName: string): Promise { const path = `/groups`; const method = 'GET'; const queryParams = { search: groupName }, postBody = {}; @@ -64,11 +66,11 @@ export class GroupIdentityService { return data[0]; } - async assignRole(groupId, roleId, roleName): Promise { + async assignRole(groupId: string, roleId: string, roleName: string): Promise { const path = `/groups/${groupId}/role-mappings/realm`; const method = 'POST'; - const queryParams = {}, - postBody = [{ id: roleId, name: roleName }]; + const queryParams = {}; + const postBody = [{ id: roleId, name: roleName }]; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; @@ -83,16 +85,18 @@ export class GroupIdentityService { */ async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise { const path = `/groups/${groupId}/role-mappings/clients/${clientId}`; - const method = 'POST', queryParams = {}, - postBody = [{ + const method = 'POST'; + const queryParams = {}; + const postBody = [ + { id: roleId, name: roleName, composite: false, clientRole: true, containerId: clientId - }]; - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; + } + ]; + return this.api.performIdentityOperation(path, method, queryParams, postBody); } /** @@ -102,7 +106,9 @@ export class GroupIdentityService { */ async getClientIdByApplicationName(applicationName: string): Promise { const path = `/clients`; - const method = 'GET', queryParams = { clientId: applicationName }, postBody = {}; + const method = 'GET'; + const queryParams = { clientId: applicationName }; + const postBody = {}; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data[0].id; diff --git a/lib/testing/src/lib/core/actions/identity/identity.service.ts b/lib/testing/src/lib/core/actions/identity/identity.service.ts index f4b6ab3317..323bc18073 100644 --- a/lib/testing/src/lib/core/actions/identity/identity.service.ts +++ b/lib/testing/src/lib/core/actions/identity/identity.service.ts @@ -82,7 +82,7 @@ export class IdentityService { await this.createIdentityUser(user); } - async deleteIdentityUser(userId): Promise { + async deleteIdentityUser(userId: string): Promise { await this.deleteUser(userId); } @@ -105,23 +105,24 @@ export class IdentityService { } } - async deleteUser(userId): Promise { + async deleteUser(userId: string): Promise { const path = `/users/${userId}`; const method = 'DELETE'; const queryParams = {}, postBody = {}; return this.api.performIdentityOperation(path, method, queryParams, postBody); } - async getUserInfoByUsername(username): Promise { + async getUserInfoByUsername(username: string): Promise { const path = `/users`; const method = 'GET'; - const queryParams = { username: username }, postBody = {}; + const queryParams = { username }; + const postBody = {}; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data[0]; } - async resetPassword(id, password): Promise { + async resetPassword(id: string, password: string): Promise { const path = `/users/${id}/reset-password`; const method = 'PUT'; const queryParams = {}, @@ -130,12 +131,12 @@ export class IdentityService { return this.api.performIdentityOperation(path, method, queryParams, postBody); } - async addUserToGroup(userId, groupId): Promise { + async addUserToGroup(userId: string, groupId: string): Promise { try { const path = `/users/${userId}/groups/${groupId}`; const method = 'PUT'; - const queryParams = {}, - postBody = { realm: 'alfresco', userId: userId, groupId: groupId }; + const queryParams = {}; + const postBody = { realm: 'alfresco', userId: userId, groupId: groupId }; return this.api.performIdentityOperation(path, method, queryParams, postBody); } catch (error) { @@ -143,11 +144,11 @@ export class IdentityService { } } - async assignRole(userId, roleId, roleName): Promise { + async assignRole(userId: string, roleId: string, roleName: string): Promise { const path = `/users/${userId}/role-mappings/realm`; const method = 'POST'; - const queryParams = {}, - postBody = [{ id: roleId, name: roleName }]; + const queryParams = {}; + const postBody = [{ id: roleId, name: roleName }]; return this.api.performIdentityOperation(path, method, queryParams, postBody); } diff --git a/lib/testing/src/lib/core/actions/identity/tasks.service.ts b/lib/testing/src/lib/core/actions/identity/tasks.service.ts index 5692459516..c093f0a844 100644 --- a/lib/testing/src/lib/core/actions/identity/tasks.service.ts +++ b/lib/testing/src/lib/core/actions/identity/tasks.service.ts @@ -26,7 +26,7 @@ export class TasksService { this.api = api; } - async createStandaloneTask(taskName, appName, options?): Promise { + async createStandaloneTask(taskName: string, appName: string, options?: Object): Promise { try { const path = '/' + appName + '/rb/v1/tasks'; const method = 'POST'; @@ -43,12 +43,13 @@ export class TasksService { } } - async createStandaloneTaskWithForm(taskName, appName, formKey, options?): Promise { + async createStandaloneTaskWithForm(taskName: string, appName: string, formKey: string, options?: Object): Promise { try { const path = '/' + appName + '/rb/v1/tasks'; const method = 'POST'; - const queryParams = {}, postBody = { + const queryParams = {}; + const postBody = { name: taskName, payloadType: 'CreateTaskPayload', formKey: formKey, @@ -61,7 +62,7 @@ export class TasksService { } } - async completeTask(taskId, appName): Promise { + async completeTask(taskId: string, appName: string): Promise { try { const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete'; const method = 'POST'; @@ -75,12 +76,13 @@ export class TasksService { } - async claimTask(taskId, appName): Promise { + async claimTask(taskId: string, appName: string): Promise { try { const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`; const method = 'POST'; - const queryParams = {}, postBody = {}; + const queryParams = {}; + const postBody = {}; return this.api.performBpmOperation(path, method, queryParams, postBody); } catch (error) { @@ -88,12 +90,13 @@ export class TasksService { } } - async deleteTask(taskId, appName): Promise { + async deleteTask(taskId: string, appName: string): Promise { try { const path = '/' + appName + '/rb/v1/tasks/' + taskId; const method = 'DELETE'; - const queryParams = {}, postBody = {}; + const queryParams = {}; + const postBody = {}; return this.api.performBpmOperation(path, method, queryParams, postBody); } catch (error) { @@ -101,19 +104,20 @@ export class TasksService { } } - async createAndCompleteTask(taskName, appName): Promise { + async createAndCompleteTask(taskName: string, appName: string): Promise { const task = await this.createStandaloneTask(taskName, appName); await this.claimTask(task.entry.id, appName); await this.completeTask(task.entry.id, appName); return task; } - async getTask(taskId, appName): Promise { + async getTask(taskId: string, appName: string): Promise { try { const path = '/' + appName + '/query/v1/tasks/' + taskId; const method = 'GET'; - const queryParams = {}, postBody = {}; + const queryParams = {}; + const postBody = {}; return this.api.performBpmOperation(path, method, queryParams, postBody); } catch (error) { @@ -121,7 +125,7 @@ export class TasksService { } } - async getTaskId(taskName, appName): Promise { + async getTaskId(taskName: string, appName: string): Promise { try { const path = '/' + appName + '/query/v1/tasks'; const method = 'GET'; @@ -135,7 +139,7 @@ export class TasksService { } } - async createStandaloneSubtask(parentTaskId, appName, name): Promise { + async createStandaloneSubtask(parentTaskId: string, appName: string, name: string): Promise { try { const path = '/' + appName + '/rb/v1/tasks'; const method = 'POST'; diff --git a/lib/testing/src/lib/core/pages/data-table-component.page.ts b/lib/testing/src/lib/core/pages/data-table-component.page.ts index b1c3de65d1..b4346ef13e 100644 --- a/lib/testing/src/lib/core/pages/data-table-component.page.ts +++ b/lib/testing/src/lib/core/pages/data-table-component.page.ts @@ -58,21 +58,21 @@ export class DataTableComponentPage { await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]'))); } - async clickCheckbox(columnName: string, columnValue): Promise { + async clickCheckbox(columnName: string, columnValue: string): Promise { const checkbox = this.getRowCheckbox(columnName, columnValue).element(by.css(`input[type='checkbox']`)); await BrowserActions.click(checkbox); } - async checkRowIsNotChecked(columnName: string, columnValue): Promise { + async checkRowIsNotChecked(columnName: string, columnValue: string): Promise { await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]'))); } - async checkRowIsChecked(columnName: string, columnValue): Promise { + async checkRowIsChecked(columnName: string, columnValue: string): Promise { const rowCheckbox = this.getRowCheckbox(columnName, columnValue); await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]'))); } - getRowCheckbox(columnName: string, columnValue): ElementFinder { + getRowCheckbox(columnName: string, columnValue: string): ElementFinder { return this.getRow(columnName, columnValue).element(by.css('mat-checkbox')); } @@ -84,29 +84,29 @@ export class DataTableComponentPage { return this.allSelectedRows.count(); } - async selectRow(columnName, columnValue): Promise { + async selectRow(columnName: string, columnValue: string): Promise { await BrowserActions.closeMenuAndDialogs(); const row = this.getRow(columnName, columnValue); await BrowserActions.click(row); } - async selectRowWithKeyboard(columnName, columnValue): Promise { + async selectRowWithKeyboard(columnName: string, columnValue: string): Promise { await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); await this.selectRow(columnName, columnValue); await browser.actions().sendKeys(protractor.Key.NULL).perform(); } - async checkRowIsSelected(columnName, columnValue): Promise { + async checkRowIsSelected(columnName: string, columnValue: string): Promise { const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); await BrowserVisibility.waitUntilElementIsVisible(selectedRow); } - async checkRowIsNotSelected(columnName, columnValue): Promise { + async checkRowIsNotSelected(columnName: string, columnValue: string): Promise { const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); } - async getColumnValueForRow(identifyingColumn, identifyingValue, columnName): Promise { + async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise { const row = this.getRow(identifyingColumn, identifyingValue); await BrowserVisibility.waitUntilElementIsVisible(row); const rowColumn = row.element(by.css(`div[title="${columnName}"] span`)); @@ -138,14 +138,14 @@ export class DataTableComponentPage { return initialList.toString() === sortedList.toString(); } - async rightClickOnRow(columnName: string, columnValue): Promise { + async rightClickOnRow(columnName: string, columnValue: string): Promise { const row = this.getRow(columnName, columnValue); await BrowserActions.rightClick(row); await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content'))); } - async getTooltip(columnName, columnValue): Promise { + async getTooltip(columnName: string, columnValue: string): Promise { return this.getCellElementByValue(columnName, columnValue).getAttribute('title'); } @@ -171,7 +171,7 @@ export class DataTableComponentPage { .map(async (el) => el.getText()); } - async getRowsWithSameColumnValues(columnName: string, columnValue) { + async getRowsWithSameColumnValues(columnName: string, columnValue: string) { const columnLocator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`); await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first()); return this.rootElement.all(columnLocator).getText(); @@ -256,7 +256,7 @@ export class DataTableComponentPage { await BrowserVisibility.waitUntilElementIsVisible(this.contents.first()); } - async checkColumnIsDisplayed(column): Promise { + async checkColumnIsDisplayed(column: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`))); } @@ -268,34 +268,34 @@ export class DataTableComponentPage { return this.list.count(); } - getCellByRowNumberAndColumnName(rowNumber, columnName): ElementFinder { + getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder { return this.list.get(rowNumber).all(by.css(`div[title="${columnName}"] span`)).first(); } - getCellByRowContentAndColumn(rowColumn, rowContent, columnName): ElementFinder { + getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder { return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`)); } - async selectRowByContent(content): Promise { + async selectRowByContent(content: string): Promise { const row = this.getCellByContent(content); await BrowserActions.click(row); } - async checkRowByContentIsSelected(folderName): Promise { + async checkRowByContentIsSelected(folderName: string): Promise { const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); await BrowserVisibility.waitUntilElementIsVisible(selectedRow); } - async checkRowByContentIsNotSelected(folderName): Promise { + async checkRowByContentIsNotSelected(folderName: string): Promise { const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); } - getCellByContent(content) { + getCellByContent(content: string): ElementFinder { return this.rootElement.all(by.cssContainingText(`adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-datatable-cell']`, content)).first(); } - async checkCellByHighlightContent(content) { + async checkCellByHighlightContent(content: string): Promise { const cell = this.rootElement.element(by.cssContainingText(`adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-name-location-cell-name'] span.adf-highlight`, content)); await BrowserVisibility.waitUntilElementIsVisible(cell); } @@ -340,7 +340,7 @@ export class DataTableComponentPage { await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip); } - async mouseOverColumn(columnName: string, columnValue): Promise { + async mouseOverColumn(columnName: string, columnValue: string): Promise { const column = this.getCellElementByValue(columnName, columnValue); await BrowserVisibility.waitUntilElementIsVisible(column); await browser.actions().mouseMove(column).perform(); diff --git a/lib/testing/src/lib/core/pages/form/formFields.ts b/lib/testing/src/lib/core/pages/form/formFields.ts index 2373213a95..28758cc31a 100644 --- a/lib/testing/src/lib/core/pages/form/formFields.ts +++ b/lib/testing/src/lib/core/pages/form/formFields.ts @@ -40,7 +40,7 @@ export class FormFields { } async clickField(locator, field): Promise { - const fieldElement: any = element(locator(field)); + const fieldElement = element(locator(field)); await BrowserActions.click(fieldElement); } diff --git a/lib/testing/src/lib/core/utils/logger.ts b/lib/testing/src/lib/core/utils/logger.ts index 72b07e9068..476f922074 100644 --- a/lib/testing/src/lib/core/utils/logger.ts +++ b/lib/testing/src/lib/core/utils/logger.ts @@ -24,25 +24,25 @@ const infoColor = '\x1b[36m%s\x1b[0m', /* tslint:disable:no-console */ export class Logger { - static info(...messages): void { + static info(...messages: string[]): void { if (browser.params.config && browser.params.config.log) { console.log(infoColor, messages.join('')); } } - static log(...messages): void { + static log(...messages: string[]): void { if (browser.params.config && browser.params.config.log) { console.log(logColor, messages.join('')); } } - static warn(...messages): void { + static warn(...messages: string[]): void { if (browser.params.config && browser.params.config.log) { console.log(warnColor, messages.join('')); } } - static error(...messages): void { + static error(...messages: string[]): void { console.log(errorColor, messages.join('')); } } diff --git a/lib/testing/src/lib/process-services-cloud/actions/message-events.service.ts b/lib/testing/src/lib/process-services-cloud/actions/message-events.service.ts index c7cac4d0a1..29c2a4376b 100644 --- a/lib/testing/src/lib/process-services-cloud/actions/message-events.service.ts +++ b/lib/testing/src/lib/process-services-cloud/actions/message-events.service.ts @@ -26,12 +26,13 @@ export class MessageEventsService { this.api = api; } - async startMessageEvent(startMessage, appName, options?: any): Promise { + async startMessageEvent(startMessage: string, appName: string, options?: Object): Promise { try { const path = '/' + appName + '/rb/v1/process-instances/message'; const method = 'POST'; - const queryParams = {}, postBody = { + const queryParams = {}; + const postBody = { 'name': startMessage, 'variables': {}, 'payloadType': 'StartMessagePayload', @@ -46,12 +47,13 @@ export class MessageEventsService { } - async receiveMessageEvent(receiveMessage, appName, options?: any): Promise { + async receiveMessageEvent(receiveMessage: string, appName: string, options?: Object): Promise { try { const path = '/' + appName + '/rb/v1/process-instances/message'; const method = 'PUT'; - const queryParams = {}, postBody = { + const queryParams = {}; + const postBody = { 'name': receiveMessage, 'variables': {}, 'payloadType': 'ReceiveMessagePayload', diff --git a/lib/testing/src/lib/process-services-cloud/actions/process-definitions.service.ts b/lib/testing/src/lib/process-services-cloud/actions/process-definitions.service.ts index 0a92fe1ce8..f6cbb55027 100644 --- a/lib/testing/src/lib/process-services-cloud/actions/process-definitions.service.ts +++ b/lib/testing/src/lib/process-services-cloud/actions/process-definitions.service.ts @@ -26,7 +26,7 @@ export class ProcessDefinitionsService { this.api = api; } - async getProcessDefinitions(appName): Promise { + async getProcessDefinitions(appName: string): Promise { const path = '/' + appName + '/rb/v1/process-definitions'; const method = 'GET'; diff --git a/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts b/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts index 0988ae90bd..23fdb7e9cb 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts @@ -36,7 +36,7 @@ export class EditProcessFilterDialogPage { await browser.driver.sleep(1000); } - async checkSaveButtonIsEnabled() { + async checkSaveButtonIsEnabled(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator)); return this.componentElement.element(this.saveButtonLocator).isEnabled(); } @@ -57,7 +57,7 @@ export class EditProcessFilterDialogPage { return this.filterNameInput.getAttribute('value'); } - async setFilterName(filterName): Promise { + async setFilterName(filterName: string): Promise { await BrowserActions.clearSendKeys(this.filterNameInput, filterName); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts b/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts index ad1d020479..e0251df23d 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts @@ -56,11 +56,11 @@ export class EditTaskFilterDialogPage { return this.filterNameInput.getAttribute('value'); } - async setFilterName(filterName): Promise { + async setFilterName(filterName: string): Promise { await BrowserActions.clearSendKeys(this.filterNameInput, filterName); } - async clearFilterName() { + async clearFilterName(): Promise { await BrowserActions.clearWithBackSpace(this.filterNameInput); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts index ae98b34d4e..6833c87376 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts @@ -51,7 +51,7 @@ export class EditProcessFilterCloudComponentPage { await BrowserVisibility.waitUntilElementIsVisible(content); } - async setStatusFilterDropDown(option): Promise { + async setStatusFilterDropDown(option: string): Promise { await this.clickOnDropDownArrow('status'); const statusElement = element.all(by.cssContainingText('mat-option span', option)).first(); @@ -91,7 +91,7 @@ export class EditProcessFilterCloudComponentPage { await BrowserActions.click(dropDownArrow); } - async setAppNameDropDown(option): Promise { + async setAppNameDropDown(option: string): Promise { await this.clickOnDropDownArrow('appName'); const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first(); @@ -132,13 +132,13 @@ export class EditProcessFilterCloudComponentPage { return this.getProperty('processInstanceId'); } - async getProperty(property): Promise { + async getProperty(property: string): Promise { const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); await BrowserVisibility.waitUntilElementIsVisible(locator); return locator.getAttribute('value'); } - async setProperty(property, option): Promise { + async setProperty(property: string, option: string): Promise { const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); await BrowserVisibility.waitUntilElementIsVisible(locator); await locator.clear(); diff --git a/lib/testing/src/lib/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts index 982af86802..7db252cc7e 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts @@ -55,7 +55,7 @@ export class EditTaskFilterCloudComponentPage { await browser.driver.sleep(1000); } - async setStatusFilterDropDown(option): Promise { + async setStatusFilterDropDown(option: string): Promise { await this.clickOnDropDownArrow('status'); const statusElement = element.all(by.cssContainingText('mat-option span', option)).first(); @@ -78,7 +78,7 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(elementSort); } - async setOrderFilterDropDown(option): Promise { + async setOrderFilterDropDown(option: string): Promise { await this.clickOnDropDownArrow('order'); const orderElement = element.all(by.cssContainingText('mat-option span', option)).first(); @@ -90,13 +90,13 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-order'] span")).first()); } - async clickOnDropDownArrow(option): Promise { + async clickOnDropDownArrow(option: string): Promise { const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']")).first(); await BrowserActions.click(dropDownArrow); await BrowserVisibility.waitUntilElementIsVisible(this.selectedOption); } - async setAssignee(option): Promise { + async setAssignee(option: string): Promise { await this.setProperty('assignee', option); } @@ -112,7 +112,7 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(this.priority); } - async setParentTaskId(option): Promise { + async setParentTaskId(option: string): Promise { await this.setProperty('parentTaskId', option); } @@ -120,7 +120,7 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(this.parentTaskId); } - async setOwner(option): Promise { + async setOwner(option: string): Promise { await this.setProperty('owner', option); } @@ -128,7 +128,7 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(this.owner); } - async setLastModifiedFrom(lastModifiedFromDate) { + async setLastModifiedFrom(lastModifiedFromDate: string) { await this.clearField(this.lastModifiedFrom); await BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate); } @@ -137,7 +137,7 @@ export class EditTaskFilterCloudComponentPage { return BrowserActions.getText(this.lastModifiedFrom); } - async setLastModifiedTo(lastModifiedToDate): Promise { + async setLastModifiedTo(lastModifiedToDate: string): Promise { await this.clearField(this.lastModifiedTo); await BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate); } @@ -194,12 +194,12 @@ export class EditTaskFilterCloudComponentPage { await browser.driver.sleep(1000); } - async clearField(locator): Promise { + async clearField(locator: ElementFinder): Promise { await BrowserActions.clearSendKeys(locator, ' '); await locator.sendKeys(protractor.Key.BACK_SPACE); } - async setAppNameDropDown(option): Promise { + async setAppNameDropDown(option: string): Promise { await this.clickOnDropDownArrow('appName'); const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first(); @@ -219,7 +219,7 @@ export class EditTaskFilterCloudComponentPage { return this.id.getAttribute('value'); } - async setTaskName(option): Promise { + async setTaskName(option: string): Promise { await this.setProperty('taskName', option); } @@ -227,7 +227,7 @@ export class EditTaskFilterCloudComponentPage { return this.taskName.getAttribute('value'); } - async setProcessDefinitionId(option): Promise { + async setProcessDefinitionId(option: string): Promise { await this.setProperty('processDefinitionId', option); } @@ -235,11 +235,11 @@ export class EditTaskFilterCloudComponentPage { return this.processDefinitionId.getAttribute('value'); } - async setProcessInstanceId(option): Promise { + async setProcessInstanceId(option: string): Promise { await this.setProperty('processInstanceId', option); } - async setProperty(property, option): Promise { + async setProperty(property: string, option: string): Promise { const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]')); await BrowserVisibility.waitUntilElementIsVisible(locator); await locator.clear(); diff --git a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts index f706db3a79..96e48dabd6 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts @@ -23,7 +23,7 @@ export class GroupCloudComponentPage { groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]')); - async searchGroups(name): Promise { + async searchGroups(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); await browser.sleep(1000); await BrowserActions.clearSendKeys(this.groupCloudSearch, name); @@ -40,32 +40,32 @@ export class GroupCloudComponentPage { } - async selectGroupFromList(name): Promise { + async selectGroupFromList(name: string): Promise { const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); await browser.sleep(1000); await BrowserActions.click(groupRow); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); } - async checkGroupIsDisplayed(name): Promise { + async checkGroupIsDisplayed(name: string): Promise { const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); await BrowserVisibility.waitUntilElementIsVisible(groupRow); } - async checkGroupIsNotDisplayed(name): Promise { + async checkGroupIsNotDisplayed(name: string): Promise { const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); } - async checkSelectedGroup(group): Promise { + async checkSelectedGroup(group: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); } - async checkGroupNotSelected(group): Promise { + async checkGroupNotSelected(group: string): Promise { await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); } - async removeSelectedGroup(group): Promise { + async removeSelectedGroup(group: string): Promise { const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`)); await BrowserActions.click(locator); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts index e6261d0de3..3fd07aeda8 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts @@ -29,25 +29,25 @@ export class PeopleCloudComponentPage { await this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE); } - async searchAssigneeAndSelect(name): Promise { + async searchAssigneeAndSelect(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); await this.selectAssigneeFromList(name); } - async searchAssignee(name): Promise { + async searchAssignee(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch); await browser.sleep(1000); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); } - async searchAssigneeToExisting(name): Promise { + async searchAssigneeToExisting(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); } - async selectAssigneeFromList(name): Promise { + async selectAssigneeFromList(name: string): Promise { const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); await browser.sleep(2000); await BrowserActions.click(assigneeRow); @@ -59,17 +59,17 @@ export class PeopleCloudComponentPage { return this.peopleCloudSearch.getAttribute('value'); } - async checkUserIsDisplayed(name): Promise { + async checkUserIsDisplayed(name: string): Promise { const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); await BrowserVisibility.waitUntilElementIsVisible(assigneeRow); } - async checkUserIsNotDisplayed(name): Promise { + async checkUserIsNotDisplayed(name: string): Promise { const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); } - async checkSelectedPeople(person): Promise { + async checkSelectedPeople(person: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person))); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts index a9bca8e3aa..dd41458b19 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts @@ -78,11 +78,11 @@ export class ProcessListCloudComponentPage { return this.dataTable.checkContentIsDisplayed(this.columns.id, processId); } - checkContentIsNotDisplayedById(processId): Promise { + checkContentIsNotDisplayedById(processId: string): Promise { return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId); } - selectRowWithKeyboard(processId): Promise { + selectRowWithKeyboard(processId: string): Promise { return this.dataTable.selectRowWithKeyboard(this.columns.id, processId); } @@ -98,11 +98,11 @@ export class ProcessListCloudComponentPage { return BrowserActions.getText(this.noProcessFound); } - getAllRowsByColumn(column): Promise { + getAllRowsByColumn(column: string) { return this.dataTable.getAllRowsColumnValues(column); } - async clickOptionsButton(content: string) { + async clickOptionsButton(content: string): Promise { await BrowserActions.closeMenuAndDialogs(); const row: ElementFinder = this.dataTable.getRow('Id', content); await BrowserActions.click(row.element(this.optionButton)); @@ -123,7 +123,7 @@ export class ProcessListCloudComponentPage { await this.dataTable.rightClickOnRow('Id', processInstance); } - async clickContextMenuActionNamed(actionName): Promise { + async clickContextMenuActionNamed(actionName: string): Promise { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/start-process-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/start-process-cloud-component.page.ts index 94eb1fe41d..cd8a880860 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/start-process-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/start-process-cloud-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element, Key, protractor, browser } from 'protractor'; +import { by, element, Key, protractor, browser, ElementFinder } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { FormFields } from '../../core/pages/form/formFields'; @@ -45,7 +45,7 @@ export class StartProcessCloudPage { await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel); } - async enterProcessName(name): Promise { + async enterProcessName(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput); await BrowserActions.clearSendKeys(this.processNameInput, name); } @@ -55,7 +55,7 @@ export class StartProcessCloudPage { return this.processNameInput.getAttribute('value'); } - async selectFromProcessDropdown(name): Promise { + async selectFromProcessDropdown(name: string): Promise { await this.clickProcessDropdownArrow(); await this.selectOption(name); } @@ -64,13 +64,13 @@ export class StartProcessCloudPage { await BrowserActions.click(this.selectProcessDropdownArrow); } - async checkOptionIsDisplayed(name): Promise { + async checkOptionIsDisplayed(name: string): Promise { const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown); await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown); } - async selectOption(name): Promise { + async selectOption(name: string): Promise { const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); await BrowserActions.click(selectProcessDropdown); } @@ -88,17 +88,17 @@ export class StartProcessCloudPage { await BrowserActions.click(this.startProcessButton); } - async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise { + async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise { const errorElement = element(by.cssContainingText(elementRef, error)); await BrowserVisibility.waitUntilElementIsVisible(errorElement); } - async blur(locator): Promise { + async blur(locator: ElementFinder): Promise { await BrowserActions.click(locator); await locator.sendKeys(Key.TAB); } - async clearField(locator) { + async clearField(locator: ElementFinder) { await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserActions.clearWithBackSpace(locator); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/start-tasks-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/start-tasks-cloud-component.page.ts index 007b5d489c..923bf47c24 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/start-tasks-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/start-tasks-cloud-component.page.ts @@ -36,19 +36,19 @@ export class StartTasksCloudPage { await BrowserVisibility.waitUntilElementIsVisible(this.form); } - async addName(userName): Promise { + async addName(userName: string): Promise { await BrowserActions.clearSendKeys(this.name, userName); } - async addDescription(userDescription): Promise { + async addDescription(userDescription: string): Promise { await BrowserActions.clearSendKeys(this.description, userDescription); } - async addPriority(userPriority): Promise { + async addPriority(userPriority: string): Promise { await BrowserActions.clearSendKeys(this.priority, userPriority); } - async addDueDate(date): Promise { + async addDueDate(date: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.dueDate); await BrowserActions.clearSendKeys(this.dueDate, date); } @@ -69,23 +69,23 @@ export class StartTasksCloudPage { await BrowserActions.click(this.cancelButton); } - async blur(locator): Promise { + async blur(locator: ElementFinder): Promise { await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsClickable(locator); await BrowserActions.click(locator); await locator.sendKeys(Key.TAB); } - async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise { + async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise { const errorElement = element(by.cssContainingText(elementRef, error)); await BrowserVisibility.waitUntilElementIsVisible(errorElement); } - async validateAssignee(error): Promise { + async validateAssignee(error: string): Promise { await this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error'); } - async validateDate(error): Promise { + async validateDate(error: string): Promise { await this.checkValidationErrorIsDisplayed(error, '.adf-error-text'); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts index f300aac24b..049d8f4bb2 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts @@ -45,39 +45,39 @@ export class TaskListCloudComponentPage { return this.dataTable; } - clickCheckbox(taskName): Promise { + clickCheckbox(taskName: string): Promise { return this.dataTable.clickCheckbox(column.name, taskName); } - checkRowIsNotChecked(taskName): Promise { + checkRowIsNotChecked(taskName: string): Promise { return this.dataTable.checkRowIsNotChecked(column.name, taskName); } - checkRowIsChecked(taskName): Promise { + checkRowIsChecked(taskName: string): Promise { return this.dataTable.checkRowIsChecked(column.name, taskName); } - getRowsWithSameName(taskName): Promise { + getRowsWithSameName(taskName: string): Promise { return this.dataTable.getRowsWithSameColumnValues(column.name, taskName); } - getRowsWithSameId(taskId): Promise { + getRowsWithSameId(taskId: string): Promise { return this.dataTable.getRowsWithSameColumnValues('Id', taskId); } - checkRowIsSelected(taskName): Promise { + checkRowIsSelected(taskName: string): Promise { return this.dataTable.checkRowIsSelected(column.name, taskName); } - checkRowIsNotSelected(taskName): Promise { + checkRowIsNotSelected(taskName: string): Promise { return this.dataTable.checkRowIsNotSelected(column.name, taskName); } - selectRowWithKeyboard(taskName): Promise { + selectRowWithKeyboard(taskName: string): Promise { return this.dataTable.selectRowWithKeyboard(column.name, taskName); } - selectRow(taskName): Promise { + selectRow(taskName: string): Promise { return this.dataTable.selectRow(column.name, taskName); } @@ -89,23 +89,23 @@ export class TaskListCloudComponentPage { return this.dataTable.getCellElementByValue(column.name, taskName); } - checkContentIsDisplayedById(taskId): Promise { + checkContentIsDisplayedById(taskId: string): Promise { return this.dataTable.checkContentIsDisplayed(column.id, taskId); } - async checkContentIsNotDisplayedById(taskId): Promise { + async checkContentIsNotDisplayedById(taskId: string): Promise { return this.dataTable.checkContentIsNotDisplayed(column.id, taskId); } - async checkContentIsDisplayedByProcessInstanceId(taskName): Promise { + async checkContentIsDisplayedByProcessInstanceId(taskName: string): Promise { return this.dataTable.checkContentIsDisplayed(column.processInstanceId, taskName); } - async checkContentIsDisplayedByName(taskName): Promise { + async checkContentIsDisplayedByName(taskName: string): Promise { return this.dataTable.checkContentIsDisplayed(column.name, taskName); } - async checkContentIsNotDisplayedByName(taskName): Promise { + async checkContentIsNotDisplayedByName(taskName: string): Promise { return this.dataTable.checkContentIsNotDisplayed(column.name, taskName); } @@ -153,7 +153,7 @@ export class TaskListCloudComponentPage { return this.dataTable.getAllRowsColumnValues(column.owner); } - async getIdCellValue(rowName): Promise { + async getIdCellValue(rowName: string): Promise { const locator = new DataTableComponentPage().getCellByRowContentAndColumn(column.name, rowName, column.id); return BrowserActions.getText(locator); } @@ -179,7 +179,7 @@ export class TaskListCloudComponentPage { await this.dataTable.rightClickOnRow('Id', taskId); } - async clickContextMenuActionNamed(actionName): Promise { + async clickContextMenuActionNamed(actionName: string): Promise { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } diff --git a/lib/testing/src/lib/process-services/pages/form-fields.page.ts b/lib/testing/src/lib/process-services/pages/form-fields.page.ts index 2fe3185cef..11bc33dabf 100644 --- a/lib/testing/src/lib/process-services/pages/form-fields.page.ts +++ b/lib/testing/src/lib/process-services/pages/form-fields.page.ts @@ -18,6 +18,7 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { by, element, ElementFinder, Locator } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; +import { By } from 'selenium-webdriver'; export class FormFieldsPage { @@ -34,54 +35,54 @@ export class FormFieldsPage { completeButton: ElementFinder = element(by.id('adf-form-complete')); errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text'); - async setFieldValue(locator, field, value): Promise { - const fieldElement: any = element(locator(field)); + async setFieldValue(locator: (id: string) => By, field: string, value: string): Promise { + const fieldElement = element(locator(field)); await BrowserVisibility.waitUntilElementIsVisible(fieldElement); await BrowserActions.clearSendKeys(fieldElement, value); } - async checkWidgetIsVisible(fieldId): Promise { + async checkWidgetIsVisible(fieldId: string): Promise { const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first(); await BrowserVisibility.waitUntilElementIsVisible(fieldElement); } - async checkWidgetIsHidden(fieldId): Promise { + async checkWidgetIsHidden(fieldId: string): Promise { const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`)); await BrowserVisibility.waitUntilElementIsVisible(hiddenElement); } - async getWidget(fieldId): Promise { + async getWidget(fieldId: string): Promise { const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); await BrowserVisibility.waitUntilElementIsVisible(widget); return widget; } - async getFieldValue(fieldId, valueLocatorParam): Promise { + async getFieldValue(fieldId: string, valueLocatorParam: Locator): Promise { const widget: ElementFinder = await this.getWidget(fieldId); const value = widget.element(valueLocatorParam || this.valueLocator); await BrowserVisibility.waitUntilElementIsVisible(value); return value.getAttribute('value'); } - async getFieldLabel(fieldId, labelLocatorParam): Promise { + async getFieldLabel(fieldId: string, labelLocatorParam: Locator): Promise { const widget = await this.getWidget(fieldId); const label = widget.all(labelLocatorParam || this.labelLocator).first(); return BrowserActions.getText(label); } - async getFieldErrorMessage(fieldId): Promise { + async getFieldErrorMessage(fieldId: string): Promise { const widget = await this.getWidget(fieldId); const error = widget.element(this.errorMessage); return BrowserActions.getText(error); } - async getFieldText(fieldId, labelLocatorParam): Promise { + async getFieldText(fieldId: string, labelLocatorParam: Locator): Promise { const widget = await this.getWidget(fieldId); const label = widget.element(labelLocatorParam || this.labelLocator); return BrowserActions.getText(label); } - async getFieldPlaceHolder(fieldId, locator = 'input'): Promise { + async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise { const placeHolderLocator = element(by.css(`${locator}#${fieldId}`)); await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator); return placeHolderLocator.getAttribute('placeholder'); @@ -119,18 +120,18 @@ export class FormFieldsPage { await BrowserActions.click(this.attachFormButton); } - async selectForm(formName): Promise { + async selectForm(formName: string): Promise { await BrowserActions.click(this.selectFormDropDownArrow); await BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent); await this.selectFormFromDropDown(formName); } - async selectFormFromDropDown(formName): Promise { + async selectFormFromDropDown(formName: string): Promise { const formNameElement = element(by.cssContainingText('span', formName)); await BrowserActions.click(formNameElement); } - async checkWidgetIsReadOnlyMode(fieldId): Promise { + async checkWidgetIsReadOnlyMode(fieldId: string): Promise { const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]')); await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly); @@ -140,8 +141,8 @@ export class FormFieldsPage { await BrowserActions.click(this.completeButton); } - async setValueInInputById(fieldId, value): Promise { - const input: any = element(by.id(fieldId)); + async setValueInInputById(fieldId: string, value: string): Promise { + const input = element(by.id(fieldId)); await BrowserVisibility.waitUntilElementIsVisible(input); await BrowserActions.clearSendKeys(input, value); }