jerryshao commented on code in PR #6460: URL: https://github.com/apache/gravitino/pull/6460#discussion_r1969517075
########## web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java: ########## @@ -683,79 +683,67 @@ public boolean verifyShowTableTitle(String title) { */ public boolean verifyShowPropertiesItemInList( String item, String key, String value, Boolean isHighlight) { - try { - Thread.sleep(ACTION_SLEEP_MILLIS); - String xpath; - if (isHighlight) { - xpath = "//div[@data-refer='props-" + item + "-" + key + "-highlight']"; - } else { - xpath = "//div[@data-refer='props-" + item + "-" + key + "']"; - } - WebElement propertyElement = driver.findElement(By.xpath(xpath)); - boolean match = Objects.equals(propertyElement.getText(), value); + WebDriverWait wait = new WebDriverWait(driver, ACTION_SLEEP); + String xpath; + if (isHighlight) { + xpath = "//div[@data-refer='props-" + item + "-" + key + "-highlight']"; + } else { + xpath = "//div[@data-refer='props-" + item + "-" + key + "']"; + } + WebElement propertyElement = + wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath))); - if (!match) { - LOG.error("Prop: does not include itemName: {}", value); - return false; - } + boolean match = Objects.equals(propertyElement.getText(), value); - return true; - } catch (Exception e) { - LOG.error(e.getMessage(), e); + if (!match) { + LOG.error("Prop: does not include itemName: {}", value); return false; } + return true; } public boolean verifyShowDataItemInList(String itemName, Boolean isColumnLevel) { - try { - Thread.sleep(ACTION_SLEEP_MILLIS); - String xpath = - "//div[@data-refer='table-grid']//div[contains(@class, 'MuiDataGrid-main')]/div[contains(@class, 'MuiDataGrid-virtualScroller')]/div/div[@role='rowgroup']//div[@data-field='name']"; - if (isColumnLevel) { - xpath = xpath + "//p"; - } - List<WebElement> list = driver.findElements(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); - return false; - } + WebDriverWait wait = new WebDriverWait(driver, ACTION_SLEEP); + String xpath = + "//div[@data-refer='table-grid']//div[contains(@class, 'MuiDataGrid-main')]/div[contains(@class, 'MuiDataGrid-virtualScroller')]/div/div[@role='rowgroup']//div[@data-field='name']"; + 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()); + } - return true; - } catch (Exception e) { - LOG.error(e.getMessage(), e); + if (!texts.contains(itemName)) { + LOG.error("table list: {} does not include itemName: {}", texts, itemName); return false; } + + return true; } public boolean verifyNoDataItemInList(String itemName, Boolean isColumnLevel) { - try { - Thread.sleep(ACTION_SLEEP_MILLIS); - String xpath = - "//div[@data-refer='table-grid']//div[contains(@class, 'MuiDataGrid-main')]/div[contains(@class, 'MuiDataGrid-virtualScroller')]/div/div[@role='rowgroup']//div[@data-field='name']"; - if (isColumnLevel) { - xpath = xpath + "//p"; - } - List<WebElement> list = driver.findElements(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); - return false; - } + String xpath = + "//div[@data-refer='table-grid']//div[contains(@class, 'MuiDataGrid-main')]/div[contains(@class, 'MuiDataGrid-virtualScroller')]/div/div[@role='rowgroup']//div[@data-field='name']"; Review Comment: Some lines like here are too long, our format requires that each line should not be longer than 100 characters, can you break such super long line into several lines? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org