Skip to content

Commit

Permalink
Merge pull request #266 from cloudsufi/e2e_errorfix_cherrypick
Browse files Browse the repository at this point in the history
[🍒] e2e error details fix
  • Loading branch information
itsankit-google authored Feb 6, 2025
2 parents e47edfd + f12f183 commit 1fccba6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
35 changes: 35 additions & 0 deletions src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,39 @@ public static void importPipeline(String filePath) throws URISyntaxException {
FileImportUtil.uploadFile(CdfStudioLocators.importPipelineInputTag(), filePath);
clickOnFixAllButtonIfDisplayed();
}

/**
* Wait till the Pipeline's preview run status banner is displayed within error details
*/
public static void waitTillPipelinePreviewRunCompletesWithError() {
waitTillPipelinePreviewRunCompletesWithErrorDetails();
}

/**
* Wait till the Pipeline's preview run status banner is displayed with error text on banner
*/
public static void waitTillPipelinePreviewRunCompletesWithErrorDetails() {
WaitHelper.waitForElementToBePresent(CdfStudioLocators.errorDetailsTextOnBanner());
}

/**
* Click on the View Details button on the Pipeline preview error banner
*/
public static void clickOnViewDetailsButtonOnErrorBanner() {
ElementHelper.clickOnElement(CdfStudioLocators.errorDetailsBannerViewDetailsButton);
}

/**
* Click on the Close button on the Pipeline preview error banner
*/
public static void clickOnCloseButtonOnErrorBanner() {
ElementHelper.clickOnElement(CdfStudioLocators.errorDetailsBannerCloseButton);
}

/**
* Click on the View Logs button on the Pipeline preview error banner
*/
public static void clickOnViewLogsButtonOnErrorBanner() {
ElementHelper.clickOnElement(CdfStudioLocators.errorStatusBannerViewLogsButton);
}
}
23 changes: 16 additions & 7 deletions src/main/java/io/cdap/e2e/pages/actions/WranglerActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.cdap.e2e.pages.actions;

import io.cdap.e2e.pages.locators.WranglerLocators;
import io.cdap.e2e.utils.ConstantsUtil;
import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.e2e.utils.SeleniumDriver;
Expand Down Expand Up @@ -44,7 +45,8 @@ public class WranglerActions {
* @param directive The directive to be selected for the column.
*/
public static void selectDirective(String columnName, String directive) {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
ElementHelper.clickOnElement(WranglerLocators.locateDirectivesTitle(pluginPropertyDirective));
Expand All @@ -60,7 +62,8 @@ public static void selectDirective(String columnName, String directive) {
*/
public static void selectDirectiveAndOption(String columnName, String directive, String option)
throws InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
String pluginPropertyDirectiveOption = PluginPropertyUtils.getPluginPropertyElementTestId(option);
Expand Down Expand Up @@ -145,7 +148,8 @@ public static void selectDirectiveAndOption(String columnName, String directive,
public static void selectDirectiveTypeWithDropdownAndText(String columnName, String directive, String directiveType,
String text) throws
InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
ElementHelper.clickOnElement(WranglerLocators.locateDirectivesTitle(pluginPropertyDirective));
Expand Down Expand Up @@ -192,7 +196,8 @@ public static void selectDirectiveTypeWithDropdownAndText(String columnName, Str
public static void selectDirectiveTypeWithThreeOptions(String columnName, String directive, String directiveType,
String option)
throws InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
String pluginPropertyDirectiveOption = PluginPropertyUtils.getPluginPropertyElementTestId(directiveType);
Expand Down Expand Up @@ -278,7 +283,8 @@ public static void selectDirectiveTypeWithThreeOptions(String columnName, String
public static void selectDirectiveTypeWithFourOption(String columnName, String directive, String directiveType,
String option, String text)
throws InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
String pluginPropertyDirectiveOption = PluginPropertyUtils.getPluginPropertyElementTestId(directiveType);
Expand Down Expand Up @@ -328,7 +334,8 @@ public static void selectDirectiveTypeWithFourOption(String columnName, String d
public static void selectDirectiveTypeWithFiveOption(String columnName, String directive, String option1,
String option2, String option3, String option4)
throws InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.locateTransformationButton(columnName));
ElementHelper.clickOnElement(WranglerLocators.locateTransformationButton(columnName));
String pluginPropertyDirective = PluginPropertyUtils.getPluginPropertyElementTestId(directive);
ElementHelper.clickOnElement(WranglerLocators.locateDirectivesTitle(pluginPropertyDirective));
Expand Down Expand Up @@ -364,7 +371,8 @@ public static void selectDirectiveTypeWithFiveOption(String columnName, String d
* @throws InterruptedException If interrupted while waiting.
*/
public static void enterDirectiveFromCommandLine(String directive) throws InterruptedException {
WaitHelper.waitForPageToLoad();
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
WaitHelper.waitForElementToBeEnabled(WranglerLocators.directiveCommandLine);
WaitHelper.waitForElementToBeClickable(WranglerLocators.directiveCommandLine);
ElementHelper.sendKeys(WranglerLocators.directiveCommandLine, directive);
Actions act = new Actions(SeleniumDriver.getDriver());
Expand All @@ -378,6 +386,7 @@ public static void enterDirectiveFromCommandLine(String directive) throws Interr
* @param column2 The second column's name to select its checkbox.
*/
public static void selectCheckboxOnTwoColumns(String column1, String column2) {
WaitHelper.waitForPageToLoad(ConstantsUtil.DEFAULT_TIMEOUT_SECONDS);
ElementHelper.clickOnElement(WranglerLocators.locateCheckboxOfColumn(column1));
ElementHelper.clickOnElement(WranglerLocators.locateCheckboxOfColumn(column2));
}
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,20 @@ public static WebElement importPipelineInputTag() {
return SeleniumDriver.getDriver().findElement(By.xpath
("//input[@id='resource-center-import-pipeline']"));
}

@FindBy(how = How.XPATH, using = "//*[@data-testid='features-pipelineDetails-errorDetails-errorCountMessage']")
public static WebElement errorDetailsBannerText;

@FindBy(how = How.XPATH, using = "//*[@data-testid='features-pipelineDetails-errorDetails-closeButton']")
public static WebElement errorDetailsBannerCloseButton;

@FindBy(how = How.XPATH, using = "//*[@data-testid='features-pipelineDetails-errorDetails-viewDetailsButton']")
public static WebElement errorDetailsBannerViewDetailsButton;

@FindBy(how = How.XPATH, using = "//*[@data-testid='features-pipelineDetails-errorDetails-viewLogsButton']")
public static WebElement errorStatusBannerViewLogsButton;

public static By errorDetailsTextOnBanner() {
return By.xpath("//*[@data-testid='features-pipelineDetails-errorDetails-errorCountMessage']");
}
}

0 comments on commit 1fccba6

Please sign in to comment.