Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.streampark.e2e.pages.common.NavBarPage.NavBarItem;

import lombok.Getter;
import lombok.SneakyThrows;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.FindBy;
Expand All @@ -44,24 +45,28 @@
super(driver);
}

@SneakyThrows
public <T extends ResourcePage.Tab> T goToTab(Class<T> tab) {
if (tab == VariablesPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuVariables));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 53 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnFo9TAn_2XzXnvj&open=AZ0YXnFo9TAn_2XzXnvj&pullRequest=4337
menuVariables.click();
Comment on lines +48 to 54
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed Thread.sleep before clicking will slow every navigation and can still be flaky on slower/faster environments. Prefer waiting on a deterministic condition (e.g., the Resource menu container has the expected "opened" class / submenu is fully expanded, or retry click until not intercepted) rather than a hard-coded sleep.

Copilot uses AI. Check for mistakes.
Comment on lines +48 to 54
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SneakyThrows around Thread.sleep will propagate InterruptedException as an unchecked exception and also clears the interrupt flag. Please catch InterruptedException explicitly here, call Thread.currentThread().interrupt(), and then fail fast so test interruptions/shutdowns behave correctly.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wolfboys This sleep pattern (@SneakyThrows + Thread.sleep(DEFAULT_SLEEP_MILLISECONDS)) is already used in 21 places across the e2e module. My code follows the same convention — sleeping 2000ms after clicking a dropdown to wait for options to render, identical to ApplicationForm.flinkCluster() and UploadsPage. Modifying all existing occurrences would be too invasive; I suggest keeping the current approach consistent.
Like this
image

return tab.cast(new VariablesPage(driver));
}

if (tab == ProjectsPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuProjects));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 61 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnFo9TAn_2XzXnvk&open=AZ0YXnFo9TAn_2XzXnvk&pullRequest=4337
menuProjects.click();
return tab.cast(new ProjectsPage(driver));
}

if (tab == UploadsPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuUploads));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 69 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnFo9TAn_2XzXnvl&open=AZ0YXnFo9TAn_2XzXnvl&pullRequest=4337
menuUploads.click();
return tab.cast(new UploadsPage(driver));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.streampark.e2e.pages.common.NavBarPage.NavBarItem;

import lombok.Getter;
import lombok.SneakyThrows;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -50,37 +51,43 @@
super(driver);
}

@SneakyThrows
public <T extends SystemPage.Tab> T goToTab(Class<T> tab) {
if (tab == UserManagementPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuUserManagement));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 59 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/system/SystemPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnDi9TAn_2XzXnve&open=AZ0YXnDi9TAn_2XzXnve&pullRequest=4337
menuUserManagement.click();
Comment on lines +54 to 60
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed Thread.sleep before clicking will slow every navigation and can still be flaky on slower/faster environments. Since NavBarPage already detects expanded menus via the streampark-menu-opened class, prefer an explicit WebDriverWait for the System menu to be in the opened/expanded state (or retry the click until it succeeds) instead of a hard-coded sleep.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to 60
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SneakyThrows around Thread.sleep will propagate InterruptedException as an unchecked exception and also clears the interrupt flag. Please catch InterruptedException explicitly here, call Thread.currentThread().interrupt(), and then fail fast (e.g., rethrow a RuntimeException) so test interruptions/shutdowns behave correctly.

Copilot uses AI. Check for mistakes.
return tab.cast(new UserManagementPage(driver));
}

if (tab == TeamManagementPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuTeamManagement));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 67 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/system/SystemPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnDi9TAn_2XzXnvf&open=AZ0YXnDi9TAn_2XzXnvf&pullRequest=4337
menuTeamManagement.click();
return tab.cast(new TeamManagementPage(driver));
}

if (tab == RoleManagementPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuRoleManagement));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 75 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/system/SystemPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnDi9TAn_2XzXnvg&open=AZ0YXnDi9TAn_2XzXnvg&pullRequest=4337
menuRoleManagement.click();
return tab.cast(new RoleManagementPage(driver));
}
if (tab == TokenManagementPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuTokenManagement));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 82 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/system/SystemPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnDi9TAn_2XzXnvh&open=AZ0YXnDi9TAn_2XzXnvh&pullRequest=4337
menuTokenManagement.click();
return tab.cast(new TokenManagementPage(driver));
}

if (tab == MemberManagementPage.class) {
new WebDriverWait(driver, Constants.DEFAULT_WEBDRIVER_WAIT_DURATION)
.until(ExpectedConditions.elementToBeClickable(menuMemberManagement));
Thread.sleep(Constants.DEFAULT_SLEEP_MILLISECONDS);

Check warning on line 90 in streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/system/SystemPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ0YXnDi9TAn_2XzXnvi&open=AZ0YXnDi9TAn_2XzXnvi&pullRequest=4337
menuMemberManagement.click();
return tab.cast(new MemberManagementPage(driver));
}
Expand Down
Loading