Unverified Commit f407adcb authored by xingchun-chen's avatar xingchun-chen Committed by GitHub
Browse files

Add e2e to create workflow case   (#2027)



* add e2e

* add ui-test

* add e2e license and notice

* add e2e license

* add license

* add ui-test

* add ui-test

* add ui-test

* e2e delete dolphinscheduler parent project dependency

* add ui-test

* dolphinscheduler_dist delete e2e license/notice

* dolphinscheduler_dist delete e2e license/notice

* dolphinscheduler_dist delete e2e license/notice

* dolphinscheduler_dist delete e2e license/notice

* pom.xml delete e2e dependency

* add e2e create workflow

* Merge remote-tracking branch 'upstream/dev' into dev

# Conflicts:
#	e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java

* Merge remote-tracking branch 'upstream/dev' into dev

# Conflicts:
#	e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java

* Merge remote-tracking branch 'upstream/dev' into dev

# Conflicts:
#	e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java

* Merge remote-tracking branch 'upstream/dev' into dev

# Conflicts:
#	e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java

* modify workflow case

Co-authored-by: default avatarchenxingchun <50446296+chenxingchun@users.noreply.github.com>
parent ee3c0aed
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.PageLoadStrategy;


/**
 * base driver class
 */
@@ -97,8 +98,13 @@ public class BaseDriver {
        /* driver setting wait time */
        // implicitly wait time
        driver.manage().timeouts().implicitlyWait(implicitlyWait, TimeUnit.SECONDS);

        // page load timeout
        driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS);

        // page load timeout
        driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS);

        // script timeout
        driver.manage().timeouts().setScriptTimeout(setScriptTimeout, TimeUnit.SECONDS);

+33 −12
Original line number Diff line number Diff line
@@ -99,8 +99,6 @@ public class BrowserCommon {
        // show wait timeout
        long timeout = Long.valueOf(PropertiesReader.getKey("driver.timeouts.webDriverWait"));
        wait = new WebDriverWait(driver, timeout);
//        this.redisUtil = redisUtil;
//        this.jedis = redisUtil.getJedis();
    }


@@ -158,18 +156,30 @@ public class BrowserCommon {
     *
     * @param locator By
     */
    public void clearInput(By locator) {
    public WebElement clearInput(By locator) {
        WebElement clearElement = locateElement(locator);
        clearElement.click();
        clearElement.clear();
        clearElement.sendKeys(Keys.chord(Keys.CONTROL, "a"));
        clearElement.sendKeys(Keys.DELETE);
        clearElement.sendKeys(Keys.BACK_SPACE);
        return clearElement;
    }

    /**
     * input codeMirror
     *
     * @param codeMirrorLocator By codeMirror
     * @param codeMirrorLineLocator By codeMirrorLine

     */
    public void inputCodeMirror(By codeMirrorLocator,By codeMirrorLineLocator,String content) {
        WebElement codeMirrorElement = locateElement(codeMirrorLocator);
        WebElement codeMirrorLineElement = locateElement(codeMirrorLineLocator);
        codeMirrorElement.click();
        codeMirrorLineElement.sendKeys(content);
    }

    /**
     * move to element
     *
     * @param locator BY
     * @return actions
     */
@@ -182,13 +192,17 @@ public class BrowserCommon {
     *
     * @param source_locator BY
     * @param target_locator BY
     * @param X  X-axis
     * @param Y Y-axis
     */
    public void dragAndDropBy(By source_locator, By target_locator, int X, int Y) {
        WebElement sourcetElement = locateElement(source_locator);
    public void dragAndDrop(By source_locator, By target_locator){
        WebElement sourceElement = locateElement(source_locator);
        WebElement targetElement = locateElement(target_locator);
        actions.dragAndDrop(sourceElement, targetElement).perform();
        actions.release();
    }

    public void moveToDragElement(By target_locator, int X, int Y){
        WebElement targetElement = locateElement(target_locator);
        actions.dragAndDrop(sourcetElement, targetElement).moveToElement(targetElement, X, Y).perform();
        actions.dragAndDropBy(targetElement, X, Y).perform();
        actions.release();
    }

@@ -300,6 +314,13 @@ public class BrowserCommon {
        executeScript("window.scrollTo(0, document.body.scrollHeight)");
    }

    public void scrollToElementBottom() {

        WebElement webElement = driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div/div[7]/div[3]"));
        ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", webElement);
    }


    /**
     * Page swipe makes the top of the element align with the top of the page
     *
+11 −1
Original line number Diff line number Diff line
@@ -29,8 +29,18 @@ public class CreatWorkflowData {
    //input shell script
    public static final String SHELL_SCRIPT = "echo 1111111";

    public static final String WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler";
    //input custom parameters
    public static final String INPUT_CUSTOM_PARAMETERS = "selenium_parameter";

    //input custom parameters value
    public static final String INPUT_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_123";

    //input add custom parameters
    public static final String INPUT_ADD_CUSTOM_PARAMETERS = "selenium_parameter_delete";

    //input add custom parameters value
    public static final String INPUT_ADD_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_delete_456";

    //create workflow title
    public static final String WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler";
}
+26 −8
Original line number Diff line number Diff line
@@ -20,9 +20,6 @@ package org.apache.dolphinscheduler.locator.project;
import org.openqa.selenium.By;

public class CreateWorkflowLocator {
    // click project manage
    public static final By CLICK_PROJECT_MANAGE = By.xpath("//div[2]/div/a/span");

    // click project name
    public static final By CLICK_PROJECT_NAME = By.xpath("//span/a");

@@ -33,16 +30,13 @@ public class CreateWorkflowLocator {
    public static final By CLICK_CREATE_WORKFLOW_BUTTON = By.xpath("//button/span");

    //mouse down at shell
    public static final By MOUSE_DOWN_AT_SHELL = By.xpath("//*[@id='SHELL']/div/div");
    public static final By MOUSE_DOWN_AT_SHELL = By.xpath("//div[@id='SHELL']/div/div");

    //mouse down at spark
    public static final By MOUSE_DOWN_AT_SPARK = By.xpath("//div[5]/div/div");

    //mouse move at DAG
    public static final By MOUSE_MOVE_SHELL_AT_DAG = By.xpath("//div[2]/div/div[2]/div[2]/div/div");

//    //click shell task
//    public static final By CLICK_SHELL_TASK = By.xpath("//div[2]/div/div[2]/div[2]/div/div");
    public static final By MOUSE_MOVE_SHELL_AT_DAG = By.xpath("//div[@id='canvas']");

    //input shell task _name
    public static final By INPUT_SHELL_TASK_NAME = By.xpath("//input");
@@ -89,9 +83,33 @@ public class CreateWorkflowLocator {
    //input timeout
    public static final By SELECT_TIMEOUT = By.xpath("//div[3]/div[2]/label/div/input");

    //click codeMirror
    public static final By CLICK_CODE_MIRROR = By.xpath("//div[5]/div/pre");

    //input script
    public static final By INPUT_SCRIPT = By.xpath("//div[2]/div/div/div/div/div/textarea");

    //click custom parameters
    public static final By CLICK_CUSTOM_PARAMETERS = By.xpath("//span/a/em");

    //input custom parameters
    public static final By INPUT_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div/div/input");

    //input custom parameters value
    public static final By INPUT_CUSTOM_PARAMETERS_VALUE = By.xpath("//div[2]/input");

    //click add custom parameters
    public static final By CLICK_ADD_CUSTOM_PARAMETERS = By.xpath("//span[2]/a/em");

    //input add custom parameters
    public static final By INPUT_ADD_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div[2]/div/input");

    //input add custom parameters value
    public static final By INPUT_ADD_CUSTOM_PARAMETERS_VALUE = By.xpath("//div[2]/div[2]/input");

    //delete custom parameters
    public static final By CLICK_DELETE_CUSTOM_PARAMETERS = By.xpath("//div[2]/span/a/em");

    //click submit button
    public static final By CLICK_SUBMIT_BUTTON = By.xpath("//button[2]/span");
}
+2 −2
Original line number Diff line number Diff line
@@ -29,9 +29,10 @@ public class CreateProjectPage extends PageCommon {
    /**
     * jump page
     */
    public void jumpPage() throws InterruptedException {
    public void jumpProjectManagePage() throws InterruptedException {
        Thread.sleep(TestConstant.ONE_THOUSANG);
        clickElement(CreateProjectLocator.PROJECT_MANAGE);
        Thread.sleep(TestConstant.ONE_THOUSANG);
    }

    /**
@@ -40,7 +41,6 @@ public class CreateProjectPage extends PageCommon {
     * @return Whether to enter the specified page after creat tenant
     */
    public boolean createProject() throws InterruptedException {
        Thread.sleep(TestConstant.ONE_THOUSANG);
        //click  create project
        clickElement(CreateProjectLocator.CREATE_PROJECT_BUTTON);
        Thread.sleep(TestConstant.ONE_THOUSANG);
Loading