mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
bug5239: Added Role Permission removal PO support
This commit is contained in:
1 parent
39c98d577f
commit
18e3d715e5
2 files changed
+58
No files matched your search
+10
@@ -8,6 +8,7 @@ import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.common.ErrorDialogPO;
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.StringListEditorCompositePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.StringListEditorCompositePO.ValueEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.TextBoxPO;
|
||||
|
||||
public class RoleDefinitionCreationAndUpdateDialogPO extends DataEntryDialogPO {
|
||||
@@ -33,6 +34,15 @@ public class RoleDefinitionCreationAndUpdateDialogPO extends DataEntryDialogPO {
|
||||
getPermissionsList().addNewValue(permission);
|
||||
}
|
||||
|
||||
public boolean isPermissionPresent(String permission) {
|
||||
ValueEntryPO findValue = getPermissionsList().findValue(permission);
|
||||
return findValue != null ? true : false;
|
||||
}
|
||||
|
||||
public void removePermission(String permission) {
|
||||
getPermissionsList().removeValueByName(permission);
|
||||
}
|
||||
|
||||
public void clickOkButtonAndExpectPermissionError() {
|
||||
clickOkButtonOrThrow();
|
||||
waitForPO(ErrorDialogPO::new, "ErrorDialog", 10).assertTitleContainsTextAndClose("Not permitted to grant permissions for role");
|
||||
|
||||
+48
@@ -8,15 +8,56 @@ import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class StringListEditorCompositePO extends PageArea {
|
||||
|
||||
public static class ValueEntryPO extends DataEntryPO {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveButton")
|
||||
private WebElement deleteButton;
|
||||
@FindBy(how = BySeleniumId.class, using = "ValueTextBox")
|
||||
private WebElement valueTextBox;
|
||||
|
||||
|
||||
public ValueEntryPO(CellTablePO<?> table, WebElement element) {
|
||||
super(table, element);
|
||||
}
|
||||
|
||||
public void deleteValueEntry() {
|
||||
deleteButton.click();
|
||||
}
|
||||
|
||||
public String getValueEntryName(){
|
||||
TextBoxPO textBoxPO = new TextBoxPO(this.driver, valueTextBox);
|
||||
String text = textBoxPO.getWebElement().getAttribute("value");
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddButton")
|
||||
private WebElement addValueButton;
|
||||
@FindBy(how = BySeleniumId.class, using = "InputSuggestBox")
|
||||
private WebElement valueInput;
|
||||
@FindBy(how = BySeleniumId.class, using = "ExpandedValuesGrid")
|
||||
private WebElement valueGrid;
|
||||
|
||||
private StringListEditorCompositePO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
private CellTablePO<ValueEntryPO> getExpandedValuesGrid() {
|
||||
return new GenericCellTablePO<>(this.driver, this.valueGrid, ValueEntryPO.class);
|
||||
}
|
||||
|
||||
public ValueEntryPO findValue(final String permission) {
|
||||
final CellTablePO<ValueEntryPO> table = getExpandedValuesGrid();
|
||||
for (ValueEntryPO entry : table.getEntries()) {
|
||||
final String name = entry.getValueEntryName();
|
||||
if (name != null) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static StringListEditorCompositePO create(WebDriver driver, WebElement permissionsInput) {
|
||||
return new StringListEditorCompositePO(driver, permissionsInput);
|
||||
}
|
||||
@@ -25,4 +66,11 @@ public class StringListEditorCompositePO extends PageArea {
|
||||
SuggestBoxPO.create(driver, valueInput).appendText(value);
|
||||
addValueButton.click();
|
||||
}
|
||||
|
||||
public void removeValueByName(String name) {
|
||||
ValueEntryPO findValue = findValue(name);
|
||||
if(findValue != null) {
|
||||
findValue.deleteValueEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user