From 03a71297dde728bc120dd27cc81b4169989e752d Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Wed, 22 Dec 2021 14:53:39 +0800 Subject: [PATCH] Unify the element selector rules for E2E (#7409) * Unify the element selector rules for E2E * Fix typo in docker swarm --- dolphinscheduler-e2e/README.md | 6 +++--- .../dolphinscheduler/e2e/pages/LoginPage.java | 6 +++--- .../e2e/pages/common/NavBarPage.java | 4 ++-- .../e2e/pages/project/ProjectDetailPage.java | 4 ++-- .../e2e/pages/project/ProjectPage.java | 8 ++++---- .../project/workflow/WorkflowDefinitionTab.java | 8 ++++---- .../e2e/pages/project/workflow/WorkflowForm.java | 2 +- .../project/workflow/WorkflowInstanceTab.java | 8 ++++---- .../pages/project/workflow/WorkflowRunDialog.java | 2 +- .../pages/project/workflow/WorkflowSaveDialog.java | 6 +++--- .../pages/project/workflow/task/TaskNodeForm.java | 4 ++-- .../e2e/pages/security/SecurityPage.java | 2 +- .../e2e/pages/security/TenantPage.java | 14 +++++++------- .../conf/home/pages/dag/_source/canvas/toolbar.vue | 2 +- .../home/pages/dag/_source/formModel/formModel.vue | 4 ++-- .../pages/dag/_source/udp/_source/selectTenant.vue | 2 +- .../src/js/conf/home/pages/dag/_source/udp/udp.vue | 4 ++-- .../pages/definition/pages/list/_source/list.vue | 6 +++--- .../pages/definition/pages/list/_source/start.vue | 2 +- .../projects/pages/definition/pages/list/index.vue | 2 +- .../pages/instance/pages/list/_source/list.vue | 6 +++--- .../projects/pages/list/_source/createProject.vue | 4 ++-- .../pages/projects/pages/list/_source/list.vue | 2 +- .../conf/home/pages/projects/pages/list/index.vue | 2 +- .../pages/tenement/_source/createTenement.vue | 10 +++++----- .../pages/security/pages/tenement/_source/list.vue | 2 +- .../home/pages/security/pages/tenement/index.vue | 2 +- dolphinscheduler-ui/src/js/conf/login/App.vue | 6 +++--- .../src/js/module/components/nav/nav.vue | 4 ++-- .../components/secondaryMenu/_source/menu.js | 6 +++--- 30 files changed, 70 insertions(+), 70 deletions(-) diff --git a/dolphinscheduler-e2e/README.md b/dolphinscheduler-e2e/README.md index 35c3043a1c..f41e5539f2 100644 --- a/dolphinscheduler-e2e/README.md +++ b/dolphinscheduler-e2e/README.md @@ -14,13 +14,13 @@ following fields, ```java public final class LoginPage { - @FindBy(id = "input-username") + @FindBy(id = "inputUsername") private WebElement inputUsername; - @FindBy(id = "input-password") + @FindBy(id = "inputPassword") private WebElement inputPassword; - @FindBy(id = "button-login") + @FindBy(id = "btnLogin") private WebElement buttonLogin; } ``` diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java index f2431d6311..9fd782d2df 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java @@ -33,13 +33,13 @@ import lombok.SneakyThrows; @Getter public final class LoginPage extends NavBarPage { - @FindBy(id = "input-username") + @FindBy(id = "inputUsername") private WebElement inputUsername; - @FindBy(id = "input-password") + @FindBy(id = "inputPassword") private WebElement inputPassword; - @FindBy(id = "button-login") + @FindBy(id = "btnLogin") private WebElement buttonLogin; public LoginPage(RemoteWebDriver driver) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java index 546a714236..e9d54d4ad7 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java @@ -33,9 +33,9 @@ import lombok.Getter; public class NavBarPage { protected final RemoteWebDriver driver; - @FindBy(id = "project-tab") + @FindBy(id = "tabProject") private WebElement projectTab; - @FindBy(id = "security-tab") + @FindBy(id = "tabSecurity") private WebElement securityTab; public NavBarPage(RemoteWebDriver driver) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectDetailPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectDetailPage.java index 5dd7051524..f4440cca0a 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectDetailPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectDetailPage.java @@ -31,9 +31,9 @@ import lombok.Getter; @Getter public final class ProjectDetailPage extends NavBarPage { - @FindBy(className = "process-definition") + @FindBy(className = "tab-process-definition") private WebElement menuProcessDefinition; - @FindBy(className = "process-instance") + @FindBy(className = "tab-process-instance") private WebElement menuProcessInstances; public ProjectDetailPage(RemoteWebDriver driver) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectPage.java index 86cdb931bd..53522ef16a 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/ProjectPage.java @@ -37,10 +37,10 @@ import lombok.Getter; @Getter public final class ProjectPage extends NavBarPage implements NavBarItem { - @FindBy(id = "button-create-project") + @FindBy(id = "btnCreateProject") private WebElement buttonCreateProject; - @FindBy(className = "rows-project") + @FindBy(className = "items-project") private List projectList; @FindBys({ @@ -105,10 +105,10 @@ public final class ProjectPage extends NavBarPage implements NavBarItem { PageFactory.initElements(driver, this); } - @FindBy(id = "input-project-name") + @FindBy(id = "inputProjectName") private WebElement inputProjectName; - @FindBy(id = "button-submit") + @FindBy(id = "btnSubmit") private WebElement buttonSubmit; } } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java index 5d30dcd19b..49e997d283 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java @@ -34,18 +34,18 @@ import java.util.stream.Collectors; @Getter public final class WorkflowDefinitionTab extends NavBarPage implements ProjectDetailPage.Tab { - @FindBy(id = "button-create-process") + @FindBy(id = "btnCreateProcess") private WebElement buttonCreateProcess; @FindBy(className = "select-all") private WebElement checkBoxSelectAll; - @FindBy(className = "button-delete-all") + @FindBy(className = "btn-delete-all") private WebElement buttonDeleteAll; @FindBys({ @FindBy(className = "el-popconfirm"), @FindBy(className = "el-button--primary"), }) private List buttonConfirm; - @FindBy(className = "rows-workflow-definitions") + @FindBy(className = "items") private List workflowList; public WorkflowDefinitionTab(RemoteWebDriver driver) { @@ -88,7 +88,7 @@ public final class WorkflowDefinitionTab extends NavBarPage implements ProjectDe final Supplier> cancelButtons = () -> workflowList() .stream() - .flatMap(it -> it.findElements(By.className("button-cancel-publish")).stream()) + .flatMap(it -> it.findElements(By.className("btn-cancel-publish")).stream()) .filter(WebElement::isDisplayed) .collect(Collectors.toList()); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java index b4250829d6..87da7823df 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java @@ -42,7 +42,7 @@ public final class WorkflowForm { private final WebDriver driver; private final WorkflowSaveDialog saveForm; - @FindBy(id = "button-save") + @FindBy(id = "btnSave") private WebElement buttonSave; public WorkflowForm(WebDriver driver) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowInstanceTab.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowInstanceTab.java index 97f29b40a9..fcb6de981e 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowInstanceTab.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowInstanceTab.java @@ -36,11 +36,11 @@ import lombok.RequiredArgsConstructor; @Getter public final class WorkflowInstanceTab extends NavBarPage implements ProjectDetailPage.Tab { - @FindBy(className = "rows-workflow-instances") + @FindBy(className = "items-workflow-instances") private List instanceList; @FindBy(className = "select-all") private WebElement checkBoxSelectAll; - @FindBy(className = "button-delete-all") + @FindBy(className = "btn-delete-all") private WebElement buttonDeleteAll; @FindBys({ @FindBy(className = "el-popconfirm"), @@ -82,7 +82,7 @@ public final class WorkflowInstanceTab extends NavBarPage implements ProjectDeta private final WebElement row; public WebElement rerunButton() { - return row.findElement(By.className("button-rerun")); + return row.findElement(By.className("btn-rerun")); } public boolean isSuccess() { @@ -94,7 +94,7 @@ public final class WorkflowInstanceTab extends NavBarPage implements ProjectDeta } public Row rerun() { - row.findElements(By.className("button-rerun")) + row.findElements(By.className("btn-rerun")) .stream() .filter(WebElement::isDisplayed) .findFirst() diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java index 9801378454..37083f2349 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java @@ -29,7 +29,7 @@ import lombok.Getter; public final class WorkflowRunDialog { private final WorkflowDefinitionTab parent; - @FindBy(id = "button-submit") + @FindBy(id = "btnSubmit") private WebElement buttonSubmit; public WorkflowRunDialog(WorkflowDefinitionTab parent) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowSaveDialog.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowSaveDialog.java index 9c0039782d..9f0b07effa 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowSaveDialog.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowSaveDialog.java @@ -38,9 +38,9 @@ public final class WorkflowSaveDialog { private final WebDriver driver; private final WorkflowForm parent; - @FindBy(id = "input-name") + @FindBy(id = "inputName") private WebElement inputName; - @FindBy(id = "button-submit") + @FindBy(id = "btnSubmit") private WebElement buttonSubmit; @FindBys({ @FindBy(className = "input-param-key"), @@ -52,7 +52,7 @@ public final class WorkflowSaveDialog { @FindBy(tagName = "input"), }) private List inputParamVal; - @FindBy(id = "select-tenant") + @FindBy(id = "selectTenant") private WebElement selectTenant; public WorkflowSaveDialog(WorkflowForm parent) { diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java index c2e703c1e1..4537985890 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java @@ -34,9 +34,9 @@ import java.util.stream.Stream; @Getter public abstract class TaskNodeForm { - @FindBy(id = "input-node-name") + @FindBy(id = "inputNodeName") private WebElement inputNodeName; - @FindBy(id = "button-submit") + @FindBy(id = "btnSubmit") private WebElement buttonSubmit; @FindBys({ @FindBy(className = "input-param-key"), diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java index 8e4c7b9848..36f960c41e 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java @@ -30,7 +30,7 @@ import lombok.Getter; @Getter public class SecurityPage extends NavBarPage implements NavBarItem { - @FindBy(className = "tenant-manage") + @FindBy(className = "tab-tenant-manage") private WebElement menuTenantManage; public SecurityPage(RemoteWebDriver driver) { 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 6e9c548189..6fc70c6b54 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 @@ -37,10 +37,10 @@ import lombok.Getter; @Getter public final class TenantPage extends NavBarPage implements SecurityPage.Tab { - @FindBy(id = "button-create-tenant") + @FindBy(id = "btnCreateTenant") private WebElement buttonCreateTenant; - @FindBy(className = "rows-tenant") + @FindBy(className = "items") private List tenantList; @FindBys({ @@ -93,19 +93,19 @@ public final class TenantPage extends NavBarPage implements SecurityPage.Tab { PageFactory.initElements(driver, this); } - @FindBy(id = "input-tenant-code") + @FindBy(id = "inputTenantCode") private WebElement inputTenantCode; - @FindBy(id = "select-queue") + @FindBy(id = "selectQueue") private WebElement selectQueue; - @FindBy(id = "input-description") + @FindBy(id = "inputDescription") private WebElement inputDescription; - @FindBy(id = "button-submit") + @FindBy(id = "btnSubmit") private WebElement buttonSubmit; - @FindBy(id = "button-cancel") + @FindBy(id = "btnCancel") private WebElement buttonCancel; } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue index 3b8f4157bf..cb701d6586 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue @@ -143,7 +143,7 @@ type="primary" size="mini" @click="saveProcess" - id="button-save" + id="btnSave" >{{ $t("Save") }} @@ -443,7 +443,7 @@ :loading="spinnerLoading" @click="ok()" :disabled="isDetails" - id="button-submit" + id="btnSubmit" >{{ spinnerLoading ? $t("Loading...") : $t("Confirm") }} diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue index 50a789f43c..31637389d1 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue @@ -20,7 +20,7 @@ @change="_onChange" v-model="selectedValue" size="small" - id="select-tenant" + id="selectTenant" style="width: 180px"> @@ -102,7 +102,7 @@ {{$t('Cancel')}} - {{$t('Add')}} + {{$t('Add')}} diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue index b7d99bfe20..ef11f23c8e 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue @@ -17,7 +17,7 @@ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue index 9fca167e29..ec1e8988e3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue @@ -20,7 +20,7 @@