add missing typing information (#5227)

* add missing typing information

* typing fixes

* revert return type

* typing fixes
This commit is contained in:
Denys Vuika
2019-11-08 14:02:05 +00:00
committed by Eugenio Romano
parent 2138ce600e
commit 0c13f3d879
29 changed files with 208 additions and 220 deletions

View File

@@ -56,7 +56,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
* (eg, following a network error). * (eg, following a network error).
*/ */
@Output() @Output()
error: EventEmitter<any> = new EventEmitter<any>(); error = new EventEmitter<any>();
hasCustomTemplate: boolean = false; hasCustomTemplate: boolean = false;
@@ -91,7 +91,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
}); });
} }
hasCustomEmptyTemplate() { hasCustomEmptyTemplate(): boolean {
return !!this.emptyTemplate; return !!this.emptyTemplate;
} }

View File

@@ -64,7 +64,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
/** Emitted when an error occurs while fetching the attachments. */ /** Emitted when an error occurs while fetching the attachments. */
@Output() @Output()
error: EventEmitter<any> = new EventEmitter<any>(); error = new EventEmitter<any>();
hasCustomTemplate: boolean = false; hasCustomTemplate: boolean = false;

View File

@@ -15,9 +15,9 @@
* limitations under the License. * 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 { 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'; import { UserEventModel } from '../../../task-list/models/user-event.model';
@Component({ @Component({
@@ -26,9 +26,10 @@ import { UserEventModel } from '../../../task-list/models/user-event.model';
styleUrls: ['./people-list.component.scss'] 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') @ViewChild('dataTable')
peopleDataTable: DataTableComponent; peopleDataTable: DataTableComponent;
@@ -43,11 +44,11 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
/** Emitted when the user clicks a row in the people list. */ /** Emitted when the user clicks a row in the people list. */
@Output() @Output()
clickRow: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>(); clickRow = new EventEmitter<UserProcessModel>();
/** Emitted when the user clicks in the 'Three Dots' drop down menu for a row. */ /** Emitted when the user clicks in the 'Three Dots' drop down menu for a row. */
@Output() @Output()
clickAction: EventEmitter<UserEventModel> = new EventEmitter<UserEventModel>(); clickAction = new EventEmitter<UserEventModel>();
user: UserProcessModel; user: UserProcessModel;
@@ -55,9 +56,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
this.peopleDataTable.columnList = this.columnList; this.peopleDataTable.columnList = this.columnList;
} }
ngAfterViewInit() {
}
selectUser(event: any) { selectUser(event: any) {
this.user = event.value.obj; this.user = event.value.obj;
this.clickRow.emit(this.user); this.clickRow.emit(this.user);
@@ -67,7 +65,7 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
return this.actions; return this.actions;
} }
onShowRowActionsMenu(event: any) { onShowRowActionsMenu(event: DataCellEvent) {
const removeAction = { const removeAction = {
title: 'Remove', title: 'Remove',
@@ -82,6 +80,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
onExecuteRowAction(event: any) { onExecuteRowAction(event: any) {
const args = event.value; const args = event.value;
const action = args.action; 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});
} }
} }

View File

@@ -40,7 +40,7 @@ export class PeopleSearchFieldComponent {
placeholder: string; placeholder: string;
@Output() @Output()
rowClick: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>(); rowClick = new EventEmitter<UserProcessModel>();
users$: Observable<UserProcessModel[]>; users$: Observable<UserProcessModel[]>;
searchUser: FormControl = new FormControl(); searchUser: FormControl = new FormControl();
@@ -64,23 +64,23 @@ export class PeopleSearchFieldComponent {
this.defaultPlaceholder = this.translationService.instant(this.defaultPlaceholder); this.defaultPlaceholder = this.translationService.instant(this.defaultPlaceholder);
} }
public reset() { reset() {
this.searchUser.reset(); this.searchUser.reset();
} }
get searchPlaceholder() { get searchPlaceholder(): string {
return this.placeholder || this.defaultPlaceholder; return this.placeholder || this.defaultPlaceholder;
} }
onRowClick(event) { onRowClick(model: UserProcessModel) {
this.rowClick.emit(event); this.rowClick.emit(model);
} }
getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string { getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string {
return getDisplayUser(firstName, lastName, delimiter); return getDisplayUser(firstName, lastName, delimiter);
} }
getInitialUserName(firstName: string, lastName: string) { getInitialUserName(firstName: string, lastName: string): string {
firstName = (firstName !== null && firstName !== '' ? firstName[0] : ''); firstName = (firstName !== null && firstName !== '' ? firstName[0] : '');
lastName = (lastName !== null && lastName !== '' ? lastName[0] : ''); lastName = (lastName !== null && lastName !== '' ? lastName[0] : '');
return this.getDisplayUser(firstName, lastName, ''); return this.getDisplayUser(firstName, lastName, '');

View File

@@ -39,11 +39,11 @@ export class PeopleSearchComponent implements OnInit {
/** Emitted when a search is performed with a new keyword. */ /** Emitted when a search is performed with a new keyword. */
@Output() @Output()
searchPeople: EventEmitter<any> = new EventEmitter(); searchPeople = new EventEmitter<any>();
/** Emitted when a user is selected and the action button is clicked. */ /** Emitted when a user is selected and the action button is clicked. */
@Output() @Output()
success: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>(); success = new EventEmitter<UserProcessModel>();
/** Emitted when the "close" button is clicked. */ /** Emitted when the "close" button is clicked. */
@Output() @Output()

View File

@@ -17,7 +17,7 @@
import { LogService, UserProcessModel } from '@alfresco/adf-core'; import { LogService, UserProcessModel } from '@alfresco/adf-core';
import { PeopleProcessService } 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 { Observable, Observer } from 'rxjs';
import { UserEventModel } from '../../../task-list/models/user-event.model'; import { UserEventModel } from '../../../task-list/models/user-event.model';
import { PeopleSearchComponent } from '../people-search/people-search.component'; import { PeopleSearchComponent } from '../people-search/people-search.component';
@@ -28,7 +28,7 @@ import { share } from 'rxjs/operators';
templateUrl: './people.component.html', templateUrl: './people.component.html',
styleUrls: ['./people.component.scss'] styleUrls: ['./people.component.scss']
}) })
export class PeopleComponent implements OnInit, AfterViewInit { export class PeopleComponent {
/** The array of User objects to display. */ /** The array of User objects to display. */
@Input() @Input()
@@ -57,12 +57,6 @@ export class PeopleComponent implements OnInit, AfterViewInit {
); );
} }
ngOnInit() {
}
ngAfterViewInit() {
}
involveUserAndCloseSearch() { involveUserAndCloseSearch() {
if (this.peopleSearch) { if (this.peopleSearch) {
this.peopleSearch.involveUserAndClose(); this.peopleSearch.involveUserAndClose();
@@ -98,9 +92,7 @@ export class PeopleComponent implements OnInit, AfterViewInit {
.removeInvolvedUser(this.taskId, user.id.toString()) .removeInvolvedUser(this.taskId, user.id.toString())
.subscribe( .subscribe(
() => { () => {
this.people = this.people.filter((involvedUser) => { this.people = this.people.filter(involvedUser => involvedUser.id !== user.id);
return involvedUser.id !== user.id;
});
}, },
() => this.logService.error('Impossible to remove involved user from task')); () => this.logService.error('Impossible to remove involved user from task'));
} }
@@ -122,16 +114,16 @@ export class PeopleComponent implements OnInit, AfterViewInit {
} }
onClickAction(event: UserEventModel) { onClickAction(event: UserEventModel) {
if (event.type === 'remove') { if (event && event.value && event.type === 'remove') {
this.removeInvolvedUser(event.value); this.removeInvolvedUser(event.value);
} }
} }
hasPeople() { hasPeople(): boolean {
return this.people && this.people.length > 0; return this.people && this.people.length > 0;
} }
isEditMode() { isEditMode(): boolean {
return !this.readOnly; return !this.readOnly;
} }

View File

@@ -18,12 +18,7 @@
/** /**
* This object represent the User Event. * This object represent the User Event.
*/ */
export class UserEventModel { export interface UserEventModel {
type: string = ''; type: string;
value: any = {}; value: any;
constructor(obj?: any) {
this.type = obj && obj.type;
this.value = obj && obj.value || {};
}
} }

View File

@@ -19,18 +19,10 @@
* This object represent the process service user group.* * This object represent the process service user group.*
*/ */
export class UserGroupModel { export interface UserGroupModel {
id?: number; id?: number;
name?: string; name?: string;
externalId?: string; externalId?: string;
status?: string; status?: string;
groups?: any = {}; 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;
}
} }

View File

@@ -77,7 +77,7 @@ export class TaskListService {
const requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel); const requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel);
return from(this.callApiTasksFiltered(requestNodeForFilter)) return from(this.callApiTasksFiltered(requestNodeForFilter))
.pipe( .pipe(
map((res: any) => { map(res => {
return res.data.find((element) => element.id === taskId) ? filterModel : null; return res.data.find((element) => element.id === taskId) ? filterModel : null;
}), }),
catchError((err) => this.handleError(err)) catchError((err) => this.handleError(err))
@@ -155,7 +155,7 @@ export class TaskListService {
getTaskDetails(taskId: string): Observable<TaskDetailsModel> { getTaskDetails(taskId: string): Observable<TaskDetailsModel> {
return from(this.callApiTaskDetails(taskId)) return from(this.callApiTaskDetails(taskId))
.pipe( .pipe(
map((details: any) => { map(details => {
return new TaskDetailsModel(details); return new TaskDetailsModel(details);
}), }),
catchError((err) => this.handleError(err)) catchError((err) => this.handleError(err))
@@ -170,7 +170,7 @@ export class TaskListService {
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> { getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
return from(this.callApiTaskChecklist(id)) return from(this.callApiTaskChecklist(id))
.pipe( .pipe(
map((response: any) => { map(response => {
const checklists: TaskDetailsModel[] = []; const checklists: TaskDetailsModel[] = [];
response.data.forEach((checklist) => { response.data.forEach((checklist) => {
checklists.push(new TaskDetailsModel(checklist)); checklists.push(new TaskDetailsModel(checklist));
@@ -194,7 +194,7 @@ export class TaskListService {
return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts)) return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
.pipe( .pipe(
map((response: any) => { map(response => {
const forms: Form[] = []; const forms: Form[] = [];
response.data.forEach((form) => { response.data.forEach((form) => {
forms.push(new Form(form.id, form.name)); forms.push(new Form(form.id, form.name));
@@ -278,9 +278,6 @@ export class TaskListService {
requestNode.size = 0; requestNode.size = 0;
return from(this.callApiTasksFiltered(requestNode)) return from(this.callApiTasksFiltered(requestNode))
.pipe( .pipe(
map((res: any) => {
return res;
}),
catchError((err) => this.handleError(err)) catchError((err) => this.handleError(err))
); );
} }
@@ -364,7 +361,7 @@ export class TaskListService {
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance). * @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
* @returns Updated task details * @returns Updated task details
*/ */
updateTask(taskId: any, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> { updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
return from(this.apiService.taskApi.updateTask(taskId, updated)) return from(this.apiService.taskApi.updateTask(taskId, updated))
.pipe( .pipe(
map((result) => <TaskDetailsModel> result), map((result) => <TaskDetailsModel> result),

View File

@@ -21,7 +21,7 @@ export class TaskDescriptionValidator implements CardViewItemValidator {
message: string = 'ADF_CLOUD_TASK_HEADER.FORM_VALIDATION.INVALID_FIELD'; message: string = 'ADF_CLOUD_TASK_HEADER.FORM_VALIDATION.INVALID_FIELD';
isValid(value: any): boolean { isValid(value: string): boolean {
const isWhitespace = (value || '').trim().length === 0; const isWhitespace = (value || '').trim().length === 0;
return value.length === 0 || !isWhitespace; return value.length === 0 || !isWhitespace;
} }

View File

@@ -37,25 +37,27 @@ export class GroupIdentityService {
await this.deleteGroup(groupId); await this.deleteGroup(groupId);
} }
async createGroup(groupName): Promise<any> { async createGroup(groupName: string): Promise<any> {
const path = '/groups'; const path = '/groups';
const method = 'POST'; const method = 'POST';
const queryParams = {}, postBody = { const queryParams = {};
const postBody = {
name: `${groupName}-${browser.params.groupSuffix}` name: `${groupName}-${browser.params.groupSuffix}`
}; };
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data; return data;
} }
async deleteGroup(groupId): Promise<any> { async deleteGroup(groupId: string): Promise<any> {
const path = `/groups/${groupId}`; const path = `/groups/${groupId}`;
const method = 'DELETE'; const method = 'DELETE';
const queryParams = {}, postBody = {}; const queryParams = {};
const postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data; return data;
} }
async getGroupInfoByGroupName(groupName): Promise<any> { async getGroupInfoByGroupName(groupName: string): Promise<any> {
const path = `/groups`; const path = `/groups`;
const method = 'GET'; const method = 'GET';
const queryParams = { search: groupName }, postBody = {}; const queryParams = { search: groupName }, postBody = {};
@@ -64,11 +66,11 @@ export class GroupIdentityService {
return data[0]; return data[0];
} }
async assignRole(groupId, roleId, roleName): Promise<any> { async assignRole(groupId: string, roleId: string, roleName: string): Promise<any> {
const path = `/groups/${groupId}/role-mappings/realm`; const path = `/groups/${groupId}/role-mappings/realm`;
const method = 'POST'; const method = 'POST';
const queryParams = {}, const queryParams = {};
postBody = [{ id: roleId, name: roleName }]; const postBody = [{ id: roleId, name: roleName }];
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data; return data;
@@ -83,16 +85,18 @@ export class GroupIdentityService {
*/ */
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> { async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
const path = `/groups/${groupId}/role-mappings/clients/${clientId}`; const path = `/groups/${groupId}/role-mappings/clients/${clientId}`;
const method = 'POST', queryParams = {}, const method = 'POST';
postBody = [{ const queryParams = {};
const postBody = [
{
id: roleId, id: roleId,
name: roleName, name: roleName,
composite: false, composite: false,
clientRole: true, clientRole: true,
containerId: clientId 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<any> { async getClientIdByApplicationName(applicationName: string): Promise<any> {
const path = `/clients`; 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); const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0].id; return data[0].id;

View File

@@ -82,7 +82,7 @@ export class IdentityService {
await this.createIdentityUser(user); await this.createIdentityUser(user);
} }
async deleteIdentityUser(userId): Promise<void> { async deleteIdentityUser(userId: string): Promise<void> {
await this.deleteUser(userId); await this.deleteUser(userId);
} }
@@ -105,23 +105,24 @@ export class IdentityService {
} }
} }
async deleteUser(userId): Promise<any> { async deleteUser(userId: string): Promise<any> {
const path = `/users/${userId}`; const path = `/users/${userId}`;
const method = 'DELETE'; const method = 'DELETE';
const queryParams = {}, postBody = {}; const queryParams = {}, postBody = {};
return this.api.performIdentityOperation(path, method, queryParams, postBody); return this.api.performIdentityOperation(path, method, queryParams, postBody);
} }
async getUserInfoByUsername(username): Promise<any> { async getUserInfoByUsername(username: string): Promise<any> {
const path = `/users`; const path = `/users`;
const method = 'GET'; const method = 'GET';
const queryParams = { username: username }, postBody = {}; const queryParams = { username };
const postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0]; return data[0];
} }
async resetPassword(id, password): Promise<any> { async resetPassword(id: string, password: string): Promise<any> {
const path = `/users/${id}/reset-password`; const path = `/users/${id}/reset-password`;
const method = 'PUT'; const method = 'PUT';
const queryParams = {}, const queryParams = {},
@@ -130,12 +131,12 @@ export class IdentityService {
return this.api.performIdentityOperation(path, method, queryParams, postBody); return this.api.performIdentityOperation(path, method, queryParams, postBody);
} }
async addUserToGroup(userId, groupId): Promise<any> { async addUserToGroup(userId: string, groupId: string): Promise<any> {
try { try {
const path = `/users/${userId}/groups/${groupId}`; const path = `/users/${userId}/groups/${groupId}`;
const method = 'PUT'; const method = 'PUT';
const queryParams = {}, const queryParams = {};
postBody = { realm: 'alfresco', userId: userId, groupId: groupId }; const postBody = { realm: 'alfresco', userId: userId, groupId: groupId };
return this.api.performIdentityOperation(path, method, queryParams, postBody); return this.api.performIdentityOperation(path, method, queryParams, postBody);
} catch (error) { } catch (error) {
@@ -143,11 +144,11 @@ export class IdentityService {
} }
} }
async assignRole(userId, roleId, roleName): Promise<any> { async assignRole(userId: string, roleId: string, roleName: string): Promise<any> {
const path = `/users/${userId}/role-mappings/realm`; const path = `/users/${userId}/role-mappings/realm`;
const method = 'POST'; const method = 'POST';
const queryParams = {}, const queryParams = {};
postBody = [{ id: roleId, name: roleName }]; const postBody = [{ id: roleId, name: roleName }];
return this.api.performIdentityOperation(path, method, queryParams, postBody); return this.api.performIdentityOperation(path, method, queryParams, postBody);
} }

View File

@@ -26,7 +26,7 @@ export class TasksService {
this.api = api; this.api = api;
} }
async createStandaloneTask(taskName, appName, options?): Promise<any> { async createStandaloneTask(taskName: string, appName: string, options?: Object): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks'; const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST'; const method = 'POST';
@@ -43,12 +43,13 @@ export class TasksService {
} }
} }
async createStandaloneTaskWithForm(taskName, appName, formKey, options?): Promise<any> { async createStandaloneTaskWithForm(taskName: string, appName: string, formKey: string, options?: Object): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks'; const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST'; const method = 'POST';
const queryParams = {}, postBody = { const queryParams = {};
const postBody = {
name: taskName, name: taskName,
payloadType: 'CreateTaskPayload', payloadType: 'CreateTaskPayload',
formKey: formKey, formKey: formKey,
@@ -61,7 +62,7 @@ export class TasksService {
} }
} }
async completeTask(taskId, appName): Promise<any> { async completeTask(taskId: string, appName: string): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete'; const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete';
const method = 'POST'; const method = 'POST';
@@ -75,12 +76,13 @@ export class TasksService {
} }
async claimTask(taskId, appName): Promise<any> { async claimTask(taskId: string, appName: string): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`; const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`;
const method = 'POST'; const method = 'POST';
const queryParams = {}, postBody = {}; const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody); return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) { } catch (error) {
@@ -88,12 +90,13 @@ export class TasksService {
} }
} }
async deleteTask(taskId, appName): Promise<any> { async deleteTask(taskId: string, appName: string): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId; const path = '/' + appName + '/rb/v1/tasks/' + taskId;
const method = 'DELETE'; const method = 'DELETE';
const queryParams = {}, postBody = {}; const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody); return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) { } catch (error) {
@@ -101,19 +104,20 @@ export class TasksService {
} }
} }
async createAndCompleteTask(taskName, appName): Promise<any> { async createAndCompleteTask(taskName: string, appName: string): Promise<any> {
const task = await this.createStandaloneTask(taskName, appName); const task = await this.createStandaloneTask(taskName, appName);
await this.claimTask(task.entry.id, appName); await this.claimTask(task.entry.id, appName);
await this.completeTask(task.entry.id, appName); await this.completeTask(task.entry.id, appName);
return task; return task;
} }
async getTask(taskId, appName): Promise<any> { async getTask(taskId: string, appName: string): Promise<any> {
try { try {
const path = '/' + appName + '/query/v1/tasks/' + taskId; const path = '/' + appName + '/query/v1/tasks/' + taskId;
const method = 'GET'; const method = 'GET';
const queryParams = {}, postBody = {}; const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody); return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) { } catch (error) {
@@ -121,7 +125,7 @@ export class TasksService {
} }
} }
async getTaskId(taskName, appName): Promise<any> { async getTaskId(taskName: string, appName: string): Promise<any> {
try { try {
const path = '/' + appName + '/query/v1/tasks'; const path = '/' + appName + '/query/v1/tasks';
const method = 'GET'; const method = 'GET';
@@ -135,7 +139,7 @@ export class TasksService {
} }
} }
async createStandaloneSubtask(parentTaskId, appName, name): Promise<any> { async createStandaloneSubtask(parentTaskId: string, appName: string, name: string): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/tasks'; const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST'; const method = 'POST';

View File

@@ -58,21 +58,21 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]'))); await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
} }
async clickCheckbox(columnName: string, columnValue): Promise<void> { async clickCheckbox(columnName: string, columnValue: string): Promise<void> {
const checkbox = this.getRowCheckbox(columnName, columnValue).element(by.css(`input[type='checkbox']`)); const checkbox = this.getRowCheckbox(columnName, columnValue).element(by.css(`input[type='checkbox']`));
await BrowserActions.click(checkbox); await BrowserActions.click(checkbox);
} }
async checkRowIsNotChecked(columnName: string, columnValue): Promise<void> { async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]'))); await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
} }
async checkRowIsChecked(columnName: string, columnValue): Promise<void> { async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue); const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]'))); 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')); return this.getRow(columnName, columnValue).element(by.css('mat-checkbox'));
} }
@@ -84,29 +84,29 @@ export class DataTableComponentPage {
return this.allSelectedRows.count(); return this.allSelectedRows.count();
} }
async selectRow(columnName, columnValue): Promise<void> { async selectRow(columnName: string, columnValue: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
const row = this.getRow(columnName, columnValue); const row = this.getRow(columnName, columnValue);
await BrowserActions.click(row); await BrowserActions.click(row);
} }
async selectRowWithKeyboard(columnName, columnValue): Promise<void> { async selectRowWithKeyboard(columnName: string, columnValue: string): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(columnName, columnValue); await this.selectRow(columnName, columnValue);
await browser.actions().sendKeys(protractor.Key.NULL).perform(); await browser.actions().sendKeys(protractor.Key.NULL).perform();
} }
async checkRowIsSelected(columnName, columnValue): Promise<void> { async checkRowIsSelected(columnName: string, columnValue: string): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsVisible(selectedRow); await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
} }
async checkRowIsNotSelected(columnName, columnValue): Promise<void> { async checkRowIsNotSelected(columnName: string, columnValue: string): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
} }
async getColumnValueForRow(identifyingColumn, identifyingValue, columnName): Promise<string> { async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise<string> {
const row = this.getRow(identifyingColumn, identifyingValue); const row = this.getRow(identifyingColumn, identifyingValue);
await BrowserVisibility.waitUntilElementIsVisible(row); await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`)); const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
@@ -138,14 +138,14 @@ export class DataTableComponentPage {
return initialList.toString() === sortedList.toString(); return initialList.toString() === sortedList.toString();
} }
async rightClickOnRow(columnName: string, columnValue): Promise<void> { async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
const row = this.getRow(columnName, columnValue); const row = this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row); await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content'))); await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
} }
async getTooltip(columnName, columnValue): Promise<string> { async getTooltip(columnName: string, columnValue: string): Promise<string> {
return this.getCellElementByValue(columnName, columnValue).getAttribute('title'); return this.getCellElementByValue(columnName, columnValue).getAttribute('title');
} }
@@ -171,7 +171,7 @@ export class DataTableComponentPage {
.map(async (el) => el.getText()); .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`); const columnLocator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first()); await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText(); return this.rootElement.all(columnLocator).getText();
@@ -256,7 +256,7 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first()); await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
} }
async checkColumnIsDisplayed(column): Promise<void> { async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`))); 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(); 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(); 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}']`)); return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
} }
async selectRowByContent(content): Promise<void> { async selectRowByContent(content: string): Promise<void> {
const row = this.getCellByContent(content); const row = this.getCellByContent(content);
await BrowserActions.click(row); await BrowserActions.click(row);
} }
async checkRowByContentIsSelected(folderName): Promise<void> { async checkRowByContentIsSelected(folderName: string): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsVisible(selectedRow); await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
} }
async checkRowByContentIsNotSelected(folderName): Promise<void> { async checkRowByContentIsNotSelected(folderName: string): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); 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(); 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<void> {
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)); 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); await BrowserVisibility.waitUntilElementIsVisible(cell);
} }
@@ -340,7 +340,7 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip); await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip);
} }
async mouseOverColumn(columnName: string, columnValue): Promise<void> { async mouseOverColumn(columnName: string, columnValue: string): Promise<void> {
const column = this.getCellElementByValue(columnName, columnValue); const column = this.getCellElementByValue(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(column); await BrowserVisibility.waitUntilElementIsVisible(column);
await browser.actions().mouseMove(column).perform(); await browser.actions().mouseMove(column).perform();

View File

@@ -40,7 +40,7 @@ export class FormFields {
} }
async clickField(locator, field): Promise<void> { async clickField(locator, field): Promise<void> {
const fieldElement: any = element(locator(field)); const fieldElement = element(locator(field));
await BrowserActions.click(fieldElement); await BrowserActions.click(fieldElement);
} }

View File

@@ -24,25 +24,25 @@ const infoColor = '\x1b[36m%s\x1b[0m',
/* tslint:disable:no-console */ /* tslint:disable:no-console */
export class Logger { export class Logger {
static info(...messages): void { static info(...messages: string[]): void {
if (browser.params.config && browser.params.config.log) { if (browser.params.config && browser.params.config.log) {
console.log(infoColor, messages.join('')); console.log(infoColor, messages.join(''));
} }
} }
static log(...messages): void { static log(...messages: string[]): void {
if (browser.params.config && browser.params.config.log) { if (browser.params.config && browser.params.config.log) {
console.log(logColor, messages.join('')); console.log(logColor, messages.join(''));
} }
} }
static warn(...messages): void { static warn(...messages: string[]): void {
if (browser.params.config && browser.params.config.log) { if (browser.params.config && browser.params.config.log) {
console.log(warnColor, messages.join('')); console.log(warnColor, messages.join(''));
} }
} }
static error(...messages): void { static error(...messages: string[]): void {
console.log(errorColor, messages.join('')); console.log(errorColor, messages.join(''));
} }
} }

View File

@@ -26,12 +26,13 @@ export class MessageEventsService {
this.api = api; this.api = api;
} }
async startMessageEvent(startMessage, appName, options?: any): Promise<any> { async startMessageEvent(startMessage: string, appName: string, options?: Object): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/process-instances/message'; const path = '/' + appName + '/rb/v1/process-instances/message';
const method = 'POST'; const method = 'POST';
const queryParams = {}, postBody = { const queryParams = {};
const postBody = {
'name': startMessage, 'name': startMessage,
'variables': {}, 'variables': {},
'payloadType': 'StartMessagePayload', 'payloadType': 'StartMessagePayload',
@@ -46,12 +47,13 @@ export class MessageEventsService {
} }
async receiveMessageEvent(receiveMessage, appName, options?: any): Promise<any> { async receiveMessageEvent(receiveMessage: string, appName: string, options?: Object): Promise<any> {
try { try {
const path = '/' + appName + '/rb/v1/process-instances/message'; const path = '/' + appName + '/rb/v1/process-instances/message';
const method = 'PUT'; const method = 'PUT';
const queryParams = {}, postBody = { const queryParams = {};
const postBody = {
'name': receiveMessage, 'name': receiveMessage,
'variables': {}, 'variables': {},
'payloadType': 'ReceiveMessagePayload', 'payloadType': 'ReceiveMessagePayload',

View File

@@ -26,7 +26,7 @@ export class ProcessDefinitionsService {
this.api = api; this.api = api;
} }
async getProcessDefinitions(appName): Promise<any> { async getProcessDefinitions(appName: string): Promise<any> {
const path = '/' + appName + '/rb/v1/process-definitions'; const path = '/' + appName + '/rb/v1/process-definitions';
const method = 'GET'; const method = 'GET';

View File

@@ -36,7 +36,7 @@ export class EditProcessFilterDialogPage {
await browser.driver.sleep(1000); await browser.driver.sleep(1000);
} }
async checkSaveButtonIsEnabled() { async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator)); await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled(); return this.componentElement.element(this.saveButtonLocator).isEnabled();
} }
@@ -57,7 +57,7 @@ export class EditProcessFilterDialogPage {
return this.filterNameInput.getAttribute('value'); return this.filterNameInput.getAttribute('value');
} }
async setFilterName(filterName): Promise<void> { async setFilterName(filterName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.filterNameInput, filterName); await BrowserActions.clearSendKeys(this.filterNameInput, filterName);
} }

View File

@@ -56,11 +56,11 @@ export class EditTaskFilterDialogPage {
return this.filterNameInput.getAttribute('value'); return this.filterNameInput.getAttribute('value');
} }
async setFilterName(filterName): Promise<void> { async setFilterName(filterName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.filterNameInput, filterName); await BrowserActions.clearSendKeys(this.filterNameInput, filterName);
} }
async clearFilterName() { async clearFilterName(): Promise<void> {
await BrowserActions.clearWithBackSpace(this.filterNameInput); await BrowserActions.clearWithBackSpace(this.filterNameInput);
} }

View File

@@ -51,7 +51,7 @@ export class EditProcessFilterCloudComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(content); await BrowserVisibility.waitUntilElementIsVisible(content);
} }
async setStatusFilterDropDown(option): Promise<void> { async setStatusFilterDropDown(option: string): Promise<void> {
await this.clickOnDropDownArrow('status'); await this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first(); const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
@@ -91,7 +91,7 @@ export class EditProcessFilterCloudComponentPage {
await BrowserActions.click(dropDownArrow); await BrowserActions.click(dropDownArrow);
} }
async setAppNameDropDown(option): Promise<void> { async setAppNameDropDown(option: string): Promise<void> {
await this.clickOnDropDownArrow('appName'); await this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first(); const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
@@ -132,13 +132,13 @@ export class EditProcessFilterCloudComponentPage {
return this.getProperty('processInstanceId'); return this.getProperty('processInstanceId');
} }
async getProperty(property): Promise<string> { async getProperty(property: string): Promise<string> {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsVisible(locator);
return locator.getAttribute('value'); return locator.getAttribute('value');
} }
async setProperty(property, option): Promise<void> { async setProperty(property: string, option: string): Promise<void> {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsVisible(locator);
await locator.clear(); await locator.clear();

View File

@@ -55,7 +55,7 @@ export class EditTaskFilterCloudComponentPage {
await browser.driver.sleep(1000); await browser.driver.sleep(1000);
} }
async setStatusFilterDropDown(option): Promise<void> { async setStatusFilterDropDown(option: string): Promise<void> {
await this.clickOnDropDownArrow('status'); await this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first(); const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
@@ -78,7 +78,7 @@ export class EditTaskFilterCloudComponentPage {
return BrowserActions.getText(elementSort); return BrowserActions.getText(elementSort);
} }
async setOrderFilterDropDown(option): Promise<void> { async setOrderFilterDropDown(option: string): Promise<void> {
await this.clickOnDropDownArrow('order'); await this.clickOnDropDownArrow('order');
const orderElement = element.all(by.cssContainingText('mat-option span', option)).first(); 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()); return BrowserActions.getText(element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-order'] span")).first());
} }
async clickOnDropDownArrow(option): Promise<void> { async clickOnDropDownArrow(option: string): Promise<void> {
const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']")).first(); const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']")).first();
await BrowserActions.click(dropDownArrow); await BrowserActions.click(dropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.selectedOption); await BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
} }
async setAssignee(option): Promise<void> { async setAssignee(option: string): Promise<void> {
await this.setProperty('assignee', option); await this.setProperty('assignee', option);
} }
@@ -112,7 +112,7 @@ export class EditTaskFilterCloudComponentPage {
return BrowserActions.getText(this.priority); return BrowserActions.getText(this.priority);
} }
async setParentTaskId(option): Promise<void> { async setParentTaskId(option: string): Promise<void> {
await this.setProperty('parentTaskId', option); await this.setProperty('parentTaskId', option);
} }
@@ -120,7 +120,7 @@ export class EditTaskFilterCloudComponentPage {
return BrowserActions.getText(this.parentTaskId); return BrowserActions.getText(this.parentTaskId);
} }
async setOwner(option): Promise<void> { async setOwner(option: string): Promise<void> {
await this.setProperty('owner', option); await this.setProperty('owner', option);
} }
@@ -128,7 +128,7 @@ export class EditTaskFilterCloudComponentPage {
return BrowserActions.getText(this.owner); return BrowserActions.getText(this.owner);
} }
async setLastModifiedFrom(lastModifiedFromDate) { async setLastModifiedFrom(lastModifiedFromDate: string) {
await this.clearField(this.lastModifiedFrom); await this.clearField(this.lastModifiedFrom);
await BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate); await BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate);
} }
@@ -137,7 +137,7 @@ export class EditTaskFilterCloudComponentPage {
return BrowserActions.getText(this.lastModifiedFrom); return BrowserActions.getText(this.lastModifiedFrom);
} }
async setLastModifiedTo(lastModifiedToDate): Promise<void> { async setLastModifiedTo(lastModifiedToDate: string): Promise<void> {
await this.clearField(this.lastModifiedTo); await this.clearField(this.lastModifiedTo);
await BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate); await BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate);
} }
@@ -194,12 +194,12 @@ export class EditTaskFilterCloudComponentPage {
await browser.driver.sleep(1000); await browser.driver.sleep(1000);
} }
async clearField(locator): Promise<void> { async clearField(locator: ElementFinder): Promise<void> {
await BrowserActions.clearSendKeys(locator, ' '); await BrowserActions.clearSendKeys(locator, ' ');
await locator.sendKeys(protractor.Key.BACK_SPACE); await locator.sendKeys(protractor.Key.BACK_SPACE);
} }
async setAppNameDropDown(option): Promise<void> { async setAppNameDropDown(option: string): Promise<void> {
await this.clickOnDropDownArrow('appName'); await this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first(); const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
@@ -219,7 +219,7 @@ export class EditTaskFilterCloudComponentPage {
return this.id.getAttribute('value'); return this.id.getAttribute('value');
} }
async setTaskName(option): Promise<void> { async setTaskName(option: string): Promise<void> {
await this.setProperty('taskName', option); await this.setProperty('taskName', option);
} }
@@ -227,7 +227,7 @@ export class EditTaskFilterCloudComponentPage {
return this.taskName.getAttribute('value'); return this.taskName.getAttribute('value');
} }
async setProcessDefinitionId(option): Promise<void> { async setProcessDefinitionId(option: string): Promise<void> {
await this.setProperty('processDefinitionId', option); await this.setProperty('processDefinitionId', option);
} }
@@ -235,11 +235,11 @@ export class EditTaskFilterCloudComponentPage {
return this.processDefinitionId.getAttribute('value'); return this.processDefinitionId.getAttribute('value');
} }
async setProcessInstanceId(option): Promise<void> { async setProcessInstanceId(option: string): Promise<void> {
await this.setProperty('processInstanceId', option); await this.setProperty('processInstanceId', option);
} }
async setProperty(property, option): Promise<void> { async setProperty(property: string, option: string): Promise<void> {
const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]')); const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsVisible(locator);
await locator.clear(); await locator.clear();

View File

@@ -23,7 +23,7 @@ export class GroupCloudComponentPage {
groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]')); groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
async searchGroups(name): Promise<void> { async searchGroups(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
await browser.sleep(1000); await browser.sleep(1000);
await BrowserActions.clearSendKeys(this.groupCloudSearch, name); await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
@@ -40,32 +40,32 @@ export class GroupCloudComponentPage {
} }
async selectGroupFromList(name): Promise<void> { async selectGroupFromList(name: string): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
await browser.sleep(1000); await browser.sleep(1000);
await BrowserActions.click(groupRow); await BrowserActions.click(groupRow);
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
} }
async checkGroupIsDisplayed(name): Promise<void> { async checkGroupIsDisplayed(name: string): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
await BrowserVisibility.waitUntilElementIsVisible(groupRow); await BrowserVisibility.waitUntilElementIsVisible(groupRow);
} }
async checkGroupIsNotDisplayed(name): Promise<void> { async checkGroupIsNotDisplayed(name: string): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
} }
async checkSelectedGroup(group): Promise<void> { async checkSelectedGroup(group: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
} }
async checkGroupNotSelected(group): Promise<void> { async checkGroupNotSelected(group: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
} }
async removeSelectedGroup(group): Promise<void> { async removeSelectedGroup(group: string): Promise<void> {
const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`)); const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`));
await BrowserActions.click(locator); await BrowserActions.click(locator);
} }

View File

@@ -29,25 +29,25 @@ export class PeopleCloudComponentPage {
await this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE); await this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
} }
async searchAssigneeAndSelect(name): Promise<void> { async searchAssigneeAndSelect(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
await this.selectAssigneeFromList(name); await this.selectAssigneeFromList(name);
} }
async searchAssignee(name): Promise<void> { async searchAssignee(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch); await BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch);
await browser.sleep(1000); await browser.sleep(1000);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
} }
async searchAssigneeToExisting(name): Promise<void> { async searchAssigneeToExisting(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name); await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
} }
async selectAssigneeFromList(name): Promise<void> { async selectAssigneeFromList(name: string): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
await browser.sleep(2000); await browser.sleep(2000);
await BrowserActions.click(assigneeRow); await BrowserActions.click(assigneeRow);
@@ -59,17 +59,17 @@ export class PeopleCloudComponentPage {
return this.peopleCloudSearch.getAttribute('value'); return this.peopleCloudSearch.getAttribute('value');
} }
async checkUserIsDisplayed(name): Promise<void> { async checkUserIsDisplayed(name: string): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
await BrowserVisibility.waitUntilElementIsVisible(assigneeRow); await BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
} }
async checkUserIsNotDisplayed(name): Promise<void> { async checkUserIsNotDisplayed(name: string): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
} }
async checkSelectedPeople(person): Promise<void> { async checkSelectedPeople(person: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person))); await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
} }

View File

@@ -78,11 +78,11 @@ export class ProcessListCloudComponentPage {
return this.dataTable.checkContentIsDisplayed(this.columns.id, processId); return this.dataTable.checkContentIsDisplayed(this.columns.id, processId);
} }
checkContentIsNotDisplayedById(processId): Promise<void> { checkContentIsNotDisplayedById(processId: string): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId); return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId);
} }
selectRowWithKeyboard(processId): Promise<void> { selectRowWithKeyboard(processId: string): Promise<void> {
return this.dataTable.selectRowWithKeyboard(this.columns.id, processId); return this.dataTable.selectRowWithKeyboard(this.columns.id, processId);
} }
@@ -98,11 +98,11 @@ export class ProcessListCloudComponentPage {
return BrowserActions.getText(this.noProcessFound); return BrowserActions.getText(this.noProcessFound);
} }
getAllRowsByColumn(column): Promise<any> { getAllRowsByColumn(column: string) {
return this.dataTable.getAllRowsColumnValues(column); return this.dataTable.getAllRowsColumnValues(column);
} }
async clickOptionsButton(content: string) { async clickOptionsButton(content: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
const row: ElementFinder = this.dataTable.getRow('Id', content); const row: ElementFinder = this.dataTable.getRow('Id', content);
await BrowserActions.click(row.element(this.optionButton)); await BrowserActions.click(row.element(this.optionButton));
@@ -123,7 +123,7 @@ export class ProcessListCloudComponentPage {
await this.dataTable.rightClickOnRow('Id', processInstance); await this.dataTable.rightClickOnRow('Id', processInstance);
} }
async clickContextMenuActionNamed(actionName): Promise<void> { async clickContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
} }

View File

@@ -15,7 +15,7 @@
* limitations under the License. * 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 { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/formFields'; import { FormFields } from '../../core/pages/form/formFields';
@@ -45,7 +45,7 @@ export class StartProcessCloudPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel); await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel);
} }
async enterProcessName(name): Promise<void> { async enterProcessName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput); await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
await BrowserActions.clearSendKeys(this.processNameInput, name); await BrowserActions.clearSendKeys(this.processNameInput, name);
} }
@@ -55,7 +55,7 @@ export class StartProcessCloudPage {
return this.processNameInput.getAttribute('value'); return this.processNameInput.getAttribute('value');
} }
async selectFromProcessDropdown(name): Promise<void> { async selectFromProcessDropdown(name: string): Promise<void> {
await this.clickProcessDropdownArrow(); await this.clickProcessDropdownArrow();
await this.selectOption(name); await this.selectOption(name);
} }
@@ -64,13 +64,13 @@ export class StartProcessCloudPage {
await BrowserActions.click(this.selectProcessDropdownArrow); await BrowserActions.click(this.selectProcessDropdownArrow);
} }
async checkOptionIsDisplayed(name): Promise<void> { async checkOptionIsDisplayed(name: string): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown); await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown); await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
} }
async selectOption(name): Promise<void> { async selectOption(name: string): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
await BrowserActions.click(selectProcessDropdown); await BrowserActions.click(selectProcessDropdown);
} }
@@ -88,17 +88,17 @@ export class StartProcessCloudPage {
await BrowserActions.click(this.startProcessButton); await BrowserActions.click(this.startProcessButton);
} }
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> { async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise<void> {
const errorElement = element(by.cssContainingText(elementRef, error)); const errorElement = element(by.cssContainingText(elementRef, error));
await BrowserVisibility.waitUntilElementIsVisible(errorElement); await BrowserVisibility.waitUntilElementIsVisible(errorElement);
} }
async blur(locator): Promise<void> { async blur(locator: ElementFinder): Promise<void> {
await BrowserActions.click(locator); await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB); await locator.sendKeys(Key.TAB);
} }
async clearField(locator) { async clearField(locator: ElementFinder) {
await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserActions.clearWithBackSpace(locator); await BrowserActions.clearWithBackSpace(locator);
} }

View File

@@ -36,19 +36,19 @@ export class StartTasksCloudPage {
await BrowserVisibility.waitUntilElementIsVisible(this.form); await BrowserVisibility.waitUntilElementIsVisible(this.form);
} }
async addName(userName): Promise<void> { async addName(userName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.name, userName); await BrowserActions.clearSendKeys(this.name, userName);
} }
async addDescription(userDescription): Promise<void> { async addDescription(userDescription: string): Promise<void> {
await BrowserActions.clearSendKeys(this.description, userDescription); await BrowserActions.clearSendKeys(this.description, userDescription);
} }
async addPriority(userPriority): Promise<void> { async addPriority(userPriority: string): Promise<void> {
await BrowserActions.clearSendKeys(this.priority, userPriority); await BrowserActions.clearSendKeys(this.priority, userPriority);
} }
async addDueDate(date): Promise<void> { async addDueDate(date: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueDate); await BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
await BrowserActions.clearSendKeys(this.dueDate, date); await BrowserActions.clearSendKeys(this.dueDate, date);
} }
@@ -69,23 +69,23 @@ export class StartTasksCloudPage {
await BrowserActions.click(this.cancelButton); await BrowserActions.click(this.cancelButton);
} }
async blur(locator): Promise<void> { async blur(locator: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserVisibility.waitUntilElementIsClickable(locator); await BrowserVisibility.waitUntilElementIsClickable(locator);
await BrowserActions.click(locator); await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB); await locator.sendKeys(Key.TAB);
} }
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> { async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise<void> {
const errorElement = element(by.cssContainingText(elementRef, error)); const errorElement = element(by.cssContainingText(elementRef, error));
await BrowserVisibility.waitUntilElementIsVisible(errorElement); await BrowserVisibility.waitUntilElementIsVisible(errorElement);
} }
async validateAssignee(error): Promise<void> { async validateAssignee(error: string): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error'); await this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error');
} }
async validateDate(error): Promise<void> { async validateDate(error: string): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-error-text'); await this.checkValidationErrorIsDisplayed(error, '.adf-error-text');
} }

View File

@@ -45,39 +45,39 @@ export class TaskListCloudComponentPage {
return this.dataTable; return this.dataTable;
} }
clickCheckbox(taskName): Promise<void> { clickCheckbox(taskName: string): Promise<void> {
return this.dataTable.clickCheckbox(column.name, taskName); return this.dataTable.clickCheckbox(column.name, taskName);
} }
checkRowIsNotChecked(taskName): Promise<void> { checkRowIsNotChecked(taskName: string): Promise<void> {
return this.dataTable.checkRowIsNotChecked(column.name, taskName); return this.dataTable.checkRowIsNotChecked(column.name, taskName);
} }
checkRowIsChecked(taskName): Promise<void> { checkRowIsChecked(taskName: string): Promise<void> {
return this.dataTable.checkRowIsChecked(column.name, taskName); return this.dataTable.checkRowIsChecked(column.name, taskName);
} }
getRowsWithSameName(taskName): Promise<string> { getRowsWithSameName(taskName: string): Promise<string> {
return this.dataTable.getRowsWithSameColumnValues(column.name, taskName); return this.dataTable.getRowsWithSameColumnValues(column.name, taskName);
} }
getRowsWithSameId(taskId): Promise<string> { getRowsWithSameId(taskId: string): Promise<string> {
return this.dataTable.getRowsWithSameColumnValues('Id', taskId); return this.dataTable.getRowsWithSameColumnValues('Id', taskId);
} }
checkRowIsSelected(taskName): Promise<void> { checkRowIsSelected(taskName: string): Promise<void> {
return this.dataTable.checkRowIsSelected(column.name, taskName); return this.dataTable.checkRowIsSelected(column.name, taskName);
} }
checkRowIsNotSelected(taskName): Promise<void> { checkRowIsNotSelected(taskName: string): Promise<void> {
return this.dataTable.checkRowIsNotSelected(column.name, taskName); return this.dataTable.checkRowIsNotSelected(column.name, taskName);
} }
selectRowWithKeyboard(taskName): Promise<void> { selectRowWithKeyboard(taskName: string): Promise<void> {
return this.dataTable.selectRowWithKeyboard(column.name, taskName); return this.dataTable.selectRowWithKeyboard(column.name, taskName);
} }
selectRow(taskName): Promise<void> { selectRow(taskName: string): Promise<void> {
return this.dataTable.selectRow(column.name, taskName); return this.dataTable.selectRow(column.name, taskName);
} }
@@ -89,23 +89,23 @@ export class TaskListCloudComponentPage {
return this.dataTable.getCellElementByValue(column.name, taskName); return this.dataTable.getCellElementByValue(column.name, taskName);
} }
checkContentIsDisplayedById(taskId): Promise<void> { checkContentIsDisplayedById(taskId: string): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.id, taskId); return this.dataTable.checkContentIsDisplayed(column.id, taskId);
} }
async checkContentIsNotDisplayedById(taskId): Promise<void> { async checkContentIsNotDisplayedById(taskId: string): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(column.id, taskId); return this.dataTable.checkContentIsNotDisplayed(column.id, taskId);
} }
async checkContentIsDisplayedByProcessInstanceId(taskName): Promise<void> { async checkContentIsDisplayedByProcessInstanceId(taskName: string): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.processInstanceId, taskName); return this.dataTable.checkContentIsDisplayed(column.processInstanceId, taskName);
} }
async checkContentIsDisplayedByName(taskName): Promise<void> { async checkContentIsDisplayedByName(taskName: string): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.name, taskName); return this.dataTable.checkContentIsDisplayed(column.name, taskName);
} }
async checkContentIsNotDisplayedByName(taskName): Promise<void> { async checkContentIsNotDisplayedByName(taskName: string): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(column.name, taskName); return this.dataTable.checkContentIsNotDisplayed(column.name, taskName);
} }
@@ -153,7 +153,7 @@ export class TaskListCloudComponentPage {
return this.dataTable.getAllRowsColumnValues(column.owner); return this.dataTable.getAllRowsColumnValues(column.owner);
} }
async getIdCellValue(rowName): Promise<string> { async getIdCellValue(rowName: string): Promise<string> {
const locator = new DataTableComponentPage().getCellByRowContentAndColumn(column.name, rowName, column.id); const locator = new DataTableComponentPage().getCellByRowContentAndColumn(column.name, rowName, column.id);
return BrowserActions.getText(locator); return BrowserActions.getText(locator);
} }
@@ -179,7 +179,7 @@ export class TaskListCloudComponentPage {
await this.dataTable.rightClickOnRow('Id', taskId); await this.dataTable.rightClickOnRow('Id', taskId);
} }
async clickContextMenuActionNamed(actionName): Promise<void> { async clickContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
} }

View File

@@ -18,6 +18,7 @@
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { by, element, ElementFinder, Locator } from 'protractor'; import { by, element, ElementFinder, Locator } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
import { By } from 'selenium-webdriver';
export class FormFieldsPage { export class FormFieldsPage {
@@ -34,54 +35,54 @@ export class FormFieldsPage {
completeButton: ElementFinder = element(by.id('adf-form-complete')); completeButton: ElementFinder = element(by.id('adf-form-complete'));
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text'); errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
async setFieldValue(locator, field, value): Promise<void> { async setFieldValue(locator: (id: string) => By, field: string, value: string): Promise<void> {
const fieldElement: any = element(locator(field)); const fieldElement = element(locator(field));
await BrowserVisibility.waitUntilElementIsVisible(fieldElement); await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
await BrowserActions.clearSendKeys(fieldElement, value); await BrowserActions.clearSendKeys(fieldElement, value);
} }
async checkWidgetIsVisible(fieldId): Promise<void> { async checkWidgetIsVisible(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first(); const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
await BrowserVisibility.waitUntilElementIsVisible(fieldElement); await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
} }
async checkWidgetIsHidden(fieldId): Promise<void> { async checkWidgetIsHidden(fieldId: string): Promise<void> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`)); const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
await BrowserVisibility.waitUntilElementIsVisible(hiddenElement); await BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
} }
async getWidget(fieldId): Promise<ElementFinder> { async getWidget(fieldId: string): Promise<ElementFinder> {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
await BrowserVisibility.waitUntilElementIsVisible(widget); await BrowserVisibility.waitUntilElementIsVisible(widget);
return widget; return widget;
} }
async getFieldValue(fieldId, valueLocatorParam): Promise<string> { async getFieldValue(fieldId: string, valueLocatorParam: Locator): Promise<string> {
const widget: ElementFinder = await this.getWidget(fieldId); const widget: ElementFinder = await this.getWidget(fieldId);
const value = widget.element(valueLocatorParam || this.valueLocator); const value = widget.element(valueLocatorParam || this.valueLocator);
await BrowserVisibility.waitUntilElementIsVisible(value); await BrowserVisibility.waitUntilElementIsVisible(value);
return value.getAttribute('value'); return value.getAttribute('value');
} }
async getFieldLabel(fieldId, labelLocatorParam): Promise<string> { async getFieldLabel(fieldId: string, labelLocatorParam: Locator): Promise<string> {
const widget = await this.getWidget(fieldId); const widget = await this.getWidget(fieldId);
const label = widget.all(labelLocatorParam || this.labelLocator).first(); const label = widget.all(labelLocatorParam || this.labelLocator).first();
return BrowserActions.getText(label); return BrowserActions.getText(label);
} }
async getFieldErrorMessage(fieldId): Promise<string> { async getFieldErrorMessage(fieldId: string): Promise<string> {
const widget = await this.getWidget(fieldId); const widget = await this.getWidget(fieldId);
const error = widget.element(this.errorMessage); const error = widget.element(this.errorMessage);
return BrowserActions.getText(error); return BrowserActions.getText(error);
} }
async getFieldText(fieldId, labelLocatorParam): Promise<string> { async getFieldText(fieldId: string, labelLocatorParam: Locator): Promise<string> {
const widget = await this.getWidget(fieldId); const widget = await this.getWidget(fieldId);
const label = widget.element(labelLocatorParam || this.labelLocator); const label = widget.element(labelLocatorParam || this.labelLocator);
return BrowserActions.getText(label); return BrowserActions.getText(label);
} }
async getFieldPlaceHolder(fieldId, locator = 'input'): Promise<string> { async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise<string> {
const placeHolderLocator = element(by.css(`${locator}#${fieldId}`)); const placeHolderLocator = element(by.css(`${locator}#${fieldId}`));
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator); await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
return placeHolderLocator.getAttribute('placeholder'); return placeHolderLocator.getAttribute('placeholder');
@@ -119,18 +120,18 @@ export class FormFieldsPage {
await BrowserActions.click(this.attachFormButton); await BrowserActions.click(this.attachFormButton);
} }
async selectForm(formName): Promise<void> { async selectForm(formName: string): Promise<void> {
await BrowserActions.click(this.selectFormDropDownArrow); await BrowserActions.click(this.selectFormDropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent); await BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
await this.selectFormFromDropDown(formName); await this.selectFormFromDropDown(formName);
} }
async selectFormFromDropDown(formName): Promise<void> { async selectFormFromDropDown(formName: string): Promise<void> {
const formNameElement = element(by.cssContainingText('span', formName)); const formNameElement = element(by.cssContainingText('span', formName));
await BrowserActions.click(formNameElement); await BrowserActions.click(formNameElement);
} }
async checkWidgetIsReadOnlyMode(fieldId): Promise<void> { async checkWidgetIsReadOnlyMode(fieldId: string): Promise<void> {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]')); const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]'));
await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly); await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
@@ -140,8 +141,8 @@ export class FormFieldsPage {
await BrowserActions.click(this.completeButton); await BrowserActions.click(this.completeButton);
} }
async setValueInInputById(fieldId, value): Promise<void> { async setValueInInputById(fieldId: string, value: string): Promise<void> {
const input: any = element(by.id(fieldId)); const input = element(by.id(fieldId));
await BrowserVisibility.waitUntilElementIsVisible(input); await BrowserVisibility.waitUntilElementIsVisible(input);
await BrowserActions.clearSendKeys(input, value); await BrowserActions.clearSendKeys(input, value);
} }