ailiujiarui commented on code in PR #16542:
URL: 
https://github.com/apache/dolphinscheduler/pull/16542#discussion_r1828916084


##########
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowJavaTaskE2ETest.java:
##########
@@ -121,35 +247,47 @@ public static void cleanup() {
 
     @Test
     @Order(1)
-    void testCreateWorkflow() {
-        WorkflowDefinitionTab workflowDefinitionPage =
-                new ProjectPage(browser)
-                        .goTo(project)
-                        .goToTab(WorkflowDefinitionTab.class);
+    void testCreateFatWorkflow() {
+        FileManagePage file = new NavBarPage(browser)
+                .goToNav(ResourcePage.class)
+                .goToTab(FileManagePage.class)
+                .uploadFile(filePath + "/fat.jar");
+
+        WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);
 
-        workflowDefinitionPage
-                .createWorkflow()
-                .<JavaTaskForm>addTask(WorkflowForm.TaskType.JAVA)
-                .script(javaContent)
+        
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='fat.jar']")));
+
+        ProjectPage projectPage = new NavBarPage(browser)
+                .goToNav(ProjectPage.class);
+
+        
wait.until(ExpectedConditions.visibilityOfAllElements(projectPage.projectList()));
+
+        WorkflowDefinitionTab workflowDefinitionPage = projectPage
+                .goTo(project)
+                .goToTab(WorkflowDefinitionTab.class);
+
+        WorkflowForm workflow1 = workflowDefinitionPage.createWorkflow();
+        workflow1.<JavaTaskForm>addTask(WorkflowForm.TaskType.JAVA)
+                .selectRunType("FAT_JAR")
+                .selectMainPackage("fat.jar")
+                .selectJavaResource("fat.jar")
                 .name("test-1")
-                .addParam("today", "${system.datetime}")
                 .selectEnv(environmentName)
                 .submit()
                 .submit()
                 .name(workflow)
-                .addGlobalParam("global_param", "hello world")
                 .submit();
 
         Awaitility.await().untilAsserted(() -> 
assertThat(workflowDefinitionPage.workflowList())
                 .as("Workflow list should contain newly-created workflow")
-                .anyMatch(
-                        it -> it.getText().contains(workflow)));
+                .anyMatch(it -> it.getText().contains(workflow)));
+
         workflowDefinitionPage.publish(workflow);
     }
 
     @Test
     @Order(30)
-    void testRunWorkflow() {
+    void testRunFatWorkflow() {

Review Comment:
   Has been modified



##########
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowJavaTaskE2ETest.java:
##########
@@ -163,17 +301,21 @@ void testRunWorkflow() {
                 .run(workflow)
                 .submit();
 
-        Awaitility.await().untilAsserted(() -> {
-            browser.navigate().refresh();
+        Awaitility.await()
+                .atMost(Duration.ofMinutes(5))

Review Comment:
   Has been modified



##########
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/JavaTaskForm.java:
##########
@@ -17,27 +17,124 @@
 
 package org.apache.dolphinscheduler.e2e.pages.project.workflow.task;
 
-import org.apache.dolphinscheduler.e2e.pages.common.CodeEditor;
+import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory;
 import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
 
+import java.util.List;
+
+import lombok.Getter;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
 import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.FindBys;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
 
+@Getter
 public class JavaTaskForm extends TaskNodeForm {
 
-    private CodeEditor codeEditor;
-
     private WebDriver driver;
 
+    @FindBys({
+            @FindBy(className = "resource-select"),
+            @FindBy(className = "n-base-selection"),
+    })
+    private WebElement selectResource;
+
+    @FindBys({
+
+            @FindBy(className = "n-tree-select"),
+            @FindBy(className = "n-base-selection"),
+    })
+    private WebElement selectMainPackage;
+
+    @FindBys({
+            @FindBy(xpath = "//div[contains(@class,'n-form-item') and 
.//span[text()='Run Type']]"),
+            @FindBy(className = "n-select"),
+            @FindBy(className = "n-base-selection")
+
+    })
+    private WebElement selectRunType;
+
     public JavaTaskForm(WorkflowForm parent) {
         super(parent);
 
-        this.codeEditor = new CodeEditor(parent.driver());
-
         this.driver = parent.driver();
+
+        PageFactory.initElements(driver, this);
     }
 
-    public JavaTaskForm script(String script) {
-        codeEditor.content(script);
+    public JavaTaskForm selectJavaResource(String resourceName) {
+        WebDriverWait wait = 
WebDriverWaitFactory.createWebDriverWait(driver());
+        wait.until(ExpectedConditions.elementToBeClickable(selectResource));
+        ((JavascriptExecutor) 
driver).executeScript("arguments[0].scrollIntoView(true); 
arguments[0].click();",
+                selectResource);
+        By optionsLocator = By.className("n-tree-node-content__text");
+        
wait.until(ExpectedConditions.visibilityOfElementLocated(optionsLocator));
+
+        List<WebElement> options = driver.findElements(optionsLocator);
+        boolean found = false;
+        for (WebElement option : options) {
+            if (option.getText().trim().startsWith(resourceName)) {
+                ((JavascriptExecutor) 
driver).executeScript("arguments[0].scrollIntoView(true); 
arguments[0].click();",
+                        option);
+                found = true;
+                break;
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("Cannot Found: " + resourceName);

Review Comment:
   Has been modified



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to