mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3455] [ACA-4250] Create methods needed for candidate tasks (#6544)
* Add task-actions util class * Add methods for candidate task * Move methods from form-fields.page to form-fields.ts * Create task-form PO * Improve selector * export new PO * update selectors and e2e App * Add negative methods - this will speed up the running time of the test
This commit is contained in:
Binary file not shown.
@@ -34,7 +34,7 @@ export class FormFields {
|
||||
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'));
|
||||
cancelButton = element(by.id('adf-no-form-cancel-button'));
|
||||
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
|
||||
|
||||
selectFormDropdown = new DropdownPage(element.all(by.css('.adf-attach-form .mat-select-arrow')).first());
|
||||
@@ -172,10 +172,13 @@ export class FormFields {
|
||||
}
|
||||
|
||||
async checkWidgetIsReadOnlyMode(fieldId: string): Promise<ElementFinder> {
|
||||
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);
|
||||
return widgetReadOnly;
|
||||
const widget = element(by.css(`adf-form-field #field-${fieldId}-container .adf-readonly`));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
async isFormFieldEnabled(formFieldId: string): Promise<boolean> {
|
||||
return element(by.id(`${formFieldId}`)).isEnabled();
|
||||
}
|
||||
|
||||
async completeForm(): Promise<void> {
|
||||
@@ -186,6 +189,10 @@ export class FormFields {
|
||||
await BrowserActions.click(this.completeNoFormButton);
|
||||
}
|
||||
|
||||
async clickCancelButton(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelButton);
|
||||
}
|
||||
|
||||
async setValueInInputById(fieldId: string, value: string): Promise<void> {
|
||||
const input = element(by.id(fieldId));
|
||||
await BrowserActions.clearSendKeys(input, value);
|
||||
@@ -230,7 +237,4 @@ export class FormFields {
|
||||
return this.cancelButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickCancelButton(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelButton);
|
||||
}
|
||||
}
|
||||
|
@@ -19,5 +19,6 @@ export * from './applications.util';
|
||||
export * from './integration.service';
|
||||
export * from './models.service';
|
||||
export * from './process.util';
|
||||
export * from './task-actions.util';
|
||||
export * from './task.util';
|
||||
export * from './user-filters.util';
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/*!
|
||||
* @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';
|
||||
|
||||
export class TaskActionsUtil {
|
||||
|
||||
api: ApiService;
|
||||
|
||||
constructor(api: ApiService) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
async claimTask(taskInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.apiService.activiti.taskActionsApi.claimTask(taskInstance);
|
||||
} catch (error) {
|
||||
Logger.error('Claim a Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
async unclaimTask(taskInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.apiService.activiti.taskActionsApi.unclaimTask(taskInstance);
|
||||
} catch (error) {
|
||||
Logger.error('Unclaim a 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)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -35,14 +35,6 @@ export class TaskUtil {
|
||||
}
|
||||
}
|
||||
|
||||
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 } });
|
||||
|
@@ -32,6 +32,9 @@ export class FormFieldsPage {
|
||||
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
|
||||
attachFormButton = element(by.id('adf-attach-form-attach-button'));
|
||||
completeButton = element(by.id('adf-form-complete'));
|
||||
claimButton = element(by.id('adf-task-form-claim-button'));
|
||||
releaseButton = element(by.id('adf-task-form-unclaim-button'));
|
||||
cancelButton = element(by.id('adf-no-form-cancel-button'));
|
||||
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
|
||||
|
||||
selectFormDropdown = new DropdownPage(element.all(by.css('.adf-attach-form .mat-select-arrow')).first());
|
||||
@@ -121,6 +124,14 @@ export class FormFieldsPage {
|
||||
await BrowserActions.click(this.attachFormButton);
|
||||
}
|
||||
|
||||
async clickOnClaimButton(): Promise<void> {
|
||||
await BrowserActions.click(this.claimButton);
|
||||
}
|
||||
|
||||
async clickOnReleaseButton(): Promise<void> {
|
||||
await BrowserActions.click(this.releaseButton);
|
||||
}
|
||||
|
||||
async selectForm(formName: string): Promise<void> {
|
||||
await this.selectFormDropdown.clickDropdown();
|
||||
await this.selectFormDropdown.checkOptionsPanelIsDisplayed();
|
||||
@@ -138,6 +149,11 @@ export class FormFieldsPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
|
||||
}
|
||||
|
||||
async isFormFieldEnabled(formFieldId: string): Promise<boolean> {
|
||||
const formField = element(by.css(`input[id=${formFieldId}]`));
|
||||
return formField.isEnabled();
|
||||
}
|
||||
|
||||
async completeForm(): Promise<void> {
|
||||
await BrowserActions.click(this.completeButton);
|
||||
}
|
||||
@@ -157,7 +173,60 @@ export class FormFieldsPage {
|
||||
}
|
||||
}
|
||||
|
||||
async isSaveButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isCancelButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isClaimButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.claimButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isReleaseButtonDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.releaseButton);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isCompleteFormButtonEnabled(): Promise<boolean> {
|
||||
return this.completeButton.isEnabled();
|
||||
}
|
||||
|
||||
async isCancelButtonEnabled(): Promise<boolean> {
|
||||
return this.cancelButton.isEnabled();
|
||||
}
|
||||
|
||||
async isSaveButtonEnabled(): Promise<boolean> {
|
||||
return this.saveButton.isEnabled();
|
||||
}
|
||||
|
||||
async isClaimButtonEnabled(): Promise<boolean> {
|
||||
return this.claimButton.isEnabled();
|
||||
}
|
||||
|
||||
async isReleaseButtonEnabled(): Promise<boolean> {
|
||||
return this.releaseButton.isEnabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -27,3 +27,4 @@ export * from './process-instance-header.page';
|
||||
export * from './start-process.page';
|
||||
export * from './select-apps-dialog.page';
|
||||
export * from './external-node-selector-dialog.page';
|
||||
export * from './task-form.page';
|
||||
|
100
lib/testing/src/lib/process-services/pages/task-form.page.ts
Normal file
100
lib/testing/src/lib/process-services/pages/task-form.page.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
/*!
|
||||
* @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 { element, by } from 'protractor';
|
||||
import { BrowserActions, BrowserVisibility } from '../../core/utils/public-api';
|
||||
|
||||
export class TaskFormPage {
|
||||
|
||||
saveButton = element(by.id('adf-form-save'));
|
||||
claimButton = element(by.css('button[data-automation-id="adf-task-form-claim-button"]'));
|
||||
releaseButton = element(by.css('button[data-automation-id="adf-task-form-unclaim-button"]'));
|
||||
|
||||
async clickOnClaimButton(): Promise<void> {
|
||||
await BrowserActions.click(this.claimButton);
|
||||
}
|
||||
|
||||
async clickOnReleaseButton(): Promise<void> {
|
||||
await BrowserActions.click(this.releaseButton);
|
||||
}
|
||||
|
||||
async isSaveButtonDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isSaveButtonNotDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.saveButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isClaimButtonDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.claimButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isClaimButtonNotDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.claimButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isReleaseButtonDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.releaseButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isReleaseButtonNotDisplayed(timeout?: number): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.releaseButton, timeout);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isSaveButtonEnabled(): Promise<boolean> {
|
||||
return this.saveButton.isEnabled();
|
||||
}
|
||||
|
||||
async isClaimButtonEnabled(): Promise<boolean> {
|
||||
return this.claimButton.isEnabled();
|
||||
}
|
||||
|
||||
async isReleaseButtonEnabled(): Promise<boolean> {
|
||||
return this.releaseButton.isEnabled();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user