break60 4 years ago
parent
commit
cbb1ee7eb5
  1. 4
      .github/workflows/ci_e2e.yml
  2. 4
      e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
  3. 5
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java
  4. 12
      e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java
  5. 43
      e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java

4
.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

4
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();
}
}

5
e2e/src/test/java/org/apache/dolphinscheduler/data/project/TimingData.java

@ -30,6 +30,9 @@ public class TimingData {
public static final String EDIT_Cc = "test.edit123qwe@qq.com";
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";
}

12
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");
}

43
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, "-");
}
}

Loading…
Cancel
Save