This is an automated email from the ASF dual-hosted git repository.
lgcareer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 5888095 [test][e2e]add timing testcase and modify chromeDriver (#3597)
5888095 is described below
commit 588809550261c39cccf72118feeea70ed18c5484
Author: xingchun-chen <[email protected]>
AuthorDate: Wed Aug 26 15:33:18 2020 +0800
[test][e2e]add timing testcase and modify chromeDriver (#3597)
* 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
* open timing testcase
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
* Optimize wait time
Co-authored-by: chenxingchun <[email protected]>
---
.github/workflows/ci_e2e.yml | 4 +-
.../dolphinscheduler/common/BrowserCommon.java | 4 ++
.../dolphinscheduler/data/project/TimingData.java | 5 ++-
.../locator/project/TimingLocator.java | 12 ++++--
.../dolphinscheduler/page/project/TimingPage.java | 43 +++++++++++++---------
5 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/.github/workflows/ci_e2e.yml b/.github/workflows/ci_e2e.yml
index 9dceb79..7f5fc8a 100644
--- a/.github/workflows/ci_e2e.yml
+++ b/.github/workflows/ci_e2e.yml
@@ -58,7 +58,9 @@ jobs:
wget
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get install -f -y
- wget -N
https://chromedriver.storage.googleapis.com/85.0.4183.83/chromedriver_linux64.zip
+ google-chrome -version
+ googleVersion=`google-chrome -version | awk '{print $3}'`
+ wget -N
https://chromedriver.storage.googleapis.com/${googleVersion}/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
diff --git
a/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
b/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
index 2eade95..0740b8d 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
@@ -444,4 +444,8 @@ public class BrowserCommon {
public boolean ifTextExists(By locator, String text) {
return
wait.until(ExpectedConditions.textToBePresentInElementLocated(locator, text));
}
+
+ public void flushPage() {
+ driver.navigate().refresh();
+ }
}
diff --git
a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java
b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java
index d00a562..e76852d 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java
@@ -30,6 +30,9 @@ public class TimingData {
public static final String EDIT_Cc = "[email protected]";
- public static final String WORKFLOW_TITLE = "工作流定义 - DolphinScheduler";
+ public static final String TIMING_OFFLINE_STATE = "下线";
+
+ public static final String TIMING_ONLINE_STATE = "上线";
+
public static final String TIMING_TITLE = "定时任务列表 - DolphinScheduler";
}
diff --git
a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java
b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java
index 2605636..f73d869 100644
---
a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java
+++
b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java
@@ -45,17 +45,23 @@ public class TimingLocator {
public static final By CLICK_CREATE_BUTTON =
By.xpath("//div[12]/button[2]/span");
//edit timing
+ public static final By TIMING_STATE = By.xpath("//table/tr[2]/td[9]/span");
+
public static final By CLICK_TIMING_MANAGEMENT_BUTTON =
By.xpath("//tr[2]/td[10]/button[6]");
+ public static final By WORKFLOW_NAME =
By.xpath("//table/tr[2]/td[2]/span/a");
+
public static final By CLICK_EDIT_TIMING_BUTTON =
By.xpath("//tr[2]/td[10]/button[1]/i");
//online timing
- public static final By CLICK_ONLINE_TIMING_BUTTON =
By.xpath("//td[10]/button[2]");
+ public static final By TIMING_MANAGEMENT_TIMING_STATE =
By.xpath("//table/tr[2]/td[7]/span");
+
+ public static final By CLICK_ONLINE_TIMING_BUTTON =
By.xpath("//table/tr[2]/td[10]/button[@title['data-original-title']='上线']");
//offline timing
- public static final By CLICK_OFFLINE_TIMING_BUTTON =
By.xpath("//div[2]/div[3]/div/div[2]/div[1]/table/tr[2]/td[10]/button[2]");
+ public static final By CLICK_OFFLINE_TIMING_BUTTON =
By.xpath("//table/tr[2]/td[10]/button[@title['data-original-title']='下线']");
//delete timing
- public static final By CLICK_DELETE_TIMING_BUTTON =
By.xpath("//div[2]/div[3]/div/div[2]/div[1]/table/tr[2]/td[10]/span/button");
+ public static final By CLICK_DELETE_TIMING_BUTTON =
By.xpath("//table/tr[2]/td[10]/span/button");
public static final By CLICK_CONFIRM_DELETE_TIMING_BUTTON =
By.xpath("//div[2]/div/button[2]/span");
}
diff --git
a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java
b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java
index e8989ff..3febc54 100644
--- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java
+++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java
@@ -18,8 +18,9 @@ package org.apache.dolphinscheduler.page.project;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.project.TimingData;
-import org.apache.dolphinscheduler.locator.project.RunWorkflowLocator;
+import org.apache.dolphinscheduler.data.project.WorkflowDefineData;
import org.apache.dolphinscheduler.locator.project.TimingLocator;
+import org.apache.dolphinscheduler.locator.project.WorkflowDefineLocator;
import org.openqa.selenium.WebDriver;
public class TimingPage extends PageCommon {
@@ -32,19 +33,19 @@ public class TimingPage extends PageCommon {
* create timing
*/
public boolean createTiming() throws InterruptedException {
+ // Determine whether the workflow status is online
+ ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE,
WorkflowDefineData.WORKFLOW_ONLINE_STATE);
+
// click timing button
System.out.println("Click timing button");
- Thread.sleep(1000);
clickButton(TimingLocator.CLICK_TIMING_BUTTON);
System.out.println("Click execution timing button");
clickButton(TimingLocator.CLICK_EXECUTION_TIMING_BUTTON);
- Thread.sleep(1000);
clickElement(TimingLocator.SELECT_FAILURE_STRATEGY_END);
clickElement(TimingLocator.SELECT_FAILURE_STRATEGY_CONTINUE);
clickElement(TimingLocator.CLICK_NOTICE_STRATEGY);
clickElement(TimingLocator.SELECT_NOTICE_STRATEGY);
- Thread.sleep(500);
clickElement(TimingLocator.CLICK_PROCESS_PRIORITY);
clickElement(TimingLocator.SELECT_PROCESS_PRIORITY);
clickElement(TimingLocator.CLICK_WORKER_GROUP);
@@ -55,7 +56,7 @@ public class TimingPage extends PageCommon {
sendInput(TimingLocator.INPUT_Cc,TimingData.Cc);
clickButton(TimingLocator.CLICK_CREATE_BUTTON);
- return ifTitleContains(TimingData.WORKFLOW_TITLE);
+ return ifTextExists(TimingLocator.TIMING_STATE,
TimingData.TIMING_OFFLINE_STATE);
}
/**
@@ -64,20 +65,20 @@ public class TimingPage extends PageCommon {
public boolean editTiming() throws InterruptedException {
// click timing button
System.out.println("Click timing management button");
- Thread.sleep(1000);
clickButton(TimingLocator.CLICK_TIMING_MANAGEMENT_BUTTON);
- Thread.sleep(1000);
+
+ // Determine whether the workflow name exists
+ ifTextExists(TimingLocator.WORKFLOW_NAME,
WorkflowDefineData.INPUT_WORKFLOW_NAME);
+
System.out.println("Click edit timing button");
clickButton(TimingLocator.CLICK_EDIT_TIMING_BUTTON);
System.out.println("Click execution timing button");
clickButton(TimingLocator.CLICK_EXECUTION_TIMING_BUTTON);
- Thread.sleep(1000);
clickElement(TimingLocator.SELECT_FAILURE_STRATEGY_END);
clickElement(TimingLocator.SELECT_FAILURE_STRATEGY_CONTINUE);
clickElement(TimingLocator.CLICK_NOTICE_STRATEGY);
clickElement(TimingLocator.SELECT_NOTICE_STRATEGY);
- Thread.sleep(500);
clickElement(TimingLocator.CLICK_PROCESS_PRIORITY);
clickElement(TimingLocator.SELECT_PROCESS_PRIORITY);
clickElement(TimingLocator.CLICK_WORKER_GROUP);
@@ -96,12 +97,15 @@ public class TimingPage extends PageCommon {
* online timing
*/
public boolean onlineTiming() throws InterruptedException {
+ flushPage();
+ // Determine whether the timing is offline
+ ifTextExists(TimingLocator.TIMING_MANAGEMENT_TIMING_STATE,
TimingData.TIMING_OFFLINE_STATE);
+
// click online timing button
System.out.println("Click online timing button");
- Thread.sleep(500);
- clickButton(TimingLocator.CLICK_ONLINE_TIMING_BUTTON);
+ clickElement(TimingLocator.CLICK_ONLINE_TIMING_BUTTON);
- return ifTitleContains(TimingData.TIMING_TITLE );
+ return ifTextExists(TimingLocator.TIMING_MANAGEMENT_TIMING_STATE,
TimingData.TIMING_ONLINE_STATE);
}
@@ -109,12 +113,15 @@ public class TimingPage extends PageCommon {
* offline timing
*/
public boolean offlineTiming() throws InterruptedException {
+ flushPage();
+ // Determine whether the timing is online
+ ifTextExists(TimingLocator.TIMING_MANAGEMENT_TIMING_STATE,
TimingData.TIMING_ONLINE_STATE);
+
// click offline timing button
System.out.println("Click offline timing button");
- Thread.sleep(500);
- clickButton(TimingLocator.CLICK_OFFLINE_TIMING_BUTTON);
+ clickElement(TimingLocator.CLICK_OFFLINE_TIMING_BUTTON);
- return ifTitleContains(TimingData.TIMING_TITLE );
+ return ifTextExists(TimingLocator.TIMING_MANAGEMENT_TIMING_STATE,
TimingData.TIMING_OFFLINE_STATE);
}
@@ -123,12 +130,14 @@ public class TimingPage extends PageCommon {
* delete timing
*/
public boolean deleteTiming() throws InterruptedException {
+ // Determine whether the timing is offline
+ ifTextExists(TimingLocator.TIMING_MANAGEMENT_TIMING_STATE,
TimingData.TIMING_OFFLINE_STATE);
+
// click offline timing button
System.out.println("Click delete timing button");
- Thread.sleep(500);
clickButton(TimingLocator.CLICK_DELETE_TIMING_BUTTON);
clickButton(TimingLocator.CLICK_CONFIRM_DELETE_TIMING_BUTTON);
- return ifTitleContains(TimingData.WORKFLOW_TITLE );
+ return ifTextExists(TimingLocator.TIMING_STATE, "-");
}
}