Files
alfresco-ng2-components/e2e/process-services/sort-tasklist-pagination.e2e.ts
Cristina Jalba 6462bbf35a [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
2020-04-21 10:15:39 +01:00

91 lines
3.6 KiB
TypeScript

/*!
* @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 { LoginPage, PaginationPage, ApplicationsUtil } from '@alfresco/adf-testing';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { browser } from 'protractor';
import { UsersActions } from '../actions/users.actions';
import { NavigationBarPage } from '../pages/adf/navigation-bar.page';
import { TasksPage } from '../pages/adf/process-services/tasks.page';
import { Util } from '../util/util';
import CONSTANTS = require('../util/constants');
describe('Task List Pagination - Sorting', () => {
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const paginationPage = new PaginationPage();
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const nrOfTasks = 20;
let processUserModel;
const taskNameBase = 'Task';
const taskNames = Util.generateSequenceFiles(10, nrOfTasks + 9, taskNameBase, '');
const itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
twenty: '20',
twentyValue: 20
};
beforeAll(async () => {
const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host
});
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
processUserModel = await users.createTenantAndUser(this.alfrescoJsApi);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
const applicationsService = new ApplicationsUtil(this.alfrescoJsApi);
await applicationsService.importPublishDeployApp(app.file_path);
for (let i = 0; i < nrOfTasks; i++) {
await this.alfrescoJsApi.activiti.taskApi.createNewTask({ name: taskNames[i] });
}
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
});
it('[C260308] Should be possible to sort tasks by name', async () => {
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await paginationPage.selectItemsPerPage(itemsPerPage.twenty);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().sortByName('ASC');
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().getAllRowsNameColumn().then(async (list) => {
await expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
await taskPage.filtersPage().sortByName('DESC');
await taskPage.filtersPage().getAllRowsNameColumn().then(async (list) => {
taskNames.reverse();
await expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
});
});