From 978096bd9e1cd5d4b0c2935444b75b0cb7f990fd Mon Sep 17 00:00:00 2001 From: neerajsinghal Date: Fri, 15 Sep 2023 18:50:28 +0530 Subject: [PATCH] BigQuery Common steps --- .../actions/CdfPluginPropertiesActions.java | 19 +++++++++++++++++++ .../locators/CdfPluginPropertiesLocators.java | 12 ++++++++++++ src/main/java/stepsdesign/PipelineSteps.java | 10 ++++++++++ 3 files changed, 41 insertions(+) diff --git a/src/main/java/io/cdap/e2e/pages/actions/CdfPluginPropertiesActions.java b/src/main/java/io/cdap/e2e/pages/actions/CdfPluginPropertiesActions.java index 3ec0d40fb..81ee7dcf4 100644 --- a/src/main/java/io/cdap/e2e/pages/actions/CdfPluginPropertiesActions.java +++ b/src/main/java/io/cdap/e2e/pages/actions/CdfPluginPropertiesActions.java @@ -1142,6 +1142,25 @@ public static void pressEscapeKey() { logger.info("Press Escape Key"); Actions act = new Actions(SeleniumDriver.getDriver()); act.sendKeys(new CharSequence[]{Keys.ESCAPE}).perform(); + } + public static void enterKeyInDedupe(String pluginProperty, String value) { + WebElement pluginPropertyInput = CdfPluginPropertiesLocators.deDupeKey(pluginProperty); + String valueFromPluginPropertiesFile = PluginPropertyUtils.pluginProp(value); + if (valueFromPluginPropertiesFile == null) { + ElementHelper.sendKeys(pluginPropertyInput, value); + return; + } + ElementHelper.sendKeys(pluginPropertyInput, valueFromPluginPropertiesFile); + } + + public static void enterValueInTableKey(String pluginProperty, String value) { + WebElement pluginPropertyInput = CdfPluginPropertiesLocators.locateTableKey(pluginProperty); + String valueFromPluginPropertiesFile = PluginPropertyUtils.pluginProp(value); + if (valueFromPluginPropertiesFile == null) { + ElementHelper.sendKeys(pluginPropertyInput, value); + return; + } + ElementHelper.sendKeys(pluginPropertyInput, valueFromPluginPropertiesFile); } } diff --git a/src/main/java/io/cdap/e2e/pages/locators/CdfPluginPropertiesLocators.java b/src/main/java/io/cdap/e2e/pages/locators/CdfPluginPropertiesLocators.java index 208409c10..592676ecc 100644 --- a/src/main/java/io/cdap/e2e/pages/locators/CdfPluginPropertiesLocators.java +++ b/src/main/java/io/cdap/e2e/pages/locators/CdfPluginPropertiesLocators.java @@ -263,4 +263,16 @@ public static WebElement selectReplicationTable(String tableName) { String path = "//div[contains(text(),'" + tableName + "')]" + "/preceding-sibling::div/span"; return SeleniumDriver.getDriver().findElement(By.xpath(path)); } + + public static WebElement deDupeValue() { + return SeleniumDriver.getDriver().findElement(By.xpath("//div[@data-cy='value']")); + } + + public static WebElement locateTableKey(String pluginProperty) { + return SeleniumDriver.getDriver().findElement + (By.xpath("//*[@data-cy='" + pluginProperty + "']//input")); } + + public static WebElement deDupeKey(String pluginProperty) { + return SeleniumDriver.getDriver().findElement(By.xpath + ("//*[@data-cy='" + pluginProperty + "']//input[@placeholder='Key']")); } } diff --git a/src/main/java/stepsdesign/PipelineSteps.java b/src/main/java/stepsdesign/PipelineSteps.java index a16f96645..f95c386be 100644 --- a/src/main/java/stepsdesign/PipelineSteps.java +++ b/src/main/java/stepsdesign/PipelineSteps.java @@ -747,4 +747,14 @@ public void enterKeyPropertyWithValue(String pluginProperty, DataTable table) { public void pressESCKey() { CdfPluginPropertiesActions.pressEscapeKey(); } + + @Then("Enter key for plugin property: {string} with values: {string}") + public void enterKeyForPluginPropertyWithValue(String pluginProperty, String value) { + CdfPluginPropertiesActions.enterKeyInDedupe(pluginProperty, value); + } + + @Then("Enter Value for plugin property table key : {string} with values: {string}") + public void enterValueInTableKey(String pluginProperty, String value) { + CdfPluginPropertiesActions.enterValueInTableKey(pluginProperty, value); + } }