|
|
@ -24,6 +24,8 @@ import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage; |
|
|
|
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; |
|
|
@ -31,20 +33,22 @@ import org.openqa.selenium.support.FindBys; |
|
|
|
import org.openqa.selenium.support.PageFactory; |
|
|
|
import org.openqa.selenium.support.PageFactory; |
|
|
|
|
|
|
|
|
|
|
|
import lombok.Getter; |
|
|
|
import lombok.Getter; |
|
|
|
|
|
|
|
import org.openqa.selenium.support.ui.ExpectedConditions; |
|
|
|
|
|
|
|
import org.openqa.selenium.support.ui.WebDriverWait; |
|
|
|
|
|
|
|
|
|
|
|
@Getter |
|
|
|
@Getter |
|
|
|
public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
@FindBy(id = "btnCreateUser") |
|
|
|
@FindBy(className = "btn-create-user") |
|
|
|
private WebElement buttonCreateUser; |
|
|
|
private WebElement buttonCreateUser; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(className = "items") |
|
|
|
@FindBy(className = "items") |
|
|
|
private List<WebElement> userList; |
|
|
|
private List<WebElement> userList; |
|
|
|
|
|
|
|
|
|
|
|
@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 UserForm createUserForm = new UserForm(); |
|
|
|
private final UserForm createUserForm = new UserForm(); |
|
|
|
private final UserForm editUserForm = new UserForm(); |
|
|
|
private final UserForm editUserForm = new UserForm(); |
|
|
@ -54,11 +58,24 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
super(driver); |
|
|
|
super(driver); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UserPage create(String user, String password, String email, String phone) { |
|
|
|
public UserPage create(String user, String password, String email, String phone, String tenant) { |
|
|
|
buttonCreateUser().click(); |
|
|
|
buttonCreateUser().click(); |
|
|
|
|
|
|
|
|
|
|
|
createUserForm().inputUserName().sendKeys(user); |
|
|
|
createUserForm().inputUserName().sendKeys(user); |
|
|
|
createUserForm().inputUserPassword().sendKeys(password); |
|
|
|
createUserForm().inputUserPassword().sendKeys(password); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createUserForm().btnSelectTenantDropdown().click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( |
|
|
|
|
|
|
|
"n-base-select-option__content"))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createUserForm().selectTenant() |
|
|
|
|
|
|
|
.stream() |
|
|
|
|
|
|
|
.filter(it -> it.getText().contains(tenant)) |
|
|
|
|
|
|
|
.findFirst() |
|
|
|
|
|
|
|
.orElseThrow(() -> new RuntimeException(String.format("No %s in tenant dropdown list", tenant))) |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
createUserForm().inputEmail().sendKeys(email); |
|
|
|
createUserForm().inputEmail().sendKeys(email); |
|
|
|
createUserForm().inputPhone().sendKeys(phone); |
|
|
|
createUserForm().inputPhone().sendKeys(phone); |
|
|
|
createUserForm().buttonSubmit().click(); |
|
|
|
createUserForm().buttonSubmit().click(); |
|
|
@ -67,8 +84,7 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UserPage update(String user, String editUser, String editPassword, String editEmail, String editPhone) { |
|
|
|
public UserPage update(String user, String editUser, String editPassword, String editEmail, String editPhone) { |
|
|
|
List<WebElement> userList = driver.findElementsByClassName("items"); |
|
|
|
userList().stream() |
|
|
|
userList.stream() |
|
|
|
|
|
|
|
.filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(user)) |
|
|
|
.filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(user)) |
|
|
|
.flatMap(it -> it.findElements(By.className("edit")).stream()) |
|
|
|
.flatMap(it -> it.findElements(By.className("edit")).stream()) |
|
|
|
.filter(WebElement::isDisplayed) |
|
|
|
.filter(WebElement::isDisplayed) |
|
|
@ -76,17 +92,21 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
.orElseThrow(() -> new RuntimeException("No edit button in user list")) |
|
|
|
.orElseThrow(() -> new RuntimeException("No edit button in user list")) |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
UserForm editUserForm = new UserForm(); |
|
|
|
editUserForm().inputUserName().sendKeys(Keys.CONTROL+"a"); |
|
|
|
|
|
|
|
editUserForm().inputUserName().sendKeys(Keys.BACK_SPACE); |
|
|
|
|
|
|
|
editUserForm().inputUserName().sendKeys(editUser); |
|
|
|
|
|
|
|
|
|
|
|
editUserForm.inputUserName().clear(); |
|
|
|
editUserForm().inputUserPassword().sendKeys(editPassword); |
|
|
|
editUserForm.inputUserName().sendKeys(editUser); |
|
|
|
|
|
|
|
editUserForm.inputUserPassword().clear(); |
|
|
|
editUserForm().inputEmail().sendKeys(Keys.CONTROL+"a"); |
|
|
|
editUserForm.inputUserPassword().sendKeys(editPassword); |
|
|
|
editUserForm().inputEmail().sendKeys(Keys.BACK_SPACE); |
|
|
|
editUserForm.inputEmail().clear(); |
|
|
|
editUserForm().inputEmail().sendKeys(editEmail); |
|
|
|
editUserForm.inputEmail().sendKeys(editEmail); |
|
|
|
|
|
|
|
editUserForm.inputPhone().clear(); |
|
|
|
editUserForm().inputPhone().sendKeys(Keys.CONTROL+"a"); |
|
|
|
editUserForm.inputPhone().sendKeys(editPhone); |
|
|
|
editUserForm().inputPhone().sendKeys(Keys.BACK_SPACE); |
|
|
|
editUserForm.buttonSubmit().click(); |
|
|
|
editUserForm().inputPhone().sendKeys(editPhone); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editUserForm().buttonSubmit().click(); |
|
|
|
|
|
|
|
|
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
@ -101,12 +121,7 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
.orElseThrow(() -> new RuntimeException("No delete button in user list")) |
|
|
|
.orElseThrow(() -> new RuntimeException("No delete button in user 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; |
|
|
|
} |
|
|
|
} |
|
|
@ -117,34 +132,58 @@ public final class UserPage extends NavBarPage implements SecurityPage.Tab { |
|
|
|
PageFactory.initElements(driver, this); |
|
|
|
PageFactory.initElements(driver, this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputUserName") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-username"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputUserName; |
|
|
|
private WebElement inputUserName; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputUserPassword") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-password"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputUserPassword; |
|
|
|
private WebElement inputUserPassword; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "selectTenant") |
|
|
|
@FindBys({ |
|
|
|
private WebElement selectTenant; |
|
|
|
@FindBy(className = "select-tenant"), |
|
|
|
|
|
|
|
@FindBy(className = "n-base-selection"), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
private WebElement btnSelectTenantDropdown; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FindBy(className = "n-base-select-option__content") |
|
|
|
|
|
|
|
private List<WebElement> selectTenant; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "selectQueue") |
|
|
|
@FindBys({ |
|
|
|
private WebElement selectQueue; |
|
|
|
@FindBy(className = "select-queue"), |
|
|
|
|
|
|
|
@FindBy(className = "n-base-selection"), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
private WebElement btnSelectQueueDropdown; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputEmail") |
|
|
|
@FindBy(className = "n-base-select-option__content") |
|
|
|
|
|
|
|
private List<WebElement> selectQueue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-email"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputEmail; |
|
|
|
private WebElement inputEmail; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "inputPhone") |
|
|
|
@FindBys({ |
|
|
|
|
|
|
|
@FindBy(className = "input-phone"), |
|
|
|
|
|
|
|
@FindBy(tagName = "input"), |
|
|
|
|
|
|
|
}) |
|
|
|
private WebElement inputPhone; |
|
|
|
private WebElement inputPhone; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "radioStateEnable") |
|
|
|
@FindBy(className = "radio-state-enable") |
|
|
|
private WebElement radioStateEnable; |
|
|
|
private WebElement radioStateEnable; |
|
|
|
|
|
|
|
|
|
|
|
@FindBy(id = "radioStateDisable") |
|
|
|
@FindBy(className = "radio-state-disable") |
|
|
|
private WebElement radioStateDisable; |
|
|
|
private WebElement radioStateDisable; |
|
|
|
|
|
|
|
|
|
|
|
@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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|