diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TenantPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TenantPage.java index eba9cce566..17f1ac8cde 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TenantPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TenantPage.java @@ -71,8 +71,11 @@ public final class TenantPage extends NavBarPage implements SecurityPage.Tab { tenantList() .stream() .filter(it -> it.getText().contains(tenant)) + .flatMap(it -> it.findElements(By.className("delete")).stream()) + .filter(WebElement::isDisplayed) .findFirst() - .ifPresent(it -> it.findElement(By.className("delete")).click()); + .orElseThrow(() -> new RuntimeException("No delete button in user list")) + .click(); buttonConfirm().click();