diff --git a/src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java b/src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java index d29d0644b..85470cff9 100644 --- a/src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java +++ b/src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java @@ -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); + } } diff --git a/src/main/java/io/cdap/e2e/pages/actions/WranglerActions.java b/src/main/java/io/cdap/e2e/pages/actions/WranglerActions.java index eeefd6054..acae7411a 100644 --- a/src/main/java/io/cdap/e2e/pages/actions/WranglerActions.java +++ b/src/main/java/io/cdap/e2e/pages/actions/WranglerActions.java @@ -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; @@ -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)); @@ -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); @@ -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)); @@ -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); @@ -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); @@ -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)); @@ -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()); @@ -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)); } diff --git a/src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java b/src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java index eff785632..a323a5635 100644 --- a/src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java +++ b/src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java @@ -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']"); + } }