From eade9db22f31e562f18663bb02137cb8df61d607 Mon Sep 17 00:00:00 2001
From: xingchun-chen <55787491+xingchun-chen@users.noreply.github.com>
Date: Mon, 24 Aug 2020 17:16:20 +0800
Subject: [PATCH] [test-2995][e2e]Optimize waiting time (#3571)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Add task connection
* Optimize test cases
* Modify variable format
* Optimize test cases
* Update BrowserCommon.java
* Update BrowserCommon.java
* Update WorkflowDefineLocator.java
* Optimize waiting time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize project wait time
* Optimize wait time
* Optimize wait time
Co-authored-by: chenxingchun <438044805@qq.com>
---
.../data/project/ProjectData.java | 3 ++
.../data/project/WorkflowDefineData.java | 12 +++++++
.../data/security/AlertManageData.java | 14 +++-----
.../data/security/QueueManageData.java | 6 ++--
.../data/security/TokenManageData.java | 4 +++
.../data/security/UserManageData.java | 3 ++
.../project/ProcessInstanceLocator.java | 3 ++
.../locator/project/ProjectLocator.java | 3 ++
.../project/WorkflowDefineLocator.java | 15 ++++----
.../locator/security/AlertManageLocator.java | 3 +-
.../locator/security/QueueManageLocator.java | 2 ++
.../locator/security/TenantManageLocator.java | 2 ++
.../locator/security/TokenManageLocator.java | 4 +++
.../locator/security/UserManageLocator.java | 6 ++--
.../page/project/ProcessInstancePage.java | 1 +
.../page/project/ProjectPage.java | 5 ++-
.../page/project/RunWorkflowPage.java | 8 +++--
.../page/project/WorkflowDefinePage.java | 21 ++++++++---
.../page/security/AlertManagePage.java | 17 ++++-----
.../page/security/QueueManagePage.java | 23 ++++++------
.../page/security/TenantManagePage.java | 6 ++--
.../page/security/TokenManagePage.java | 35 ++++++++++---------
.../page/security/UserManagePage.java | 16 ++++++---
.../testSecurity/TestTokenManage.java | 2 +-
.../testcase/testSecurity/TestUserManage.java | 2 +-
e2e/testng.xml | 30 ++++++++--------
26 files changed, 152 insertions(+), 94 deletions(-)
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java
index fce247aa4d..036a6771bd 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java
@@ -17,6 +17,9 @@
package org.apache.dolphinscheduler.data.project;
public class ProjectData {
+
+ public static final String CREATE_PROJECT_BUTTON = "创建项目";
+
// create project name
public static final String PROJECT_NAME = "selenium_project_1";
// create project description
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java
index 0b3645f329..c9eb32e948 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java
@@ -20,6 +20,9 @@ public class WorkflowDefineData {
/**
* create workflow data
*/
+
+ public static final String workflow_define = "工作流定义";
+
//input shell task name
public static final String SHELL_TASK_NAME = "shell_task_selenium_1";
@@ -74,4 +77,13 @@ public class WorkflowDefineData {
//input to add workflow global parameters value
public static final String INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES = "selenium_global_parameters_value_2";
+
+ /**
+ * workflowDefine list
+ */
+ public static final String WORKFLOW_ONLINE_STATE = "上线";
+
+ public static final String WORKFLOW_OFFLINE_STATE = "下线";
+
+
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java
index aa470169fc..ae996a209d 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java
@@ -17,18 +17,14 @@
package org.apache.dolphinscheduler.data.security;
public class AlertManageData {
- /**
- * Alert Name
- */
+ //Alert Name
public static final String ALERT_NAME = "selenium_alert_Name";
- /**
- * Alert Type
- */
+ public static final String CREATE_ALERT = "创建告警组";
+
+ // Alert Type
public static final String ALERT_TYPE = "邮件";
- /**
- * Alert Description
- */
+ //Alert Description
public static final String DESCRIPTION = "create alert test";
public static final String ALERT_MANAGE = "告警组管理 - DolphinScheduler";
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java
index 9fa9568a35..46f0d834d1 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java
@@ -22,6 +22,8 @@ public class QueueManageData {
*/
public static final String QUEUE_NAME = "selenium_queue_name";
+ public static final String CREATE_QUEUE = "创建队列";
+
/**
* Create Queue Value
*/
@@ -30,12 +32,12 @@ public class QueueManageData {
/**
* Edit Queue Name
*/
- public static final String EDIT_QUEUE_NAME = "_edit";
+ public static final String EDIT_QUEUE_NAME = "selenium_queue_value_edit";
/**
* Edit Queue Value
*/
- public static final String EDIT_QUEUE_VALUE = "_edit";
+ public static final String EDIT_QUEUE_VALUE = "selenium_queue_value_edit";
public static final String QUEUE_MANAGE = "队列管理 - DolphinScheduler";
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java
index 6b6370f550..9dd625ec25 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java
@@ -18,7 +18,11 @@ package org.apache.dolphinscheduler.data.security;
public class TokenManageData {
public static final String TOKEN_MANAGE = "令牌管理 - DolphinScheduler";
+ public static final String CREATE_TOKEN = "创建令牌";
+
public static final String DATE = "2038-06-10 00:00:00";
+ public static final String NAME = "admin";
+
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java
index 10dcd45af7..ee7fc60bc4 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java
@@ -31,6 +31,9 @@ public class UserManageData {
public static final String USER_MANAGE = "用户管理 - DolphinScheduler";
+ public static final String CREATE_USER_BUTTON = "创建用户";
+
+
/**
* edit user
*/
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java
index 445ea3ee78..c881c276b6 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java
@@ -20,6 +20,9 @@ import org.openqa.selenium.By;
public class ProcessInstanceLocator {
// jump Process Instance page
+ // process instance state is success
+ public static final By PROCESS_INSTANCE_SUCCESS_STATE = By.xpath("//table/tr[2]/td[4]/span/em[@title['data-original-title']='成功']");
+
//click Process Instance name
public static final By CLICK_PROCESS_INSTANCE_NAME = By.xpath("//div[4]/div/ul/li[2]");
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java
index 8b26e673a6..94af3ac546 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java
@@ -34,6 +34,9 @@ public class ProjectLocator {
//submit button
public static final By SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
+ // project name
+ public static final By LIST_PROJECT_NAME = By.xpath("//table/tr[2]/td[2]/span/a");
+
//delete project button
public static final By DELETE_PROJECT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[9]/span/button");
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java
index a70b22eacf..01fdb39e4a 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java
@@ -49,10 +49,10 @@ public class WorkflowDefineLocator {
public static final By INPUT_SHELL_TASK_NAME = By.xpath("//input");
//click stop run type
- public static final By CLICK_STOP_RUN_TYPE = By.xpath("//label[2]/span/input");
+ public static final By CLICK_STOP_RUN_TYPE = By.xpath("//label[2]/span[1]/input");
//click normal run type
- public static final By CLICK_NORMAL_RUN_TYPE = By.xpath("//span/input");
+ public static final By CLICK_NORMAL_RUN_TYPE = By.xpath("//label[1]/span[1]/input");
//input shell task description
public static final By INPUT_SHELL_TASK_DESCRIPTION = By.xpath("//label/div/textarea");
@@ -182,23 +182,24 @@ public class WorkflowDefineLocator {
/**
* online workflow
*/
+ public static final By WORKFLOW_STATE = By.xpath("//table/tr[2]/td[4]/span");
+
+
// click online workflow button
- public static final By CLICK_ONLINE_WORKFLOW_BUTTON = By.xpath("//div[1]/div/table/tr[2]/td[10]/button[4]");
+ public static final By CLICK_ONLINE_WORKFLOW_BUTTON = By.xpath("//button[@title['data-original-title']='上线']");
/**
* offline workflow
*/
// click offline workflow button
- public static final By CLICK_OFFLINE_WORKFLOW_BUTTON = By.xpath("//div[1]/div/table/tr[2]/td[10]/button[4]");
-
+ public static final By CLICK_OFFLINE_WORKFLOW_BUTTON = By.xpath("//button[@title['data-original-title']='下线']");
/**
* delete workflow
*/
//click delete workflow button
- public static final By DELETE_WORKFLOW_BOTTOM = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[10]/span/button");
+ public static final By DELETE_WORKFLOW_BOTTOM = By.xpath("//table/tr[2]/td[10]/span/button");
//click confirm delete workflow button
public static final By CONFIRM_DELETE_WORKFLOW_BOTTOM = By.xpath("//div[2]/div/button[2]/span");
-
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java
index e4dbe731df..82ac473e5b 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java
@@ -28,8 +28,9 @@ public class AlertManageLocator {
public static final By INPUT_ALERT_DESCRIPTION = By.xpath("//textarea");
public static final By SUBMIT_ALERT = By.xpath("//div[3]/button[2]/span");
+ public static final By ALERT_NAME = By.xpath("//table/tr[2]/td[2]/span");
+
//delete alert locator
public static final By DELETE_ALERT_BUTTON = By.xpath("//span/button");
public static final By CONFIRM_DELETE_ALERT_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}
-
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java
index ee7d3992b5..dd42a91db0 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java
@@ -26,6 +26,8 @@ public class QueueManageLocator {
public static final By INPUT_QUEUE_VALUE = By.xpath("//div[2]/div[2]/div/input");
public static final By SUBMIT_QUEUE = By.xpath("//button[2]/span");
+ public static final By LIST_QUEUE_NAME = By.xpath("//table/tr[2]/td[2]/span");
+
//edit queue locator
public static final By CLICK_EDIT_QUEUE = By.xpath("//td[6]/button/i");
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java
index 7db883615c..2f7a5f9ca3 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java
@@ -38,4 +38,6 @@ public class TenantManageLocator{
public static final By DELETE_TENANT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[8]/span/button");
public static final By CONFIRM_DELETE_TENANT_BUTTON = By.xpath("//div[2]/div/button[2]/span");
+
+ public static final By TENANT_CODE_FIRST = By.xpath("//table/tr[2]/td[2]/span");
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java
index 0626ed8031..d935dd54a0 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java
@@ -30,7 +30,11 @@ public class TokenManageLocator {
public static final By CLICK_SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
+ public static final By EDIT_TOKEN_BUTTON = By.xpath("//table/tr[2]/td[7]/button");
+
//edit token
+ public static final By TOKEN = By.xpath("//table/tr[2]/td[1]/span");
+
public static final By CLICK_EDIT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[7]/button/i");
//delete token
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java
index ef2ec9095c..ecfd285d60 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java
@@ -52,13 +52,15 @@ public class UserManageLocator {
/**
* edit user
*/
+ public static final By USER_NAME = By.xpath("//table/tr[2]/td[2]/span");
+
public static final By EDIT_GENERAL_USER_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[11]/button");
public static final By EDIT_ADMIN_USER_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[3]/td[11]/button");
/**
* delete user
*/
- public static final By DELETE_USER_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[11]/span[2]/button");
+ public static final By DELETE_USER_BUTTON = By.xpath("//table/tr[3]/td[11]/span[2]/button");
- public static final By CONFIRM_DELETE_USER_BUTTON = By.xpath("//div[2]/div/button[2]/span");
+ public static final By CONFIRM_DELETE_USER_BUTTON = By.xpath("//tr[3]/td[11]/span[2]/div/div[2]/div/button[2]/span");
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java
index 4d1a1c2530..8c251afc84 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java
@@ -34,6 +34,7 @@ public class ProcessInstancePage extends PageCommon {
public boolean rerunWorkflowPage() throws InterruptedException {
Thread.sleep(2000);
clickTopElement(ProcessInstanceLocator.CLICK_PROCESS_INSTANCE_NAME);
+ locateElement(ProcessInstanceLocator.PROCESS_INSTANCE_SUCCESS_STATE);
clickTopElement(ProcessInstanceLocator.CLICK_RERUN_BUTTON);
return ifTitleContains(ProcessInstanceData.PROCESS_INSTANCE_TITLE);
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java
index 5c591d0b5d..6a93094340 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java
@@ -32,7 +32,6 @@ public class ProjectPage extends PageCommon {
*/
public boolean jumpProjectManagePage() throws InterruptedException {
clickTopElement(ProjectLocator.PROJECT_MANAGE);
- Thread.sleep(TestConstant.ONE_THOUSAND);
return ifTitleContains(ProjectData.PROJECT_TITLE);
}
@@ -42,7 +41,7 @@ public class ProjectPage extends PageCommon {
* @return Whether to enter the specified page after create project
*/
public boolean createProject() throws InterruptedException {
- Thread.sleep(500);
+ ifTextExists(ProjectLocator.CREATE_PROJECT_BUTTON,ProjectData.CREATE_PROJECT_BUTTON);
clickElement(ProjectLocator.CREATE_PROJECT_BUTTON);
// input create project data
@@ -53,7 +52,7 @@ public class ProjectPage extends PageCommon {
clickButton(ProjectLocator.SUBMIT_BUTTON);
// Whether to enter the specified page after submit
- return ifTitleContains(ProjectData.PROJECT_TITLE);
+ return ifTextExists(ProjectLocator.LIST_PROJECT_NAME,ProjectData.PROJECT_NAME);
}
/**
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/RunWorkflowPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/RunWorkflowPage.java
index 9f14dde8fa..921e593e44 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/RunWorkflowPage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/RunWorkflowPage.java
@@ -18,7 +18,9 @@ package org.apache.dolphinscheduler.page.project;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.project.RunWorkflowData;
+import org.apache.dolphinscheduler.data.project.WorkflowDefineData;
import org.apache.dolphinscheduler.locator.project.RunWorkflowLocator;
+import org.apache.dolphinscheduler.locator.project.WorkflowDefineLocator;
import org.openqa.selenium.WebDriver;
public class RunWorkflowPage extends PageCommon {
@@ -27,17 +29,17 @@ public class RunWorkflowPage extends PageCommon {
}
public boolean runWorkflow() throws InterruptedException {
+ // Determine whether the workflow status is online
+ ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE, WorkflowDefineData.WORKFLOW_ONLINE_STATE);
+
// click run workflow button
System.out.println("Click run workflow button");
- Thread.sleep(1000);
clickButton(RunWorkflowLocator.CLICK_RUN_WORKFLOW_BUTTON);
- Thread.sleep(1000);
clickElement(RunWorkflowLocator.SELECT_FAILURE_STRATEGY_END);
clickElement(RunWorkflowLocator.SELECT_FAILURE_STRATEGY_CONTINUE);
clickElement(RunWorkflowLocator.CLICK_NOTICE_STRATEGY);
clickElement(RunWorkflowLocator.SELECT_NOTICE_STRATEGY);
- Thread.sleep(500);
clickElement(RunWorkflowLocator.CLICK_PROCESS_PRIORITY);
clickElement(RunWorkflowLocator.SELECT_PROCESS_PRIORITY_HIGHEST);
clickElement(RunWorkflowLocator.CLICK_WORKER_GROUP);
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java
index 83442562ca..8826222189 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java
@@ -18,7 +18,9 @@ package org.apache.dolphinscheduler.page.project;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
+import org.apache.dolphinscheduler.data.project.ProjectData;
import org.apache.dolphinscheduler.data.project.WorkflowDefineData;
+import org.apache.dolphinscheduler.locator.project.ProjectLocator;
import org.apache.dolphinscheduler.locator.project.WorkflowDefineLocator;
import org.openqa.selenium.WebDriver;
@@ -32,9 +34,12 @@ public class WorkflowDefinePage extends PageCommon {
*/
public boolean jumpWorkflowPage() throws InterruptedException {
+ ifTextExists(ProjectLocator.LIST_PROJECT_NAME, ProjectData.PROJECT_NAME);
+
// click project name
clickElement(WorkflowDefineLocator.CLICK_PROJECT_NAME);
- Thread.sleep(TestConstant.ONE_THOUSAND);
+
+ ifTextExists(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE,WorkflowDefineData.workflow_define);
System.out.println("Click on workflow define to jump to workflow define page");
// click workflow define
@@ -126,7 +131,6 @@ public class WorkflowDefinePage extends PageCommon {
//click submit button
clickElement(WorkflowDefineLocator.CLICK_SUBMIT_BUTTON);
- Thread.sleep(TestConstant.ONE_THOUSAND);
System.out.println("Task node set up successfully");
System.out.println("move to Dag Element ");
moveToDragElement(WorkflowDefineLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100);
@@ -185,7 +189,6 @@ public class WorkflowDefinePage extends PageCommon {
//delete workflow global parameters value
clickElement(WorkflowDefineLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS);
- Thread.sleep(TestConstant.ONE_THOUSAND);
//click add button
System.out.println("submit workflow");
@@ -197,6 +200,9 @@ public class WorkflowDefinePage extends PageCommon {
public boolean onlineWorkflow() throws InterruptedException {
clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE);
+ // Determine whether the workflow status is offline
+ ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE,WorkflowDefineData.WORKFLOW_OFFLINE_STATE);
+
// click online button
System.out.println("Click online workflow button");
clickButton(WorkflowDefineLocator.CLICK_ONLINE_WORKFLOW_BUTTON);
@@ -207,9 +213,11 @@ public class WorkflowDefinePage extends PageCommon {
public boolean offlineWorkflow() throws InterruptedException {
clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE);
+ // Determine whether the workflow status is online
+ ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE,WorkflowDefineData.WORKFLOW_ONLINE_STATE);
+
// click offline button
System.out.println("offline workflow");
- Thread.sleep(500);
clickButton(WorkflowDefineLocator.CLICK_OFFLINE_WORKFLOW_BUTTON);
return ifTitleContains(WorkflowDefineData.WORKFLOW_TITLE);
@@ -218,8 +226,11 @@ public class WorkflowDefinePage extends PageCommon {
public boolean deleteWorkflow() throws InterruptedException {
//click delete workflow
- Thread.sleep(500);
clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE);
+
+ // Determine whether the workflow status is offline
+ ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE,WorkflowDefineData.WORKFLOW_OFFLINE_STATE);
+
clickButton(WorkflowDefineLocator.DELETE_WORKFLOW_BOTTOM);
//click confirm delete project
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java
index 4ea64dfc4c..541251e0db 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java
@@ -31,22 +31,21 @@ public class AlertManagePage extends PageCommon {
}
/**
- * createTenant
+ * create alert
*
* @return Whether to enter the specified page after create tenant
*/
public boolean createAlert() throws InterruptedException {
// click alert manage
- Thread.sleep(500);
System.out.println("start click alert manage button");
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
- Thread.sleep(500);
+
+ //determine whether the create alert button exists
+ ifTextExists(AlertManageLocator.CLICK_CREATE_ALERT,AlertManageData.CREATE_ALERT);
// click create alert button
System.out.println("start click create alert button");
clickElement(AlertManageLocator.CLICK_CREATE_ALERT);
- Thread.sleep(500);
-
// input alert data
System.out.println("start input alert ");
sendInput(AlertManageLocator.INPUT_ALERT_NAME, AlertManageData.ALERT_NAME);
@@ -61,15 +60,17 @@ public class AlertManagePage extends PageCommon {
clickButton(AlertManageLocator.SUBMIT_ALERT);
// Whether to enter the specified page after submit
- return ifTitleContains(AlertManageData.ALERT_MANAGE);
+ return ifTextExists(AlertManageLocator.ALERT_NAME, AlertManageData.ALERT_NAME);
}
public boolean deleteAlert() throws InterruptedException {
- // click user manage
+ // click alert manage
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
- // click delete user button
+ ifTextExists(AlertManageLocator.ALERT_NAME, AlertManageData.ALERT_NAME);
+
+ // click delete alert button
clickButton(AlertManageLocator.DELETE_ALERT_BUTTON);
// click confirm delete button
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java
index 95165aec1d..368202e921 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java
@@ -37,15 +37,15 @@ public class QueueManagePage extends PageCommon {
*/
public boolean createQueue() throws InterruptedException {
// click queue manage
- Thread.sleep(500);
System.out.println("start click queue manage button");
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
- Thread.sleep(500);
+
+ //determine whether the create queue button exists
+ ifTextExists(QueueManageLocator.CLICK_CREATE_QUEUE,QueueManageData.CREATE_QUEUE);
// click create queue button
System.out.println("start click create queue button");
- clickElement(QueueManageLocator.CLICK_CREATE_QUEUE);
- Thread.sleep(500);
+ clickButton(QueueManageLocator.CLICK_CREATE_QUEUE);
// input queue data
System.out.println("start input queue");
@@ -57,7 +57,7 @@ public class QueueManagePage extends PageCommon {
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
- return ifTitleContains(QueueManageData.QUEUE_MANAGE);
+ return ifTextExists(QueueManageLocator.LIST_QUEUE_NAME, QueueManageData.QUEUE_NAME);
}
@@ -68,22 +68,21 @@ public class QueueManagePage extends PageCommon {
*/
public boolean editQueue() throws InterruptedException {
// click queue manage
- Thread.sleep(1000);
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
- Thread.sleep(1000);
+
+ ifTextExists(QueueManageLocator.LIST_QUEUE_NAME, QueueManageData.QUEUE_NAME);
// click edit queue button
- clickElement(QueueManageLocator.CLICK_EDIT_QUEUE);
- Thread.sleep(1000);
+ clickButton(QueueManageLocator.CLICK_EDIT_QUEUE);
// input queue data
- sendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.EDIT_QUEUE_NAME);
- sendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.EDIT_QUEUE_VALUE);
+ clearSendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.EDIT_QUEUE_NAME);
+ clearSendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.EDIT_QUEUE_VALUE);
// click button
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
- return ifTitleContains(QueueManageData.QUEUE_MANAGE);
+ return ifTextExists(QueueManageLocator.LIST_QUEUE_NAME, QueueManageData.EDIT_QUEUE_NAME);
}
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java
index 085bfa93a3..40d964fa33 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java
@@ -46,7 +46,7 @@ public class TenantManagePage extends PageCommon {
* @return Whether to enter the specified page after create tenant
*/
public boolean createTenant() throws InterruptedException {
- clickButton(TenantManageLocator.TENANT_MANAGE);
+ clickElement(TenantManageLocator.TENANT_MANAGE);
//create tenant
clickButton(TenantManageLocator.CREATE_TENANT_BUTTON);
@@ -61,11 +61,11 @@ public class TenantManagePage extends PageCommon {
clickButton(TenantManageLocator.SUBMIT_BUTTON);
// Whether to enter the specified page after submit
- return ifTitleContains(TenantManageData.TENANT_MANAGE);
+ return ifTextExists(TenantManageLocator.TENANT_CODE_FIRST, TenantManageData.TENANT_CODE);
}
public boolean deleteTenant() throws InterruptedException {
- clickButton(TenantManageLocator.TENANT_MANAGE);
+ clickElement(TenantManageLocator.TENANT_MANAGE);
// click delete button
clickButton(TenantManageLocator.DELETE_TENANT_BUTTON);
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java
index 2f8204ac47..61fb93c570 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java
@@ -27,26 +27,24 @@ public class TokenManagePage extends PageCommon {
}
/**
- * createTenant
+ * create token
*
- * @return Whether to enter the specified page after creat tenant
+ * @return Whether to enter the specified page after create tenant
*/
public boolean createToken() throws InterruptedException {
//create token
- Thread.sleep(1000);
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
- Thread.sleep(1000);
+
+ //determine whether the create token button exists
+ ifTextExists(TokenManageLocator.CLICK_CREATE_TOKEN,TokenManageData.CREATE_TOKEN);
// click create token button
clickButton(TokenManageLocator.CLICK_CREATE_TOKEN);
- Thread.sleep(1000);
-
- //selectDate(TokenManageLocator.js, TokenManageLocator.CLICK_TIME, TokenManageData.DATE);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
- Thread.sleep(2500);
+ Thread.sleep(2000);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
@@ -55,21 +53,25 @@ public class TokenManagePage extends PageCommon {
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
-
- //edit token
+ /**
+ * edit token
+ *
+ * @return Whether to enter the specified page after edit tenant
+ */
public boolean editToken() throws InterruptedException {
- // click token manage
- clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
- Thread.sleep(1000);
+ // edit token
+ ifTextExists(TokenManageLocator.TOKEN, "1");
- // click create token button
+ // determine the existence of the editing token
+ locateElement(TokenManageLocator.EDIT_TOKEN_BUTTON);
+
+ // click edit token button
clickButton(TokenManageLocator.CLICK_EDIT_BUTTON);
- Thread.sleep(1000);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
- Thread.sleep(2500);
+ Thread.sleep(2000);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
@@ -83,7 +85,6 @@ public class TokenManagePage extends PageCommon {
public boolean deleteToken() throws InterruptedException {
// click token manage
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
- Thread.sleep(1000);
clickButton(TokenManageLocator.CLICK_DELETE_BUTTON);
clickButton(TokenManageLocator.CLICK_CONFIRM_DELETE_BUTTON);
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java
index 31f0445cd8..367896a3cf 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java
@@ -29,12 +29,15 @@ public class UserManagePage extends PageCommon {
/**
* create user
*
- * @return Whether to enter the specified page after creat tenant
+ * @return Whether to enter the specified page after create tenant
*/
public boolean createUser() throws InterruptedException {
// click user manage
clickElement(UserManageLocator.CLICK_USER_MANAGE);
+ //determine whether the create user button exists
+ ifTextExists(UserManageLocator.CLICK_CREATE_USER_BUTTON,UserManageData.CREATE_USER_BUTTON);
+
// click create user button
clickButton(UserManageLocator.CLICK_CREATE_USER_BUTTON);
@@ -64,9 +67,11 @@ public class UserManagePage extends PageCommon {
//edit general user
// click user manage
System.out.println("start edit general user");
- Thread.sleep(500);
clickElement(UserManageLocator.CLICK_USER_MANAGE);
+ //determine whether the general user exists
+ ifTextExists(UserManageLocator.USER_NAME,UserManageData.USERNAME);
+
// click edit user button
clickButton(UserManageLocator.EDIT_GENERAL_USER_BUTTON );
@@ -97,13 +102,15 @@ public class UserManagePage extends PageCommon {
/**
* edit admin user
*/
- public boolean editAdminlUser() throws InterruptedException {
+ public boolean editAdminUser() throws InterruptedException {
//edit admin user
// click user manage
System.out.println("start edit admin user");
- Thread.sleep(500);
clickElement(UserManageLocator.CLICK_USER_MANAGE);
+ //determine whether the general user edit success
+ ifTextExists(UserManageLocator.USER_NAME,UserManageData.EDIT_USERNAME);
+
// click edit user button
clickButton(UserManageLocator.EDIT_ADMIN_USER_BUTTON );
@@ -115,7 +122,6 @@ public class UserManagePage extends PageCommon {
// click button
clickButton(UserManageLocator.SUBMIT);
System.out.println("end edit admin user");
- Thread.sleep(500);
// Whether to enter the specified page after submit
return ifTitleContains(UserManageData.USER_MANAGE);
}
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java
index e46cf0d997..816ae64c29 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java
@@ -24,7 +24,7 @@ public class TestTokenManage extends BaseTest {
private TokenManagePage tokenManagePage;
@Test(groups={"functionTests","token"},dependsOnGroups = { "login" },description = "TestTokenManage")
- public void testUserManage() throws InterruptedException {
+ public void testTokenManage() throws InterruptedException {
tokenManagePage = new TokenManagePage(driver);
//generate token
System.out.println("start create token");
diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java
index e464d7c57e..2adc4e7769 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java
@@ -39,7 +39,7 @@ public class TestUserManage extends BaseTest {
//edit user
System.out.println("start edit user");
assert userManagePage.editGeneralUser();
- assert userManagePage.editAdminlUser();
+ assert userManagePage.editAdminUser();
System.out.println("end edit user");
System.out.println("===================================");
diff --git a/e2e/testng.xml b/e2e/testng.xml
index 7e5dc5228b..e08c4da917 100644
--- a/e2e/testng.xml
+++ b/e2e/testng.xml
@@ -53,20 +53,20 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -78,7 +78,7 @@
-
+