mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3040]Refactor/and move to testing package POs and API calls (#5607)
* Refactor/and move to testing package POs and API calls * Remove method * Add task list PO * Use adf testing package APS1 calls * Fix some tests * Update new test * Fix some process-services tests * no message * Fix 2 tests * Create StartProcess page in ADF testing package; refactor process-services tests * no message
This commit is contained in:
@@ -26,7 +26,7 @@ export class AppPublish {
|
||||
force: boolean = true;
|
||||
}
|
||||
|
||||
export class ApplicationService {
|
||||
export class ApplicationsUtil {
|
||||
|
||||
api: AlfrescoApi;
|
||||
|
||||
@@ -54,4 +54,16 @@ export class ApplicationService {
|
||||
Logger.error('Import Application - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
async getAppDefinitionByName(appName): Promise<any> {
|
||||
try {
|
||||
const appDefinitionsList = await this.api.activiti.appsApi.getAppDefinitions();
|
||||
const appDefinition = appDefinitionsList.data.filter((currentApp) => {
|
||||
return currentApp.name === appName;
|
||||
});
|
||||
return appDefinition;
|
||||
} catch (error) {
|
||||
Logger.error('Get AppDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
}
|
@@ -27,7 +27,7 @@ export class ModelsActions {
|
||||
|
||||
async deleteVersionModel(modelId) {
|
||||
try {
|
||||
return this.api.activiti.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp : true });
|
||||
return await this.api.activiti.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp : true });
|
||||
} catch (error) {
|
||||
Logger.error('Delete Model Version - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export class ModelsActions {
|
||||
|
||||
async deleteEntireModel(modelId) {
|
||||
try {
|
||||
return this.api.activiti.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp : true });
|
||||
return await this.api.activiti.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp : true });
|
||||
} catch (error) {
|
||||
Logger.error('Delete Model - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
|
87
lib/testing/src/lib/core/actions/APS/process.util.ts
Normal file
87
lib/testing/src/lib/core/actions/APS/process.util.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
/*!
|
||||
* @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 { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
import { ApplicationsUtil } from './applications.util';
|
||||
import { Logger } from '../../utils/logger';
|
||||
import { StringUtil } from '../../utils/string.util';
|
||||
|
||||
export class ProcessUtil {
|
||||
|
||||
api: AlfrescoApi;
|
||||
|
||||
constructor(api: AlfrescoApi) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
async startProcessByDefinitionName(appName: string, processDefinitionName: string): Promise<any> {
|
||||
try {
|
||||
const appDefinition = await new ApplicationsUtil(this.api).getAppDefinitionByName(appName);
|
||||
|
||||
const processDefinition = await this.getProcessDefinitionByName(appDefinition.deploymentId, processDefinitionName);
|
||||
|
||||
const startProcessOptions: any = { processDefinitionId: processDefinition.id, name: processDefinitionName };
|
||||
|
||||
return this.api.activiti.processApi.startNewProcessInstance(startProcessOptions);
|
||||
} catch (error) {
|
||||
Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
async startProcessOfApp(appName: string, processName?: string): Promise<any> {
|
||||
try {
|
||||
const appDefinition = await new ApplicationsUtil(this.api).getAppDefinitionByName(appName);
|
||||
const processDefinitionList = await this.api.activiti.processApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId });
|
||||
const startProcessOptions: any = { processDefinitionId: processDefinitionList.data[0].id, name: processName ? processName : StringUtil.generateRandomString(5).toLowerCase() };
|
||||
return this.api.activiti.processApi.startNewProcessInstance(startProcessOptions);
|
||||
} catch (error) {
|
||||
Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
async cancelProcessInstance(processInstance: string): Promise<any> {
|
||||
try {
|
||||
return this.api.activiti.processApi.deleteProcessInstance(processInstance);
|
||||
} catch (error) {
|
||||
Logger.error('Cancel Process - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<any> {
|
||||
try {
|
||||
const processDefinitionList = await this.api.activiti.processApi.getProcessDefinitions({ deploymentId: deploymentId });
|
||||
const chosenProcess = processDefinitionList.data.find( (processDefinition) => {
|
||||
return processDefinition.name === processName;
|
||||
});
|
||||
return chosenProcess;
|
||||
} catch (error) {
|
||||
Logger.error('Get ProcessDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
|
||||
}
|
||||
}
|
||||
|
||||
async getProcessTaskId(processId: string): Promise<string> {
|
||||
const taskList = await this.api.activiti.taskApi.listTasks({});
|
||||
let wantedtask;
|
||||
|
||||
taskList.data.forEach((task) => {
|
||||
if (task.processInstanceId === processId) {
|
||||
wantedtask = task;
|
||||
}
|
||||
});
|
||||
return wantedtask ? wantedtask : 'null';
|
||||
}
|
||||
}
|
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './applications.service';
|
||||
export * from './applications.util';
|
||||
export * from './process.util';
|
||||
export * from './models.service';
|
||||
export * from './integration.service';
|
||||
|
68
lib/testing/src/lib/process-services/pages/filters.page.ts
Normal file
68
lib/testing/src/lib/process-services/pages/filters.page.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* @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 { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { by, element, ElementFinder, Locator } from 'protractor';
|
||||
|
||||
export class FiltersPage {
|
||||
|
||||
accordionMenu: ElementFinder = element(by.css('.app-processes-menu mat-accordion'));
|
||||
buttonWindow: ElementFinder = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
|
||||
processIcon: Locator = by.xpath('ancestor::div[@class="mat-list-item-content"]/mat-icon');
|
||||
|
||||
async clickFilterButton(filterElement: ElementFinder): Promise<void> {
|
||||
await BrowserActions.click(filterElement);
|
||||
}
|
||||
|
||||
async isFilterEnabled(filterElement: ElementFinder): Promise<boolean> {
|
||||
return filterElement.isEnabled();
|
||||
}
|
||||
|
||||
async isFilterHighlighted(filterName): Promise<boolean> {
|
||||
const processNameHighlighted: ElementFinder = element(by.css(`mat-list-item.adf-active span[data-automation-id='${filterName}_filter']`));
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(processNameHighlighted);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isFilterDisplayed(name): Promise<boolean> {
|
||||
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(filterName);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async checkFilterHasNoIcon(name): Promise<void> {
|
||||
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(filterName);
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon));
|
||||
}
|
||||
|
||||
async getFilterIcon(name): Promise<string> {
|
||||
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(filterName);
|
||||
const icon = filterName.element(this.processIcon);
|
||||
return BrowserActions.getText(icon);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
* @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 { by, element, ElementFinder } from 'protractor';
|
||||
import { FiltersPage } from './filters.page';
|
||||
|
||||
export class ProcessFiltersPage {
|
||||
|
||||
filtersPage = new FiltersPage();
|
||||
|
||||
runningFilter: ElementFinder = element(by.css('span[data-automation-id="Running_filter"]'));
|
||||
completedFilter: ElementFinder = element(by.css('div[class="mat-list-text"] > span[data-automation-id="Completed_filter"]'));
|
||||
allFilter: ElementFinder = element(by.css('span[data-automation-id="All_filter"]'));
|
||||
accordionMenu: ElementFinder = element(by.css('.app-processes-menu mat-accordion'));
|
||||
|
||||
async clickRunningFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.runningFilter);
|
||||
}
|
||||
|
||||
async clickCompletedFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.completedFilter);
|
||||
}
|
||||
|
||||
async clickAllFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.allFilter);
|
||||
}
|
||||
|
||||
async isRunningFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('Running');
|
||||
}
|
||||
|
||||
async isCompletedFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('Completed');
|
||||
}
|
||||
|
||||
async isAllFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('All');
|
||||
}
|
||||
|
||||
async isRunningFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('Running');
|
||||
}
|
||||
|
||||
async isCompletedFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('Completed');
|
||||
}
|
||||
|
||||
async isAllFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('All');
|
||||
}
|
||||
}
|
@@ -19,11 +19,16 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { by, element, ElementFinder } from 'protractor';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
|
||||
export class StartProcessDialog {
|
||||
export class ProcessInstanceTasksPage {
|
||||
|
||||
startProcessDialog: ElementFinder = element(by.id('adf-start-process-dialog'));
|
||||
title: ElementFinder = this.startProcessDialog.element(by.css('h4.mat-dialog-title'));
|
||||
closeButton: ElementFinder = this.startProcessDialog.element(by.cssContainingText(`div.adf-start-process-dialog-actions button span`, 'Close'));
|
||||
startForm: ElementFinder = element(by.css('div[data-automation-id="start-form"]'));
|
||||
|
||||
async clickOnStartForm(): Promise<void> {
|
||||
await BrowserActions.click(this.startForm);
|
||||
}
|
||||
|
||||
async checkStartProcessDialogIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.startProcessDialog);
|
@@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* @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 { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { element, by, ElementFinder } from 'protractor';
|
||||
|
||||
export class ProcessListPage {
|
||||
|
||||
processListEmptyTitle: ElementFinder = element(by.css('div[class="adf-empty-content__title"]'));
|
||||
processInstanceList: ElementFinder = element(by.css('adf-process-instance-list'));
|
||||
dataTable: DataTableComponentPage = new DataTableComponentPage(this.processInstanceList);
|
||||
|
||||
getDisplayedProcessListEmptyTitle(): Promise<string> {
|
||||
return BrowserActions.getText(this.processListEmptyTitle);
|
||||
}
|
||||
|
||||
titleNotPresent(): Promise<string> {
|
||||
return BrowserVisibility.waitUntilElementIsNotPresent(this.processListEmptyTitle);
|
||||
}
|
||||
|
||||
async checkProcessListIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceList);
|
||||
}
|
||||
|
||||
checkContentIsDisplayedByColumn(column: string, processName: string): Promise<void> {
|
||||
return this.dataTable.checkContentIsDisplayed(column, processName);
|
||||
}
|
||||
|
||||
checkContentIsNotDisplayedByColumn(column: string, processName: string): Promise<void> {
|
||||
return this.dataTable.checkContentIsNotDisplayed(column, processName);
|
||||
}
|
||||
}
|
@@ -16,5 +16,11 @@
|
||||
*/
|
||||
|
||||
export * from './form-fields.page';
|
||||
export * from './start-process-dialog.page';
|
||||
export * from './filters.page';
|
||||
export * from './process-filters.page';
|
||||
export * from './process-list.page';
|
||||
export * from './task-list.page';
|
||||
export * from './task-filters.page';
|
||||
export * from './process-instance-tasks.page';
|
||||
export * from './start-process.page';
|
||||
export * from './select-apps-dialog.page';
|
||||
|
148
lib/testing/src/lib/process-services/pages/start-process.page.ts
Normal file
148
lib/testing/src/lib/process-services/pages/start-process.page.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
/*!
|
||||
* @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 { by, element, Key, protractor, browser, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { DropdownPage } from '../../material/pages/dropdown.page';
|
||||
import { FormFields } from '../../core/pages/form/form-fields';
|
||||
|
||||
export class StartProcessPage {
|
||||
|
||||
defaultProcessName: ElementFinder = element(by.css('input[id="processName"]'));
|
||||
processNameInput: ElementFinder = element(by.id('processName'));
|
||||
selectProcessDropdownArrow: ElementFinder = element(by.css('button[id="adf-select-process-dropdown"]'));
|
||||
cancelProcessButton: ElementFinder = element(by.id('cancel_process'));
|
||||
formStartProcessButton: ElementFinder = element(by.css('button[data-automation-id="adf-form-start process"]'));
|
||||
startProcessButton: ElementFinder = element(by.css('button[data-automation-id="btn-start"]'));
|
||||
noProcess: ElementFinder = element(by.id('no-process-message'));
|
||||
processDefinition: ElementFinder = element(by.css('input[id="processDefinitionName"]'));
|
||||
processDefinitionOptionsPanel: ElementFinder = element(by.css('div[class*="mat-autocomplete-panel"]'));
|
||||
|
||||
dropdownPage = new DropdownPage();
|
||||
|
||||
async checkNoProcessMessage(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
|
||||
}
|
||||
|
||||
async pressDownArrowAndEnter(): Promise<void> {
|
||||
await this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
|
||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||
}
|
||||
|
||||
async checkNoProcessDefinitionOptionIsDisplayed() {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel);
|
||||
}
|
||||
|
||||
async getDefaultName(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.defaultProcessName);
|
||||
return this.defaultProcessName.getAttribute('value');
|
||||
}
|
||||
|
||||
async deleteDefaultName() {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
|
||||
await BrowserActions.clearWithBackSpace(this.processNameInput);
|
||||
}
|
||||
|
||||
async enterProcessName(name): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.processNameInput, name);
|
||||
}
|
||||
|
||||
async selectFromProcessDropdown(name): Promise<void> {
|
||||
await this.clickProcessDropdownArrow();
|
||||
await this.selectOption(name);
|
||||
}
|
||||
|
||||
async clickProcessDropdownArrow(): Promise<void> {
|
||||
await BrowserActions.click(this.selectProcessDropdownArrow);
|
||||
}
|
||||
|
||||
async checkOptionIsDisplayed(name): Promise<void> {
|
||||
await this.dropdownPage.checkOptionIsDisplayed(name);
|
||||
}
|
||||
|
||||
async checkOptionIsNotDisplayed(name): Promise<void> {
|
||||
await this.dropdownPage.checkOptionIsNotDisplayed(name);
|
||||
}
|
||||
|
||||
async selectOption(name): Promise<void> {
|
||||
await this.dropdownPage.selectOption(name);
|
||||
}
|
||||
|
||||
async typeProcessDefinition(name): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.processDefinition, name);
|
||||
}
|
||||
|
||||
async getProcessDefinitionValue(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
|
||||
return this.processDefinition.getAttribute('value');
|
||||
}
|
||||
|
||||
async clickCancelProcessButton(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelProcessButton);
|
||||
}
|
||||
|
||||
async clickFormStartProcessButton(): Promise<void> {
|
||||
await BrowserActions.click(this.formStartProcessButton);
|
||||
}
|
||||
|
||||
async checkStartFormProcessButtonIsEnabled() {
|
||||
await expect(await this.formStartProcessButton.isEnabled()).toBe(true);
|
||||
}
|
||||
|
||||
async checkStartProcessButtonIsEnabled() {
|
||||
await expect(await this.startProcessButton.isEnabled()).toBe(true);
|
||||
}
|
||||
|
||||
async checkStartProcessButtonIsDisabled() {
|
||||
await expect(await this.startProcessButton.isEnabled()).toBe(false);
|
||||
}
|
||||
|
||||
async clickStartProcessButton(): Promise<void> {
|
||||
await BrowserActions.click(this.startProcessButton);
|
||||
}
|
||||
|
||||
async checkSelectProcessPlaceholderIsDisplayed(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
|
||||
const processPlaceholder = await this.processDefinition.getAttribute('value');
|
||||
return processPlaceholder;
|
||||
}
|
||||
|
||||
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> {
|
||||
const errorElement: ElementFinder = element(by.cssContainingText(elementRef, error));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
|
||||
}
|
||||
|
||||
async blur(locator): Promise<void> {
|
||||
await BrowserActions.click(locator);
|
||||
await locator.sendKeys(Key.TAB);
|
||||
}
|
||||
|
||||
async clearField(locator): Promise<void> {
|
||||
await BrowserActions.clearWithBackSpace(locator);
|
||||
}
|
||||
|
||||
formFields(): FormFields {
|
||||
return new FormFields();
|
||||
}
|
||||
|
||||
async startProcess({name, processName }) {
|
||||
await this.enterProcessName(name);
|
||||
await this.selectFromProcessDropdown(processName);
|
||||
await this.clickStartProcessButton();
|
||||
}
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
/*!
|
||||
* @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 { by, element, ElementFinder } from 'protractor';
|
||||
import { FiltersPage } from './filters.page';
|
||||
|
||||
export class TaskFiltersPage {
|
||||
|
||||
filtersPage = new FiltersPage();
|
||||
|
||||
myTasks: ElementFinder = element(by.css('span[data-automation-id="My Tasks_filter"]'));
|
||||
queuedTask: ElementFinder = element(by.css('span[data-automation-id="Queued Tasks_filter"]'));
|
||||
completedTask: ElementFinder = element(by.css('span[data-automation-id="Completed Tasks_filter"]'));
|
||||
involvedTask: ElementFinder = element(by.css('span[data-automation-id="Involved Tasks_filter"]'));
|
||||
accordionMenu: ElementFinder = element(by.css('.app-processes-menu mat-accordion'));
|
||||
|
||||
async clickMyTasksFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.myTasks);
|
||||
}
|
||||
|
||||
async clickQueuedFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.queuedTask);
|
||||
}
|
||||
|
||||
async clickCompletedFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.completedTask);
|
||||
}
|
||||
|
||||
async clickInvolvedFilterButton(): Promise<void> {
|
||||
await this.filtersPage.clickFilterButton(this.involvedTask);
|
||||
}
|
||||
|
||||
async isMyTasksFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('My Tasks');
|
||||
}
|
||||
|
||||
async isQueuedFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('Queued Tasks');
|
||||
}
|
||||
|
||||
async isCompletedFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('Completed Tasks');
|
||||
}
|
||||
|
||||
async isInvolvedFilterHighlighted(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterHighlighted('Involved Tasks');
|
||||
}
|
||||
|
||||
async isMyTasksFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('My Tasks');
|
||||
}
|
||||
|
||||
async isQueuedFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('Queued Tasks');
|
||||
}
|
||||
|
||||
async isCompletedFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('Completed Tasks');
|
||||
}
|
||||
|
||||
async isInvolvedFilterDisplayed(): Promise<boolean> {
|
||||
return this.filtersPage.isFilterDisplayed('Involved Tasks');
|
||||
}
|
||||
}
|
64
lib/testing/src/lib/process-services/pages/task-list.page.ts
Normal file
64
lib/testing/src/lib/process-services/pages/task-list.page.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
/*!
|
||||
* @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 { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { element, by, ElementFinder } from 'protractor';
|
||||
|
||||
export class TaskListPage {
|
||||
|
||||
noTasksFound: ElementFinder = element(by.css('div[class="adf-empty-content__title"]'));
|
||||
taskList: ElementFinder = element(by.css('adf-tasklist'));
|
||||
dataTable: DataTableComponentPage = new DataTableComponentPage(this.taskList);
|
||||
|
||||
getDataTable() {
|
||||
return this.dataTable;
|
||||
}
|
||||
|
||||
getRowsDisplayedWithSameName(taskName): Promise<string> {
|
||||
return this.dataTable.getRowsWithSameColumnValues('Name', taskName);
|
||||
}
|
||||
|
||||
checkContentIsDisplayedByColumn(column: string, processName: string): Promise<void> {
|
||||
return this.dataTable.checkContentIsDisplayed(column, processName);
|
||||
}
|
||||
|
||||
checkContentIsNotDisplayedByColumn(column: string, processName: string): Promise<void> {
|
||||
return this.dataTable.checkContentIsNotDisplayed(column, processName);
|
||||
}
|
||||
|
||||
async checkTaskListIsLoaded(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.taskList);
|
||||
}
|
||||
|
||||
getNoTasksFoundMessage(): Promise<string> {
|
||||
return BrowserActions.getText(this.noTasksFound);
|
||||
}
|
||||
|
||||
checkRowIsSelected(taskName): Promise<void> {
|
||||
return this.dataTable.checkRowIsSelected('Name', taskName);
|
||||
}
|
||||
|
||||
selectRow(taskName): Promise<void> {
|
||||
return this.dataTable.selectRow('Name', taskName);
|
||||
}
|
||||
|
||||
getAllRowsNameColumn(): Promise<any> {
|
||||
return this.dataTable.getAllRowsColumnValues('Name');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user