Skip to content

Commit

Permalink
[CI] Fix flaky e2e test (#3882)
Browse files Browse the repository at this point in the history
* fix flaky e2e test
  • Loading branch information
SbloodyS authored Jul 18, 2024
1 parent 383f2ef commit 006dd94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,6 +57,7 @@ public UploadsPage(RemoteWebDriver driver) {
super(driver);
}

@SneakyThrows
public UploadsPage createUpload(String engineType, String resourceType, String resourceName,
String resource,
String description) {
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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();
Expand All @@ -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()
Expand Down

0 comments on commit 006dd94

Please sign in to comment.