This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new fd38ef1 [E2E] Add the update test for tenant (#8282)
fd38ef1 is described below
commit fd38ef129bdbf214c1ede39caac9bd802427a6a0
Author: QuakeWang <[email protected]>
AuthorDate: Tue Feb 8 09:25:00 2022 +0800
[E2E] Add the update test for tenant (#8282)
---
.../dolphinscheduler/e2e/cases/TenantE2ETest.java | 20 ++++++++++--
.../e2e/pages/security/TenantPage.java | 37 ++++++++++++++++++----
.../pages/security/pages/tenement/_source/list.vue | 4 +--
3 files changed, 50 insertions(+), 11 deletions(-)
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 254a2af..08c335f 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 17f1ac8..7f071a4 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 35195d8..e42f348 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 @@
<div class="table-box">
<el-table :data="list" size="mini" style="width: 100%"
row-class-name="items">
<el-table-column type="index" :label="$t('#')"
width="50"></el-table-column>
- <el-table-column prop="tenantCode" :label="$t('OS Tenant Code')"
min-width="100"></el-table-column>
+ <el-table-column prop="tenantCode" :label="$t('OS Tenant Code')"
min-width="100" class-name="tenantCode"></el-table-column>
<el-table-column :label="$t('Description')" min-width="100">
<template slot-scope="scope">
<span>{{scope.row.description | filterNull}}</span>
@@ -39,7 +39,7 @@
<el-table-column :label="$t('Operation')" width="100">
<template slot-scope="scope">
<el-tooltip :content="$t('Edit')" placement="top">
- <el-button type="primary" size="mini"
icon="el-icon-edit-outline" @click="_edit(scope.row)" circle></el-button>
+ <el-button type="primary" size="mini"
icon="el-icon-edit-outline" @click="_edit(scope.row)" circle
class="edit"></el-button>
</el-tooltip>
<el-tooltip :content="$t('Delete')" placement="top">
<el-button type="danger" size="mini" icon="el-icon-delete"
circle></el-button>