mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3774]Add process custom filter tests (#4085)
* Add process custom filter tests * Modified getAllRowsNameColumn datatable method.
This commit is contained in:
committed by
Eugenio Romano
parent
a9e5c9b77e
commit
261eeae6f4
@@ -51,25 +51,14 @@ export class DataTablePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAllRowsNameColumn() {
|
getAllRowsNameColumn() {
|
||||||
return this.getAllRowsColumnValues(this.nameColumn);
|
return this.getAllRowsColumnValues('Name');
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllRowsColumnValues(locator) {
|
async getAllRowsColumnValues(locator) {
|
||||||
let deferred = protractor.promise.defer();
|
let columnLocator = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='" + column + "'] span");
|
||||||
Util.waitUntilElementIsVisible(element.all(locator).first());
|
Util.waitUntilElementIsVisible(element.all(columnLocator).first());
|
||||||
let initialList = [];
|
let initialList = await element.all(columnLocator).getText();
|
||||||
|
return initialList.filter((el) => el);
|
||||||
element.all(locator).each(function (currentElement) {
|
|
||||||
currentElement.getText().then(function (text) {
|
|
||||||
if (text !== '') {
|
|
||||||
initialList.push(text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).then(function () {
|
|
||||||
deferred.fulfill(initialList);
|
|
||||||
});
|
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRowByRowNumber(rowNumber) {
|
getRowByRowNumber(rowNumber) {
|
||||||
|
@@ -19,6 +19,7 @@ import { Util } from '../../../util/util';
|
|||||||
|
|
||||||
import { ProcessFiltersCloudComponent } from '../process_cloud/processFiltersCloudComponent';
|
import { ProcessFiltersCloudComponent } from '../process_cloud/processFiltersCloudComponent';
|
||||||
import { ProcessListCloudComponent } from '../process_cloud/processListCloudComponent';
|
import { ProcessListCloudComponent } from '../process_cloud/processListCloudComponent';
|
||||||
|
import { EditProcessFilterCloudComponent } from '../process_cloud/editProcessFilterCloudComponent';
|
||||||
import { element, by } from 'protractor';
|
import { element, by } from 'protractor';
|
||||||
|
|
||||||
export class ProcessCloudDemoPage {
|
export class ProcessCloudDemoPage {
|
||||||
@@ -30,15 +31,24 @@ export class ProcessCloudDemoPage {
|
|||||||
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
|
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
|
||||||
|
|
||||||
processListCloud = new ProcessListCloudComponent();
|
processListCloud = new ProcessListCloudComponent();
|
||||||
|
editProcessFilterCloud = new EditProcessFilterCloudComponent();
|
||||||
|
|
||||||
processFiltersCloudComponent(filter) {
|
processFiltersCloudComponent(filter) {
|
||||||
return new ProcessFiltersCloudComponent(filter);
|
return new ProcessFiltersCloudComponent(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editProcessFilterCloudComponent() {
|
||||||
|
return this.editProcessFilterCloud;
|
||||||
|
}
|
||||||
|
|
||||||
processListCloudComponent() {
|
processListCloudComponent() {
|
||||||
return this.processListCloud;
|
return this.processListCloud;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAllRowsByIdColumn() {
|
||||||
|
return this.processListCloud.getAllRowsByColumn('Id');
|
||||||
|
}
|
||||||
|
|
||||||
allProcessesFilter() {
|
allProcessesFilter() {
|
||||||
return new ProcessFiltersCloudComponent(this.allProcesses);
|
return new ProcessFiltersCloudComponent(this.allProcesses);
|
||||||
}
|
}
|
||||||
|
@@ -39,9 +39,6 @@ export class TaskListDemoPage {
|
|||||||
stateSelector = element(by.css("div[class*='mat-select-panel']"));
|
stateSelector = element(by.css("div[class*='mat-select-panel']"));
|
||||||
sortDropDownArrow = element(by.css("mat-form-field[data-automation-id='sort'] div[class*='arrow']"));
|
sortDropDownArrow = element(by.css("mat-form-field[data-automation-id='sort'] div[class*='arrow']"));
|
||||||
sortSelector = element(by.css("div[class*='mat-select-panel']"));
|
sortSelector = element(by.css("div[class*='mat-select-panel']"));
|
||||||
processDefinitionIdColumn = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='Process Definition Id'] span");
|
|
||||||
processInstanceIdColumn = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='a" +
|
|
||||||
"df-datatable-row'] div[title='Process Instance Id'] span");
|
|
||||||
|
|
||||||
taskList(): TasksListPage {
|
taskList(): TasksListPage {
|
||||||
return this.taskListPage;
|
return this.taskListPage;
|
||||||
@@ -212,11 +209,11 @@ export class TaskListDemoPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAllProcessDefinitionIds() {
|
getAllProcessDefinitionIds() {
|
||||||
return this.taskList().getDataTable().getAllRowsColumnValues(this.processDefinitionIdColumn);
|
return this.taskList().getDataTable().getAllRowsColumnValues('Process Definition Id');
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllProcessInstanceIds() {
|
getAllProcessInstanceIds() {
|
||||||
return this.taskList().getDataTable().getAllRowsColumnValues(this.processInstanceIdColumn);
|
return this.taskList().getDataTable().getAllRowsColumnValues('Process Instance Id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,67 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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 { Util } from '../../../util/util';
|
||||||
|
import { by, element } from 'protractor';
|
||||||
|
|
||||||
|
export class EditProcessFilterCloudComponent {
|
||||||
|
|
||||||
|
customiseFilter = element(by.id('adf-edit-process-filter-title-id'));
|
||||||
|
selectedOption = element(by.css('mat-option[class*="mat-selected"]'));
|
||||||
|
|
||||||
|
clickCustomiseFilterHeader() {
|
||||||
|
Util.waitUntilElementIsVisible(this.customiseFilter);
|
||||||
|
this.customiseFilter.click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setStateFilterDropDown(option) {
|
||||||
|
this.clickOnDropDownArrow('status');
|
||||||
|
|
||||||
|
let stateElement = element.all(by.cssContainingText('mat-option span', option)).first();
|
||||||
|
Util.waitUntilElementIsClickable(stateElement);
|
||||||
|
Util.waitUntilElementIsVisible(stateElement);
|
||||||
|
stateElement.click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSortFilterDropDown(option) {
|
||||||
|
this.clickOnDropDownArrow('sort');
|
||||||
|
|
||||||
|
let sortElement = element.all(by.cssContainingText('mat-option span', option)).first();
|
||||||
|
Util.waitUntilElementIsClickable(sortElement);
|
||||||
|
Util.waitUntilElementIsVisible(sortElement);
|
||||||
|
sortElement.click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setOrderFilterDropDown(option) {
|
||||||
|
this.clickOnDropDownArrow('order');
|
||||||
|
|
||||||
|
let orderElement = element.all(by.cssContainingText('mat-option span', option)).first();
|
||||||
|
Util.waitUntilElementIsClickable(orderElement);
|
||||||
|
Util.waitUntilElementIsVisible(orderElement);
|
||||||
|
orderElement.click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
clickOnDropDownArrow(option) {
|
||||||
|
let dropDownArrow = element(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']"));
|
||||||
|
Util.waitUntilElementIsVisible(dropDownArrow);
|
||||||
|
dropDownArrow.click();
|
||||||
|
Util.waitUntilElementIsVisible(this.selectedOption);
|
||||||
|
}
|
||||||
|
}
|
@@ -40,4 +40,8 @@ export class ProcessListCloudComponent {
|
|||||||
return this.noProcessFound.getText();
|
return this.noProcessFound.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAllRowsByColumn(column) {
|
||||||
|
return this.dataTable.getAllRowsColumnValues(column);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
123
e2e/process-services-cloud/process_custom_filters.e2e.ts
Normal file
123
e2e/process-services-cloud/process_custom_filters.e2e.ts
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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 TestConfig = require('../test.config');
|
||||||
|
|
||||||
|
import { LoginSSOPage } from '../pages/adf/loginSSOPage';
|
||||||
|
import { SettingsPage } from '../pages/adf/settingsPage';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
|
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/processCloudDemoPage';
|
||||||
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/tasksCloudDemoPage';
|
||||||
|
import { AppListCloudComponent } from '../pages/adf/process_cloud/appListCloudComponent';
|
||||||
|
|
||||||
|
import { ProcessDefinitions } from '../actions/APS-cloud/process-definitions';
|
||||||
|
import { ProcessInstances } from '../actions/APS-cloud/process-instances';
|
||||||
|
import { Tasks } from '../actions/APS-cloud/tasks';
|
||||||
|
import { Query } from '../actions/APS-cloud/query';
|
||||||
|
|
||||||
|
describe('Process list cloud', () => {
|
||||||
|
|
||||||
|
describe('Process List', () => {
|
||||||
|
const settingsPage = new SettingsPage();
|
||||||
|
const loginSSOPage = new LoginSSOPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
let appListCloudComponent = new AppListCloudComponent();
|
||||||
|
let processCloudDemoPage = new ProcessCloudDemoPage();
|
||||||
|
let tasksCloudDemoPage = new TasksCloudDemoPage();
|
||||||
|
|
||||||
|
const tasksService: Tasks = new Tasks();
|
||||||
|
const processDefinitionService: ProcessDefinitions = new ProcessDefinitions();
|
||||||
|
const processInstancesService: ProcessInstances = new ProcessInstances();
|
||||||
|
const queryService: Query = new Query();
|
||||||
|
|
||||||
|
const path = '/auth/realms/springboot';
|
||||||
|
let silentLogin;
|
||||||
|
let runningProcess, completedProcess;
|
||||||
|
const simpleApp = 'candidateuserapp';
|
||||||
|
const user = TestConfig.adf.adminEmail, password = TestConfig.adf.adminPassword;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
silentLogin = false;
|
||||||
|
settingsPage.setProviderBpmSso(TestConfig.adf.hostSso, TestConfig.adf.hostSso + path, silentLogin);
|
||||||
|
loginSSOPage.clickOnSSOButton();
|
||||||
|
loginSSOPage.loginAPS(user, password);
|
||||||
|
|
||||||
|
await processDefinitionService.init(user, password);
|
||||||
|
let processDefinition = await processDefinitionService.getProcessDefinitions(simpleApp);
|
||||||
|
await processInstancesService.init(user, password);
|
||||||
|
runningProcess = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key, simpleApp);
|
||||||
|
|
||||||
|
completedProcess = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key, simpleApp);
|
||||||
|
await queryService.init(user, password);
|
||||||
|
let task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, simpleApp);
|
||||||
|
await tasksService.init(user, password);
|
||||||
|
let claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, simpleApp);
|
||||||
|
await tasksService.completeTask(claimedTask.entry.id, simpleApp);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach((done) => {
|
||||||
|
navigationBarPage.navigateToProcessServicesCloudPage();
|
||||||
|
appListCloudComponent.checkApsContainer();
|
||||||
|
appListCloudComponent.goToApp(simpleApp);
|
||||||
|
tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
||||||
|
processCloudDemoPage.clickOnProcessFilters();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290069] Should display processes ordered by name when Name is selected from sort dropdown', async() => {
|
||||||
|
processCloudDemoPage.editProcessFilterCloudComponent().clickCustomiseFilterHeader().setStateFilterDropDown('RUNNING')
|
||||||
|
.setSortFilterDropDown('NAME').setOrderFilterDropDown('ASC');
|
||||||
|
processCloudDemoPage.processListCloudComponent().getDataTable().getAllRowsNameColumn().then(function (list) {
|
||||||
|
let initialList = list.slice(0);
|
||||||
|
list.sort();
|
||||||
|
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
processCloudDemoPage.editProcessFilterCloudComponent().setOrderFilterDropDown('DESC');
|
||||||
|
processCloudDemoPage.processListCloudComponent().getDataTable().getAllRowsNameColumn().then(function (list) {
|
||||||
|
let initialList = list.slice(0);
|
||||||
|
list.sort();
|
||||||
|
list.reverse();
|
||||||
|
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C291783] Should display processes ordered by id when Id is selected from sort dropdown', async() => {
|
||||||
|
processCloudDemoPage.editProcessFilterCloudComponent().clickCustomiseFilterHeader().setStateFilterDropDown('RUNNING')
|
||||||
|
.setSortFilterDropDown('ID').setOrderFilterDropDown('ASC');
|
||||||
|
processCloudDemoPage.getAllRowsByIdColumn().then(function (list) {
|
||||||
|
let initialList = list.slice(0);
|
||||||
|
list.sort(function (firstStr, secondStr) {
|
||||||
|
return firstStr.localeCompare(secondStr);
|
||||||
|
});
|
||||||
|
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
processCloudDemoPage.editProcessFilterCloudComponent().setOrderFilterDropDown('DESC');
|
||||||
|
processCloudDemoPage.getAllRowsByIdColumn().then(function (list) {
|
||||||
|
let initialList = list.slice(0);
|
||||||
|
list.sort(function (firstStr, secondStr) {
|
||||||
|
return firstStr.localeCompare(secondStr);
|
||||||
|
});
|
||||||
|
list.reverse();
|
||||||
|
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -8,7 +8,7 @@
|
|||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<form [formGroup]="editProcessFilterForm">
|
<form [formGroup]="editProcessFilterForm">
|
||||||
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-between center" fxLayoutGap="10px">
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-between center" fxLayoutGap="10px">
|
||||||
<mat-form-field [floatLabel]="'auto'" fxFlex>
|
<mat-form-field [floatLabel]="'auto'" fxFlex data-automation-id="status">
|
||||||
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STATUS' | translate}}" formControlName="state" id="adf-process-filter-state-id">
|
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STATUS' | translate}}" formControlName="state" id="adf-process-filter-state-id">
|
||||||
<mat-option *ngFor="let state of status" [value]="state.value">
|
<mat-option *ngFor="let state of status" [value]="state.value">
|
||||||
{{ state.label }}
|
{{ state.label }}
|
||||||
@@ -29,14 +29,14 @@
|
|||||||
id="adf-process-filter-process-definition-id"
|
id="adf-process-filter-process-definition-id"
|
||||||
placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_ID' | translate}}"/>
|
placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_ID' | translate}}"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field [floatLabel]="'auto'" fxFlex>
|
<mat-form-field [floatLabel]="'auto'" fxFlex data-automation-id="sort">
|
||||||
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COLUMN' | translate}}" formControlName="sort" id="adf-process-filter-sort-id">
|
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COLUMN' | translate}}" formControlName="sort" id="adf-process-filter-sort-id">
|
||||||
<mat-option *ngFor="let column of columns" [value]="column.key">
|
<mat-option *ngFor="let column of columns" [value]="column.key">
|
||||||
{{ column.label }}
|
{{ column.label }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field [floatLabel]="'auto'" fxFlex>
|
<mat-form-field [floatLabel]="'auto'" fxFlex data-automation-id="order">
|
||||||
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.DIRECTION' | translate}}" formControlName="order" id="adf-process-filter-order-id">
|
<mat-select placeholder="{{'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.DIRECTION' | translate}}" formControlName="order" id="adf-process-filter-order-id">
|
||||||
<mat-option *ngFor="let direction of directions" [value]="direction">
|
<mat-option *ngFor="let direction of directions" [value]="direction">
|
||||||
{{ direction }}
|
{{ direction }}
|
||||||
|
Reference in New Issue
Block a user