|
|
@ -24,33 +24,35 @@ import lombok.Getter; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
|
|
|
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.security.Key; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.openqa.selenium.By; |
|
|
|
import org.openqa.selenium.By; |
|
|
|
|
|
|
|
import org.openqa.selenium.JavascriptExecutor; |
|
|
|
|
|
|
|
import org.openqa.selenium.Keys; |
|
|
|
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.FindBys; |
|
|
|
import org.openqa.selenium.support.FindBys; |
|
|
|
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.Select; |
|
|
|
|
|
|
|
import org.openqa.selenium.support.ui.WebDriverWait; |
|
|
|
import org.openqa.selenium.support.ui.WebDriverWait; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Getter |
|
|
|
@Getter |
|
|
|
public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem { |
|
|
|
public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem { |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "btnCreateDataSource") |
|
|
|
@FindBy(className = "btn-create-data-source") |
|
|
|
private WebElement buttonCreateDataSource; |
|
|
|
private WebElement buttonCreateDataSource; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(className = "data-source-items") |
|
|
|
@FindBy(className = "data-source-items") |
|
|
|
private List<WebElement> dataSourceItemsList; |
|
|
|
private List<WebElement> dataSourceItemsList; |
|
|
|
|
|
|
|
|
|
|
|
@FindBys({ |
|
|
|
@FindBys({ |
|
|
|
@FindBy(className = "el-popconfirm"), |
|
|
|
@FindBy(className = "n-popconfirm__action"), |
|
|
|
@FindBy(className = "el-button--primary"), |
|
|
|
@FindBy(className = "n-button--primary-type"), |
|
|
|
}) |
|
|
|
}) |
|
|
|
private List<WebElement> buttonConfirm; |
|
|
|
private WebElement buttonConfirm; |
|
|
|
|
|
|
|
|
|
|
|
private final CreateDataSourceForm createDataSourceForm; |
|
|
|
private final CreateDataSourceForm createDataSourceForm; |
|
|
|
|
|
|
|
|
|
|
@ -66,7 +68,8 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem |
|
|
|
|
|
|
|
|
|
|
|
createDataSourceForm().btnDataSourceTypeDropdown().click(); |
|
|
|
createDataSourceForm().btnDataSourceTypeDropdown().click(); |
|
|
|
|
|
|
|
|
|
|
|
new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated(new By.ById("dialogCreateDataSource"))); |
|
|
|
new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated( |
|
|
|
|
|
|
|
new By.ByClassName("dialog-create-data-source"))); |
|
|
|
|
|
|
|
|
|
|
|
createDataSourceForm().selectDataSourceType() |
|
|
|
createDataSourceForm().selectDataSourceType() |
|
|
|
.stream() |
|
|
|
.stream() |
|
|
@ -78,7 +81,8 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem |
|
|
|
createDataSourceForm().inputDataSourceName().sendKeys(dataSourceName); |
|
|
|
createDataSourceForm().inputDataSourceName().sendKeys(dataSourceName); |
|
|
|
createDataSourceForm().inputDataSourceDescription().sendKeys(dataSourceDescription); |
|
|
|
createDataSourceForm().inputDataSourceDescription().sendKeys(dataSourceDescription); |
|
|
|
createDataSourceForm().inputIP().sendKeys(ip); |
|
|
|
createDataSourceForm().inputIP().sendKeys(ip); |
|
|
|
createDataSourceForm().inputPort().clear(); |
|
|
|
createDataSourceForm().inputPort().sendKeys(Keys.CONTROL + "a"); |
|
|
|
|
|
|
|
createDataSourceForm().inputPort().sendKeys(Keys.BACK_SPACE); |
|
|
|
createDataSourceForm().inputPort().sendKeys(port); |
|
|
|
createDataSourceForm().inputPort().sendKeys(port); |
|
|
|
createDataSourceForm().inputUserName().sendKeys(userName); |
|
|
|
createDataSourceForm().inputUserName().sendKeys(userName); |
|
|
|
createDataSourceForm().inputPassword().sendKeys(password); |
|
|
|
createDataSourceForm().inputPassword().sendKeys(password); |
|
|
@ -97,18 +101,13 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem |
|
|
|
dataSourceItemsList() |
|
|
|
dataSourceItemsList() |
|
|
|
.stream() |
|
|
|
.stream() |
|
|
|
.filter(it -> it.getText().contains(name)) |
|
|
|
.filter(it -> it.getText().contains(name)) |
|
|
|
.flatMap(it -> it.findElements(By.id("btnDelete")).stream()) |
|
|
|
.flatMap(it -> it.findElements(By.className("btn-delete")).stream()) |
|
|
|
.filter(WebElement::isDisplayed) |
|
|
|
.filter(WebElement::isDisplayed) |
|
|
|
.findFirst() |
|
|
|
.findFirst() |
|
|
|
.orElseThrow(() -> new RuntimeException("No delete button in data source list")) |
|
|
|
.orElseThrow(() -> new RuntimeException("No delete button in data source list")) |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
buttonConfirm() |
|
|
|
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm()); |
|
|
|
.stream() |
|
|
|
|
|
|
|
.filter(WebElement::isDisplayed) |
|
|
|
|
|
|
|
.findFirst() |
|
|
|
|
|
|
|
.orElseThrow(() -> new RuntimeException("No confirm button when deleting")) |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
@ -119,43 +118,70 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem |
|
|
|
PageFactory.initElements(driver, this); |
|
|
|
PageFactory.initElements(driver, this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(className = "options-datasource-type") |
|
|
|
@FindBy(className = "n-base-select-option__content") |
|
|
|
private List<WebElement> selectDataSourceType; |
|
|
|
private List<WebElement> selectDataSourceType; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "btnDataSourceTypeDropDown") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "btn-data-source-type-drop-down"), |
|
|
|
|
|
|
|
@FindBy(className = "n-base-selection"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement btnDataSourceTypeDropdown; |
|
|
|
private WebElement btnDataSourceTypeDropdown; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputDataSourceName") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-data-source-name"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputDataSourceName; |
|
|
|
private WebElement inputDataSourceName; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputDataSourceDescription") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-data-source-description"), |
|
|
|
|
|
|
|
@FindBy(tagName = "textarea"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputDataSourceDescription; |
|
|
|
private WebElement inputDataSourceDescription; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputIP") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-ip"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputIP; |
|
|
|
private WebElement inputIP; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputPort") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-port"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputPort; |
|
|
|
private WebElement inputPort; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputUserName") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-username"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputUserName; |
|
|
|
private WebElement inputUserName; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputPassword") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-password"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputPassword; |
|
|
|
private WebElement inputPassword; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputDataBase") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-data-base"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputDataBase; |
|
|
|
private WebElement inputDataBase; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputJdbcParams") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-jdbc-params"), |
|
|
|
|
|
|
|
@FindBy(tagName = "textarea"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputJdbcParams; |
|
|
|
private WebElement inputJdbcParams; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "btnSubmit") |
|
|
|
@FindBy(className = "btn-submit") |
|
|
|
private WebElement buttonSubmit; |
|
|
|
private WebElement buttonSubmit; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "btnCancel") |
|
|
|
@FindBy(className = "btn-cancel") |
|
|
|
private WebElement buttonCancel; |
|
|
|
private WebElement buttonCancel; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "btnTestConnection") |
|
|
|
@FindBy(className = "btn-test-connection") |
|
|
|
private WebElement btnTestConnection; |
|
|
|
private WebElement btnTestConnection; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|