mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[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:
committed by
Eugenio Romano
parent
002998b10e
commit
2e8d998853
231
e2e/pages/adf/demo-shell/taskListDemoPage.ts
Normal file
231
e2e/pages/adf/demo-shell/taskListDemoPage.ts
Normal 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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user