diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java index 254a2af719..08c335fbd6 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java @@ -19,7 +19,6 @@ package org.apache.dolphinscheduler.e2e.cases; - import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; @@ -38,6 +37,7 @@ import org.openqa.selenium.remote.RemoteWebDriver; @DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml") class TenantE2ETest { private static final String tenant = System.getProperty("user.name"); + private static final String editDescription = "This is a test"; private static RemoteWebDriver browser; @@ -74,11 +74,27 @@ class TenantE2ETest { .contains("already exists") ); - page.createTenantForm().buttonCancel().click(); + page.tenantForm().buttonCancel().click(); } @Test @Order(30) + void testUpdateTenant() { + TenantPage page = new TenantPage(browser); + + page.update(tenant, editDescription); + + await().untilAsserted(() -> { + browser.navigate().refresh(); + assertThat(page.tenantList()) + .as("Tenant list should contain newly-modified tenant") + .extracting(WebElement::getText) + .anyMatch(it -> it.contains(tenant)); + }); + } + + @Test + @Order(40) void testDeleteTenant() { final TenantPage page = new TenantPage(browser); page.delete(tenant); 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 17f1ac8cde..7f071a4f44 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 @@ -46,12 +46,17 @@ public final class TenantPage extends NavBarPage implements SecurityPage.Tab { }) private WebElement buttonConfirm; - private final CreateTenantForm createTenantForm; + @FindBy(className = "tenantCode") + private WebElement tenantCode; + + private final TenantForm tenantForm; + private final TenantForm editTenantForm; public TenantPage(RemoteWebDriver driver) { super(driver); - createTenantForm = new CreateTenantForm(); + tenantForm = new TenantForm(); + editTenantForm = new TenantForm(); } public TenantPage create(String tenant) { @@ -60,9 +65,27 @@ public final class TenantPage extends NavBarPage implements SecurityPage.Tab { public TenantPage create(String tenant, String description) { buttonCreateTenant().click(); - createTenantForm().inputTenantCode().sendKeys(tenant); - createTenantForm().inputDescription().sendKeys(description); - createTenantForm().buttonSubmit().click(); + tenantForm().inputTenantCode().sendKeys(tenant); + tenantForm().inputDescription().sendKeys(description); + tenantForm().buttonSubmit().click(); + + return this; + } + + public TenantPage update(String tenant, String description) { + tenantList().stream() + .filter(it -> it.findElement(By.className("tenantCode")).getAttribute("innerHTML").contains(tenant)) + .flatMap(it -> it.findElements(By.className("edit")).stream()) + .filter(WebElement::isDisplayed) + .findFirst() + .orElseThrow(() -> new RuntimeException("No edit button in tenant list")) + .click(); + + TenantForm editTenantForm = new TenantForm(); + + editTenantForm.inputDescription().clear(); + editTenantForm.inputDescription().sendKeys(description); + editTenantForm.buttonSubmit().click(); return this; } @@ -83,8 +106,8 @@ public final class TenantPage extends NavBarPage implements SecurityPage.Tab { } @Getter - public class CreateTenantForm { - CreateTenantForm() { + public class TenantForm { + TenantForm() { PageFactory.initElements(driver, this); } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/list.vue index 35195d8f6d..e42f34828c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/list.vue @@ -19,7 +19,7 @@
- +