From 8ee5cd19088617ee6f96b8244fdb88dd1d43a110 Mon Sep 17 00:00:00 2001 From: Geeta Mandakini Ayyalasomayajula <45559635+gmandakini@users.noreply.github.com> Date: Thu, 18 Jul 2019 10:54:15 +0100 Subject: [PATCH] Add rightclick method to browseractions (#4942) * added right click method to browseractions * added rightclickrowbyindex method to DataTableComponentPage * updated row locator * removed the rightclick from here --- lib/testing/src/lib/core/pages/data-table-component.page.ts | 5 +++++ lib/testing/src/lib/core/utils/browser-actions.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/testing/src/lib/core/pages/data-table-component.page.ts b/lib/testing/src/lib/core/pages/data-table-component.page.ts index f3d8cc1de8..29501f3358 100644 --- a/lib/testing/src/lib/core/pages/data-table-component.page.ts +++ b/lib/testing/src/lib/core/pages/data-table-component.page.ts @@ -258,6 +258,11 @@ export class DataTableComponentPage { return row; } + getRowByIndex(index: number) { + const row = this.rootElement.element(by.xpath(`//div[contains(@class,'adf-datatable-body')]//div[contains(@class,'adf-datatable-row')][${index}]`)); + return row; + } + contentInPosition(position) { BrowserVisibility.waitUntilElementIsVisible(this.contents); return this.contents.get(position - 1).getText(); diff --git a/lib/testing/src/lib/core/utils/browser-actions.ts b/lib/testing/src/lib/core/utils/browser-actions.ts index 0514947622..a0afc20b68 100644 --- a/lib/testing/src/lib/core/utils/browser-actions.ts +++ b/lib/testing/src/lib/core/utils/browser-actions.ts @@ -60,6 +60,11 @@ export class BrowserActions { return this; } + static async rightClick(elementFinder: ElementFinder) { + BrowserVisibility.waitUntilElementIsVisible(elementFinder); + return browser.actions().click(elementFinder, protractor.Button.RIGHT).perform(); + } + static async closeMenuAndDialogs() { return browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); }