[ADF-4066] Start task form with no assignee is saved as unassigned task (#4347)

* in progress

* in progress

* ADF-4012 pull request ready

* crc's

* crc's - moved the methods ProcessListCloudComponent to dataTablePage, to keep it common.

* crc's - moved the methods ProcessListCloudComponent to dataTablePage, to keep it common.

* changed the locator to use data-automation-id

* linting fix

* test automated - C268974

* test automated - C268974

* crc's

* crc's

* crc's

* crc's

* linting fix

* added automation for C276980 - Duplicate User or Group

* merged the overlapping testcases

* Changed  checkUserHasRoleSelected to use datatable methods

* changed hte usernames to something more relevant and readable.

* [ADF-4066] Should create a task unassigned when assignee field is empty … (#4334)

* C297675 Should create a task unassigned when assignee field is empty in Start Task form automated

* linting fixes and updated some locators which are returning more than 1 result back when running this test, as part of best practices.

* using hte new method added as it's more efficient, getIdCellValue

* linting fixes

* updates

* updated the taskname variables to more meaningful ones.

* added data-automation-id for better test locators.
This commit is contained in:
gmandakini
2019-02-25 11:35:55 +00:00
committed by Eugenio Romano
parent 687257e45e
commit 70c523546a
4 changed files with 91 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
<mat-icon>arrow_back</mat-icon> Go Back
</button>
<h4>Simple page to show the taskId: {{ taskId }} of the app: {{ appName }}</h4>
<h4 data-automation-id="task-details-header">Simple page to show the taskId: {{ taskId }} of the app: {{ appName }}</h4>
<adf-cloud-task-header
[appName]="appName"

View File

@@ -0,0 +1,46 @@
/*!
* @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 { by, element } from 'protractor';
import { Util } from '../../../../util/util';
export class TaskDetailsPage {
taskDetailsHeader = element(by.css(`h4[data-automation-id='task-details-header']`));
taskPropertyList = element(by.css('adf-cloud-task-header adf-card-view div[class="adf-property-list"]'));
getTaskDetailsHeader() {
Util.waitUntilElementIsOnPage(this.taskPropertyList);
return this.taskDetailsHeader.getText();
}
checkPropertyIsDisplayed(propertyName) {
Util.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="header-${propertyName}"]`)));
return element(by.css(`div[data-automation-id="header-${propertyName}"]`));
}
getPropertyLabel(propertyLabel) {
Util.waitUntilElementIsVisible(this.checkPropertyIsDisplayed(propertyLabel).element(by.css(`div[data-automation-id="card-textitem-label-${propertyLabel}"]`)));
return this.checkPropertyIsDisplayed(propertyLabel).element(by.css(`div[data-automation-id="card-textitem-label-${propertyLabel}"]`)).getText();
}
getPropertyValue(propertyValue) {
Util.waitUntilElementIsVisible(this.checkPropertyIsDisplayed(propertyValue).element(by.css(`span[data-automation-id="card-textitem-value-${propertyValue}"]`)));
return this.checkPropertyIsDisplayed(propertyValue).element(by.css(`span[data-automation-id="card-textitem-value-${propertyValue}"]`)).getText();
}
}

View File

@@ -19,6 +19,10 @@ import { Util } from '../../../util/util';
import { DataTablePage } from '../dataTablePage';
import { element, by } from 'protractor';
let column = {
id: 'Id'
};
export class TaskListCloudComponent {
taskList = element(by.css('adf-cloud-task-list'));
@@ -40,8 +44,14 @@ export class TaskListCloudComponent {
return this.noTasksFound.getText();
}
getAllRowsByColumn(column) {
return this.dataTable.getAllRowsColumnValues(column);
getAllRowsByColumn(columnName) {
return this.dataTable.getAllRowsColumnValues(columnName);
}
getIdCellValue(rowName) {
let locator = new DataTablePage().getCellByNameAndColumn(rowName, column.id);
Util.waitUntilElementIsVisible(locator);
return locator.getText();
}
}

View File

@@ -23,17 +23,19 @@ import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
import { StartTasksCloudComponent } from '../pages/adf/process-cloud/startTasksCloudComponent';
import { Util } from '../util/util';
import { TaskDetailsPage } from '../pages/adf/demo-shell/process-services/taskDetailsPage';
describe('Start Task', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const taskDetailsPage = new TaskDetailsPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudComponent();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const startTask = new StartTasksCloudComponent();
const standaloneTaskName1 = Util.generateRandomString(5);
const standaloneTaskName2 = Util.generateRandomString(5);
const standaloneTaskName = Util.generateRandomString(5);
const unassignedTaskName = Util.generateRandomString(5);
const taskName255Characters = Util.generateRandomString(255);
const taskNameBiggerThen255Characters = Util.generateRandomString(256);
const lengthValidationError = 'Length exceeded, 255 characters max.';
@@ -61,22 +63,22 @@ describe('Start Task', () => {
startTask.checkStartButtonIsDisabled()
.blur(startTask.name)
.checkValidationErrorIsDisplayed(requiredError);
startTask.addName(standaloneTaskName1)
startTask.addName(standaloneTaskName)
.addDescription('descriptions')
.addDueDate('12/12/2018');
startTask.checkStartButtonIsEnabled();
startTask.clickCancelButton();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName1);
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName);
});
it('[C290180] Should be able to create a new standalone task', () => {
tasksCloudDemoPage.openNewTaskForm();
startTask.addName(standaloneTaskName1)
startTask.addName(standaloneTaskName)
.addDescription('descriptions')
.addDueDate('12/12/2018')
.addPriority('50')
.clickStartButton();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName1);
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName);
});
it('[C290181] Should be displayed an error message if task name exceed 255 characters', () => {
@@ -103,12 +105,12 @@ describe('Start Task', () => {
it('[C290182] Should be possible to assign the task to another user', () => {
tasksCloudDemoPage.openNewTaskForm();
startTask.addName(standaloneTaskName1)
startTask.addName(standaloneTaskName)
.addAssignee('Super Admin')
.clickStartButton();
tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName1);
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName);
});
it('[C291953] Assignee field should display the logged user as default', () => {
@@ -119,14 +121,34 @@ describe('Start Task', () => {
it('[C291956] Should be able to create a new standalone task without assignee', () => {
tasksCloudDemoPage.openNewTaskForm();
startTask.addName(standaloneTaskName2);
startTask.addName(unassignedTaskName);
startTask.clearField(startTask.assignee);
startTask.clickStartButton();
tasksCloudDemoPage.editTaskFilterCloudComponent()
.clickCustomiseFilterHeader()
.setStateFilterDropDown('CREATED')
.clearAssignment();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName2);
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(unassignedTaskName);
});
it('[C297675] Should create a task unassigned when assignee field is empty in Start Task form', () => {
tasksCloudDemoPage.openNewTaskForm();
startTask.addName(unassignedTaskName);
startTask.clearField(startTask.assignee);
startTask.clickStartButton();
tasksCloudDemoPage.editTaskFilterCloudComponent()
.clickCustomiseFilterHeader()
.setStateFilterDropDown('CREATED')
.clearAssignment();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(unassignedTaskName);
let taskId = tasksCloudDemoPage.taskListCloudComponent().getIdCellValue(unassignedTaskName);
tasksCloudDemoPage.taskListCloudComponent().getDataTable().selectRowByContentName(unassignedTaskName);
expect(taskDetailsPage.getTaskDetailsHeader()).toContain(taskId);
expect(taskDetailsPage.getPropertyLabel('assignee')).toBe('Assignee');
expect(taskDetailsPage.getPropertyValue('assignee')).toBe('No assignee');
});
});