mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-1951 - added extra test cases for start task and assignee (#5534)
* AAE-1951 - added extra test cases for start task and assignee * AAE-1951 - fixed license
This commit is contained in:
@@ -160,4 +160,12 @@ export class TasksCloudDemoPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Task ID: ' + taskId)));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Action Type: ' + action)));
|
||||
}
|
||||
|
||||
async clickStartNewTaskButton() {
|
||||
await BrowserVisibility.waitUntilElementIsClickable(this.createButton);
|
||||
await BrowserActions.click(this.createButton);
|
||||
await BrowserVisibility.waitUntilElementIsClickable(this.newTaskButton);
|
||||
await BrowserActions.click(this.newTaskButton);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,7 +25,9 @@ import {
|
||||
LoginSSOPage,
|
||||
StringUtil,
|
||||
TaskHeaderCloudPage,
|
||||
TasksService
|
||||
TasksService,
|
||||
StartTasksCloudPage,
|
||||
PeopleCloudComponentPage
|
||||
} from '@alfresco/adf-testing';
|
||||
import { browser } from 'protractor';
|
||||
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasks-cloud-demo.page';
|
||||
@@ -35,6 +37,7 @@ import moment = require('moment');
|
||||
describe('Task Header cloud component', () => {
|
||||
const basicCreatedTaskName = StringUtil.generateRandomString();
|
||||
const completedTaskName = StringUtil.generateRandomString();
|
||||
const unclaimedTaskName = StringUtil.generateRandomString();
|
||||
let basicCreatedTask: any;
|
||||
let basicCreatedDate: any;
|
||||
let completedTask: any;
|
||||
@@ -46,6 +49,7 @@ describe('Task Header cloud component', () => {
|
||||
let defaultDate: string;
|
||||
let groupInfo: any;
|
||||
let testUser: any;
|
||||
let unclaimedTask: any;
|
||||
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
|
||||
const priority = 30;
|
||||
const description = 'descriptionTask';
|
||||
@@ -59,6 +63,8 @@ describe('Task Header cloud component', () => {
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
const appListCloudComponent = new AppListCloudPage();
|
||||
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
||||
const startTaskCloudPage = new StartTasksCloudPage();
|
||||
const peopleCloudComponentPage = new PeopleCloudComponentPage();
|
||||
const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers);
|
||||
let tasksService: TasksService;
|
||||
let identityService: IdentityService;
|
||||
@@ -78,6 +84,7 @@ describe('Task Header cloud component', () => {
|
||||
tasksService = new TasksService(apiService);
|
||||
|
||||
const createdTaskId = await tasksService.createStandaloneTask(basicCreatedTaskName, simpleApp);
|
||||
unclaimedTask = await tasksService.createStandaloneTask(unclaimedTaskName, simpleApp);
|
||||
|
||||
await tasksService.claimTask(createdTaskId.entry.id, simpleApp);
|
||||
|
||||
@@ -173,6 +180,55 @@ describe('Task Header cloud component', () => {
|
||||
.toEqual(subTask.entry.parentTaskId === null ? '' : subTask.entry.parentTaskId);
|
||||
});
|
||||
|
||||
it('[C309698] - Should validate the Priority field', async () => {
|
||||
const myTaskName = `Test_C309698_${StringUtil.generateRandomString()}`;
|
||||
await tasksCloudDemoPage.clickStartNewTaskButton();
|
||||
await startTaskCloudPage.addName(myTaskName);
|
||||
await startTaskCloudPage.typePriorityOf('50');
|
||||
await startTaskCloudPage.clickStartButton();
|
||||
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter();
|
||||
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(myTaskName);
|
||||
await tasksCloudDemoPage.taskListCloudComponent().selectRow(myTaskName);
|
||||
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
||||
|
||||
await taskHeaderCloudPage.priorityCardTextItem.clickOnEditButton();
|
||||
await taskHeaderCloudPage.priorityCardTextItem.enterTextField('$$%£W21');
|
||||
await taskHeaderCloudPage.priorityCardTextItem.clickOnSaveButton();
|
||||
const errorMessage = await taskHeaderCloudPage.priorityCardTextItem.getErrorMessage();
|
||||
await expect(errorMessage).toBe('Enter a different value');
|
||||
|
||||
await taskHeaderCloudPage.priorityCardTextItem.enterTextField('600');
|
||||
await taskHeaderCloudPage.priorityCardTextItem.clickOnSaveButton();
|
||||
const currentValue = await taskHeaderCloudPage.priorityCardTextItem.getFieldValue();
|
||||
await expect(currentValue).toBe('600');
|
||||
});
|
||||
|
||||
it('[C309698] - Should validate the Priority field', async () => {
|
||||
await tasksCloudDemoPage.editTaskFilterCloud.openFilter();
|
||||
await tasksCloudDemoPage.editTaskFilterCloud.setStatusFilterDropDown('ALL');
|
||||
await tasksCloudDemoPage.editTaskFilterCloud.clearAssignee();
|
||||
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(unclaimedTask.entry.name);
|
||||
await tasksCloudDemoPage.taskListCloudComponent().selectRow(unclaimedTask.entry.name);
|
||||
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
||||
const currentAssignee = await taskHeaderCloudPage.assigneeCardTextItem.getFieldValue();
|
||||
await expect(currentAssignee).toBe('No assignee');
|
||||
await taskHeaderCloudPage.priorityCardTextItem.checkElementIsReadonly();
|
||||
await taskHeaderCloudPage.statusCardTextItem.checkElementIsReadonly();
|
||||
});
|
||||
|
||||
it('[C291991] - Should be able to assign a task only to the users that have access to the selected app', async () => {
|
||||
await tasksCloudDemoPage.clickStartNewTaskButton();
|
||||
const currentAssignee = await peopleCloudComponentPage.getChipAssignee();
|
||||
await expect(currentAssignee).toContain(testUser.firstName, 'Invalid Assignee first name set for the new task');
|
||||
await expect(currentAssignee).toContain(testUser.lastName, 'Invalid Assignee last name set for the new task');
|
||||
await peopleCloudComponentPage.searchAssignee('hrUser');
|
||||
await peopleCloudComponentPage.checkUserIsDisplayed('HR User');
|
||||
await peopleCloudComponentPage.searchAssignee('processAdmin');
|
||||
await peopleCloudComponentPage.checkUserIsDisplayed('Process Admin User');
|
||||
await peopleCloudComponentPage.searchAssignee('modeler');
|
||||
await peopleCloudComponentPage.checkOptionIsNotDisplayed();
|
||||
});
|
||||
|
||||
describe('Default Date format', () => {
|
||||
beforeEach(async () => {
|
||||
await LocalStorageUtil.setConfigField('dateValues', '{' +
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { element, by, ElementFinder, Locator } from 'protractor';
|
||||
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
|
||||
|
||||
export class CardTextItemPage {
|
||||
|
||||
rootElement: ElementFinder;
|
||||
@@ -27,6 +26,9 @@ export class CardTextItemPage {
|
||||
field: Locator = by.css('span[data-automation-id*="card-textitem-value"] span');
|
||||
labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]');
|
||||
toggle: Locator = by.css('div[data-automation-id*="card-textitem-toggle"]');
|
||||
editButton: Locator = by.css('button.adf-textitem-action[title*=Edit]');
|
||||
errorMessage: Locator = by.css('.adf-textitem-editable-error');
|
||||
clickableElement: Locator = by.css('.adf-textitem-clickable');
|
||||
|
||||
constructor(label: string = 'assignee') {
|
||||
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-textitem`));
|
||||
@@ -59,4 +61,18 @@ export class CardTextItemPage {
|
||||
async clickOnClearButton(): Promise<void> {
|
||||
await BrowserActions.click(this.rootElement.element(this.clearButton));
|
||||
}
|
||||
|
||||
async clickOnEditButton(): Promise<void> {
|
||||
await BrowserActions.click(this.rootElement.element(this.editButton));
|
||||
}
|
||||
|
||||
async getErrorMessage(): Promise<string> {
|
||||
const errorField = this.rootElement.element(this.errorMessage);
|
||||
return BrowserActions.getText(errorField);
|
||||
}
|
||||
|
||||
async checkElementIsReadonly(): Promise <void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.clickableElement));
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.editButton));
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ export class PeopleCloudComponentPage {
|
||||
formFields: FormFields = new FormFields();
|
||||
labelLocator: Locator = by.css("label[class*='adf-label']");
|
||||
inputLocator: Locator = by.css('input');
|
||||
assigneeChipList: ElementFinder = element(by.css('mat-chip-list[data-automation-id="adf-cloud-people-chip-list"]'));
|
||||
|
||||
async clearAssignee(): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' ');
|
||||
@@ -62,6 +63,11 @@ export class PeopleCloudComponentPage {
|
||||
return this.peopleCloudSearch.getAttribute('value');
|
||||
}
|
||||
|
||||
async getChipAssignee(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeChipList);
|
||||
return this.assigneeChipList.all(by.css('mat-chip')).first().getText();
|
||||
}
|
||||
|
||||
async checkUserIsDisplayed(name: string): Promise<void> {
|
||||
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
|
||||
@@ -72,6 +78,16 @@ export class PeopleCloudComponentPage {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
|
||||
}
|
||||
|
||||
async checkOptionIsDisplayed(): Promise <void> {
|
||||
const optionList = element(by.css('.adf-people-cloud-list'));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(optionList);
|
||||
}
|
||||
|
||||
async checkOptionIsNotDisplayed(): Promise <void> {
|
||||
const optionList = element(by.css('.adf-people-cloud-list'));
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(optionList);
|
||||
}
|
||||
|
||||
async checkSelectedPeople(person: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ export class StartTasksCloudPage {
|
||||
cancelButton: ElementFinder = element(by.css('button[id="button-cancel"]'));
|
||||
form: ElementFinder = element.all(by.css('adf-cloud-start-task form')).first();
|
||||
formDefinitionSelector: ElementFinder = element(by.css('.adf-form-definition-selector'));
|
||||
priorityStartTaskField: ElementFinder = element(by.css('input[formControlName="priority"]'));
|
||||
|
||||
async checkFormIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.form);
|
||||
@@ -105,4 +106,9 @@ export class StartTasksCloudPage {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(row);
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
}
|
||||
|
||||
async typePriorityOf(priorityValue: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.priorityStartTaskField);
|
||||
await BrowserActions.clearSendKeys(this.priorityStartTaskField, priorityValue);
|
||||
}
|
||||
}
|
||||
|
@@ -86,5 +86,4 @@ export class TaskHeaderCloudPage {
|
||||
async checkTaskPropertyListIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.taskPropertyList);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user