From 2372710f3d983f3c2038a08bf5a92d06fbffebd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iulia=20Burc=C4=83?= Date: Tue, 2 Jun 2020 11:39:20 +0300 Subject: [PATCH] [ACA-3332] Add Context menu click action for process and task list and selectRow for process list (#5730) * Add click on context menu action * Export context-menu class through public-api.ts * Add isContextMenuDisplayed method * Add select row method for process list * Typo in context-menu class * Move Context Menu class in core folder * Add async and await to select process row method * Remove return from select process row method * Rename selectRow method for Process and Task list --- .../src/lib/core/pages/context-menu.page.ts | 37 +++++++++++++++++++ lib/testing/src/lib/core/pages/public-api.ts | 1 + .../pages/process-list.page.ts | 4 ++ .../process-services/pages/task-list.page.ts | 4 +- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 lib/testing/src/lib/core/pages/context-menu.page.ts diff --git a/lib/testing/src/lib/core/pages/context-menu.page.ts b/lib/testing/src/lib/core/pages/context-menu.page.ts new file mode 100644 index 0000000000..056c3a97cb --- /dev/null +++ b/lib/testing/src/lib/core/pages/context-menu.page.ts @@ -0,0 +1,37 @@ +/*! + * @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 { BrowserActions } from '../utils/browser-actions'; +import { element, by, ElementFinder } from 'protractor'; +import { BrowserVisibility } from '../public-api'; + +export class ContextMenuPage { + contextMenu: ElementFinder = element(by.id('adf-context-menu-content')); + + async isContextMenuDisplayed(): Promise { + try { + await BrowserVisibility.waitUntilElementIsVisible(this.contextMenu); + return true; + } catch (error) { + return false; + } + } + + async clickContextMenuActionNamed(actionName: string): Promise { + await BrowserActions.click(element(by.css(`button[data-automation-id="context-${actionName}"]`))); + } +} diff --git a/lib/testing/src/lib/core/pages/public-api.ts b/lib/testing/src/lib/core/pages/public-api.ts index 0757722673..c551b067c5 100644 --- a/lib/testing/src/lib/core/pages/public-api.ts +++ b/lib/testing/src/lib/core/pages/public-api.ts @@ -32,3 +32,4 @@ export * from './config-editor-page'; export * from './about.page'; export * from './snackbar.page'; export * from './data-table/public-api'; +export * from './context-menu.page'; diff --git a/lib/testing/src/lib/process-services/pages/process-list.page.ts b/lib/testing/src/lib/process-services/pages/process-list.page.ts index 6a46ea5c87..ab7ab0ff8b 100644 --- a/lib/testing/src/lib/process-services/pages/process-list.page.ts +++ b/lib/testing/src/lib/process-services/pages/process-list.page.ts @@ -45,4 +45,8 @@ export class ProcessListPage { checkContentIsNotDisplayedByColumn(column: string, processName: string): Promise { return this.dataTable.checkContentIsNotDisplayed(column, processName); } + + async selectRowByName(processName: string): Promise { + await this.dataTable.selectRow('Name', processName); + } } diff --git a/lib/testing/src/lib/process-services/pages/task-list.page.ts b/lib/testing/src/lib/process-services/pages/task-list.page.ts index 29ac820eaa..a9f35f246f 100644 --- a/lib/testing/src/lib/process-services/pages/task-list.page.ts +++ b/lib/testing/src/lib/process-services/pages/task-list.page.ts @@ -63,8 +63,8 @@ export class TaskListPage { return this.dataTable.checkRowIsSelected('Name', taskName); } - selectRow(taskName): Promise { - return this.dataTable.selectRow('Name', taskName); + async selectRowByName(taskName: string): Promise { + await this.dataTable.selectRow('Name', taskName); } getAllRowsNameColumn(): Promise {