mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-4829] - Add e2e tests for custom action menu in TaskList and ProcessList (#5081)
* in progress custom action menu on tasklist * C315723 - automated * split into 2 methods, addAction, addDisabledAction
This commit is contained in:
parent
c2af8a23f0
commit
1527397b7b
@ -52,6 +52,7 @@ export class TasksCloudDemoPage {
|
|||||||
titleInputField: ElementFinder = element(by.css('input[placeholder="Title"]'));
|
titleInputField: ElementFinder = element(by.css('input[placeholder="Title"]'));
|
||||||
iconInputField: ElementFinder = element(by.css('input[placeholder="Icon"]'));
|
iconInputField: ElementFinder = element(by.css('input[placeholder="Icon"]'));
|
||||||
addActionButton: ElementFinder = element(by.cssContainingText('button span', 'Add'));
|
addActionButton: ElementFinder = element(by.cssContainingText('button span', 'Add'));
|
||||||
|
disableCheckbox: ElementFinder = element(by.css(`mat-checkbox[formcontrolname='disabled']`));
|
||||||
|
|
||||||
formControllersPage: FormControllersPage = new FormControllersPage();
|
formControllersPage: FormControllersPage = new FormControllersPage();
|
||||||
|
|
||||||
@ -164,8 +165,23 @@ export class TasksCloudDemoPage {
|
|||||||
await BrowserActions.click(this.addActionButton);
|
await BrowserActions.click(this.addActionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addDisabledAction(text: string): Promise<void> {
|
||||||
|
await BrowserActions.clearSendKeys(this.keyInputField, text);
|
||||||
|
await BrowserActions.clearSendKeys(this.titleInputField, text);
|
||||||
|
await BrowserActions.clearSendKeys(this.iconInputField, text);
|
||||||
|
await BrowserActions.click(this.disableCheckbox);
|
||||||
|
await BrowserActions.click(this.addActionButton);
|
||||||
|
}
|
||||||
|
|
||||||
async actionAdded(action: string): Promise<void> {
|
async actionAdded(action: string): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`mat-chip`, action)));
|
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`mat-chip`, action)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkActionExecuted(taskId: string, action: string): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Action Menu:')));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Context Menu:')));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Task Id: ' + taskId)));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`span`, 'Action Type: ' + action)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ describe('Process list cloud', () => {
|
|||||||
await tasksCloudDemoPage.actionAdded('edit');
|
await tasksCloudDemoPage.actionAdded('edit');
|
||||||
await tasksCloudDemoPage.addAction('delete');
|
await tasksCloudDemoPage.addAction('delete');
|
||||||
await tasksCloudDemoPage.actionAdded('delete');
|
await tasksCloudDemoPage.actionAdded('delete');
|
||||||
|
await tasksCloudDemoPage.addDisabledAction('disabledaction');
|
||||||
|
await tasksCloudDemoPage.actionAdded('disabledaction');
|
||||||
await tasksCloudDemoPage.clickAppButton();
|
await tasksCloudDemoPage.clickAppButton();
|
||||||
await processCloudDemoPage.clickOnProcessFilters();
|
await processCloudDemoPage.clickOnProcessFilters();
|
||||||
await processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
|
await processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
|
||||||
@ -99,9 +101,12 @@ describe('Process list cloud', () => {
|
|||||||
await expect(await processCloudDemoPage.getActiveFilterName()).toBe('Running Processes');
|
await expect(await processCloudDemoPage.getActiveFilterName()).toBe('Running Processes');
|
||||||
await processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded();
|
await processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded();
|
||||||
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(editProcess.entry.id);
|
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(editProcess.entry.id);
|
||||||
await processCloudDemoPage.processListCloudComponent().clickOnCustomActionMenu(editProcess.entry.id, 'edit');
|
await processCloudDemoPage.processListCloudComponent().clickOptionsButton(editProcess.entry.id);
|
||||||
|
await expect(await processCloudDemoPage.processListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false);
|
||||||
|
await processCloudDemoPage.processListCloudComponent().clickOnCustomActionMenu('edit');
|
||||||
await processCloudDemoPage.checkActionExecuted(editProcess.entry.id, 'edit');
|
await processCloudDemoPage.checkActionExecuted(editProcess.entry.id, 'edit');
|
||||||
await processCloudDemoPage.processListCloudComponent().rightClickOnRow(deleteProcess.entry.id);
|
await processCloudDemoPage.processListCloudComponent().rightClickOnRow(deleteProcess.entry.id);
|
||||||
|
await expect(await processCloudDemoPage.processListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false);
|
||||||
await processCloudDemoPage.processListCloudComponent().clickContextMenuActionNamed('delete');
|
await processCloudDemoPage.processListCloudComponent().clickContextMenuActionNamed('delete');
|
||||||
await processCloudDemoPage.checkActionExecuted(deleteProcess.entry.id, 'delete');
|
await processCloudDemoPage.checkActionExecuted(deleteProcess.entry.id, 'delete');
|
||||||
});
|
});
|
||||||
|
123
e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts
Normal file
123
e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { browser } from 'protractor';
|
||||||
|
import { GroupIdentityService, IdentityService, LoginSSOPage, QueryService, SettingsPage, TasksService } from '@alfresco/adf-testing';
|
||||||
|
import { AppListCloudPage } from '@alfresco/adf-testing';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
|
||||||
|
|
||||||
|
import { ProcessDefinitionsService, ApiService } from '@alfresco/adf-testing';
|
||||||
|
import { ProcessInstancesService } from '@alfresco/adf-testing';
|
||||||
|
import resources = require('../util/resources');
|
||||||
|
|
||||||
|
describe('Process list cloud', () => {
|
||||||
|
|
||||||
|
describe('Process List - Custom Action Menu', () => {
|
||||||
|
const loginSSOPage = new LoginSSOPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const appListCloudComponent = new AppListCloudPage();
|
||||||
|
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
||||||
|
const settingsPage = new SettingsPage();
|
||||||
|
|
||||||
|
let processDefinitionService: ProcessDefinitionsService;
|
||||||
|
let processInstancesService: ProcessInstancesService;
|
||||||
|
let identityService: IdentityService;
|
||||||
|
let groupIdentityService: GroupIdentityService;
|
||||||
|
let queryService: QueryService;
|
||||||
|
let tasksService: TasksService;
|
||||||
|
let testUser, groupInfo, editProcess, deleteProcess, editTask, deleteTask;
|
||||||
|
|
||||||
|
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
|
||||||
|
const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, 'BPM');
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
|
||||||
|
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
||||||
|
identityService = new IdentityService(apiService);
|
||||||
|
groupIdentityService = new GroupIdentityService(apiService);
|
||||||
|
testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]);
|
||||||
|
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
|
||||||
|
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
|
||||||
|
|
||||||
|
await apiService.login(testUser.email, testUser.password);
|
||||||
|
processDefinitionService = new ProcessDefinitionsService(apiService);
|
||||||
|
const processDefinition = await processDefinitionService
|
||||||
|
.getProcessDefinitionByName(resources.ACTIVITI7_APPS.SIMPLE_APP.processes.dropdownrestprocess, simpleApp);
|
||||||
|
|
||||||
|
processInstancesService = new ProcessInstancesService(apiService);
|
||||||
|
editProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
|
||||||
|
deleteProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
|
||||||
|
queryService = new QueryService(apiService);
|
||||||
|
|
||||||
|
editTask = await queryService.getProcessInstanceTasks(editProcess.entry.id, simpleApp);
|
||||||
|
deleteTask = await queryService.getProcessInstanceTasks(deleteProcess.entry.id, simpleApp);
|
||||||
|
tasksService = new TasksService(apiService);
|
||||||
|
await tasksService.claimTask(editTask.list.entries[0].entry.id, simpleApp);
|
||||||
|
await tasksService.claimTask(deleteTask.list.entries[0].entry.id, simpleApp);
|
||||||
|
|
||||||
|
await settingsPage.setProviderBpmSso(
|
||||||
|
browser.params.config.bpmHost,
|
||||||
|
browser.params.config.oauth2.host,
|
||||||
|
browser.params.config.identityHost);
|
||||||
|
await loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
||||||
|
await identityService.deleteIdentityUser(testUser.idIdentityService);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
||||||
|
await appListCloudComponent.checkApsContainer();
|
||||||
|
await appListCloudComponent.goToApp(simpleApp);
|
||||||
|
await tasksCloudDemoPage.clickSettingsButton();
|
||||||
|
await tasksCloudDemoPage.enableTestingMode();
|
||||||
|
await tasksCloudDemoPage.enableActionMenu();
|
||||||
|
await tasksCloudDemoPage.enableContextMenu();
|
||||||
|
await tasksCloudDemoPage.addActionIsDisplayed();
|
||||||
|
await tasksCloudDemoPage.addAction('edit');
|
||||||
|
await tasksCloudDemoPage.actionAdded('edit');
|
||||||
|
await tasksCloudDemoPage.addAction('delete');
|
||||||
|
await tasksCloudDemoPage.actionAdded('delete');
|
||||||
|
await tasksCloudDemoPage.addDisabledAction('disabledaction');
|
||||||
|
await tasksCloudDemoPage.actionAdded('disabledaction');
|
||||||
|
await tasksCloudDemoPage.clickAppButton();
|
||||||
|
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
|
||||||
|
await tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C315723] Should be able to see and execute custom action menu', async () => {
|
||||||
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(editTask.list.entries[0].entry.id);
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().clickOptionsButton(editTask.list.entries[0].entry.id);
|
||||||
|
await expect(await tasksCloudDemoPage.taskListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false);
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().clickOnCustomActionMenu('edit');
|
||||||
|
await tasksCloudDemoPage.checkActionExecuted(editTask.list.entries[0].entry.id, 'edit');
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().rightClickOnRow(deleteTask.list.entries[0].entry.id);
|
||||||
|
await expect(await tasksCloudDemoPage.taskListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false);
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().clickContextMenuActionNamed('delete');
|
||||||
|
await tasksCloudDemoPage.checkActionExecuted(deleteTask.list.entries[0].entry.id, 'delete');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -102,15 +102,23 @@ export class ProcessListCloudComponentPage {
|
|||||||
return this.dataTable.getAllRowsColumnValues(column);
|
return this.dataTable.getAllRowsColumnValues(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickOnCustomActionMenu(content: string, action: string): Promise<void> {
|
async clickOptionsButton(content: string) {
|
||||||
await BrowserActions.closeMenuAndDialogs();
|
await BrowserActions.closeMenuAndDialogs();
|
||||||
const row: ElementFinder = this.dataTable.getRow('Id', content);
|
const row: ElementFinder = this.dataTable.getRow('Id', content);
|
||||||
await BrowserActions.click(row.element(this.optionButton));
|
await BrowserActions.click(row.element(this.optionButton));
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
|
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickOnCustomActionMenu(action: string): Promise<void> {
|
||||||
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
|
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
|
||||||
await BrowserActions.click(actionButton);
|
await BrowserActions.click(actionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isCustomActionEnabled(action: string): Promise<boolean> {
|
||||||
|
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
|
||||||
|
return actionButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
async rightClickOnRow(processInstance: string): Promise<void> {
|
async rightClickOnRow(processInstance: string): Promise<void> {
|
||||||
await this.dataTable.rightClickOnRow('Id', processInstance);
|
await this.dataTable.rightClickOnRow('Id', processInstance);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||||
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
||||||
import { element, by, ElementFinder } from 'protractor';
|
import { element, by, ElementFinder, Locator } from 'protractor';
|
||||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||||
|
|
||||||
const column = {
|
const column = {
|
||||||
@ -36,6 +36,8 @@ export class TaskListCloudComponentPage {
|
|||||||
|
|
||||||
taskList = element(by.css('adf-cloud-task-list'));
|
taskList = element(by.css('adf-cloud-task-list'));
|
||||||
noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
|
noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
|
||||||
|
actionMenu: ElementFinder = element(by.css('div[role="menu"]'));
|
||||||
|
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
|
||||||
|
|
||||||
dataTable = new DataTableComponentPage(this.taskList);
|
dataTable = new DataTableComponentPage(this.taskList);
|
||||||
|
|
||||||
@ -156,4 +158,29 @@ export class TaskListCloudComponentPage {
|
|||||||
return BrowserActions.getText(locator);
|
return BrowserActions.getText(locator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async clickOptionsButton(content: string) {
|
||||||
|
await BrowserActions.closeMenuAndDialogs();
|
||||||
|
const row: ElementFinder = this.dataTable.getRow('Id', content);
|
||||||
|
await BrowserActions.click(row.element(this.optionButton));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickOnCustomActionMenu(action: string): Promise<void> {
|
||||||
|
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
|
||||||
|
await BrowserActions.click(actionButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
async isCustomActionEnabled(action: string): Promise<boolean> {
|
||||||
|
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
|
||||||
|
return actionButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async rightClickOnRow(taskId: string): Promise<void> {
|
||||||
|
await this.dataTable.rightClickOnRow('Id', taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickContextMenuActionNamed(actionName): Promise<void> {
|
||||||
|
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user