mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1933] Add dropdown testing page (#5491)
* [AAE-1933] Add process and task filters testing methods - check option is visible in dropdown * [AAE-1933] Add dropdown page * [AAE-1933] Remove methods replaced by dropdown page * [AAE-1933] Fix dropdown methods not working * [AAE-1933] Fix e2e * [AAE-1933] Fix task-form-cloud e2e
This commit is contained in:
@@ -23,6 +23,7 @@ import { FolderDialogPage } from './dialog/folder-dialog.page';
|
||||
import { NavigationBarPage } from './navigation-bar.page';
|
||||
|
||||
import path = require('path');
|
||||
import { DropdownPage } from '../../../lib/testing/src/lib/material/pages/dropdown.page';
|
||||
|
||||
export class ContentServicesPage {
|
||||
|
||||
@@ -593,7 +594,9 @@ export class ContentServicesPage {
|
||||
}
|
||||
|
||||
async selectSite(siteName: string): Promise<void> {
|
||||
await BrowserActions.clickOnSelectDropdownOption(siteName, this.siteListDropdown);
|
||||
const dropdownPage = new DropdownPage(this.siteListDropdown);
|
||||
await dropdownPage.clickDropdown();
|
||||
await dropdownPage.selectOption(siteName);
|
||||
}
|
||||
|
||||
async clickDownloadButton(): Promise<void> {
|
||||
|
@@ -46,7 +46,7 @@ describe('Task form cloud component', () => {
|
||||
let processDefinitionService: ProcessDefinitionsService;
|
||||
let processInstancesService: ProcessInstancesService;
|
||||
|
||||
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, formTaskId, assigneeTaskId, assigneeReleaseTask;
|
||||
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, formTaskId, assigneeTaskId, assigneeReleaseTask, candidateUsersTask ;
|
||||
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
|
||||
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
|
||||
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
|
||||
@@ -82,7 +82,11 @@ describe('Task form cloud component', () => {
|
||||
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateUserProcess, candidateBaseApp);
|
||||
|
||||
processInstancesService = new ProcessInstancesService(apiServiceHrUser);
|
||||
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
|
||||
const candidateUsersProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
|
||||
|
||||
const processInstanceTasks = await queryService.getProcessInstanceTasks(candidateUsersProcessInstance.entry.id, candidateBaseApp);
|
||||
candidateUsersTask = processInstanceTasks.list.entries[0];
|
||||
await tasksService.claimTask(candidateUsersTask.entry.id, candidateBaseApp);
|
||||
|
||||
processDefinition = await processDefinitionService
|
||||
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.dropdownrestprocess, simpleApp);
|
||||
@@ -168,8 +172,8 @@ describe('Task form cloud component', () => {
|
||||
|
||||
it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => {
|
||||
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
||||
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
|
||||
await tasksCloudDemoPage.taskListCloudComponent().selectRow(assigneeTask.entry.name);
|
||||
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(candidateUsersTask.entry.id);
|
||||
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(candidateUsersTask.entry.id);
|
||||
await expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE');
|
||||
});
|
||||
|
||||
|
@@ -112,17 +112,4 @@ export class BrowserActions {
|
||||
// if the opened menu has only disabled items, pressing escape to close it won't work
|
||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||
}
|
||||
|
||||
static async clickOnDropdownOption(option: string, dropDownElement: ElementFinder): Promise<void> {
|
||||
await this.click(dropDownElement);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element('div[class*="mat-menu-content"] button'));
|
||||
const optionElement = element(by.cssContainingText('div[class*="mat-menu-content"] button', option));
|
||||
await this.click(optionElement);
|
||||
}
|
||||
|
||||
static async clickOnSelectDropdownOption(option: string, dropDownElement: ElementFinder): Promise<void> {
|
||||
await this.click(dropDownElement);
|
||||
const optionElement = element(by.cssContainingText('mat-option span.mat-option-text', option));
|
||||
await this.click(optionElement);
|
||||
}
|
||||
}
|
||||
|
50
lib/testing/src/lib/material/pages/dropdown.page.ts
Normal file
50
lib/testing/src/lib/material/pages/dropdown.page.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* @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 { element, by, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
|
||||
export class DropdownPage {
|
||||
|
||||
dropDownElement: ElementFinder;
|
||||
|
||||
constructor(dropDownElement: ElementFinder = element.all(by.css('div[class="mat-select-arrow-wrapper"]')).first()) {
|
||||
this.dropDownElement = dropDownElement;
|
||||
}
|
||||
|
||||
async checkOptionIsVisibleInDropdown(option: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-option span', option)), 5000);
|
||||
}
|
||||
|
||||
async checkOptionIsNotVisible(option: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-option span', option)), 5000);
|
||||
}
|
||||
|
||||
async clickDropdown(): Promise<void> {
|
||||
await BrowserActions.click(this.dropDownElement);
|
||||
}
|
||||
|
||||
async selectOption(option: string): Promise<void> {
|
||||
const optionElement = element(by.cssContainingText('mat-option span.mat-option-text', option));
|
||||
await BrowserActions.click(optionElement);
|
||||
}
|
||||
|
||||
async getValue(): Promise<string> {
|
||||
return BrowserActions.getText(element(by.css('mat-form-field span')));
|
||||
}
|
||||
}
|
@@ -17,3 +17,4 @@
|
||||
|
||||
export * from './tabs.page';
|
||||
export * from './date-picker.page';
|
||||
export * from './dropdown.page';
|
||||
|
Reference in New Issue
Block a user