From 1f55f884517f7a44f195d1cd111ebca04cd59b3d Mon Sep 17 00:00:00 2001 From: SbloodyS <460888207@qq.com> Date: Sat, 29 Jun 2024 20:15:36 +0800 Subject: [PATCH] feature 16229 --- .../e2e/pages/common/CodeEditor.java | 4 ++++ .../e2e/core/DolphinSchedulerExtension.java | 14 ++++++++++++-- dolphinscheduler-e2e/pom.xml | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java index 8adbb06b4b..6fe3f5e3e8 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java @@ -81,6 +81,7 @@ public final class CodeEditor { .click() .sendKeys(inputContent) .sendKeys(Constants.LINE_SEPARATOR) + .pause(Constants.DEFAULT_SLEEP_SECONDS) .perform(); continue; } else { @@ -93,6 +94,7 @@ public final class CodeEditor { .click() .sendKeys(inputContent) .sendKeys(Constants.LINE_SEPARATOR) + .pause(Constants.DEFAULT_SLEEP_SECONDS) .perform(); } else { for (int p = 0 ; p < editorLineText.strip().length(); p++) { @@ -105,12 +107,14 @@ public final class CodeEditor { .click() .sendKeys(inputContent) .sendKeys(Constants.LINE_SEPARATOR) + .pause(Constants.DEFAULT_SLEEP_SECONDS) .perform(); } } else { actions.moveToElement(editor.get(i)) .click() .sendKeys(Constants.LINE_SEPARATOR) + .pause(Constants.DEFAULT_SLEEP_SECONDS) .perform(); } } 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 ae490af80a..762e3f31ec 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 @@ -45,6 +45,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.RemoteWebDriver; import org.testcontainers.Testcontainers; +import org.testcontainers.containers.BindMode; import org.testcontainers.containers.BrowserWebDriverContainer; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -142,11 +143,20 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall imageName = DockerImageName.parse("seleniarm/standalone-chromium:124.0-chromedriver-124.0") .asCompatibleSubstituteFor("selenium/standalone-chrome"); + if (!Files.exists(Constants.HOST_CHROME_DOWNLOAD_PATH)) { + try { + Files.createDirectories(Constants.HOST_CHROME_DOWNLOAD_PATH); + } catch (IOException e) { + LOGGER.error("Failed to create chrome download directory: {}", Constants.HOST_CHROME_DOWNLOAD_PATH); + throw new RuntimeException(e); + } + } + 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) + Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH, BindMode.READ_WRITE) .withRecordingMode(RECORD_ALL, record.toFile(), MP4) .withStartupTimeout(Duration.ofSeconds(300)); } else { @@ -154,7 +164,7 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall .withCapabilities(new ChromeOptions()) .withCreateContainerCmdModifier(cmd -> cmd.withUser("root")) .withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(), - Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH) + Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH, BindMode.READ_WRITE) .withRecordingMode(RECORD_ALL, record.toFile(), MP4) .withStartupTimeout(Duration.ofSeconds(300)); } diff --git a/dolphinscheduler-e2e/pom.xml b/dolphinscheduler-e2e/pom.xml index 8fa51cca20..3ee8886acb 100644 --- a/dolphinscheduler-e2e/pom.xml +++ b/dolphinscheduler-e2e/pom.xml @@ -44,6 +44,7 @@ 2.17.2 31.0.1-jre 2.22.2 + 1.19.8 @@ -120,7 +121,7 @@ org.testcontainers testcontainers-bom - 1.19.8 + ${testcontainers.version} import pom