diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClickhouseDataSourceE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClickhouseDataSourceE2ETest.java index aae65d1f83..e150e73e98 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClickhouseDataSourceE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClickhouseDataSourceE2ETest.java @@ -21,12 +21,14 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -80,10 +82,10 @@ public class ClickhouseDataSourceE2ETest { page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); - new WebDriverWait(page.driver(), 10).until(ExpectedConditions.invisibilityOfElementLocated( + new WebDriverWait(page.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated( new By.ByClassName("dialog-create-data-source"))); - await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) + Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) .as("DataSource list should contain newly-created database") .extracting(WebElement::getText) .anyMatch(it -> it.contains(dataSourceName))); @@ -96,7 +98,7 @@ public class ClickhouseDataSourceE2ETest { page.delete(dataSourceName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClusterE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClusterE2ETest.java index 18c6a69ec0..a7e526540b 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClusterE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ClusterE2ETest.java @@ -21,13 +21,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.security.ClusterPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -63,7 +63,7 @@ class ClusterE2ETest { final ClusterPage page = new ClusterPage(browser); page.create(clusterName, clusterConfig, clusterDesc); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.clusterList()) .as("Cluster list should contain newly-created cluster") @@ -78,7 +78,7 @@ class ClusterE2ETest { final ClusterPage page = new ClusterPage(browser); page.create(clusterName, clusterConfig, clusterDesc); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -92,7 +92,7 @@ class ClusterE2ETest { final ClusterPage page = new ClusterPage(browser); page.update(clusterName, editClusterName, editClusterConfig, editClusterDesc); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.clusterList()) .as("Cluster list should contain newly-modified cluster") @@ -108,7 +108,7 @@ class ClusterE2ETest { page.delete(editClusterName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/EnvironmentE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/EnvironmentE2ETest.java index 555307ce70..1e3d848645 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/EnvironmentE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/EnvironmentE2ETest.java @@ -21,16 +21,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; -import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; import org.apache.dolphinscheduler.e2e.pages.security.EnvironmentPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; -import org.apache.dolphinscheduler.e2e.pages.security.WorkerGroupPage; -import org.junit.jupiter.api.AfterAll; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -68,7 +65,7 @@ class EnvironmentE2ETest { final EnvironmentPage page = new EnvironmentPage(browser); page.create(environmentName, environmentConfig, environmentDesc, environmentWorkerGroup); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.environmentList()) .as("Environment list should contain newly-created environment") @@ -83,7 +80,7 @@ class EnvironmentE2ETest { final EnvironmentPage page = new EnvironmentPage(browser); page.create(environmentName, environmentConfig, environmentDesc, environmentWorkerGroup); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -97,7 +94,7 @@ class EnvironmentE2ETest { final EnvironmentPage page = new EnvironmentPage(browser); page.update(environmentName, editEnvironmentName, editEnvironmentConfig, editEnvironmentDesc, editEnvironmentWorkerGroup); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.environmentList()) .as("Environment list should contain newly-modified environment") @@ -113,7 +110,7 @@ class EnvironmentE2ETest { page.delete(editEnvironmentName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java index 574597f42f..1bfa997f85 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java @@ -21,7 +21,6 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.Constants; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; @@ -40,6 +39,7 @@ import java.nio.file.Path; import java.time.Duration; import java.util.Comparator; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -90,15 +90,15 @@ public class FileManageE2ETest { .goToTab(TenantPage.class) .create(tenant); - await().untilAsserted(() -> assertThat(tenantPage.tenantList()) - .as("Tenant list should contain newly-created tenant") - .extracting(WebElement::getText) - .anyMatch(it -> it.contains(tenant))); + Awaitility.await().untilAsserted(() -> assertThat(tenantPage.tenantList()) + .as("Tenant list should contain newly-created tenant") + .extracting(WebElement::getText) + .anyMatch(it -> it.contains(tenant))); UserPage userPage = tenantPage.goToNav(SecurityPage.class) .goToTab(UserPage.class); - new WebDriverWait(userPage.driver(), 20).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(userPage.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("name"))); userPage.update(user, user, email, phone, tenant) @@ -124,7 +124,7 @@ public class FileManageE2ETest { page.createDirectory(testDirectoryName); - await().untilAsserted(() -> assertThat(page.fileList()) + Awaitility.await().untilAsserted(() -> assertThat(page.fileList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testDirectoryName))); @@ -137,7 +137,7 @@ public class FileManageE2ETest { page.cancelCreateDirectory(testDirectoryName); - await().untilAsserted(() -> assertThat(page.fileList()) + Awaitility.await().untilAsserted(() -> assertThat(page.fileList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testDirectoryName))); @@ -199,7 +199,7 @@ public class FileManageE2ETest { .goToTab(FileManagePage.class) .delete(testDirectoryName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( @@ -218,7 +218,7 @@ public class FileManageE2ETest { page.createFile(testFileName, scripts); - await().untilAsserted(() -> assertThat(page.fileList()) + Awaitility.await().untilAsserted(() -> assertThat(page.fileList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testFileName))); @@ -231,7 +231,7 @@ public class FileManageE2ETest { page.rename(testFileName, testRenameFileName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.fileList()) @@ -249,7 +249,7 @@ public class FileManageE2ETest { page.editFile(testRenameFileName, scripts); - await().untilAsserted(() -> assertThat(page.fileList()) + Awaitility.await().untilAsserted(() -> assertThat(page.fileList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testRenameFileName))); @@ -262,7 +262,7 @@ public class FileManageE2ETest { page.delete(testRenameFileName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( @@ -285,9 +285,9 @@ public class FileManageE2ETest { page.uploadFile(testUnder1GBFilePath.toFile().getAbsolutePath()); - new WebDriverWait(browser, 10).until(ExpectedConditions.invisibilityOfElementLocated(By.id("fileUpdateDialog"))); + new WebDriverWait(browser, Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated(By.id("fileUpdateDialog"))); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { assertThat(page.fileList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) @@ -304,7 +304,7 @@ public class FileManageE2ETest { File file = Constants.HOST_CHROME_DOWNLOAD_PATH.resolve(testUnder1GBFileName).toFile(); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { assert file.exists(); }); } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FunctionManageE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FunctionManageE2ETest.java index a94343576c..144c430eee 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FunctionManageE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FunctionManageE2ETest.java @@ -22,7 +22,6 @@ package org.apache.dolphinscheduler.e2e.cases; import lombok.SneakyThrows; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.Constants; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; @@ -44,6 +43,7 @@ import java.nio.file.Path; import java.time.Duration; import java.util.Comparator; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -89,7 +89,7 @@ public class FunctionManageE2ETest { .goToTab(TenantPage.class) .create(tenant); - await().untilAsserted(() -> assertThat(tenantPage.tenantList()) + Awaitility.await().untilAsserted(() -> assertThat(tenantPage.tenantList()) .as("Tenant list should contain newly-created tenant") .extracting(WebElement::getText) .anyMatch(it -> it.contains(tenant))); @@ -99,7 +99,7 @@ public class FunctionManageE2ETest { UserPage userPage = tenantPage.goToNav(SecurityPage.class) .goToTab(UserPage.class); - new WebDriverWait(userPage.driver(), 20).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(userPage.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("name"))); UdfManagePage udfManagePage = userPage.update(user, user, email, phone, tenant) @@ -147,7 +147,7 @@ public class FunctionManageE2ETest { page.createUdfFunction(testUdfFunctionName, testClassName, testUploadUdfFileName, testDescription); - await().untilAsserted(() -> assertThat(page.functionList()) + Awaitility.await().untilAsserted(() -> assertThat(page.functionList()) .as("Function list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testUdfFunctionName))); @@ -162,7 +162,7 @@ public class FunctionManageE2ETest { page.renameUdfFunction(testUdfFunctionName, testRenameUdfFunctionName); - await().pollDelay(Duration.ofSeconds(2)).untilAsserted(() -> assertThat(page.functionList()) + Awaitility.await().pollDelay(Duration.ofSeconds(2)).untilAsserted(() -> assertThat(page.functionList()) .as("Function list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testRenameUdfFunctionName))); @@ -175,7 +175,7 @@ public class FunctionManageE2ETest { page.deleteUdfFunction(testRenameUdfFunctionName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/HiveDataSourceE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/HiveDataSourceE2ETest.java index 142349fbd1..9b6e661f52 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/HiveDataSourceE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/HiveDataSourceE2ETest.java @@ -21,12 +21,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; +import java.time.Duration; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -35,6 +36,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import org.testcontainers.shaded.org.awaitility.Awaitility; @DolphinScheduler(composeFiles = "docker/datasource-hive/docker-compose.yaml") public class HiveDataSourceE2ETest { @@ -64,12 +66,13 @@ public class HiveDataSourceE2ETest { private static final String jdbcParams = ""; - @BeforeAll public static void setup() { new LoginPage(browser) .login(user, password) .goToNav(DataSourcePage.class); + + } @Test @@ -79,10 +82,10 @@ public class HiveDataSourceE2ETest { page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, hivePassword, database, jdbcParams); - new WebDriverWait(page.driver(), 10).until(ExpectedConditions.invisibilityOfElementLocated( + new WebDriverWait(page.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated( new By.ByClassName("dialog-create-data-source"))); - await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) + Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) .as("DataSource list should contain newly-created database") .extracting(WebElement::getText) .anyMatch(it -> it.contains(dataSourceName))); @@ -95,7 +98,7 @@ public class HiveDataSourceE2ETest { page.delete(dataSourceName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/MysqlDataSourceE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/MysqlDataSourceE2ETest.java index 76fb3674bb..5078f55e35 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/MysqlDataSourceE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/MysqlDataSourceE2ETest.java @@ -21,17 +21,18 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; @@ -81,10 +82,10 @@ public class MysqlDataSourceE2ETest { page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, mysqlPassword, database, jdbcParams); - new WebDriverWait(page.driver(), 10).until(ExpectedConditions.invisibilityOfElementLocated( + new WebDriverWait(page.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated( new By.ByClassName("dialog-create-data-source"))); - await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) + Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) .as("DataSource list should contain newly-created database") .extracting(WebElement::getText) .anyMatch(it -> it.contains(dataSourceName))); @@ -97,7 +98,7 @@ public class MysqlDataSourceE2ETest { page.delete(dataSourceName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/PostgresDataSourceE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/PostgresDataSourceE2ETest.java index c54e867eb8..647c667741 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/PostgresDataSourceE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/PostgresDataSourceE2ETest.java @@ -21,12 +21,14 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -80,10 +82,10 @@ public class PostgresDataSourceE2ETest { page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); - new WebDriverWait(page.driver(), 10).until(ExpectedConditions.invisibilityOfElementLocated( + new WebDriverWait(page.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated( new By.ByClassName("dialog-create-data-source"))); - await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) + Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) .as("DataSource list should contain newly-created database") .extracting(WebElement::getText) .anyMatch(it -> it.contains(dataSourceName))); @@ -96,7 +98,7 @@ public class PostgresDataSourceE2ETest { page.delete(dataSourceName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ProjectE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ProjectE2ETest.java index 2701ae3b64..f9f54299e8 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ProjectE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/ProjectE2ETest.java @@ -20,16 +20,15 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.project.ProjectPage; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; -import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; @DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml") @@ -57,7 +56,7 @@ class ProjectE2ETest { final ProjectPage page = new ProjectPage(browser); page.delete(project); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( page.projectList() diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java index bfbcc5bb5f..0ad3ee3a35 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java @@ -21,13 +21,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.security.QueuePage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -60,7 +60,7 @@ class QueueE2ETest { final QueuePage page = new QueuePage(browser); page.create(queueName, queueValue); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.queueList()) .as("Queue list should contain newly-created queue") @@ -75,7 +75,7 @@ class QueueE2ETest { final QueuePage page = new QueuePage(browser); page.create(queueName, queueValue); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -90,7 +90,7 @@ class QueueE2ETest { page.update(queueName, editQueueName, editQueueValue); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.queueList()) .as("Queue list should contain newly-modified Queue") diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/SqlServerDataSourceE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/SqlServerDataSourceE2ETest.java index 8a666fa278..7777b9a441 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/SqlServerDataSourceE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/SqlServerDataSourceE2ETest.java @@ -21,12 +21,14 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -80,10 +82,10 @@ public class SqlServerDataSourceE2ETest { page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); - new WebDriverWait(page.driver(), 10).until(ExpectedConditions.invisibilityOfElementLocated( + new WebDriverWait(page.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.invisibilityOfElementLocated( new By.ByClassName("dialog-create-data-source"))); - await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) + Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) .as("DataSource list should contain newly-created database") .extracting(WebElement::getText) .anyMatch(it -> it.contains(dataSourceName))); @@ -96,7 +98,7 @@ public class SqlServerDataSourceE2ETest { page.delete(dataSourceName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java index 08c335fbd6..d80eae7b89 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TenantE2ETest.java @@ -20,13 +20,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -56,7 +56,7 @@ class TenantE2ETest { final TenantPage page = new TenantPage(browser); page.create(tenant); - await().untilAsserted(() -> assertThat(page.tenantList()) + Awaitility.await().untilAsserted(() -> assertThat(page.tenantList()) .as("Tenant list should contain newly-created tenant") .extracting(WebElement::getText) .anyMatch(it -> it.contains(tenant))); @@ -69,7 +69,7 @@ class TenantE2ETest { page.create(tenant); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -84,7 +84,7 @@ class TenantE2ETest { page.update(tenant, editDescription); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.tenantList()) .as("Tenant list should contain newly-modified tenant") @@ -99,7 +99,7 @@ class TenantE2ETest { final TenantPage page = new TenantPage(browser); page.delete(tenant); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TokenE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TokenE2ETest.java index 9417c595f5..8d287637b0 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TokenE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/TokenE2ETest.java @@ -20,13 +20,13 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TokenPage; +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -55,7 +55,7 @@ public class TokenE2ETest { TokenPage page = new TokenPage(browser); page.create(userName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.tokenList()) @@ -72,7 +72,7 @@ public class TokenE2ETest { String oldToken = page.getToken(userName); page.update(userName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.tokenList()) @@ -88,7 +88,7 @@ public class TokenE2ETest { TokenPage page = new TokenPage(browser); page.delete(userName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.tokenList()) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UdfManageE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UdfManageE2ETest.java index 63b01905eb..07610f9b12 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UdfManageE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UdfManageE2ETest.java @@ -20,9 +20,7 @@ package org.apache.dolphinscheduler.e2e.cases; -import lombok.SneakyThrows; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.Constants; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; @@ -33,6 +31,17 @@ import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; import org.apache.dolphinscheduler.e2e.pages.security.UserPage; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.Comparator; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -43,16 +52,7 @@ import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; -import java.util.Objects; +import lombok.SneakyThrows; @DolphinScheduler(composeFiles = "docker/file-manage/docker-compose.yaml") public class UdfManageE2ETest { @@ -86,7 +86,7 @@ public class UdfManageE2ETest { .goToTab(TenantPage.class) .create(tenant); - await().untilAsserted(() -> assertThat(tenantPage.tenantList()) + Awaitility.await().untilAsserted(() -> assertThat(tenantPage.tenantList()) .as("Tenant list should contain newly-created tenant") .extracting(WebElement::getText) .anyMatch(it -> it.contains(tenant))); @@ -94,7 +94,7 @@ public class UdfManageE2ETest { UserPage userPage = tenantPage.goToNav(SecurityPage.class) .goToTab(UserPage.class); - new WebDriverWait(userPage.driver(), 20).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(userPage.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("name"))); userPage.update(user, user, email, phone, tenant) @@ -118,10 +118,10 @@ public class UdfManageE2ETest { void testCreateDirectory() { final UdfManagePage page = new UdfManagePage(browser); - new WebDriverWait(page.driver(), 10) + new WebDriverWait(page.driver(), Duration.ofSeconds(20)) .until(ExpectedConditions.urlContains("/resource-manage")); page.createDirectory(testDirectoryName); - await().untilAsserted(() -> assertThat(page.udfList()) + Awaitility.await().untilAsserted(() -> assertThat(page.udfList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) .anyMatch(it -> it.contains(testDirectoryName))); @@ -151,7 +151,7 @@ public class UdfManageE2ETest { final UdfManagePage page = new UdfManagePage(browser); page.delete(testDirectoryName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( @@ -170,7 +170,7 @@ public class UdfManageE2ETest { downloadFile("https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/3.1.2/hive-jdbc-3.1.2.jar", testUploadUdfFilePath.toFile().getAbsolutePath()); page.uploadFile(testUploadUdfFilePath.toFile().getAbsolutePath()); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { assertThat(page.udfList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) @@ -202,7 +202,7 @@ public class UdfManageE2ETest { final UdfManagePage page = new UdfManagePage(browser); page.rename(testUploadUdfFileName, testUploadUdfRenameFileName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { assertThat(page.udfList()) .as("File list should contain newly-created file") .extracting(WebElement::getText) @@ -216,7 +216,7 @@ public class UdfManageE2ETest { final UdfManagePage page = new UdfManagePage(browser); page.delete(testUploadUdfRenameFileName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UserE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UserE2ETest.java index 35f98b2e71..3ed263ec0e 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UserE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/UserE2ETest.java @@ -21,7 +21,6 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; @@ -30,6 +29,9 @@ import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; import org.apache.dolphinscheduler.e2e.pages.security.UserPage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -63,7 +65,7 @@ class UserE2ETest { .goToTab(TenantPage.class) .create(tenant); - await().untilAsserted(() -> assertThat(tenantPage.tenantList()) + Awaitility.await().untilAsserted(() -> assertThat(tenantPage.tenantList()) .as("Tenant list should contain newly-created tenant") .extracting(WebElement::getText) .anyMatch(it -> it.contains(tenant))); @@ -87,7 +89,7 @@ class UserE2ETest { page.create(user, password, email, phone, tenant); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.userList()) @@ -104,7 +106,7 @@ class UserE2ETest { page.create(user, password, email, phone, tenant); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -117,14 +119,14 @@ class UserE2ETest { void testEditUser() { UserPage page = new UserPage(browser); - new WebDriverWait(browser, 20).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(browser, Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("name"))); browser.navigate().refresh(); page.update(user, editUser, editEmail, editPhone, tenant); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.userList()) .as("User list should contain newly-modified User") @@ -140,7 +142,7 @@ class UserE2ETest { page.delete(editUser); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkerGroupE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkerGroupE2ETest.java index b4bb4eee8c..b7f2a9474c 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkerGroupE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkerGroupE2ETest.java @@ -21,13 +21,15 @@ package org.apache.dolphinscheduler.e2e.cases; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; import org.apache.dolphinscheduler.e2e.pages.LoginPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.WorkerGroupPage; +import java.time.Duration; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -57,12 +59,12 @@ class WorkerGroupE2ETest { void testCreateWorkerGroup() { final WorkerGroupPage page = new WorkerGroupPage(browser); - new WebDriverWait(page.driver(), 10) + new WebDriverWait(page.driver(), Duration.ofSeconds(20)) .until(ExpectedConditions.urlContains("/security/worker-group-manage")); page.create(workerGroupName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.workerGroupList()) @@ -79,7 +81,7 @@ class WorkerGroupE2ETest { page.create(workerGroupName); - await().untilAsserted(() -> + Awaitility.await().untilAsserted(() -> assertThat(browser.findElement(By.tagName("body")).getText()) .contains("already exists") ); @@ -93,7 +95,7 @@ class WorkerGroupE2ETest { final WorkerGroupPage page = new WorkerGroupPage(browser); page.update(workerGroupName, editWorkerGroupName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat(page.workerGroupList()) .as("workerGroup list should contain newly-modified workerGroup") @@ -110,7 +112,7 @@ class WorkerGroupE2ETest { page.delete(editWorkerGroupName); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); assertThat( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java index 9354b2745e..0b97ab02af 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java @@ -33,6 +33,8 @@ import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.SubWorkflowTa import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; import org.apache.dolphinscheduler.e2e.pages.security.UserPage; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -43,7 +45,6 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import java.time.Duration; @@ -75,7 +76,7 @@ class WorkflowE2ETest { .goToNav(SecurityPage.class) .goToTab(UserPage.class); - new WebDriverWait(userPage.driver(), 20).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(userPage.driver(), Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("name"))); userPage.update(user, user, email, phone, tenant) @@ -127,7 +128,7 @@ class WorkflowE2ETest { .submit() ; - await().untilAsserted(() -> assertThat(workflowDefinitionPage.workflowList()) + Awaitility.await().untilAsserted(() -> assertThat(workflowDefinitionPage.workflowList()) .as("Workflow list should contain newly-created workflow") .anyMatch( it -> it.getText().contains(workflow) @@ -159,7 +160,7 @@ class WorkflowE2ETest { .submit() ; - await().untilAsserted(() -> assertThat( + Awaitility.await().untilAsserted(() -> assertThat( workflowDefinitionPage.workflowList() ).anyMatch(it -> it.getText().contains(workflow))); workflowDefinitionPage.publish(workflow); @@ -181,7 +182,7 @@ class WorkflowE2ETest { .run(workflow) .submit(); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); final Row row = projectPage @@ -203,7 +204,7 @@ class WorkflowE2ETest { .next() .rerun(); - await().timeout(Duration.ofSeconds(20)).untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); final Row row = projectPage diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowSwitchE2ETest.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowSwitchE2ETest.java index fdd48399f6..edf4bc59e2 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowSwitchE2ETest.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowSwitchE2ETest.java @@ -34,6 +34,8 @@ import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.ShellTaskForm import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.SwitchTaskForm; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage; import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; + +import org.testcontainers.shaded.org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; @@ -43,7 +45,6 @@ import org.openqa.selenium.remote.RemoteWebDriver; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; @DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml") class WorkflowSwitchE2ETest { @@ -133,7 +134,7 @@ class WorkflowSwitchE2ETest { .addGlobalParam("key", "1") .submit(); - await().untilAsserted(() -> assertThat( + Awaitility.await().untilAsserted(() -> assertThat( workflowDefinitionPage.workflowList() ).anyMatch(it -> it.getText().contains(workflow))); @@ -157,7 +158,7 @@ class WorkflowSwitchE2ETest { .run(workflow) .submit(); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { browser.navigate().refresh(); final Row row = projectPage @@ -175,7 +176,7 @@ class WorkflowSwitchE2ETest { .goToTab(TaskInstanceTab.class) .instances(); - await().untilAsserted(() -> { + Awaitility.await().untilAsserted(() -> { assertThat(taskInstances.size()).isEqualTo(3); assertThat(taskInstances.stream().filter(row -> row.name().contains(ifBranchName)).count()).isEqualTo(1); assertThat(taskInstances.stream().noneMatch(row -> row.name().contains(elseBranchName))).isTrue(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java index 74aa3e96d5..cde8c9d778 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/LoginPage.java @@ -32,6 +32,8 @@ import org.openqa.selenium.support.ui.WebDriverWait; import lombok.Getter; import lombok.SneakyThrows; +import java.time.Duration; + @Getter public final class LoginPage extends NavBarPage { @FindBys({ @@ -58,7 +60,7 @@ public final class LoginPage extends NavBarPage { @SneakyThrows public NavBarPage login(String username, String password) { - new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(buttonSwitchLanguage)); + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.elementToBeClickable(buttonSwitchLanguage)); buttonSwitchLanguage().click(); @@ -66,7 +68,7 @@ public final class LoginPage extends NavBarPage { inputPassword().sendKeys(password); buttonLogin().click(); - new WebDriverWait(driver, 20) + new WebDriverWait(driver, Duration.ofSeconds(30)) .until(ExpectedConditions.urlContains("/home")); return new NavBarPage(driver); 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 8e610fb8d5..e55751c367 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 @@ -29,6 +29,9 @@ import org.openqa.selenium.support.FindBys; import org.openqa.selenium.support.PageFactory; import lombok.Getter; + +import java.time.Duration; + import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @@ -48,7 +51,7 @@ public final class CodeEditor { } public CodeEditor content(String content) { - new WebDriverWait(this.driver, 10).until(ExpectedConditions.elementToBeClickable(editor)); + new WebDriverWait(this.driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(editor)); editor.click(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java index 0c846a24c4..0a6373977a 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/NavBarPage.java @@ -35,6 +35,8 @@ import org.openqa.selenium.support.ui.WebDriverWait; import lombok.Getter; +import java.time.Duration; + @Getter public class NavBarPage { protected final RemoteWebDriver driver; @@ -62,25 +64,25 @@ public class NavBarPage { public T goToNav(Class nav) { if (nav == ProjectPage.class) { - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(projectTab)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(projectTab)); projectTab.click(); return nav.cast(new ProjectPage(driver)); } if (nav == SecurityPage.class) { - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(securityTab)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(securityTab)); securityTab.click(); return nav.cast(new SecurityPage(driver)); } if (nav == ResourcePage.class) { - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(resourceTab)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(resourceTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", resourceTab()); return nav.cast(new ResourcePage(driver)); } if (nav == DataSourcePage.class) { - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(dataSourceTab)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(dataSourceTab)); dataSourceTab.click(); return nav.cast(new DataSourcePage(driver)); } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java index 78f16b781f..1f6c76fd44 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java @@ -25,6 +25,7 @@ import lombok.Getter; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; import java.security.Key; +import java.time.Duration; import java.util.List; import org.openqa.selenium.By; @@ -73,12 +74,12 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem String jdbcParams) { buttonCreateDataSource().click(); - new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated( + new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.visibilityOfElementLocated( new By.ByClassName("dialog-source-modal"))); dataSourceModal().findElement(By.className(dataSourceType.toUpperCase()+"-box")).click(); - new WebDriverWait(driver, 10).until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase())); + new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase())); createDataSourceForm().inputDataSourceName().sendKeys(dataSourceName); createDataSourceForm().inputDataSourceDescription().sendKeys(dataSourceDescription); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java index 9e2ebe803d..d5a7b386c5 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java @@ -20,20 +20,22 @@ package org.apache.dolphinscheduler.e2e.pages.project.workflow; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; -import lombok.Getter; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; import org.apache.dolphinscheduler.e2e.pages.project.ProjectDetailPage; + +import java.util.List; +import java.util.stream.Collectors; + import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBys; +import org.testcontainers.shaded.org.awaitility.Awaitility; -import java.util.List; -import java.util.stream.Collectors; +import lombok.Getter; @Getter public final class WorkflowDefinitionTab extends NavBarPage implements ProjectDetailPage.Tab { @@ -133,7 +135,7 @@ public final class WorkflowDefinitionTab extends NavBarPage implements ProjectDe } public WorkflowDefinitionTab delete(String workflow) { - await().untilAsserted(() -> assertThat(workflowList()) + Awaitility.await().untilAsserted(() -> assertThat(workflowList()) .as("Workflow list should contain newly-created workflow") .anyMatch( it -> it.getText().contains(workflow) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java index 2558631922..772cb69dea 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowForm.java @@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.ShellTaskForm import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.SubWorkflowTaskForm; import java.nio.charset.StandardCharsets; +import java.time.Duration; import java.util.List; import java.util.concurrent.TimeUnit; @@ -86,7 +87,7 @@ public final class WorkflowForm { } public WebElement getTask(String taskName) { - List tasks = new WebDriverWait(driver, 10) + List tasks = new WebDriverWait(driver, Duration.ofSeconds(20)) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("svg > g > g[class^='x6-graph-svg-stage'] > g[data-shape^='dag-task']"))); WebElement task = tasks.stream() 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 493f729b1d..9a3e24fb8a 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,9 @@ import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import lombok.Getter; + +import java.time.Duration; + import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @@ -41,7 +44,7 @@ public final class WorkflowRunDialog { } public WorkflowDefinitionTab submit() { - new WebDriverWait(parent().driver(), 5).until(ExpectedConditions.elementToBeClickable(buttonSubmit())); + new WebDriverWait(parent().driver(), Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(buttonSubmit())); buttonSubmit().click(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java index dddf6e7ba6..d89037feaa 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java @@ -30,6 +30,7 @@ import org.openqa.selenium.support.FindBys; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import java.time.Duration; import java.util.List; @Getter @@ -53,11 +54,11 @@ public final class SubWorkflowTaskForm extends TaskNodeForm { } public SubWorkflowTaskForm childNode(String node) { - new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(btnSelectChildNodeDropdown)); + new WebDriverWait(driver, Duration.ofSeconds(5)).until(ExpectedConditions.elementToBeClickable(btnSelectChildNodeDropdown)); btnSelectChildNodeDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(By.className( + new WebDriverWait(driver, Duration.ofSeconds(5)).until(ExpectedConditions.visibilityOfElementLocated(By.className( "n-base-select-option__content"))); selectChildNode() diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SwitchTaskForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SwitchTaskForm.java index 7dc3497e41..988a00c7bd 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SwitchTaskForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SwitchTaskForm.java @@ -29,6 +29,7 @@ import org.openqa.selenium.support.FindBys; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import java.time.Duration; import java.util.List; @Getter @@ -53,7 +54,7 @@ public final class SwitchTaskForm extends TaskNodeForm { final By optionsLocator = By.className("option-else-branches"); - new WebDriverWait(parent().driver(), 10) + new WebDriverWait(parent().driver(), Duration.ofSeconds(10)) .until(ExpectedConditions.visibilityOfElementLocated(optionsLocator)); List webElements = parent().driver().findElements(optionsLocator); @@ -78,7 +79,7 @@ public final class SwitchTaskForm extends TaskNodeForm { final By optionsLocator = By.className("option-if-branches"); - new WebDriverWait(parent().driver(), 10) + new WebDriverWait(parent().driver(), Duration.ofSeconds(10)) .until(ExpectedConditions.visibilityOfElementLocated(optionsLocator)); List webElements = parent().driver().findElements(optionsLocator); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java index cfa884fafe..ee0f5399eb 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/TaskNodeForm.java @@ -32,6 +32,7 @@ import org.openqa.selenium.support.pagefactory.ByChained; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import java.time.Duration; import java.util.List; import java.util.stream.Stream; @@ -116,7 +117,7 @@ public abstract class TaskNodeForm { final By optionsLocator = By.className("option-pre-tasks"); - new WebDriverWait(parent.driver(), 10) + new WebDriverWait(parent.driver(), Duration.ofSeconds(20)) .until(ExpectedConditions.visibilityOfElementLocated(optionsLocator)); List webElements = parent.driver().findElements(optionsLocator); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/FileManagePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/FileManagePage.java index 03283d00ac..a2a780be9d 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/FileManagePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/FileManagePage.java @@ -40,6 +40,7 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.io.File; +import java.time.Duration; import java.util.List; @@ -181,9 +182,9 @@ public class FileManagePage extends NavBarPage implements ResourcePage.Tab { .orElseThrow(() -> new RuntimeException("No edit button in file manage list")) .click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.urlContains("/edit")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/edit")); - new WebDriverWait(driver, 5).until(ExpectedConditions.textToBePresentInElement(driver.findElementByTagName("body"), fileName)); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.tagName("body")), fileName)); editFileBox().codeEditor().content(scripts); editFileBox().buttonSubmit().click(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java index f5a7b075d1..377af2e1ac 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java @@ -19,9 +19,10 @@ */ package org.apache.dolphinscheduler.e2e.pages.resource; -import lombok.Getter; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; -import org.apache.dolphinscheduler.e2e.pages.security.TenantPage; + +import java.time.Duration; + import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; @@ -29,6 +30,8 @@ import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import lombok.Getter; + @Getter public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { @@ -47,26 +50,26 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { public T goToTab(Class tab) { if (tab == FileManagePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(fileManageTab)); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/resource")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(fileManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab()); - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/file-manage")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/file-manage")); return tab.cast(new FileManagePage(driver)); } if (tab == UdfManagePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(udfManageTab)); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/resource")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(udfManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", udfManageTab()); - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource-manage")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/resource-manage")); return tab.cast(new UdfManagePage(driver)); } if (tab == FunctionManagePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(functionManageTab)); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/resource")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(functionManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", functionManageTab()); - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/function-manage")); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.urlContains("/function-manage")); return tab.cast(new FunctionManagePage(driver)); } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java index fa680866d9..37e07dec75 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/UdfManagePage.java @@ -24,6 +24,7 @@ import lombok.Getter; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; +import java.time.Duration; import java.util.List; import org.openqa.selenium.By; @@ -80,7 +81,7 @@ public class UdfManagePage extends NavBarPage implements ResourcePage.Tab { } public UdfManagePage uploadFile(String filePath) { - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(buttonUploadUdf)); + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.elementToBeClickable(buttonUploadUdf)); buttonUploadUdf().click(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/EnvironmentPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/EnvironmentPage.java index 8e34238788..5d9f9bea36 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/EnvironmentPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/EnvironmentPage.java @@ -21,6 +21,7 @@ package org.apache.dolphinscheduler.e2e.pages.security; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; +import java.time.Duration; import java.util.List; import org.openqa.selenium.By; @@ -66,7 +67,7 @@ public final class EnvironmentPage extends NavBarPage implements SecurityPage.Ta createEnvironmentForm().inputEnvironmentDesc().sendKeys(desc); editEnvironmentForm().btnSelectWorkerGroupDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( "n-base-select-option__content"))); editEnvironmentForm().selectWorkerGroupList() .stream() @@ -105,7 +106,7 @@ public final class EnvironmentPage extends NavBarPage implements SecurityPage.Ta if (editEnvironmentForm().selectedWorkerGroup().getAttribute("innerHTML").equals(workerGroup)) { editEnvironmentForm().btnSelectWorkerGroupDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( + new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( "n-base-select-option__content"))); editEnvironmentForm().selectWorkerGroupList() .stream() diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java index f6f599de71..5a5bb9c277 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java @@ -33,6 +33,8 @@ import org.openqa.selenium.support.ui.WebDriverWait; import lombok.Getter; +import java.time.Duration; + @Getter public class SecurityPage extends NavBarPage implements NavBarItem { @@ -66,57 +68,57 @@ public class SecurityPage extends NavBarPage implements NavBarItem { public T goToTab(Class tab) { if (tab == TenantPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuTenantManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuTenantManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuTenantManage()); return tab.cast(new TenantPage(driver)); } if (tab == UserPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menUserManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menUserManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menUserManage()); return tab.cast(new UserPage(driver)); } if (tab == WorkerGroupPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menWorkerGroupManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menWorkerGroupManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menWorkerGroupManage()); return tab.cast(new WorkerGroupPage(driver)); } if (tab == QueuePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuQueueManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuQueueManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuQueueManage()); return tab.cast(new QueuePage(driver)); } if (tab == EnvironmentPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuEnvironmentManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuEnvironmentManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuEnvironmentManage()); return tab.cast(new EnvironmentPage(driver)); } if (tab == ClusterPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuClusterManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuClusterManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuClusterManage()); return tab.cast(new ClusterPage(driver)); } if (tab == TokenPage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuTokenManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuTokenManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuTokenManage()); return tab.cast(new TokenPage(driver)); } if (tab == NamespacePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); - new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuNamespaceManage)); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.elementToBeClickable(menuNamespaceManage)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuNamespaceManage()); return tab.cast(new NamespacePage(driver)); } diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TokenPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TokenPage.java index 1654437d1d..5def2ad64f 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TokenPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/TokenPage.java @@ -22,6 +22,7 @@ package org.apache.dolphinscheduler.e2e.pages.security; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage.Tab; +import java.time.Duration; import java.util.List; import org.openqa.selenium.By; @@ -68,9 +69,9 @@ public final class TokenPage extends NavBarPage implements Tab { public TokenPage create(String userName) { buttonCreateToken().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(createTokenForm().selectUserNameDropdown())); + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.elementToBeClickable(createTokenForm().selectUserNameDropdown())); createTokenForm().selectUserNameDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( "n-base-select-option__content"))); createTokenForm().selectUserNameList() .stream() @@ -80,7 +81,7 @@ public final class TokenPage extends NavBarPage implements Tab { userName))) .click(); - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(createTokenForm().buttonGenerateToken())); + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.elementToBeClickable(createTokenForm().buttonGenerateToken())); createTokenForm().buttonGenerateToken().click(); createTokenForm().buttonSubmit().click(); @@ -97,9 +98,9 @@ public final class TokenPage extends NavBarPage implements Tab { .orElseThrow(() -> new RuntimeException("No edit button in token list")) .click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(editTokenForm().buttonGenerateToken())); + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.elementToBeClickable(editTokenForm().buttonGenerateToken())); editTokenForm().buttonGenerateToken().click(); - new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(editTokenForm().buttonGenerateToken())); + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.elementToBeClickable(editTokenForm().buttonGenerateToken())); editTokenForm().buttonSubmit().click(); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/UserPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/UserPage.java index 0fcc488c3d..26a236ad52 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/UserPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/UserPage.java @@ -21,6 +21,7 @@ package org.apache.dolphinscheduler.e2e.pages.security; import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; +import java.time.Duration; import java.util.List; import org.openqa.selenium.By; @@ -66,7 +67,7 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { createUserForm().btnSelectTenantDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( "n-base-select-option__content"))); createUserForm().selectTenant() @@ -99,7 +100,7 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { createUserForm().btnSelectTenantDropdown().click(); - new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( + new WebDriverWait(driver, Duration.ofSeconds(30)).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( "n-base-select-option__content"))); createUserForm().selectTenant() 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 ac0cb5117f..edb10caf77 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 @@ -34,7 +34,6 @@ import java.time.Duration; import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -50,12 +49,12 @@ import org.testcontainers.containers.BrowserWebDriverContainer; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.shaded.org.awaitility.Awaitility; +import org.testcontainers.utility.DockerImageName; 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 { @@ -77,7 +76,7 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall @SuppressWarnings("UnstableApiUsage") public void beforeAll(ExtensionContext context) throws IOException { Awaitility.setDefaultTimeout(Duration.ofSeconds(60)); - Awaitility.setDefaultPollInterval(Duration.ofSeconds(10)); + Awaitility.setDefaultPollInterval(Duration.ofSeconds(2)); setRecordPath(); @@ -95,11 +94,11 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall } browser.start(); - driver = browser.getWebDriver(); + driver = new RemoteWebDriver(browser.getSeleniumAddress(), new ChromeOptions()); driver.manage().timeouts() - .implicitlyWait(5, TimeUnit.SECONDS) - .pageLoadTimeout(5, TimeUnit.SECONDS); + .implicitlyWait(Duration.ofSeconds(10)) + .pageLoadTimeout(Duration.ofSeconds(10)); driver.manage().window() .maximize(); diff --git a/dolphinscheduler-e2e/pom.xml b/dolphinscheduler-e2e/pom.xml index 8a0d5dd55c..ee831be1d7 100644 --- a/dolphinscheduler-e2e/pom.xml +++ b/dolphinscheduler-e2e/pom.xml @@ -35,11 +35,10 @@ 8 UTF-8 - 5.7.2 - 3.141.59 + 5.8.1 + 4.6.0 1.18.20 3.20.2 - 4.1.0 1.5.30 1.7.36 2.17.2 @@ -95,13 +94,6 @@ test - - org.awaitility - awaitility - ${awaitility.version} - test - - org.projectlombok lombok @@ -127,7 +119,7 @@ org.testcontainers testcontainers-bom - 1.16.3 + 1.18.3 import pom