xiangzihao
5 months ago
committed by
GitHub
85 changed files with 2000 additions and 1980 deletions
@ -1,112 +1,107 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.openqa.selenium.support.ui.WebDriverWait; |
||||
|
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-clickhouse/docker-compose.yaml") |
||||
public class ClickhouseDataSourceE2ETest { |
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "CLICKHOUSE"; |
||||
|
||||
private static final String dataSourceName = "clickhouse_test"; |
||||
|
||||
private static final String dataSourceDescription = "clickhouse_test"; |
||||
|
||||
private static final String ip = "clickhouse"; |
||||
|
||||
private static final String port = "8123"; |
||||
|
||||
private static final String userName = "ch_test"; |
||||
|
||||
private static final String pgPassword = "ch_test"; |
||||
|
||||
private static final String database = "ch_test"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateClickhouseDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteClickhouseDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList() |
||||
).noneMatch( |
||||
it -> it.getText().contains(dataSourceName) |
||||
); |
||||
}); |
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.LoginPage; |
||||
import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; |
||||
|
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.testcontainers.shaded.org.awaitility.Awaitility; |
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-clickhouse/docker-compose.yaml") |
||||
public class ClickhouseDataSourceE2ETest { |
||||
|
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "CLICKHOUSE"; |
||||
|
||||
private static final String dataSourceName = "clickhouse_test"; |
||||
|
||||
private static final String dataSourceDescription = "clickhouse_test"; |
||||
|
||||
private static final String ip = "clickhouse"; |
||||
|
||||
private static final String port = "8123"; |
||||
|
||||
private static final String userName = "ch_test"; |
||||
|
||||
private static final String pgPassword = "ch_test"; |
||||
|
||||
private static final String database = "ch_test"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateClickhouseDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, |
||||
database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteClickhouseDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList()).noneMatch( |
||||
it -> it.getText().contains(dataSourceName)); |
||||
}); |
||||
} |
||||
} |
||||
|
@ -1,113 +1,108 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.openqa.selenium.support.ui.WebDriverWait; |
||||
|
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-mysql/docker-compose.yaml") |
||||
public class MysqlDataSourceE2ETest { |
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "MYSQL"; |
||||
|
||||
private static final String dataSourceName = "mysql_test"; |
||||
|
||||
private static final String dataSourceDescription = "mysql_test"; |
||||
|
||||
private static final String ip = "mysql"; |
||||
|
||||
private static final String port = "3306"; |
||||
|
||||
private static final String userName = "root"; |
||||
|
||||
private static final String mysqlPassword = "123456"; |
||||
|
||||
private static final String database = "mysql"; |
||||
|
||||
private static final String jdbcParams = "{\"useSSL\": false}"; |
||||
|
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateMysqlDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, mysqlPassword, database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteMysqlDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList() |
||||
).noneMatch( |
||||
it -> it.getText().contains(dataSourceName) |
||||
); |
||||
}); |
||||
} |
||||
|
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.LoginPage; |
||||
import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; |
||||
|
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.testcontainers.shaded.org.awaitility.Awaitility; |
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-mysql/docker-compose.yaml") |
||||
public class MysqlDataSourceE2ETest { |
||||
|
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "MYSQL"; |
||||
|
||||
private static final String dataSourceName = "mysql_test"; |
||||
|
||||
private static final String dataSourceDescription = "mysql_test"; |
||||
|
||||
private static final String ip = "mysql"; |
||||
|
||||
private static final String port = "3306"; |
||||
|
||||
private static final String userName = "root"; |
||||
|
||||
private static final String mysqlPassword = "123456"; |
||||
|
||||
private static final String database = "mysql"; |
||||
|
||||
private static final String jdbcParams = "{\"useSSL\": false}"; |
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateMysqlDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, mysqlPassword, |
||||
database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteMysqlDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList()).noneMatch( |
||||
it -> it.getText().contains(dataSourceName)); |
||||
}); |
||||
} |
||||
|
||||
} |
||||
|
@ -1,112 +1,107 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.openqa.selenium.support.ui.WebDriverWait; |
||||
|
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-postgresql/docker-compose.yaml") |
||||
public class PostgresDataSourceE2ETest { |
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "POSTGRESQL"; |
||||
|
||||
private static final String dataSourceName = "postgres_test"; |
||||
|
||||
private static final String dataSourceDescription = "postgres_test"; |
||||
|
||||
private static final String ip = "postgres"; |
||||
|
||||
private static final String port = "5432"; |
||||
|
||||
private static final String userName = "postgres"; |
||||
|
||||
private static final String pgPassword = "postgres"; |
||||
|
||||
private static final String database = "postgres"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreatePostgresDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeletePostgresDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList() |
||||
).noneMatch( |
||||
it -> it.getText().contains(dataSourceName) |
||||
); |
||||
}); |
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.LoginPage; |
||||
import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; |
||||
|
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.testcontainers.shaded.org.awaitility.Awaitility; |
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-postgresql/docker-compose.yaml") |
||||
public class PostgresDataSourceE2ETest { |
||||
|
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "POSTGRESQL"; |
||||
|
||||
private static final String dataSourceName = "postgres_test"; |
||||
|
||||
private static final String dataSourceDescription = "postgres_test"; |
||||
|
||||
private static final String ip = "postgres"; |
||||
|
||||
private static final String port = "5432"; |
||||
|
||||
private static final String userName = "postgres"; |
||||
|
||||
private static final String pgPassword = "postgres"; |
||||
|
||||
private static final String database = "postgres"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreatePostgresDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, |
||||
database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeletePostgresDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList()).noneMatch( |
||||
it -> it.getText().contains(dataSourceName)); |
||||
}); |
||||
} |
||||
} |
||||
|
@ -1,112 +1,107 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.openqa.selenium.support.ui.WebDriverWait; |
||||
|
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-sqlserver/docker-compose.yaml") |
||||
public class SqlServerDataSourceE2ETest { |
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "SQLSERVER"; |
||||
|
||||
private static final String dataSourceName = "sqlserver_test"; |
||||
|
||||
private static final String dataSourceDescription = "sqlserver_test"; |
||||
|
||||
private static final String ip = "sqlserver"; |
||||
|
||||
private static final String port = "1433"; |
||||
|
||||
private static final String userName = "sa"; |
||||
|
||||
private static final String pgPassword = "OcP2020123"; |
||||
|
||||
private static final String database = "master"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateSqlServerDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteSqlServerDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList() |
||||
).noneMatch( |
||||
it -> it.getText().contains(dataSourceName) |
||||
); |
||||
}); |
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.cases; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler; |
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.LoginPage; |
||||
import org.apache.dolphinscheduler.e2e.pages.datasource.DataSourcePage; |
||||
|
||||
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.WebElement; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.testcontainers.shaded.org.awaitility.Awaitility; |
||||
|
||||
@DolphinScheduler(composeFiles = "docker/datasource-sqlserver/docker-compose.yaml") |
||||
public class SqlServerDataSourceE2ETest { |
||||
|
||||
private static RemoteWebDriver browser; |
||||
|
||||
private static final String tenant = System.getProperty("user.name"); |
||||
|
||||
private static final String user = "admin"; |
||||
|
||||
private static final String password = "dolphinscheduler123"; |
||||
|
||||
private static final String dataSourceType = "SQLSERVER"; |
||||
|
||||
private static final String dataSourceName = "sqlserver_test"; |
||||
|
||||
private static final String dataSourceDescription = "sqlserver_test"; |
||||
|
||||
private static final String ip = "sqlserver"; |
||||
|
||||
private static final String port = "1433"; |
||||
|
||||
private static final String userName = "sa"; |
||||
|
||||
private static final String pgPassword = "OcP2020123"; |
||||
|
||||
private static final String database = "master"; |
||||
|
||||
private static final String jdbcParams = ""; |
||||
|
||||
@BeforeAll |
||||
public static void setup() { |
||||
new LoginPage(browser) |
||||
.login(user, password) |
||||
.goToNav(DataSourcePage.class); |
||||
} |
||||
|
||||
@Test |
||||
@Order(10) |
||||
void testCreateSqlServerDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.createDataSource(dataSourceType, dataSourceName, dataSourceDescription, ip, port, userName, pgPassword, |
||||
database, jdbcParams); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(page.driver()).until(ExpectedConditions.invisibilityOfElementLocated( |
||||
new By.ByClassName("dialog-create-data-source"))); |
||||
|
||||
Awaitility.await().untilAsserted(() -> assertThat(page.dataSourceItemsList()) |
||||
.as("DataSource list should contain newly-created database") |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(dataSourceName))); |
||||
} |
||||
|
||||
@Test |
||||
@Order(20) |
||||
void testDeleteSqlServerDataSource() { |
||||
final DataSourcePage page = new DataSourcePage(browser); |
||||
|
||||
page.delete(dataSourceName); |
||||
|
||||
Awaitility.await().untilAsserted(() -> { |
||||
browser.navigate().refresh(); |
||||
|
||||
assertThat( |
||||
page.dataSourceItemsList()).noneMatch( |
||||
it -> it.getText().contains(dataSourceName)); |
||||
}); |
||||
} |
||||
} |
||||
|
@ -1,204 +1,201 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.pages.datasource; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
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; |
||||
import org.openqa.selenium.JavascriptExecutor; |
||||
import org.openqa.selenium.Keys; |
||||
import org.openqa.selenium.WebDriver; |
||||
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.openqa.selenium.support.PageFactory; |
||||
import org.openqa.selenium.support.ui.ExpectedCondition; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
import org.openqa.selenium.support.ui.WebDriverWait; |
||||
|
||||
|
||||
@Getter |
||||
public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem { |
||||
|
||||
@FindBy(className = "btn-create-data-source") |
||||
private WebElement buttonCreateDataSource; |
||||
|
||||
@FindBy(className = "data-source-items") |
||||
private List<WebElement> dataSourceItemsList; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "n-popconfirm__action"), |
||||
@FindBy(className = "n-button--primary-type"), |
||||
}) |
||||
private WebElement buttonConfirm; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "dialog-source-modal"), |
||||
}) |
||||
private WebElement dataSourceModal; |
||||
|
||||
private final CreateDataSourceForm createDataSourceForm; |
||||
|
||||
public DataSourcePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
createDataSourceForm = new CreateDataSourceForm(); |
||||
} |
||||
|
||||
public DataSourcePage createDataSource(String dataSourceType, String dataSourceName, String dataSourceDescription, String ip, String port, String userName, String password, String database, |
||||
String jdbcParams) { |
||||
buttonCreateDataSource().click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.visibilityOfElementLocated( |
||||
new By.ByClassName("dialog-source-modal"))); |
||||
|
||||
dataSourceModal().findElement(By.className(dataSourceType.toUpperCase()+"-box")).click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase())); |
||||
|
||||
createDataSourceForm().inputDataSourceName().sendKeys(dataSourceName); |
||||
createDataSourceForm().inputDataSourceDescription().sendKeys(dataSourceDescription); |
||||
createDataSourceForm().inputIP().sendKeys(ip); |
||||
createDataSourceForm().inputPort().sendKeys(Keys.CONTROL + "a"); |
||||
createDataSourceForm().inputPort().sendKeys(Keys.BACK_SPACE); |
||||
createDataSourceForm().inputPort().sendKeys(port); |
||||
createDataSourceForm().inputUserName().sendKeys(userName); |
||||
createDataSourceForm().inputPassword().sendKeys(password); |
||||
createDataSourceForm().inputDataBase().sendKeys(database); |
||||
|
||||
if (!"".equals(jdbcParams)) { |
||||
createDataSourceForm().inputJdbcParams().sendKeys(jdbcParams); |
||||
} |
||||
|
||||
createDataSourceForm().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public DataSourcePage delete(String name) { |
||||
dataSourceItemsList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(name)) |
||||
.flatMap(it -> it.findElements(By.className("btn-delete")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No delete button in data source list")) |
||||
.click(); |
||||
|
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm()); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateDataSourceForm { |
||||
CreateDataSourceForm() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBy(className = "n-base-select-option__content") |
||||
private List<WebElement> selectDataSourceType; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "btn-data-source-type-drop-down"), |
||||
@FindBy(className = "n-base-selection"), |
||||
}) |
||||
private WebElement btnDataSourceTypeDropdown; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-source-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDataSourceName; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-source-description"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputDataSourceDescription; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-ip"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputIP; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-port"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputPort; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-username"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputUserName; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-password"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputPassword; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-base"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDataBase; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-jdbc-params"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputJdbcParams; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
|
||||
@FindBy(className = "btn-test-connection") |
||||
private WebElement btnTestConnection; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-zeppelin_rest_endpoint"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputZeppelinRestEndpoint; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-kubeConfig"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputKubeConfig; |
||||
|
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.pages.datasource; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
||||
|
||||
import java.util.List; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
import org.openqa.selenium.By; |
||||
import org.openqa.selenium.JavascriptExecutor; |
||||
import org.openqa.selenium.Keys; |
||||
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.openqa.selenium.support.PageFactory; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
|
||||
@Getter |
||||
public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem { |
||||
|
||||
@FindBy(className = "btn-create-data-source") |
||||
private WebElement buttonCreateDataSource; |
||||
|
||||
@FindBy(className = "data-source-items") |
||||
private List<WebElement> dataSourceItemsList; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "n-popconfirm__action"), |
||||
@FindBy(className = "n-button--primary-type"), |
||||
}) |
||||
private WebElement buttonConfirm; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "dialog-source-modal"), |
||||
}) |
||||
private WebElement dataSourceModal; |
||||
|
||||
private final CreateDataSourceForm createDataSourceForm; |
||||
|
||||
public DataSourcePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
createDataSourceForm = new CreateDataSourceForm(); |
||||
} |
||||
|
||||
public DataSourcePage createDataSource(String dataSourceType, String dataSourceName, String dataSourceDescription, |
||||
String ip, String port, String userName, String password, String database, |
||||
String jdbcParams) { |
||||
buttonCreateDataSource().click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.visibilityOfElementLocated( |
||||
new By.ByClassName("dialog-source-modal"))); |
||||
|
||||
dataSourceModal().findElement(By.className(dataSourceType.toUpperCase() + "-box")).click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.textToBePresentInElement( |
||||
driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase())); |
||||
|
||||
createDataSourceForm().inputDataSourceName().sendKeys(dataSourceName); |
||||
createDataSourceForm().inputDataSourceDescription().sendKeys(dataSourceDescription); |
||||
createDataSourceForm().inputIP().sendKeys(ip); |
||||
createDataSourceForm().inputPort().sendKeys(Keys.CONTROL + "a"); |
||||
createDataSourceForm().inputPort().sendKeys(Keys.BACK_SPACE); |
||||
createDataSourceForm().inputPort().sendKeys(port); |
||||
createDataSourceForm().inputUserName().sendKeys(userName); |
||||
createDataSourceForm().inputPassword().sendKeys(password); |
||||
createDataSourceForm().inputDataBase().sendKeys(database); |
||||
|
||||
if (!"".equals(jdbcParams)) { |
||||
createDataSourceForm().inputJdbcParams().sendKeys(jdbcParams); |
||||
} |
||||
|
||||
createDataSourceForm().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public DataSourcePage delete(String name) { |
||||
dataSourceItemsList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(name)) |
||||
.flatMap(it -> it.findElements(By.className("btn-delete")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No delete button in data source list")) |
||||
.click(); |
||||
|
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm()); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateDataSourceForm { |
||||
|
||||
CreateDataSourceForm() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBy(className = "n-base-select-option__content") |
||||
private List<WebElement> selectDataSourceType; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "btn-data-source-type-drop-down"), |
||||
@FindBy(className = "n-base-selection"), |
||||
}) |
||||
private WebElement btnDataSourceTypeDropdown; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-source-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDataSourceName; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-source-description"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputDataSourceDescription; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-ip"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputIP; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-port"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputPort; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-username"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputUserName; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-password"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputPassword; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-data-base"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDataBase; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-jdbc-params"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputJdbcParams; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
|
||||
@FindBy(className = "btn-test-connection") |
||||
private WebElement btnTestConnection; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-zeppelin_rest_endpoint"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputZeppelinRestEndpoint; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-kubeConfig"), |
||||
@FindBy(tagName = "textarea"), |
||||
}) |
||||
private WebElement inputKubeConfig; |
||||
|
||||
} |
||||
} |
||||
|
@ -1,331 +1,333 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.pages.resource; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.CodeEditor; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
||||
|
||||
import org.openqa.selenium.By; |
||||
import org.openqa.selenium.JavascriptExecutor; |
||||
import org.openqa.selenium.Keys; |
||||
import org.openqa.selenium.WebDriver; |
||||
import org.openqa.selenium.WebElement; |
||||
import org.openqa.selenium.remote.LocalFileDetector; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.FindBy; |
||||
import org.openqa.selenium.support.FindBys; |
||||
import org.openqa.selenium.support.PageFactory; |
||||
import org.openqa.selenium.support.ui.ExpectedCondition; |
||||
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; |
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
import static org.testcontainers.shaded.org.awaitility.Awaitility.await; |
||||
|
||||
|
||||
@Getter |
||||
public class FileManagePage extends NavBarPage implements ResourcePage.Tab { |
||||
@FindBy(className = "btn-create-directory") |
||||
private WebElement buttonCreateDirectory; |
||||
|
||||
@FindBy(className = "btn-create-file") |
||||
private WebElement buttonCreateFile; |
||||
|
||||
@FindBy(className = "btn-upload-resource") |
||||
private WebElement buttonUploadFile; |
||||
|
||||
private final CreateDirectoryBox createDirectoryBox; |
||||
|
||||
private final RenameBox renameBox; |
||||
|
||||
private final UploadFileBox uploadFileBox; |
||||
|
||||
private final EditFileBox editFileBox; |
||||
|
||||
@FindBy(className = "items") |
||||
private List<WebElement> fileList; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "n-popconfirm__action"), |
||||
@FindBy(className = "n-button--primary-type"), |
||||
}) |
||||
private WebElement buttonConfirm; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "monaco-editor"), |
||||
@FindBy(className = "view-line"), |
||||
}) |
||||
private WebElement editor; |
||||
|
||||
public FileManagePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
createDirectoryBox = new CreateDirectoryBox(); |
||||
|
||||
renameBox = new RenameBox(); |
||||
|
||||
uploadFileBox = new UploadFileBox(); |
||||
|
||||
editFileBox = new EditFileBox(); |
||||
|
||||
} |
||||
|
||||
public FileManagePage createDirectory(String name) { |
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(name); |
||||
createDirectoryBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage cancelCreateDirectory(String name) { |
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(name); |
||||
createDirectoryBox().buttonCancel().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage rename(String currentName, String AfterName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(currentName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-rename")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No rename button in file manage list")) |
||||
.click(); |
||||
|
||||
renameBox().inputName().sendKeys(Keys.CONTROL + "a"); |
||||
renameBox().inputName().sendKeys(Keys.BACK_SPACE); |
||||
renameBox().inputName().sendKeys(AfterName); |
||||
renameBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage createSubDirectory(String directoryName, String subDirectoryName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(directoryName)) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException(String.format("No %s in file manage list", directoryName))) |
||||
.click(); |
||||
|
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(subDirectoryName); |
||||
createDirectoryBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage delete(String name) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(name)) |
||||
.flatMap(it -> it.findElements(By.className("btn-delete")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No delete button in file manage list")) |
||||
.click(); |
||||
|
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm()); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
// todo: add file type
|
||||
public FileManagePage createFile(String fileName, String scripts) { |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.elementToBeClickable(buttonCreateFile())); |
||||
|
||||
buttonCreateFile().click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource/file/create")); |
||||
|
||||
CreateFileBox createFileBox = new CreateFileBox(); |
||||
createFileBox.inputFileName().sendKeys(fileName); |
||||
createFileBox.codeEditor().content(scripts); |
||||
createFileBox.buttonSubmit().click(); |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource/file-manage")); |
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage createFileUntilSuccess(String fileName, String scripts) { |
||||
|
||||
createFile(fileName, scripts); |
||||
|
||||
await() |
||||
.untilAsserted(() -> |
||||
assertThat(fileList()) |
||||
.as("File list should contain newly-created file: " + fileName) |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(fileName))); |
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage editFile(String fileName, String scripts) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(fileName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-edit")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No edit button in file manage list")) |
||||
.click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/edit")); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.tagName("body")), fileName)); |
||||
|
||||
editFileBox().codeEditor().content(scripts); |
||||
editFileBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage uploadFile(String filePath) { |
||||
buttonUploadFile().click(); |
||||
|
||||
driver.setFileDetector(new LocalFileDetector()); |
||||
|
||||
uploadFileBox().buttonUpload().sendKeys(filePath); |
||||
uploadFileBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage downloadFile(String fileName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(fileName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-download")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No download button in file manage list")) |
||||
.click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateDirectoryBox { |
||||
CreateDirectoryBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-directory-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDirectoryName; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class RenameBox { |
||||
RenameBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputName; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateFileBox { |
||||
CreateFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-file-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputFileName; |
||||
|
||||
private final CodeEditor codeEditor = new CodeEditor(driver); |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class EditFileBox { |
||||
EditFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
CodeEditor codeEditor = new CodeEditor(driver); |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class UploadFileBox { |
||||
UploadFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "btn-upload"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement buttonUpload; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.e2e.pages.resource; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
import static org.testcontainers.shaded.org.awaitility.Awaitility.await; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.CodeEditor; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
||||
|
||||
import java.util.List; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
import org.openqa.selenium.By; |
||||
import org.openqa.selenium.JavascriptExecutor; |
||||
import org.openqa.selenium.Keys; |
||||
import org.openqa.selenium.WebElement; |
||||
import org.openqa.selenium.remote.LocalFileDetector; |
||||
import org.openqa.selenium.remote.RemoteWebDriver; |
||||
import org.openqa.selenium.support.FindBy; |
||||
import org.openqa.selenium.support.FindBys; |
||||
import org.openqa.selenium.support.PageFactory; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
|
||||
@Getter |
||||
public class FileManagePage extends NavBarPage implements ResourcePage.Tab { |
||||
|
||||
@FindBy(className = "btn-create-directory") |
||||
private WebElement buttonCreateDirectory; |
||||
|
||||
@FindBy(className = "btn-create-file") |
||||
private WebElement buttonCreateFile; |
||||
|
||||
@FindBy(className = "btn-upload-resource") |
||||
private WebElement buttonUploadFile; |
||||
|
||||
private final CreateDirectoryBox createDirectoryBox; |
||||
|
||||
private final RenameBox renameBox; |
||||
|
||||
private final UploadFileBox uploadFileBox; |
||||
|
||||
private final EditFileBox editFileBox; |
||||
|
||||
@FindBy(className = "items") |
||||
private List<WebElement> fileList; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "n-popconfirm__action"), |
||||
@FindBy(className = "n-button--primary-type"), |
||||
}) |
||||
private WebElement buttonConfirm; |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "monaco-editor"), |
||||
@FindBy(className = "view-line"), |
||||
}) |
||||
private WebElement editor; |
||||
|
||||
public FileManagePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
createDirectoryBox = new CreateDirectoryBox(); |
||||
|
||||
renameBox = new RenameBox(); |
||||
|
||||
uploadFileBox = new UploadFileBox(); |
||||
|
||||
editFileBox = new EditFileBox(); |
||||
|
||||
} |
||||
|
||||
public FileManagePage createDirectory(String name) { |
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(name); |
||||
createDirectoryBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage cancelCreateDirectory(String name) { |
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(name); |
||||
createDirectoryBox().buttonCancel().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage rename(String currentName, String AfterName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(currentName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-rename")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No rename button in file manage list")) |
||||
.click(); |
||||
|
||||
renameBox().inputName().sendKeys(Keys.CONTROL + "a"); |
||||
renameBox().inputName().sendKeys(Keys.BACK_SPACE); |
||||
renameBox().inputName().sendKeys(AfterName); |
||||
renameBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage createSubDirectory(String directoryName, String subDirectoryName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(directoryName)) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException(String.format("No %s in file manage list", directoryName))) |
||||
.click(); |
||||
|
||||
buttonCreateDirectory().click(); |
||||
|
||||
createDirectoryBox().inputDirectoryName().sendKeys(subDirectoryName); |
||||
createDirectoryBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage delete(String name) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(name)) |
||||
.flatMap(it -> it.findElements(By.className("btn-delete")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No delete button in file manage list")) |
||||
.click(); |
||||
|
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm()); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
// todo: add file type
|
||||
public FileManagePage createFile(String fileName, String scripts) { |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver) |
||||
.until(ExpectedConditions.elementToBeClickable(buttonCreateFile())); |
||||
|
||||
buttonCreateFile().click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource/file/create")); |
||||
|
||||
CreateFileBox createFileBox = new CreateFileBox(); |
||||
createFileBox.inputFileName().sendKeys(fileName); |
||||
createFileBox.codeEditor().content(scripts); |
||||
createFileBox.buttonSubmit().click(); |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource/file-manage")); |
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage createFileUntilSuccess(String fileName, String scripts) { |
||||
|
||||
createFile(fileName, scripts); |
||||
|
||||
await() |
||||
.untilAsserted(() -> assertThat(fileList()) |
||||
.as("File list should contain newly-created file: " + fileName) |
||||
.extracting(WebElement::getText) |
||||
.anyMatch(it -> it.contains(fileName))); |
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage editFile(String fileName, String scripts) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(fileName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-edit")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No edit button in file manage list")) |
||||
.click(); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/edit")); |
||||
|
||||
WebDriverWaitFactory.createWebDriverWait(driver) |
||||
.until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.tagName("body")), fileName)); |
||||
|
||||
editFileBox().codeEditor().content(scripts); |
||||
editFileBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage uploadFile(String filePath) { |
||||
buttonUploadFile().click(); |
||||
|
||||
driver.setFileDetector(new LocalFileDetector()); |
||||
|
||||
uploadFileBox().buttonUpload().sendKeys(filePath); |
||||
uploadFileBox().buttonSubmit().click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
public FileManagePage downloadFile(String fileName) { |
||||
fileList() |
||||
.stream() |
||||
.filter(it -> it.getText().contains(fileName)) |
||||
.flatMap(it -> it.findElements(By.className("btn-download")).stream()) |
||||
.filter(WebElement::isDisplayed) |
||||
.findFirst() |
||||
.orElseThrow(() -> new RuntimeException("No download button in file manage list")) |
||||
.click(); |
||||
|
||||
return this; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateDirectoryBox { |
||||
|
||||
CreateDirectoryBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-directory-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputDirectoryName; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class RenameBox { |
||||
|
||||
RenameBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputName; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class CreateFileBox { |
||||
|
||||
CreateFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "input-file-name"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement inputFileName; |
||||
|
||||
private final CodeEditor codeEditor = new CodeEditor(driver); |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class EditFileBox { |
||||
|
||||
EditFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
CodeEditor codeEditor = new CodeEditor(driver); |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
|
||||
@Getter |
||||
public class UploadFileBox { |
||||
|
||||
UploadFileBox() { |
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
@FindBys({ |
||||
@FindBy(className = "btn-upload"), |
||||
@FindBy(tagName = "input"), |
||||
}) |
||||
private WebElement buttonUpload; |
||||
|
||||
@FindBy(className = "btn-submit") |
||||
private WebElement buttonSubmit; |
||||
|
||||
@FindBy(className = "btn-cancel") |
||||
private WebElement buttonCancel; |
||||
} |
||||
} |
||||
|
@ -1,63 +1,61 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
package org.apache.dolphinscheduler.e2e.pages.resource; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
||||
|
||||
import java.time.Duration; |
||||
|
||||
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.PageFactory; |
||||
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 { |
||||
@FindBy(css = ".tab-vertical > .n-menu-item:nth-child(1) > .n-menu-item-content") |
||||
private WebElement fileManageTab; |
||||
|
||||
public ResourcePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
public <T extends ResourcePage.Tab> T goToTab(Class<T> tab) { |
||||
if (tab == FileManagePage.class) { |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource")); |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.elementToBeClickable(fileManageTab)); |
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab()); |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/file-manage")); |
||||
return tab.cast(new FileManagePage(driver)); |
||||
} |
||||
|
||||
throw new UnsupportedOperationException("Unknown tab: " + tab.getName()); |
||||
} |
||||
|
||||
public interface Tab { |
||||
} |
||||
} |
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one |
||||
* or more contributor license agreements. See the NOTICE file |
||||
* distributed with this work for additional information |
||||
* regarding copyright ownership. The ASF licenses this file |
||||
* to you under the Apache License, Version 2.0 (the |
||||
* "License"); you may not use this file except in compliance |
||||
* with the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, |
||||
* software distributed under the License is distributed on an |
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
* KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations |
||||
* under the License. |
||||
* |
||||
*/ |
||||
package org.apache.dolphinscheduler.e2e.pages.resource; |
||||
|
||||
import org.apache.dolphinscheduler.e2e.core.WebDriverWaitFactory; |
||||
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
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.PageFactory; |
||||
import org.openqa.selenium.support.ui.ExpectedConditions; |
||||
|
||||
@Getter |
||||
public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { |
||||
|
||||
@FindBy(css = ".tab-vertical > .n-menu-item:nth-child(1) > .n-menu-item-content") |
||||
private WebElement fileManageTab; |
||||
|
||||
public ResourcePage(RemoteWebDriver driver) { |
||||
super(driver); |
||||
|
||||
PageFactory.initElements(driver, this); |
||||
} |
||||
|
||||
public <T extends ResourcePage.Tab> T goToTab(Class<T> tab) { |
||||
if (tab == FileManagePage.class) { |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/resource")); |
||||
WebDriverWaitFactory.createWebDriverWait(driver) |
||||
.until(ExpectedConditions.elementToBeClickable(fileManageTab)); |
||||
((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab()); |
||||
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.urlContains("/file-manage")); |
||||
return tab.cast(new FileManagePage(driver)); |
||||
} |
||||
|
||||
throw new UnsupportedOperationException("Unknown tab: " + tab.getName()); |
||||
} |
||||
|
||||
public interface Tab { |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue