alfresco-ng2-components/e2e/process-services/sort-tasklist-pagination.e2e.ts
Eugenio Romano 990fa4625b
fix ordering e2e failing test (#4825)
* ordering fix use common method in datatable

* ordering fix use common method in datatable

* fix sorting ps e2e

* fix ordering

* move search page in testing and fix sorting boolean flag

* fix import

* fix moment

* use common sort method in document list test

* use common sort method in document list test

* remove unnecesary sort control

* remove duplicate test

* remove e2e suspended removed status

* documentation
2019-06-11 07:34:16 +01:00

99 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 } from '@alfresco/adf-testing';
import { TasksPage } from '../pages/adf/process-services/tasksPage';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { PaginationPage } from '@alfresco/adf-testing';
import CONSTANTS = require('../util/constants');
import { browser } from 'protractor';
import resources = require('../util/resources');
import { Util } from '../util/util';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { AppsActions } from '../actions/APS/apps.actions';
import { UsersActions } from '../actions/users.actions';
describe('Task List Pagination - Sorting', () => {
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const paginationPage = new PaginationPage();
const app = 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 (done) => {
const apps = new AppsActions();
const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf.url
});
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);
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
for (let i = 0; i < nrOfTasks; i++) {
this.alfrescoJsApi.activiti.taskApi.createNewTask({name: taskNames[i]});
}
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
it('[C260308] Should be possible to sort tasks by name', () => {
new NavigationBarPage().navigateToProcessServicesPage().goToTaskApp();
taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
taskPage.tasksListPage().getDataTable().waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
taskPage.tasksListPage().getDataTable().waitForTableBody();
taskPage.filtersPage().sortByName('ASC');
taskPage.tasksListPage().getDataTable().waitForTableBody();
taskPage.filtersPage().getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
taskPage.filtersPage().sortByName('DESC');
taskPage.filtersPage().getAllRowsNameColumn().then(function (list) {
taskNames.reverse();
expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
});
});