From 006dd94a7abbeec839bba459ca30550843cda87a Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Thu, 18 Jul 2024 12:02:01 +0800 Subject: [PATCH] [CI] Fix flaky e2e test (#3882) * fix flaky e2e test --- .../e2e/cases/UploadManagementTest.java | 2 +- .../e2e/pages/resource/UploadsPage.java | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java index 9fa8577b97..69d96b309a 100644 --- a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java +++ b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java @@ -87,7 +87,7 @@ void testCreateUpload() { @Order(20) void testCreateDuplicateUpload() { final UploadsPage uploadsPage = new UploadsPage(browser); - browser.navigate().refresh(); + uploadsPage.createUpload(engineType, resourceType, resourceName, mavenPom, description); Awaitility.await() diff --git a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java index 59e0921380..ae272d0ba2 100644 --- a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java +++ b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java @@ -21,6 +21,7 @@ import org.apache.streampark.e2e.pages.common.NavBarPage; import lombok.Getter; +import lombok.SneakyThrows; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -56,6 +57,7 @@ public UploadsPage(RemoteWebDriver driver) { super(driver); } + @SneakyThrows public UploadsPage createUpload(String engineType, String resourceType, String resourceName, String resource, String description) { @@ -67,8 +69,7 @@ public UploadsPage createUpload(String engineType, String resourceType, String r // select engine type. createUploadForm.btnSelectEngineTypeDropDown().click(); - new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION) - .until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectEngineType())); + Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS); createUploadForm.selectEngineType().stream() .filter(e -> e.getText().equals(engineType)) .findFirst() @@ -79,8 +80,7 @@ public UploadsPage createUpload(String engineType, String resourceType, String r // select resource type. createUploadForm.btnSelectResourceTypeDropDown().click(); - new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION) - .until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectResourceType())); + Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS); createUploadForm.selectResourceType().stream() .filter(e -> e.getText().equals(resourceType)) .findFirst() @@ -97,6 +97,7 @@ public UploadsPage createUpload(String engineType, String resourceType, String r return this; } + @SneakyThrows public UploadsPage editUpload(String engineType, String resourceType, String resourceName, String resource, String description) { waitForPageLoading(); @@ -112,20 +113,18 @@ public UploadsPage editUpload(String engineType, String resourceType, String res // select engine type. createUploadForm.btnSelectEngineTypeDropDown().click(); - new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION) - .until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectEngineType())); - createUploadForm.selectResourceType.stream() + Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS); + createUploadForm.selectEngineType().stream() .filter(e -> e.getText().equals(engineType)) .findFirst() .orElseThrow( () -> new RuntimeException( - String.format("No %s in resourceType dropdown list", resourceType))) + String.format("No %s in engineType dropdown list", resourceType))) .click(); // select resource type. createUploadForm.btnSelectResourceTypeDropDown().click(); - new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION) - .until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectResourceType())); + Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS); createUploadForm.selectResourceType().stream() .filter(e -> e.getText().equals(resourceType)) .findFirst()