mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3184][ACA-3185] Create Task Util class (#5863)
* Create Task Util page * Export Task Util class * Update Task Util * Add checks for No Form fields
This commit is contained in:
@@ -27,10 +27,13 @@ export class FormFields {
|
||||
valueLocator = by.css('input');
|
||||
labelLocator = by.css('label');
|
||||
noFormMessage = element(by.css('.adf-empty-content__title'));
|
||||
noFormMessageStandaloneTask = element(by.css('adf-task-standalone #adf-no-form-message'));
|
||||
noFormTemplate = element(by.css('adf-empty-content'));
|
||||
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
|
||||
completedStandaloneTaskNoFormMessage = element(by.css('adf-task-standalone #adf-completed-form-message'));
|
||||
attachFormButton = element(by.id('adf-attach-form-attach-button'));
|
||||
completeButton = element(by.id('adf-form-complete'));
|
||||
completeNoFormButton = element(by.id('adf-no-form-complete-button'));
|
||||
cancelButton = element(by.css('#adf-no-form-cancel-button'));
|
||||
errorMessage = by.css('.adf-error-text-container .adf-error-text');
|
||||
|
||||
@@ -124,10 +127,36 @@ export class FormFields {
|
||||
return BrowserActions.getText(this.noFormMessage);
|
||||
}
|
||||
|
||||
async getNoFormMessageStandaloneTask(): Promise<string> {
|
||||
return BrowserActions.getText(this.noFormMessageStandaloneTask);
|
||||
}
|
||||
|
||||
async getCompletedTaskNoFormMessage(): Promise<string> {
|
||||
return BrowserActions.getText(this.completedTaskNoFormMessage);
|
||||
}
|
||||
|
||||
async getCompletedStandaloneTaskNoFormMessage(): Promise<string> {
|
||||
return BrowserActions.getText(this.completedStandaloneTaskNoFormMessage);
|
||||
}
|
||||
|
||||
async isStandaloneTaskNoFormMessageDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessageStandaloneTask);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isAttachFormButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async clickOnAttachFormButton(): Promise<void> {
|
||||
await BrowserActions.click(this.attachFormButton);
|
||||
}
|
||||
@@ -152,6 +181,10 @@ export class FormFields {
|
||||
await BrowserActions.click(this.completeButton);
|
||||
}
|
||||
|
||||
async completeNoFormTask(): Promise<void> {
|
||||
await BrowserActions.click(this.completeNoFormButton);
|
||||
}
|
||||
|
||||
async setValueInInputById(fieldId: string, value: string): Promise<void> {
|
||||
const input = element(by.id(fieldId));
|
||||
await BrowserActions.clearSendKeys(input, value);
|
||||
@@ -166,10 +199,23 @@ export class FormFields {
|
||||
}
|
||||
}
|
||||
|
||||
async isCompleteNoFormButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.completeNoFormButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isCompleteFormButtonEnabled(): Promise<boolean> {
|
||||
return this.completeButton.isEnabled();
|
||||
}
|
||||
|
||||
async isCompleteNoFormButtonEnabled(): Promise<boolean> {
|
||||
return this.completeNoFormButton.isEnabled();
|
||||
}
|
||||
|
||||
async isCancelButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
|
||||
|
@@ -19,3 +19,4 @@ export * from './applications.util';
|
||||
export * from './integration.service';
|
||||
export * from './models.service';
|
||||
export * from './process.util';
|
||||
export * from './task.util';
|
||||
|
61
lib/testing/src/lib/process-services/actions/task.util.ts
Normal file
61
lib/testing/src/lib/process-services/actions/task.util.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Logger } from '../../core/utils/logger';
|
||||
import { ApiService } from '../../core/actions/api.service';
|
||||
import { TaskRepresentation } from '@alfresco/js-api';
|
||||
|
||||
export class TaskUtil {
|
||||
|
||||
api: ApiService;
|
||||
|
||||
constructor(api: ApiService) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
async createStandaloneTask(taskName: string): Promise<any> {
|
||||
try {
|
||||
return this.api.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: taskName }));
|
||||
} catch (error) {
|
||||
Logger.error('Create Standalone Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
async completeTask(taskInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.apiService.activiti.taskActionsApi.completeTask(taskInstance);
|
||||
} catch (error) {
|
||||
Logger.error('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
async completeTaskForm(taskInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.getInstance().activiti.taskApi.completeTaskForm(taskInstance, { values: { label: null } });
|
||||
} catch (error) {
|
||||
Logger.error('Complete Task Form - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
async deleteTask(taskInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.apiService.activiti.taskApi.deleteTask(taskInstance);
|
||||
} catch (error) {
|
||||
Logger.error('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user