[ADF-3569] Add tests for task list demo page: (#3810)

* [ADF-3438] Add tests for task list demo page:

* Fixing some tests

* Added new tests

* Add more tests

* Fix the name of the test for bamboo

* Fix test name to work on bamboo

* no message

* Added new tests

* Modified the error message.

* no message

* fix lint issues

* Fix lint issues

* Changing taskListSinglePage from js to ts

* Uncomment a test

* Fixing lint issues

* Solve lint error

* Refactored taskListDemoPage

* Commented two tests that are failing because of a bug in APS

* Fix lint error

* Resolved comments
This commit is contained in:
cristinaj
2018-11-19 14:20:42 +02:00
committed by Eugenio Romano
parent 002998b10e
commit 2e8d998853
16 changed files with 1031 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
<input
matInput
class="form-control"
[formControl]="taskAppId">
[formControl]="taskAppId" data-automation-id="appId input">
<mat-error *ngIf="taskAppId.hasError('pattern')">
{{ 'TASK_LIST_DEMO.ERROR_MESSAGE.APP_ID_TYPE_ERROR' | translate }}
</mat-error>
@@ -17,7 +17,7 @@
<input
matInput
class="form-control"
[formControl]="taskName">
[formControl]="taskName" data-automation-id="task name">
</mat-form-field>
<mat-form-field>
@@ -25,14 +25,14 @@
<input
matInput
class="form-control"
[formControl]="taskId">
[formControl]="taskId" data-automation-id="task id">
</mat-form-field>
<mat-form-field>
<mat-label>Start</mat-label>
<input
matInput
class="form-control"
class="form-control" data-automation-id="start"
matTooltip="{{ 'TASK_LIST_DEMO.TOOLTIP_MESSAGE.START_INPUT' | translate }}"
[formControl]="taskStart">
<mat-error *ngIf="taskStart.hasError('pattern')">
@@ -45,7 +45,7 @@
<input
matInput
class="form-control"
[formControl]="taskProcessDefinitionId">
[formControl]="taskProcessDefinitionId" data-automation-id="process definition id">
<mat-hint>E.g. SimpleProcess:1:2</mat-hint>
</mat-form-field>
@@ -54,16 +54,16 @@
<input
matInput
class="form-control"
[formControl]="taskProcessInstanceId">
[formControl]="taskProcessInstanceId" data-automation-id="process instance id">
<mat-hint>E.g. 12345</mat-hint>
</mat-form-field>
<mat-form-field>
<mat-form-field data-automation-id="items per page">
<mat-label>Items per page</mat-label>
<input
matInput
class="form-control"
[formControl]="taskSize">
[formControl]="taskSize" data-automation-id="items per page">
<mat-error *ngIf="taskSize.hasError('min')">
{{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_GREATER_THAN' | translate: { value: minValue } }}
</mat-error>
@@ -72,12 +72,12 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field data-automation-id="page">
<mat-label>Page</mat-label>
<input
matInput
class="form-control"
[formControl]="taskPage">
[formControl]="taskPage" data-automation-id="page">
<mat-error *ngIf="taskPage.hasError('min')">
{{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_GREATER_THAN' | translate: { value: minValue } }}
</mat-error>
@@ -89,14 +89,14 @@
<mat-form-field>
<mat-label>Due After</mat-label>
<input matInput class="form-control" [matDatepicker]="pickerAfter" placeholder="Choose a date"
[formControl]="taskDueAfter">
[formControl]="taskDueAfter" data-automation-id="due after">
<mat-datepicker-toggle matSuffix [for]="pickerAfter"></mat-datepicker-toggle>
<mat-datepicker #pickerAfter></mat-datepicker>
</mat-form-field>
<mat-form-field>
<mat-label>Due Before</mat-label>
<input matInput class="form-control" [matDatepicker]="pickerBefore" placeholder="Choose a date"
[formControl]="taskDueBefore">
[formControl]="taskDueBefore" data-automation-id="due before">
<mat-datepicker-toggle matSuffix [for]="pickerBefore"></mat-datepicker-toggle>
<mat-datepicker #pickerBefore></mat-datepicker>
</mat-form-field>
@@ -123,22 +123,22 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-form-field data-automation-id="state">
<mat-label>State</mat-label>
<mat-select
class="form-control"
[formControl]="taskState">
[formControl]="taskState" data-automation-id="selected state">
<mat-option *ngFor="let stateOption of stateOptions" [value]="stateOption.value">{{
stateOption.title }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-form-field data-automation-id="sort">
<mat-label>Sort</mat-label>
<mat-select
class="form-control"
[formControl]="taskSort">
[formControl]="taskSort" data-automation-id="selected sort">
<mat-option *ngFor="let sortOption of sortOptions" [value]="sortOption.value">{{ sortOption.title
}}
</mat-option>

View File

@@ -24,12 +24,7 @@ import remote = require('selenium-webdriver/remote');
export class AppsActions {
async importPublishDeployApp(alfrescoJsApi, appFileLocation) {
browser.setFileDetector(new remote.FileDetector());
let pathFile = path.join(TestConfig.main.rootPath + appFileLocation);
let file = fs.createReadStream(pathFile);
let appCreated = await alfrescoJsApi.activiti.appsApi.importAppDefinition(file);
let appCreated = await this.importApp(alfrescoJsApi, appFileLocation);
let publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish());
@@ -38,6 +33,15 @@ export class AppsActions {
return appCreated;
}
async importApp(alfrescoJsApi, appFileLocation) {
browser.setFileDetector(new remote.FileDetector());
let pathFile = path.join(TestConfig.main.rootPath + appFileLocation);
let file = fs.createReadStream(pathFile);
return await alfrescoJsApi.activiti.appsApi.importAppDefinition(file);
}
async publishDeployApp(alfrescoJsApi, appId) {
browser.setFileDetector(new remote.FileDetector());

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 AppPublish = require('../../models/APS/AppPublish');
export class AppsRuntimeActions {
async getRuntimeAppByName(alfrescoJsApi, appName) {
let runtimeApps = await this.getRuntimeAppDefinitions(alfrescoJsApi);
let desiredApp;
for (let i = 0; i < runtimeApps.data.length; i++) {
if (runtimeApps.data[i].name === appName) {
desiredApp = runtimeApps.data[i];
}
}
return desiredApp;
}
async getRuntimeAppDefinitions(alfrescoJsApi) {
return await alfrescoJsApi.activiti.appsRuntimeApi.getAppDefinitions();
}
}

View File

@@ -43,6 +43,25 @@ export class UsersActions {
return user;
}
async getApsUserByEmail(alfrescoJsApi, email) {
let users = await alfrescoJsApi.activiti.adminUsersApi.getUsers();
let user = users.data.filter((currentUser) => {
return currentUser.email === email;
});
return user;
}
async createApsUserWithName(alfrescoJsApi, tenantId, email, firstName, lastName) {
let user = new User({ tenantId: tenantId , email: email, firstName: firstName, lastName: lastName});
await alfrescoJsApi.activiti.adminUsersApi.createNewUser(user);
return user;
}
async cleanupTenant(alfrescoJsApi, tenantId) {
return alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
}

View File

@@ -364,7 +364,7 @@ describe('Document List Component', () => {
done();
});
it('[C268119] "ygj" letters should be rendered properly', async (done) => {
it('[C268119] - ygj letters rendering in document list', async (done) => {
acsUser = new AcsUserModel();
/* cspell:disable-next-line */
let folderName = 'ggggggjjjjjjjjjjjjyyyyyy';
@@ -399,7 +399,7 @@ describe('Document List Component', () => {
done();
});
it('[C269086] Should display "Islocked" field for files', async (done) => {
it('[C269086] Should display Islocked field for files', async (done) => {
let testFileA = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location

View File

@@ -172,7 +172,7 @@ describe('Aspect oriented config', () => {
metadataViewPage.checkMetadataGroupIsPresent('Content');
});
it('[C260182] Should show all the aspects if the default configuration contains the asterisk symbol' , () => {
it('[C260182] Should show all the aspects if the default configuration contains the star symbol' , () => {
configEditorPage.enterConfiguration('{' +
' "presets": {' +

View File

@@ -291,7 +291,7 @@ describe('Content Services Viewer', () => {
viewerPage.clickCloseButton();
});
it('[C260054] Should display "Preview couldn\'t be loaded" and viewer toolbar when opening an unsupported file', () => {
it('[C260054] Should display Preview could not be loaded and viewer toolbar when opening an unsupported file', () => {
viewerPage.viewFile(unsupportedFile.name);
browser.driver.sleep(3000); // wait open file

View File

@@ -38,13 +38,40 @@ var DataTablePage = function (rootElement = element(by.css("adf-datatable"))) {
var pageLoaded = element(by.css("div[data-automation-id='auto_id_id']"));
var tableBody = element.all(by.css("div[class='adf-datatable-body']")).first();
var spinner = element(by.css('mat-progress-spinner'));
var rows = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']");
var nameColumn = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='Name'] span");
this.goToDatatable = function () {
browser.driver.get(dataTableURL);
Util.waitUntilElementIsVisible(pageLoaded);
};
this.getAllDisplayedRows = function () {
return element.all(rows).count();
};
this.getAllRowsNameColumn = function () {
return this.getAllRowsColumnValues(nameColumn);
};
this.getAllRowsColumnValues = function (locator) {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(element.all(locator).first());
var initialList = [];
element.all(locator).each(function (element) {
element.getText().then(function (text) {
if (text !== '') {
initialList.push(text);
}
});
}).then(function () {
deferred.fulfill(initialList);
});
return deferred.promise;
};
/**
* Retrieve row by row number
*
@@ -298,5 +325,18 @@ var DataTablePage = function (rootElement = element(by.css("adf-datatable"))) {
Util.waitUntilElementIsPresent(spinner);
};
this.checkRowIsDisplayedByName = function (name) {
Util.waitUntilElementIsVisible(element(by.css("div[filename='"+name+"']")));
};
this.checkRowIsNotDisplayedByName = function (taskName) {
Util.waitUntilElementIsNotOnPage(element(by.css("div[filename='"+taskName+"']")));
};
this.getNumberOfRowsDisplayedWithSameName = function (taskName) {
Util.waitUntilElementIsVisible(element(by.css("div[filename='"+taskName+"']")));
return element.all(by.css("div[title='Name'][filename='"+taskName+"']")).count();
};
};
module.exports = DataTablePage;

View File

@@ -0,0 +1,231 @@
/*!
* @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 = require('../../../util/util');
import DataTable = require('../dataTablePage');
import TaskListPage = require('../process_services/tasksListPage');
import PaginationPage = require('../paginationPage');
import { element, by } from 'protractor';
export class TaskListDemoPage {
appId = element(by.css("input[data-automation-id='appId input']"));
itemsPerPage = element(by.css("input[data-automation-id='items per page']"));
itemsPerPageForm = element(by.css("mat-form-field[data-automation-id='items per page']"));
processDefinitionId = element(by.css("input[data-automation-id='process definition id']"));
processInstanceId = element(by.css("input[data-automation-id='process instance id']"));
page = element(by.css("input[data-automation-id='page']"));
pageForm = element(by.css("mat-form-field[data-automation-id='page']"));
taskName = element(by.css("input[data-automation-id='task name']"));
resetButton = element(by.css("div[class='adf-reset-button'] button"));
dueBefore = element(by.css("input[data-automation-id='due before']"));
dueAfter = element(by.css("input[data-automation-id='due after']"));
taskId = element(by.css("input[data-automation-id='task id']"));
stateDropDownArrow = element(by.css("mat-form-field[data-automation-id='state'] div[class*='arrow']"));
stateSelector = element(by.css("div[class*='mat-select-content']"));
sortDropDownArrow = element(by.css("mat-form-field[data-automation-id='sort'] div[class*='arrow']"));
sortSelector = element(by.css("div[class*='mat-select-content']"));
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*='adf-datatable-row'] div[title='Process Instance Id'] span");
taskList() {
return new TaskListPage();
}
paginationPage() {
return new PaginationPage();
}
typeAppId(input) {
Util.waitUntilElementIsVisible(this.appId);
this.clearText(this.appId);
this.appId.sendKeys(input);
return this;
}
clickAppId() {
Util.waitUntilElementIsVisible(this.appId);
this.appId.click();
return this;
}
getAppId() {
Util.waitUntilElementIsVisible(this.appId);
return this.appId.getAttribute('value');
}
typeTaskId(input) {
Util.waitUntilElementIsVisible(this.taskId);
this.clearText(this.taskId);
this.taskId.sendKeys(input);
return this;
}
getTaskId() {
Util.waitUntilElementIsVisible(this.taskId);
return this.taskId.getAttribute('value');
}
typeTaskName(input) {
Util.waitUntilElementIsVisible(this.taskName);
this.clearText(this.taskName);
this.taskName.sendKeys(input);
return this;
}
getTaskName() {
Util.waitUntilElementIsVisible(this.taskName);
return this.taskName.getAttribute('value');
}
typeItemsPerPage(input) {
Util.waitUntilElementIsVisible(this.itemsPerPage);
this.clearText(this.itemsPerPage);
this.itemsPerPage.sendKeys(input);
return this;
}
getItemsPerPage() {
Util.waitUntilElementIsVisible(this.itemsPerPage);
return this.itemsPerPage.getAttribute('value');
}
typeProcessDefinitionId(input) {
Util.waitUntilElementIsVisible(this.processDefinitionId);
this.clearText(this.processDefinitionId);
this.processDefinitionId.sendKeys(input);
return this;
}
getProcessDefinitionId() {
Util.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
}
typeProcessInstanceId(input) {
Util.waitUntilElementIsVisible(this.processInstanceId);
this.clearText(this.processInstanceId);
this.processInstanceId.sendKeys(input);
return this;
}
getProcessInstanceId() {
Util.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
}
getItemsPerPageFieldErrorMessage() {
Util.waitUntilElementIsVisible(this.itemsPerPageForm);
let errorMessage = this.itemsPerPageForm.element(by.css('mat-error'));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
typePage(input) {
Util.waitUntilElementIsVisible(this.page);
this.clearText(this.page);
this.page.sendKeys(input);
return this;
}
getPage() {
Util.waitUntilElementIsVisible(this.page);
return this.page.getAttribute('value');
}
getPageFieldErrorMessage() {
Util.waitUntilElementIsVisible(this.pageForm);
let errorMessage = this.pageForm.element(by.css('mat-error'));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
typeDueAfter(input) {
Util.waitUntilElementIsVisible(this.dueAfter);
this.clearText(this.dueAfter);
this.dueAfter.sendKeys(input);
return this;
}
getDueAfter() {
Util.waitUntilElementIsVisible(this.dueAfter);
return this.dueAfter.getAttribute('value');
}
typeDueBefore(input) {
Util.waitUntilElementIsVisible(this.dueBefore);
this.clearText(this.dueBefore);
this.dueBefore.sendKeys(input);
return this;
}
getDueBefore() {
Util.waitUntilElementIsVisible(this.dueBefore);
return this.dueBefore.getAttribute('value');
}
clearText(input) {
Util.waitUntilElementIsVisible(input);
return input.clear();
}
clickResetButton() {
Util.waitUntilElementIsVisible(this.resetButton);
this.resetButton.click();
}
selectSort(sort) {
this.clickOnSortDropDownArrow();
let sortElement = element.all(by.cssContainingText('mat-option span', sort)).first();
Util.waitUntilElementIsClickable(sortElement);
Util.waitUntilElementIsVisible(sortElement);
sortElement.click();
return this;
}
clickOnSortDropDownArrow() {
Util.waitUntilElementIsVisible(this.sortDropDownArrow);
this.sortDropDownArrow.click();
Util.waitUntilElementIsVisible(this.sortSelector);
}
selectState(state) {
this.clickOnStateDropDownArrow();
let stateElement = element.all(by.cssContainingText('mat-option span', state)).first();
Util.waitUntilElementIsClickable(stateElement);
Util.waitUntilElementIsVisible(stateElement);
stateElement.click();
return this;
}
clickOnStateDropDownArrow() {
Util.waitUntilElementIsVisible(this.stateDropDownArrow);
this.stateDropDownArrow.click();
Util.waitUntilElementIsVisible(this.stateSelector);
}
getAllProcessDefinitionIds() {
return this.taskList().getDataTable().getAllRowsColumnValues(this.processDefinitionIdColumn);
}
getAllProcessInstanceIds() {
return this.taskList().getDataTable().getAllRowsColumnValues(this.processInstanceIdColumn);
}
}

View File

@@ -38,6 +38,7 @@ var ContentList = function () {
var rows = by.css("div[id='document-list-container'] div[class*='adf-datatable-body'] div[class*='adf-datatable-row']");
var emptyFolderMessage = element(by.css("div[class='adf-empty-folder-this-space-is-empty']"));
var table = element(by.css("div[class*='upload-border']"));
var tableBody = element.all(by.css("adf-document-list div[class='adf-datatable-body']")).first();
this.getRowsName = function (content) {
var row = element.all(by.xpath("//div[@id='document-list-container']//div[@filename='" + content + "']")).first();
@@ -382,5 +383,9 @@ var ContentList = function () {
return this;
};
this.waitForTableBody = function () {
Util.waitUntilElementIsVisible(tableBody);
};
};
module.exports = ContentList;

View File

@@ -23,6 +23,7 @@ import { ProcessServicesPage } from './process_services/processServicesPage';
export class NavigationBarPage {
contentServicesButton = element(by.css('a[data-automation-id="Content Services"]'));
taskListButton = element(by.css("a[data-automation-id='Task List']"));
configEditorButton = element(by.css('a[data-automation-id="Configuration Editor"]'));
processServicesButton = element(by.css('a[data-automation-id="Process Services"]'));
loginButton = element(by.css('a[data-automation-id="Login"]'));
@@ -43,6 +44,11 @@ export class NavigationBarPage {
this.contentServicesButton.click();
}
clickTaskListButton() {
Util.waitUntilElementIsVisible(this.taskListButton);
this.taskListButton.click();
}
clickConfigEditorButton() {
Util.waitUntilElementIsVisible(this.configEditorButton);
this.configEditorButton.click();
@@ -156,4 +162,8 @@ export class NavigationBarPage {
goToSite(site) {
browser.get(TestConfig.adf.url + `/files/${site.entry.guid}/display/list`);
}
checkContentServicesButtonIsDisplayed() {
Util.waitUntilElementIsVisible(contentServicesButton);
}
}

View File

@@ -21,6 +21,7 @@ var PaginationPage = function () {
var itemsPerPageDropdown = element(by.css("div[class*='adf-pagination__perpage-block'] button"));
var pageSelectorDropDown = element(by.css("div[class*='adf-pagination__page-selector']"));
var pageSelectorArrow = element(by.css("button[aria-label='Current page selector']"));
var itemsPerPage = element(by.css("span[class='adf-pagination__max-items']"));
var currentPage = element(by.css("span[class='adf-pagination__current-page']"));
var totalPages = element(by.css("span[class='adf-pagination__total-pages']"));
@@ -32,7 +33,7 @@ var PaginationPage = function () {
var pageDropDown = element(by.css("div[class*='adf-pagination__actualinfo-block'] button"));
var pageDropDownOptions = by.css("div[class*='mat-menu-content'] button");
var paginationSection = element(by.css("adf-pagination"));
var paginationSectionEmpty = element(by.css("adf-pagination[class*='adf-pagination__empty ng-star-inserted']"));
var paginationSectionEmpty = element(by.css("adf-pagination[class*='adf-pagination__empty']"));
var totalFiles = element(by.css('span[class="adf-pagination__range"]'));
this.selectItemsPerPage = function (item) {
@@ -53,6 +54,14 @@ var PaginationPage = function () {
return this;
};
this.checkPageSelectorIsNotDisplayed = function() {
Util.waitUntilElementIsNotOnPage(pageSelectorArrow);
};
this.checkPageSelectorIsDisplayed = function() {
Util.waitUntilElementIsVisible(pageSelectorArrow);
};
this.checkPaginationIsNotDisplayed = function () {
Util.waitUntilElementIsOnPage(paginationSectionEmpty);
return this;
@@ -82,6 +91,11 @@ var PaginationPage = function () {
this.clickOnNextPage = function () {
Util.waitUntilElementIsVisible(nextPageButton);
Util.waitUntilElementIsClickable(nextPageButton);
browser.actions().mouseMove(nextPageButton).perform();
Util.waitUntilElementIsVisible(nextPageButton);
Util.waitUntilElementIsClickable(nextPageButton).then(()=> {
browser.driver.sleep(2000);
});
return nextPageButton.click();
};

View File

@@ -29,7 +29,7 @@ var TasksListPage = function () {
return dataTable;
};
this.checkTaskListIsLoaded = function () {
this.checkTaskListIsLoaded = function() {
Util.waitUntilElementIsVisible(taskList);
return this;
};

View File

@@ -0,0 +1,627 @@
/*!
* @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 { by } from 'protractor';
import { LoginPage } from '../pages/adf/loginPage';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TaskListDemoPage } from '../pages/adf/demo-shell/taskListDemoPage';
import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage');
import PaginationPage = require('../pages/adf/paginationPage');
import TasksPage = require('../pages/adf/process_services/tasksPage');
import AppPublish = require('../models/APS/AppPublish');
import CONSTANTS = require('../util/constants');
import moment = require('moment');
import Task = require('../models/APS/Task');
import ProcessModel = require('../models/APS/UpdateProcessModel');
import Tenant = require('../models/APS/Tenant');
import TaskModel = require('../models/APS/TaskModel');
import FileModel = require('../models/ACS/fileModel');
import FormModel = require('../models/APS/FormModel');
import TestConfig = require('../test.config');
import resources = require('../util/resources');
import Util = require('../util/util');
import dateFormat = require('dateformat');
import AlfrescoApi = require('alfresco-js-api-node');
import { AppsActions } from '../actions/APS/apps.actions';
import { AppsRuntimeActions } from '../actions/APS/appsRuntime.actions';
import { UsersActions } from '../actions/users.actions';
import path = require('path');
import fs = require('fs');
describe('Start Task - Custom App', () => {
let loginPage = new LoginPage();
let navigationBarPage = new NavigationBarPage();
let taskListSinglePage = new TaskListDemoPage();
let paginationPage = new PaginationPage();
let processUserModel;
let app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
let appRuntime, secondAppRuntime;
let secondApp = resources.Files.WIDGETS_SMOKE_TEST;
let appModel, secondAppModel;
let completedTasks = [];
let paginationTasksName = ['t01', 't02', 't03', 't04', 't05', 't06', 't07', 't08', 't09', 't10', 't11', 't12', 't13', 'taskOne', 'taskTwo', 'taskOne'];
let completedTasksName = ['completed01', 'completed02', 'completed03'];
let allTasksName = ['t01', 'taskOne', 'taskTwo', 'taskOne', 't13', 't12', 't11', 't10', 't09', 't08', 't07', 't06', 't05', 't04', 't03', 't02',
'User Task', 'User Task', 'User Task', 'User Task'];
let invalidAppId = '1234567890', invalidName = 'invalidName', invalidTaskId = '0000';
let noTasksFoundMessage = 'No Tasks Found';
let nrOfTasks = 20, currentPage = 1, totalNrOfPages = 'of 4';
let currentDateStandardFormat = Util.getCrtDateInFormat('YYYY-MM-DDTHH:mm:ss.SSSZ');
let currentDate = Util.getCrtDateInFormat('MM/DD/YYYY');
let beforeDate = moment().add(-1, 'days').format('MM/DD/YYYY');
let afterDate = moment().add(1, 'days').format('MM/DD/YYYY');
let taskWithDueDate;
let processDefinitionId;
let itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
fifteen: '15',
fifteenValue: 15,
twenty: '20',
twentyValue: 20,
default: '25'
};
beforeAll(async (done) => {
let apps = new AppsActions();
let appsRuntime = new AppsRuntimeActions();
let users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
let newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id);
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
appRuntime = await appsRuntime.getRuntimeAppByName(this.alfrescoJsApi, app.title);
secondAppModel = await apps.importPublishDeployApp(this.alfrescoJsApi, secondApp.file_location);
secondAppRuntime = await appsRuntime.getRuntimeAppByName(this.alfrescoJsApi, secondApp.title);
processDefinitionId = await apps.startProcess(this.alfrescoJsApi, appModel);
await apps.startProcess(this.alfrescoJsApi, appModel);
await apps.startProcess(this.alfrescoJsApi, secondAppModel);
await apps.startProcess(this.alfrescoJsApi, secondAppModel);
for (let i = 1; i < paginationTasksName.length; i++) {
await this.alfrescoJsApi.activiti.taskApi.createNewTask({'name': paginationTasksName[i]});
}
for (let i = 0; i < 3; i++) {
completedTasks[i] = await this.alfrescoJsApi.activiti.taskApi.createNewTask({'name': completedTasksName[i],
'dueDate': Util.getSpecificDateAfterCrtDateInFormat('YYYY-MM-DDTHH:mm:ss.SSSZ', i + 2)});
await this.alfrescoJsApi.activiti.taskActionsApi.completeTask(completedTasks[i].id);
}
taskWithDueDate = await this.alfrescoJsApi.activiti.taskApi.createNewTask({'name': paginationTasksName[0], 'dueDate': currentDateStandardFormat});
loginPage.loginToProcessServicesUsingUserModel(processUserModel);
done();
});
it('[C286362] Default pagination settings on task list', () => {
navigationBarPage.clickTaskListButton();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(nrOfTasks);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName)).toEqual(true);
});
expect(paginationPage.getCurrentPage()).toEqual('Page 1');
expect(paginationPage.getTotalPages()).toEqual('of 1');
paginationPage.checkPageSelectorIsNotDisplayed();
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C286367] 20 Items per page', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage(itemsPerPage.twentyValue);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(nrOfTasks);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName)).toEqual(true);
});
paginationPage.checkNextPageButtonIsDisabled();
paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C286365] 5 Items per page', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286364] 10 Items per page', function () {
currentPage = 1;
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage(itemsPerPage.tenValue);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.tenValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(0, 10))).toEqual(true);
});
paginationPage.clickOnNextPage();
currentPage++;
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
expect(paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.tenValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(10, 20))).toEqual(true);
});
});
it('[C286363] 15 Items per page', function () {
currentPage = 1;
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage(itemsPerPage.fifteenValue);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fifteenValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(0, 15))).toEqual(true);
});
currentPage++;
paginationPage.clickOnNextPage();
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
expect(paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286366] Pagination is not displayed when no task is displayed', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeAppId(secondAppRuntime.id);
expect(taskListSinglePage.getAppId()).toEqual(secondAppRuntime.id.toString());
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286406] Invalid values for items per page', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage('0').clickAppId();
expect(taskListSinglePage.getItemsPerPageFieldErrorMessage()).toEqual('Value must be greater than or equal to 1');
});
it('[C286404] Navigate using page field', function () {
currentPage = 1;
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeItemsPerPage(itemsPerPage.fiveValue);
taskListSinglePage.typePage(currentPage);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual(totalNrOfPages);
paginationPage.checkPageSelectorIsDisplayed();
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
});
currentPage++;
taskListSinglePage.typePage(currentPage);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual(totalNrOfPages);
paginationPage.checkPageSelectorIsDisplayed();
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
});
currentPage++;
taskListSinglePage.typePage(currentPage);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual(totalNrOfPages);
paginationPage.checkPageSelectorIsDisplayed();
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
});
currentPage++;
taskListSinglePage.typePage(currentPage);
taskListSinglePage.taskList().getDataTable().waitForTableBody();
expect(paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
expect(paginationPage.getTotalPages()).toEqual(totalNrOfPages);
paginationPage.checkPageSelectorIsDisplayed();
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(itemsPerPage.fiveValue);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286405] Type invalid values to page field', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typePage('0').clickAppId();
expect(taskListSinglePage.getPageFieldErrorMessage()).toEqual('Value must be greater than or equal to 1');
taskListSinglePage.clickResetButton();
taskListSinglePage.typePage('2');
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286413] Task is displayed when typing into dueAfter field a date before the tasks due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueAfter(beforeDate);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(paginationTasksName[0]);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(1);
});
it('[C286414] Task is not displayed when typing into dueAfter field a date after the task due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueAfter(afterDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286415] Task is not displayed when typing into dueAfter field the same date as tasks due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueAfter(currentDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286424] Task is not displayed when typing into dueBefore field a date before the tasks due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(beforeDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286425] Task is displayed when typing into dueBefore field a date after the task due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(afterDate);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(paginationTasksName[0]);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(1);
});
it('[C286426] Task is not displayed when typing into dueBefore field the same date as tasks due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(currentDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286428] Task is not displayed when typing into dueAfter field a date before the task due date and into dueBefore a date before task due date', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(beforeDate);
taskListSinglePage.typeDueAfter(beforeDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286427] Task is displayed when typing into dueAfter field a date before the tasks due date and into dueBefore a date after', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(afterDate);
taskListSinglePage.typeDueAfter(beforeDate);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(paginationTasksName[0]);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(1);
});
it('[C286429] Task is not displayed when typing into dueAfter field a date after the tasks due date and into dueBefore a date after', function () {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueBefore(afterDate);
taskListSinglePage.typeDueAfter(afterDate);
taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C280515] Should be able to see only the tasks of a specific app when typing the apps id in the appId field', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeAppId(appRuntime.id);
expect(taskListSinglePage.getAppId()).toEqual(appRuntime.id.toString());
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(app.taskName);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(app.taskName);
taskListSinglePage.taskList().getDataTable().checkRowIsNotDisplayedByName(paginationTasksName[13]);
});
it('[C280569] Should be able to see No tasks found when typing an invalid appId', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeAppId(invalidAppId);
expect(taskListSinglePage.getAppId()).toEqual(invalidAppId.toString());
expect(taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C280570] Should be able to see only the tasks with specific name when typing the name in the task name field', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeTaskName(paginationTasksName[13]);
expect(taskListSinglePage.getTaskName()).toEqual(paginationTasksName[13]);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(paginationTasksName[13]);
expect(taskListSinglePage.taskList().getDataTable().getNumberOfRowsDisplayedWithSameName(paginationTasksName[13])).toEqual(2);
});
it('[C280571] Should be able to see No tasks found when typing a task name that does not exist', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeTaskName(invalidName);
expect(taskListSinglePage.getTaskName()).toEqual(invalidName);
expect(taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C280629] Should be able to see only the task with specific taskId when typing it in the task Id field', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeTaskId(taskWithDueDate.id);
expect(taskListSinglePage.getTaskId()).toEqual(taskWithDueDate.id);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(taskWithDueDate.name);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(1);
});
it('[C280630] Should be able to see No tasks found when typing an invalid taskId', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeTaskId(invalidTaskId);
expect(taskListSinglePage.getTaskId()).toEqual(invalidTaskId);
expect(taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C286589] Should be able to see only completed tasks when choosing Completed from state drop down', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.selectState('Completed');
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[0].name);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[1].name);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[2].name);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(3);
});
it('[C286597] Should be able to see only running tasks when choosing Active from state drop down', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.selectState('Active');
taskListSinglePage.taskList().getDataTable().checkRowIsNotDisplayedByName(completedTasks[0].name);
taskListSinglePage.taskList().getDataTable().checkRowIsNotDisplayedByName(completedTasks[1].name);
taskListSinglePage.taskList().getDataTable().checkRowIsNotDisplayedByName(completedTasks[2].name);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName)).toEqual(true);
});
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(20);
});
it('[C286598] Should be able to see all tasks when choosing All from state drop down', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.selectState('All');
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[0].name);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[1].name);
taskListSinglePage.taskList().getDataTable().checkRowIsDisplayedByName(completedTasks[2].name);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, allTasksName)).toEqual(true);
});
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(23);
});
// failing due to ADF-3667, blocked by ACTIVITI-1975
xit('[C286599] Should be able to sort tasks ascending by due date when choosing due(asc) from sort drop down', () => {
let sortAscByDueDate = [taskWithDueDate.name, completedTasks[0].name, completedTasks[1].name, completedTasks[2].name];
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueAfter(beforeDate);
taskListSinglePage.selectState('All');
taskListSinglePage.selectSort('Due (asc)');
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, sortAscByDueDate)).toEqual(true);
});
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(4);
taskListSinglePage.clickResetButton();
taskListSinglePage.selectState('All');
taskListSinglePage.selectSort('Due (asc)');
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(23);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list.slice(0, 4), sortAscByDueDate)).toEqual(true);
expect(Util.arrayContainsArray(list.slice(4, list.length), allTasksName)).toEqual(true);
});
});
// failing due to ADF-3667, blocked by ACTIVITI-1975
xit('[C286600] Should be able to sort tasks descending by due date when choosing due(desc) from sort drop down', () => {
let sortDescByDueDate = [completedTasks[2].name, completedTasks[1].name, completedTasks[0].name, taskWithDueDate.name];
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeDueAfter(beforeDate);
taskListSinglePage.selectState('All');
taskListSinglePage.selectSort('Due (desc)');
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list, sortDescByDueDate)).toEqual(true);
});
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(4);
taskListSinglePage.clickResetButton();
taskListSinglePage.selectState('All');
taskListSinglePage.selectSort('Due (asc)');
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(23);
taskListSinglePage.taskList().getDataTable().getAllRowsNameColumn().then(function (list) {
expect(Util.arrayContainsArray(list.slice(0, 4), sortDescByDueDate)).toEqual(true);
expect(Util.arrayContainsArray(list.slice(4, list.length), allTasksName)).toEqual(true);
});
});
it('[C286622] Should be able to see only tasks that are part of a specific process when processDefinitionId is set', () => {
let processDefinitionIds = [processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId,
processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId];
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeProcessDefinitionId(processDefinitionId.processDefinitionId);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(4);
taskListSinglePage.getAllProcessDefinitionIds().then(function (list) {
expect(Util.arrayContainsArray(list, processDefinitionIds)).toEqual(true);
});
});
it('[C286623] Should be able to see No tasks found when typing an invalid processDefinitionId', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeProcessDefinitionId(invalidTaskId);
expect(taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C286622] Should be able to see only tasks that are part of a specific process when processInstanceId is set', () => {
let processInstanceIds = [processDefinitionId.id];
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeProcessInstanceId(processDefinitionId.id);
expect(taskListSinglePage.getProcessInstanceId()).toEqual(processDefinitionId.id);
expect(taskListSinglePage.taskList().getDataTable().getAllDisplayedRows()).toBe(1);
taskListSinglePage.getAllProcessInstanceIds().then(function (list) {
expect(Util.arrayContainsArray(list, processInstanceIds)).toEqual(true);
});
});
it('[C286623] Should be able to see No tasks found when typing an invalid processInstanceId', () => {
navigationBarPage.clickTaskListButton();
taskListSinglePage.clickResetButton();
taskListSinglePage.typeProcessInstanceId(invalidTaskId);
expect(taskListSinglePage.getProcessInstanceId()).toEqual(invalidTaskId);
expect(taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
});

View File

@@ -87,6 +87,7 @@ exports.Files = {
WIDGETS_SMOKE_TEST: {
file_location: "/resources/apps/Widgets smoke test.zip",
title: "Widgets smoke test",
formName: "Widgets smoke test",
title: "Widgets smoke test",
form_fields: {

View File

@@ -78,6 +78,16 @@ exports.getCrtDateInFormat = function (dateFormat) {
return moment().format(dateFormat);
};
/**
* Get specific date after current date in specific format
*
* @return {string}
* @method getCrtDateInFormat
*/
exports.getSpecificDateAfterCrtDateInFormat = function (dateFormat, days) {
return moment(new Date()).add(days, 'days').format(dateFormat);
};
/**
* Generates a random string.
*