You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/30 08:24:45 UTC

[GitHub] [dolphinscheduler] kezhenxu94 commented on a change in pull request #8180: [E2E] add switch task case

kezhenxu94 commented on a change in pull request #8180:
URL: https://github.com/apache/dolphinscheduler/pull/8180#discussion_r795145252



##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/ShellTaskForm.java
##########
@@ -23,6 +23,9 @@
 import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
 
 import lombok.Getter;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.FindBys;

Review comment:
       Unused

##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java
##########
@@ -60,26 +70,50 @@ public WorkflowForm(WebDriver driver) {
 
         final JavascriptExecutor js = (JavascriptExecutor) driver;
         final String dragAndDrop = String.join("\n",
-            Resources.readLines(Resources.getResource("dragAndDrop.js"), StandardCharsets.UTF_8));
+                Resources.readLines(Resources.getResource("dragAndDrop.js"), StandardCharsets.UTF_8));
         js.executeScript(dragAndDrop, task, canvas);
 
         switch (type) {
             case SHELL:
                 return (T) new ShellTaskForm(this);
             case SUB_PROCESS:
                 return (T) new SubWorkflowTaskForm(this);
+            case SWITCH:
+                return (T) new SwitchTaskForm(this);
         }
         throw new UnsupportedOperationException("Unknown task type");
     }
 
+    public WebElement getTask(String taskName) {
+        List<WebElement> tasks = new WebDriverWait(driver, 10)
+                .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("svg > g > g[class^='x6-graph-svg-stage'] > g[data-shape^='dag-task']")));

Review comment:
       Hi @caishunfeng , can we get rid of this kind of selector by adding a class or id to the svg node?

##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SwitchTaskForm.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.dolphinscheduler.e2e.pages.project.workflow.task;
+
+import lombok.Getter;
+import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.FindBys;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.util.List;
+
+@Getter
+public final class SwitchTaskForm extends TaskNodeForm {
+
+    @FindBy(id = "add-if-branch")

Review comment:
       For `id`, let's use camel case style with the element type prefix `btn`, `btnAddIfBranch`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org