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