You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/03/22 06:11:55 UTC
[dolphinscheduler] branch dev updated: [Feature][e2e] Suggest e2e test adapt M1 chip (#9077)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 197accc [Feature][e2e] Suggest e2e test adapt M1 chip (#9077)
197accc is described below
commit 197accc60107370600719a7ade7e86bd80f69d26
Author: xiangzihao <46...@qq.com>
AuthorDate: Tue Mar 22 14:11:50 2022 +0800
[Feature][e2e] Suggest e2e test adapt M1 chip (#9077)
---
.../pages/project/workflow/WorkflowRunDialog.java | 4 ++
.../e2e/core/DolphinSchedulerExtension.java | 68 +++++++++++++++-------
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java
index 8d5e065..493f729 100644
--- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java
+++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java
@@ -24,6 +24,8 @@ import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import lombok.Getter;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
@Getter
public final class WorkflowRunDialog {
@@ -39,6 +41,8 @@ public final class WorkflowRunDialog {
}
public WorkflowDefinitionTab submit() {
+ new WebDriverWait(parent().driver(), 5).until(ExpectedConditions.elementToBeClickable(buttonSubmit()));
+
buttonSubmit().click();
return parent();
diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java
index 55f6c30..21e2f12 100644
--- a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java
+++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java
@@ -59,13 +59,14 @@ import com.google.common.base.Strings;
import com.google.common.net.HostAndPort;
import lombok.extern.slf4j.Slf4j;
+import org.testcontainers.utility.DockerImageName;
@Slf4j
-final class DolphinSchedulerExtension
- implements BeforeAllCallback, AfterAllCallback,
- BeforeEachCallback {
+final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback {
private final boolean LOCAL_MODE = Objects.equals(System.getProperty("local"), "true");
+ private final boolean M1_CHIP_FLAG = Objects.equals(System.getProperty("m1_chip"), "true");
+
private RemoteWebDriver driver;
private DockerComposeContainer<?> compose;
private BrowserWebDriverContainer<?> browser;
@@ -73,36 +74,24 @@ final class DolphinSchedulerExtension
private HostAndPort address;
private String rootPath;
+ private Path record;
+
@Override
@SuppressWarnings("UnstableApiUsage")
public void beforeAll(ExtensionContext context) throws IOException {
Awaitility.setDefaultTimeout(Duration.ofSeconds(60));
Awaitility.setDefaultPollInterval(Duration.ofSeconds(10));
+ setRecordPath();
+
if (LOCAL_MODE) {
runInLocal();
} else {
runInDockerContainer(context);
}
- final Path record;
- if (!Strings.isNullOrEmpty(System.getenv("RECORDING_PATH"))) {
- record = Paths.get(System.getenv("RECORDING_PATH"));
- if (!record.toFile().exists()) {
- if (!record.toFile().mkdir()) {
- throw new IOException("Failed to create recording directory: " + record.toAbsolutePath());
- }
- }
- } else {
- record = Files.createTempDirectory("record-");
- }
+ setBrowserContainerByOsName();
- browser = new BrowserWebDriverContainer<>()
- .withCapabilities(new ChromeOptions())
- .withCreateContainerCmdModifier(cmd -> cmd.withUser("root"))
- .withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(),
- Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH)
- .withRecordingMode(RECORD_ALL, record.toFile(), MP4);
if (network != null) {
browser.withNetwork(network);
}
@@ -128,8 +117,8 @@ final class DolphinSchedulerExtension
}
private void runInLocal() {
- Testcontainers.exposeHostPorts(8888);
- address = HostAndPort.fromParts("host.testcontainers.internal", 8888);
+ Testcontainers.exposeHostPorts(3000);
+ address = HostAndPort.fromParts("host.testcontainers.internal", 3000);
rootPath = "/";
}
@@ -159,6 +148,41 @@ final class DolphinSchedulerExtension
rootPath = "/dolphinscheduler/ui/";
}
+ private void setBrowserContainerByOsName() {
+ DockerImageName imageName;
+
+ if (LOCAL_MODE && M1_CHIP_FLAG) {
+ imageName = DockerImageName.parse("seleniarm/standalone-chromium:4.1.2-20220227")
+ .asCompatibleSubstituteFor("selenium/standalone-chrome");
+
+ browser = new BrowserWebDriverContainer<>(imageName)
+ .withCapabilities(new ChromeOptions())
+ .withCreateContainerCmdModifier(cmd -> cmd.withUser("root"))
+ .withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(),
+ Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH);
+ } else {
+ browser = new BrowserWebDriverContainer<>()
+ .withCapabilities(new ChromeOptions())
+ .withCreateContainerCmdModifier(cmd -> cmd.withUser("root"))
+ .withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(),
+ Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH)
+ .withRecordingMode(RECORD_ALL, record.toFile(), MP4);
+ }
+ }
+
+ private void setRecordPath() throws IOException {
+ if (!Strings.isNullOrEmpty(System.getenv("RECORDING_PATH"))) {
+ record = Paths.get(System.getenv("RECORDING_PATH"));
+ if (!record.toFile().exists()) {
+ if (!record.toFile().mkdir()) {
+ throw new IOException("Failed to create recording directory: " + record.toAbsolutePath());
+ }
+ }
+ } else {
+ record = Files.createTempDirectory("record-");
+ }
+ }
+
@Override
public void afterAll(ExtensionContext context) {
browser.afterTest(new TestDescription(context), Optional.empty());