[ADF-3807]Create automated tests for process filters (#4072)

* Added tests related to process filters

* Adding back a check in task filters tests.

* no message

* Creating a completed process

* Added tests for default process filters

* Wait for the page to be loaded
This commit is contained in:
cristinaj 2018-12-12 18:46:09 +02:00 committed by Eugenio Romano
parent e241779f3a
commit 137584839b
11 changed files with 449 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<mat-accordion> <mat-accordion>
<mat-expansion-panel [expanded]="true" (opened)="panelOpenStateTask = true" (closed)="panelOpenStateTask = false"> <mat-expansion-panel [expanded]="true" (opened)="panelOpenStateTask = true" (closed)="panelOpenStateTask = false" data-automation-id='Task Filters'>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
Task Filters Task Filters
@ -14,7 +14,7 @@
</adf-cloud-task-filters> </adf-cloud-task-filters>
</mat-expansion-panel> </mat-expansion-panel>
<mat-expansion-panel (opened)="panelOpenStateProcess = true" (closed)="panelOpenStateProcess = false"> <mat-expansion-panel (opened)="panelOpenStateProcess = true" (closed)="panelOpenStateProcess = false" data-automation-id='Process Filters'>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
Process Filters Process Filters

View File

@ -0,0 +1,40 @@
/*!
* @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 { ApiService } from './apiservice';
export class ProcessDefinitions {
api: ApiService = new ApiService();
constructor() {
}
async init(username, password) {
await this.api.login(username, password);
}
async getProcessDefinitions(appName) {
const path = '/' + appName + '-rb/v1/process-definitions';
const method = 'GET';
const queryParams = {};
const data = await this.api.performBpmOperation(path, method, queryParams, {});
return data;
}
}

View File

@ -0,0 +1,73 @@
/*!
* @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 { ApiService } from './apiservice';
export class ProcessInstances {
api: ApiService = new ApiService();
constructor() {
}
async init(username, password) {
await this.api.login(username, password);
}
async createProcessInstance(processDefKey, appName) {
const path = '/' + appName + '-rb/v1/process-instances';
const method = 'POST';
const queryParams = {}, postBody = {
'processDefinitionKey': processDefKey,
'payloadType': 'StartProcessPayload'
};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async suspendProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/suspend';
const method = 'POST';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async deleteProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId;
const method = 'DELETE';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async completeProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/complete';
const method = 'POST';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
}

View File

@ -0,0 +1,41 @@
/*!
* @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 { ApiService } from './apiservice';
export class Query {
api: ApiService = new ApiService();
constructor() {
}
async init(username, password) {
await this.api.login(username, password);
}
async getProcessInstanceTasks(processInstanceId, appName) {
const path = '/' + appName + '-query/v1/process-instances/' + processInstanceId + '/tasks';
const method = 'GET';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
}

View File

@ -44,7 +44,6 @@ export class DataTablePage {
constructor(rootElement: ElementFinder = element(by.css('adf-datatable'))) { constructor(rootElement: ElementFinder = element(by.css('adf-datatable'))) {
this.rootElement = rootElement; this.rootElement = rootElement;
this.list = this.rootElement.all(by.css(`div[class*=adf-datatable-body] div[class*=adf-datatable-row]`)); this.list = this.rootElement.all(by.css(`div[class*=adf-datatable-body] div[class*=adf-datatable-row]`));
} }
getAllDisplayedRows() { getAllDisplayedRows() {

View File

@ -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 { ProcessFiltersCloudComponent } from '../process_cloud/processFiltersCloudComponent';
import { ProcessListCloudComponent } from '../process_cloud/processListCloudComponent';
import { element, by } from 'protractor';
export class ProcessCloudDemoPage {
allProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.ALL_PROCESSES_filter"]'));
runningProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.RUNNING_PROCESSES_filter"]'));
completedProcesses = element(by.css('span[data-automation-id="ADF_CLOUD_PROCESS_FILTERS.COMPLETED_PROCESSES_filter"]'));
activeFilter = element(by.css("mat-list-item[class*='active'] span"));
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
processListCloud = new ProcessListCloudComponent();
processFiltersCloudComponent(filter) {
return new ProcessFiltersCloudComponent(filter);
}
processListCloudComponent() {
return this.processListCloud;
}
allProcessesFilter() {
return new ProcessFiltersCloudComponent(this.allProcesses);
}
runningProcessesFilter() {
return new ProcessFiltersCloudComponent(this.runningProcesses);
}
completedProcessesFilter() {
return new ProcessFiltersCloudComponent(this.completedProcesses);
}
customProcessFilter(filterName) {
return new ProcessFiltersCloudComponent(element(by.css(`span[data-automation-id="${filterName}_filter"]`)));
}
checkActiveFilterActive() {
Util.waitUntilElementIsVisible(this.activeFilter);
return this.activeFilter.getText();
}
clickOnProcessFilters() {
Util.waitUntilElementIsVisible(this.processFilters);
return this.processFilters.click();
}
}

View File

@ -0,0 +1,58 @@
/*!
* @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 } from 'protractor';
export class ProcessFiltersCloudComponent {
filter;
filterIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
this.filter = filter;
}
checkProcessFilterIsDisplayed() {
Util.waitUntilElementIsVisible(this.filter);
return this;
}
getProcessFilterIcon() {
Util.waitUntilElementIsVisible(this.filter);
let icon = this.filter.element(this.filterIcon);
Util.waitUntilElementIsVisible(icon);
return icon.getText();
}
checkProcessFilterHasNoIcon() {
Util.waitUntilElementIsVisible(this.filter);
Util.waitUntilElementIsNotOnPage(this.filter.element(this.filterIcon));
}
clickProcessFilter() {
Util.waitUntilElementIsVisible(this.filter);
Util.waitUntilElementIsClickable(this.filter);
return this.filter.click();
}
checkProcessFilterNotDisplayed() {
Util.waitUntilElementIsNotVisible(this.filter);
return this.filter;
}
}

View File

@ -0,0 +1,43 @@
/*!
* @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 { DataTablePage } from '../dataTablePage';
import { element, by } from 'protractor';
export class ProcessListCloudComponent {
processList = element(by.css('adf-cloud-process-list'));
noProcessFound = element.all(by.css("p[class='adf-empty-content__title']")).first();
dataTable = new DataTablePage(this.processList);
getDataTable() {
return this.dataTable;
}
checkProcessListIsLoaded() {
Util.waitUntilElementIsVisible(this.processList);
return this;
}
getNoProcessFoundMessage() {
Util.waitUntilElementIsVisible(this.noProcessFound);
return this.noProcessFound.getText();
}
}

View File

@ -21,7 +21,7 @@ import { element, by } from 'protractor';
export class TaskListCloudComponent { export class TaskListCloudComponent {
taskList = element(by.css('adf-tasklist')); taskList = element(by.css('adf-cloud-task-list'));
noTasksFound = element.all(by.css("p[class='adf-empty-content__title']")).first(); noTasksFound = element.all(by.css("p[class='adf-empty-content__title']")).first();
dataTable = new DataTablePage(this.taskList); dataTable = new DataTablePage(this.taskList);

View File

@ -0,0 +1,122 @@
/*!
* @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 filters cloud', () => {
describe('Process Filters', () => {
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('[C290021] Should be able to view default filters', () => {
processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed();
processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed();
processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed();
});
it('[C290043] Should display process in Running Processes List when process is started', () => {
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Running Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(runningProcess.entry.id);
processCloudDemoPage.completedProcessesFilter().clickProcessFilter();
processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Completed Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsNotDisplayed(runningProcess.entry.id);
processCloudDemoPage.allProcessesFilter().clickProcessFilter();
processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('All Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(runningProcess.entry.id);
});
it('[C290044] Should display process in Completed Processes List when process is completed', () => {
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Running Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsNotDisplayed(completedProcess.entry.id);
processCloudDemoPage.completedProcessesFilter().clickProcessFilter();
processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('Completed Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(completedProcess.entry.id);
processCloudDemoPage.allProcessesFilter().clickProcessFilter();
processCloudDemoPage.allProcessesFilter().checkProcessFilterIsDisplayed();
expect(processCloudDemoPage.checkActiveFilterActive()).toBe('All Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkContentIsDisplayed(completedProcess.entry.id);
});
});
});

View File

@ -27,7 +27,7 @@ import { Tasks } from '../actions/APS-cloud/tasks';
describe('Task filters cloud', () => { describe('Task filters cloud', () => {
describe('Filters', () => { describe('Task Filters', () => {
const settingsPage = new SettingsPage(); const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage(); const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
@ -56,6 +56,7 @@ describe('Task filters cloud', () => {
it('[C290011] Should display default filters when an app is deployed', () => { it('[C290011] Should display default filters when an app is deployed', () => {
tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed(); tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
tasksCloudDemoPage.completedTasksFilter().checkTaskFilterIsDisplayed();
}); });
xit('[C290009] Should display default filters and created task', () => { xit('[C290009] Should display default filters and created task', () => {