Skip to content

Commit

Permalink
Merge pull request #250 from cloudsufi/stepsForByoidTest
Browse files Browse the repository at this point in the history
Add steps for CDF BYOID login test
  • Loading branch information
Vipinofficial11 authored Aug 27, 2024
2 parents 65ba38c + 3c8da48 commit 2c58750
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
15 changes: 15 additions & 0 deletions src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 6 additions & 0 deletions src/main/java/io/cdap/e2e/utils/CdfHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/cdap/e2e/utils/ConstantsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/stepsdesign/PipelineSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/connectionParameters.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2c58750

Please sign in to comment.