This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-1.0 by this push:
new 4e5256d8f4 [#8559] improvement(CI): fix Frontend CI failed by
StaleElementReferenceException (#8567)
4e5256d8f4 is described below
commit 4e5256d8f4444cf1ab69fe3e337a0107dd3ca43b
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Sep 16 18:22:15 2025 +0800
[#8559] improvement(CI): fix Frontend CI failed by
StaleElementReferenceException (#8567)
### What changes were proposed in this pull request?
fix Frontend CI failed by StaleElementReferenceException
### Why are the changes needed?
Fix: #8559
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
CI pass
Co-authored-by: mchades <[email protected]>
---
.../test/web/ui/pages/CatalogsPage.java | 36 ++++++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
index a59d8927a1..e47cb28215 100644
---
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
+++
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
@@ -30,6 +30,7 @@ import
org.apache.gravitino.integration.test.web.ui.utils.BaseWebIT;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
+import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@@ -737,19 +738,34 @@ public class CatalogsPage extends BaseWebIT {
if (isColumnLevel) {
xpath = xpath + "//p";
}
- List<WebElement> list =
-
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(xpath)));
- List<String> texts = new ArrayList<>();
- for (WebElement element : list) {
- texts.add(element.getText());
- }
- if (!texts.contains(itemName)) {
- LOG.error("table list: {} does not include itemName: {}", texts,
itemName);
+ try {
+ List<WebElement> list =
+
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(xpath)));
+ List<String> texts = new ArrayList<>();
+
+ for (int i = 0; i < list.size(); i++) {
+ try {
+ texts.add(list.get(i).getText());
+ } catch (StaleElementReferenceException e) {
+ // Element failed, re-find and obtain text
+ List<WebElement> refreshedList =
driver.findElements(By.xpath(xpath));
+ if (i < refreshedList.size()) {
+ texts.add(refreshedList.get(i).getText());
+ }
+ }
+ }
+
+ if (!texts.contains(itemName)) {
+ LOG.error("table list: {} does not include itemName: {}", texts,
itemName);
+ }
+
+ return texts.contains(itemName);
+ } catch (StaleElementReferenceException e) {
+ // The entire lookup process failed, return false to let the outer layer
retry.
+ LOG.warn("Elements became stale during verification, will retry", e);
return false;
}
-
- return true;
}
public boolean verifyNoDataItemInList(String itemName, Boolean
isColumnLevel) {