Skip to content

Commit 5d4f50b

Browse files
Merge 9b1c9c2 into 3f21a7a
2 parents 3f21a7a + 9b1c9c2 commit 5d4f50b

File tree

8 files changed

+352
-0
lines changed

8 files changed

+352
-0
lines changed

.github/workflows/e2e.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
class: org.apache.dolphinscheduler.e2e.cases.TokenE2ETest
107107
- name: Workflow
108108
class: org.apache.dolphinscheduler.e2e.cases.WorkflowE2ETest
109+
- name: WorkflowHttp
110+
class: org.apache.dolphinscheduler.e2e.cases.WorkflowHttpTaskE2ETest
109111
# - name: WorkflowForSwitch
110112
# class: org.apache.dolphinscheduler.e2e.cases.WorkflowSwitchE2ETest
111113
- name: FileManage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/*
2+
* Licensed to Apache Software Foundation (ASF) under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Apache Software Foundation (ASF) licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.dolphinscheduler.e2e.cases;
21+
22+
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler;
23+
import org.apache.dolphinscheduler.e2e.pages.LoginPage;
24+
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
25+
import org.apache.dolphinscheduler.e2e.pages.project.ProjectDetailPage;
26+
import org.apache.dolphinscheduler.e2e.pages.project.ProjectPage;
27+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowDefinitionTab;
28+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
29+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowInstanceTab;
30+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.HttpTaskForm;
31+
import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage;
32+
import org.apache.dolphinscheduler.e2e.pages.security.TenantPage;
33+
import org.apache.dolphinscheduler.e2e.pages.security.UserPage;
34+
import org.junit.jupiter.api.AfterAll;
35+
import org.junit.jupiter.api.BeforeAll;
36+
import org.junit.jupiter.api.Order;
37+
import org.junit.jupiter.api.Test;
38+
import org.openqa.selenium.By;
39+
import org.openqa.selenium.remote.RemoteWebDriver;
40+
import org.openqa.selenium.support.ui.ExpectedConditions;
41+
import org.openqa.selenium.support.ui.WebDriverWait;
42+
import org.testcontainers.shaded.org.awaitility.Awaitility;
43+
44+
import java.time.Duration;
45+
46+
import static org.assertj.core.api.Assertions.assertThat;
47+
@DolphinScheduler(composeFiles = "docker/workflow-http/docker-compose.yaml")
48+
public class WorkflowHttpTaskE2ETest {
49+
50+
51+
private static final String project = "test-workflow-1";
52+
53+
private static final String workflow = "test-workflow-1";
54+
55+
private static final String user = "admin";
56+
57+
private static final String password = "dolphinscheduler123";
58+
59+
private static final String email = "[email protected]";
60+
61+
private static final String phone = "15800000000";
62+
63+
private static final String tenant = System.getProperty("user.name");
64+
65+
private static final String mockServerUrl = "http://mockServer:1080/test";
66+
67+
private static RemoteWebDriver browser;
68+
69+
@BeforeAll
70+
public static void setup() {
71+
UserPage userPage = new LoginPage(browser)
72+
.login("admin", "dolphinscheduler123")
73+
.goToNav(SecurityPage.class)
74+
.goToTab(TenantPage.class)
75+
.create(tenant)
76+
.goToNav(SecurityPage.class)
77+
.goToTab(UserPage.class);
78+
79+
new WebDriverWait(userPage.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated(
80+
new By.ByClassName("name")));
81+
82+
userPage.update(user, user, email, phone, tenant)
83+
.goToNav(ProjectPage.class)
84+
.create(project)
85+
;
86+
}
87+
88+
@AfterAll
89+
public static void cleanup() {
90+
new NavBarPage(browser)
91+
.goToNav(ProjectPage.class)
92+
.goTo(project)
93+
.goToTab(WorkflowDefinitionTab.class)
94+
.delete(workflow);
95+
96+
new NavBarPage(browser)
97+
.goToNav(ProjectPage.class)
98+
.delete(project);
99+
100+
browser.navigate().refresh();
101+
102+
new NavBarPage(browser)
103+
.goToNav(SecurityPage.class)
104+
.goToTab(TenantPage.class)
105+
.delete(tenant);
106+
}
107+
108+
@Test
109+
@Order(1)
110+
void testCreateWorkflow() {
111+
WorkflowDefinitionTab workflowDefinitionPage =
112+
new ProjectPage(browser)
113+
.goTo(project)
114+
.goToTab(WorkflowDefinitionTab.class);
115+
116+
workflowDefinitionPage
117+
.createWorkflow()
118+
.<HttpTaskForm> addTask(WorkflowForm.TaskType.HTTP)
119+
.url(mockServerUrl)
120+
.name("test-1")
121+
.addParam("today", "${system.datetime}")
122+
.submit()
123+
124+
.submit()
125+
.name(workflow)
126+
.addGlobalParam("global_param", "hello world")
127+
.submit()
128+
;
129+
130+
Awaitility.await().untilAsserted(() -> assertThat(workflowDefinitionPage.workflowList())
131+
.as("Workflow list should contain newly-created workflow")
132+
.anyMatch(
133+
it -> it.getText().contains(workflow)
134+
));
135+
workflowDefinitionPage.publish(workflow);
136+
}
137+
138+
139+
@Test
140+
@Order(30)
141+
void testRunWorkflow() {
142+
final ProjectDetailPage projectPage =
143+
new ProjectPage(browser)
144+
.goToNav(ProjectPage.class)
145+
.goTo(project);
146+
147+
projectPage
148+
.goToTab(WorkflowInstanceTab.class)
149+
.deleteAll();
150+
projectPage
151+
.goToTab(WorkflowDefinitionTab.class)
152+
.run(workflow)
153+
.submit();
154+
155+
Awaitility.await().untilAsserted(() -> {
156+
browser.navigate().refresh();
157+
158+
final WorkflowInstanceTab.Row row = projectPage
159+
.goToTab(WorkflowInstanceTab.class)
160+
.instances()
161+
.iterator()
162+
.next();
163+
164+
assertThat(row.isSuccess()).isTrue();
165+
assertThat(row.executionTime()).isEqualTo(1);
166+
});
167+
}
168+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
*/
20+
21+
22+
package org.apache.dolphinscheduler.e2e.pages.common;
23+
24+
import lombok.Getter;
25+
import org.openqa.selenium.WebDriver;
26+
import org.openqa.selenium.WebElement;
27+
import org.openqa.selenium.support.FindBy;
28+
import org.openqa.selenium.support.FindBys;
29+
import org.openqa.selenium.support.PageFactory;
30+
import org.openqa.selenium.support.ui.ExpectedConditions;
31+
import org.openqa.selenium.support.ui.WebDriverWait;
32+
33+
import java.time.Duration;
34+
35+
@Getter
36+
public class HttpInput {
37+
@FindBys({
38+
@FindBy(className = "input-url-name"),
39+
@FindBy(tagName = "input")
40+
})
41+
private WebElement urlInput;
42+
43+
private WebDriver driver;
44+
45+
46+
47+
public HttpInput(WebDriver driver) {
48+
PageFactory.initElements(driver, this);
49+
this.driver = driver;
50+
}
51+
52+
public HttpInput content(String content) {
53+
new WebDriverWait(this.driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(urlInput));
54+
urlInput().sendKeys(content);
55+
return this;
56+
}
57+
58+
}

dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
package org.apache.dolphinscheduler.e2e.pages.project.workflow;
2121

22+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.HttpTaskForm;
2223
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.ShellTaskForm;
2324
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.SubWorkflowTaskForm;
2425

@@ -82,6 +83,8 @@ public <T> T addTask(TaskType type) {
8283
return (T) new SubWorkflowTaskForm(this);
8384
case SWITCH:
8485
return (T) new SwitchTaskForm(this);
86+
case HTTP:
87+
return (T) new HttpTaskForm(this);
8588
}
8689
throw new UnsupportedOperationException("Unknown task type");
8790
}
@@ -117,5 +120,6 @@ public enum TaskType {
117120
SHELL,
118121
SUB_PROCESS,
119122
SWITCH,
123+
HTTP,
120124
}
121125
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
*/
20+
21+
package org.apache.dolphinscheduler.e2e.pages.project.workflow.task;
22+
23+
import org.apache.dolphinscheduler.e2e.pages.common.HttpInput;
24+
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
25+
import org.openqa.selenium.WebDriver;
26+
27+
public class HttpTaskForm extends TaskNodeForm{
28+
private WebDriver driver;
29+
30+
private HttpInput httpInput;
31+
32+
33+
public HttpTaskForm(WorkflowForm parent) {
34+
super(parent);
35+
this.httpInput = new HttpInput(parent.driver());
36+
this.driver = parent.driver();
37+
}
38+
39+
public HttpTaskForm url(String script) {
40+
httpInput.content(script);
41+
return this;
42+
}
43+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
version: "3.8"
19+
20+
services:
21+
dolphinscheduler:
22+
image: apache/dolphinscheduler-standalone-server:ci
23+
environment:
24+
MASTER_MAX_CPU_LOAD_AVG: 400
25+
MASTER_RESERVED_MEMORY: 0.01
26+
WORKER_TENANT_AUTO_CREATE: 'true'
27+
ports:
28+
- "12345:12345"
29+
networks:
30+
- e2e
31+
healthcheck:
32+
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
33+
interval: 5s
34+
timeout: 5s
35+
retries: 120
36+
mockServer:
37+
image: mockserver/mockserver:5.14.0
38+
environment:
39+
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/mockserver-config.json
40+
ports:
41+
- "1080:1080"
42+
networks:
43+
- e2e
44+
volumes:
45+
- type: bind
46+
source: ./
47+
target: /config
48+
healthcheck:
49+
test: [ "CMD", "curl", "http://localhost:1080/" ]
50+
interval: 5s
51+
timeout: 5s
52+
retries: 120
53+
networks:
54+
e2e:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
[{
3+
"httpRequest": {
4+
"path": "/test",
5+
"method": "GET"
6+
},
7+
"httpResponse": {
8+
"body": [
9+
{
10+
"name": "lzl",
11+
"age": 18
12+
},
13+
{
14+
"name": "pizz2",
15+
"age": 19
16+
}
17+
],
18+
"headers": {
19+
"Content-Type": "application/json"
20+
}
21+
}
22+
}]

dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export function useHttp(model: { [field: string]: any }): IJsonItem[] {
4343
return [
4444
{
4545
type: 'input',
46+
class: 'input-url-name',
4647
field: 'url',
4748
name: t('project.node.http_url'),
4849
props: {

0 commit comments

Comments
 (0)