From 26c5f3cac4e2ffe08f2d9bf1b38ef696087e4e19 Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Thu, 20 Apr 2023 15:34:52 +0800 Subject: [PATCH] [E2E-Test] Try to fix flaky e2e test (#13971) * try to fix flaky e2e test --- .../dolphinscheduler/e2e/pages/resource/ResourcePage.java | 3 +++ .../dolphinscheduler/e2e/pages/resource/UdfManagePage.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java index 1faba6d090..f5a7b075d1 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java @@ -50,6 +50,7 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(fileManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab()); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/file-manage")); return tab.cast(new FileManagePage(driver)); } @@ -57,6 +58,7 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(udfManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", udfManageTab()); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource-manage")); return tab.cast(new UdfManagePage(driver)); } @@ -64,6 +66,7 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(functionManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", functionManageTab()); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/function-manage")); return tab.cast(new FunctionManagePage(driver)); } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java index ab50e25fae..319c1e744c 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java @@ -34,6 +34,8 @@ import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBys; import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; @Getter public class UdfManagePage extends NavBarPage implements ResourcePage.Tab { @@ -79,6 +81,8 @@ public class UdfManagePage extends NavBarPage implements ResourcePage.Tab { } public UdfManagePage uploadFile(String filePath) { + new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(buttonUploadUdf)); + buttonUploadUdf().click(); driver.setFileDetector(new LocalFileDetector());