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

[test-2995][e2e]Add task connection (#3524)



* Add task connection 

* Optimize test cases
 

* Modify variable format
 
 

* Optimize test cases
 

* Update BrowserCommon.java

* Update BrowserCommon.java

* Update WorkflowDefineLocator.java

Co-authored-by: default avatarchenxingchun <438044805@qq.com>
parent 59610a56
Loading
Loading
Loading
Loading
+32 −8
Original line number Diff line number Diff line
@@ -223,22 +223,46 @@ public class BrowserCommon {
    /**
     * mouse drag  element
     *
     * @param source_locator BY
     * @param target_locator BY
     * @param sourceLocator BY
     * @param targetLocator BY
     */
    public void dragAndDrop(By source_locator, By target_locator) {
        WebElement sourceElement = locateElement(source_locator);
        WebElement targetElement = locateElement(target_locator);
    public void dragAndDrop(By sourceLocator, By targetLocator) {
        WebElement sourceElement = locateElement(sourceLocator);
        WebElement targetElement = locateElement(targetLocator);
        actions.dragAndDrop(sourceElement, targetElement).perform();
        actions.release();
    }

    public void moveToDragElement(By target_locator, int X, int Y) {
        WebElement targetElement = locateElement(target_locator);
        actions.dragAndDropBy(targetElement, X, Y).perform();
    public void moveToDragElement(By targetLocator, int x, int y) {
        WebElement targetElement = locateElement(targetLocator);
        actions.dragAndDropBy(targetElement, x, y).perform();
        actions.release();
    }

    /**
     * Right mouse click on the element
     *
     * @param locator By
     * @return actions
     */
    public void mouseRightClickElement(By locator) {
        WebElement mouseRightClickElement = locateElement(locator);
        actions.contextClick(mouseRightClickElement).perform();
    }

    /**
     * The mouse moves from a position to a specified positionØ
     *
     * @param sourceLocator BY
     * @param targetLocator BY
     * @return actions
     */
    public void mouseMovePosition(By sourceLocator, By targetLocator) throws InterruptedException {
        WebElement sourceElement = locateElement(sourceLocator);
        WebElement targetElement = locateElement(targetLocator);
        actions.dragAndDrop(sourceElement,targetElement).perform();
        actions.click();
    }

    /**
     * jump page
+11 −1
Original line number Diff line number Diff line
@@ -120,12 +120,22 @@ public class WorkflowDefineLocator {
    //click submit button
    public static final By CLICK_SUBMIT_BUTTON = By.xpath("//div[3]/div/button[2]/span");

    //copy task
    public static final By MOUSE_RIGHT_CLICK = By.xpath("//div[2]/div[2]/div/div/div/div/div[2]");
    public static final By COPY_TASK = By.xpath("//a[3]/span");

    //click line
    public static final By CLICK_LINE = By.xpath("//a[@id='line']/button/i");

    public static final By LINE_SOURCES_TASK = By.xpath("//div[@id='canvas']/div[1]/div[2]");

    public static final By LINE_TARGET_TASK = By.xpath("//div[@id='canvas']/div[2]/div[2]");

    /**
     * save workflow
     */
    //click save workflow button
    public static final By CLICK_SAVE_WORKFLOW_BUTTON = By.xpath("//div[2]/div[1]/div[2]/button[2]");
    public static final By CLICK_SAVE_WORKFLOW_BUTTON = By.xpath("//div[2]/div[1]/div[2]/button[2]/span");

    //input  workflow name
    public static final By INPUT_WORKFLOW_NAME = By.xpath("//input");
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,11 @@ public class WorkflowDefinePage extends PageCommon {
        System.out.println("move to Dag Element ");
        moveToDragElement(WorkflowDefineLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100);

        System.out.println("copy task");
        mouseRightClickElement(WorkflowDefineLocator.MOUSE_RIGHT_CLICK);
        clickButton(WorkflowDefineLocator.COPY_TASK);
        clickButton(WorkflowDefineLocator.CLICK_LINE);
        mouseMovePosition(WorkflowDefineLocator.LINE_SOURCES_TASK,WorkflowDefineLocator.LINE_TARGET_TASK);
        return ifTitleContains(WorkflowDefineData.CREATE_WORKFLOW_TITLE);
    }