feature 16229

This commit is contained in:
SbloodyS 2024-06-29 20:15:36 +08:00
parent 42827bcca5
commit 1f55f88451
3 changed files with 18 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -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));
}

View File

@ -44,6 +44,7 @@
<log4j-slf4j-impl.version>2.17.2</log4j-slf4j-impl.version>
<guava.version>31.0.1-jre</guava.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<testcontainers.version>1.19.8</testcontainers.version>
</properties>
<dependencies>
@ -120,7 +121,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.19.8</version>
<version>${testcontainers.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>