From 3c8da48fd801f9902a62b60c1ef54c76cec4f4b7 Mon Sep 17 00:00:00 2001 From: poojantcs Date: Wed, 24 Jul 2024 18:43:10 +0530 Subject: [PATCH] Add steps for CDF BYOID login test --- .../cdap/e2e/pages/actions/CdfSignInActions.java | 12 ++++++++++++ .../cdap/e2e/pages/locators/CdfSignInLocator.java | 15 +++++++++++++++ src/main/java/io/cdap/e2e/utils/CdfHelper.java | 6 ++++++ .../java/io/cdap/e2e/utils/ConstantsUtil.java | 5 +++++ src/main/java/stepsdesign/PipelineSteps.java | 5 +++++ .../resources/connectionParameters.properties | 7 +++++++ 6 files changed, 50 insertions(+) diff --git a/src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java b/src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java index 99abab6b0..a01197ed0 100644 --- a/src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java +++ b/src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java @@ -55,4 +55,16 @@ public static boolean isUserLoggedInCDF() { return !WaitHelper.waitForElementToBeOptionallyDisplayed( CdfSignInLocator.locatorOfEmailTextBox(), ConstantsUtil.SMALL_TIMEOUT_SECONDS); } + + public static void byoidLogin() throws IOException, InterruptedException { + ElementHelper.sendKeys(cdfSignInLocator.byoidProvider, + SeleniumHelper.readParameters(ConstantsUtil.BYOID_PROVIDER)); + ElementHelper.clickOnElement(cdfSignInLocator.nextButton); + WaitHelper.waitForElementToBeDisplayed(cdfSignInLocator.keycloakLogo); + ElementHelper.sendKeys(cdfSignInLocator.byoidUsername, + SeleniumHelper.readParameters(ConstantsUtil.BYOID_USERNAME)); + ElementHelper.sendKeys(cdfSignInLocator.byoidPassword, + SeleniumHelper.readParameters(ConstantsUtil.BYOID_PASSWORD)); + ElementHelper.clickOnElement(cdfSignInLocator.byoidSignInButton); + } } diff --git a/src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java b/src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java index 4782ac307..8a57993a3 100644 --- a/src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java +++ b/src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java @@ -55,4 +55,19 @@ public static By locatePluginNameInList(String pluginName, String pluginGroupNa "//div[contains(@class, 'PluginNameContainer')][normalize-space(text()) = '" + pluginName + "' " + "or translate(normalize-space(text()),' ','') = '" + pluginName + "']"); } + + @FindBy(how = How.XPATH, using = "//input[@name='providerName']") + public WebElement byoidProvider; + + @FindBy(how = How.XPATH, using = "//*[@id='kc-header']") + public WebElement keycloakLogo; + + @FindBy(how = How.XPATH, using = "//*[@id='kc-form-login']//*[@id='username']") + public WebElement byoidUsername; + + @FindBy(how = How.XPATH, using = "//*[@id='kc-form-login']//*[@id='password']") + public WebElement byoidPassword; + + @FindBy(how = How.XPATH, using = "//*[@id='kc-form-buttons']//*[@id='kc-login']") + public WebElement byoidSignInButton; } diff --git a/src/main/java/io/cdap/e2e/utils/CdfHelper.java b/src/main/java/io/cdap/e2e/utils/CdfHelper.java index bbc1c99ff..ba3476c69 100644 --- a/src/main/java/io/cdap/e2e/utils/CdfHelper.java +++ b/src/main/java/io/cdap/e2e/utils/CdfHelper.java @@ -68,6 +68,12 @@ default void openCdf() throws IOException, InterruptedException { CdfStudioLocators.locatePluginNameInList(ConstantsUtil.FIRST_PLUGIN_IN_LIST, "Source")); } + default void openCdfForByoid() throws IOException, InterruptedException { + SeleniumDriver.openPage(SeleniumHelper.readParameters(ConstantsUtil.CDFBYOIDURL)); + WaitHelper.waitForPageToLoad(); + CdfSignInActions.byoidLogin(); + } + default int countOfNoOfRecordsTransferredToBigQueryIn(String tableName) throws IOException, InterruptedException { int countRecords; countRecords = BigQueryClient.countBqQuery(PluginPropertyUtils.pluginProp(tableName)); diff --git a/src/main/java/io/cdap/e2e/utils/ConstantsUtil.java b/src/main/java/io/cdap/e2e/utils/ConstantsUtil.java index 90c3643bf..4ed56e754 100644 --- a/src/main/java/io/cdap/e2e/utils/ConstantsUtil.java +++ b/src/main/java/io/cdap/e2e/utils/ConstantsUtil.java @@ -42,6 +42,11 @@ public class ConstantsUtil { public static final String WRANGLER_CONNECTIONS_URL = "cdfConnectionsUrl"; public static final String REPLICATION_URL = "replicationUrl"; public static final String TESTONHDF = "testOnHdf"; + public static final String CDFBYOIDURL = "cdfbyoidurl"; + public static final String TESTBYOID = "testByoid"; + public static final String BYOID_PROVIDER = "byoidProvider"; + public static final String BYOID_USERNAME = "byoidUsername"; + public static final String BYOID_PASSWORD = "byoidPassword"; public static final String BATCH = "Batch"; public static final String REALTIME = "Realtime"; public static final String ERROR = "ERROR"; diff --git a/src/main/java/stepsdesign/PipelineSteps.java b/src/main/java/stepsdesign/PipelineSteps.java index f95c386be..3ae8a4e53 100644 --- a/src/main/java/stepsdesign/PipelineSteps.java +++ b/src/main/java/stepsdesign/PipelineSteps.java @@ -71,6 +71,11 @@ public void openDatafusionProjectToConfigurePipeline() throws IOException, Inter openCdf(); } + @Given("Open Datafusion BYOID sign in page") + public void openDatafusionByoidSignInPage() throws IOException, InterruptedException { + openCdfForByoid(); + } + @When("Select data pipeline type as: {string}") public void selectDataPipelineType(String type) { CdfStudioActions.selectDataPipelineType(type); diff --git a/src/main/resources/connectionParameters.properties b/src/main/resources/connectionParameters.properties index d70a475a3..098a99ee8 100644 --- a/src/main/resources/connectionParameters.properties +++ b/src/main/resources/connectionParameters.properties @@ -6,6 +6,8 @@ cdfurl=http://localhost:11011/pipelines/ns/default/studio cdfConnectionsUrl=http://localhost:11011/cdap/ns/default/connections # CDAP Replication url replicationUrl=http://localhost:11011/cdap/ns/default/replication/create +# CDF BYOID url +cdfbyoidurl=https://test-byoid-cdf-url/ testOnHdf=false hdfUsername=cdap @@ -15,6 +17,11 @@ testOnCdf=false cdfUsername=dummy cdfPassword=dummy +testByoid=false +byoidProvider=test-provider +byoidUsername=test-user +byoidPassword=test-password + screenshotForAllSteps=false # properties to be removed-start