Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package pages.administration.editGroupsPage;
import ddsl.dcomponents.AlertComponent;
import ddsl.dcomponents.DComponent;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
import rest.models.ResourceModel;
public class CreateResourceDetailsDialog extends DComponent {
@FindBy(id = "resourceTypeIdentifier")
private WebElement resourceTypeDdl;
@FindBy(id = "identifierValue_id")
private WebElement resourceIdentifierInput;
@FindBy(id = "identifierScheme_id")
private WebElement resourceSchemeInput;
@FindBy(id = "visibility_id")
private WebElement resourceVisibilityDdl;
@FindBy(id = "saveButton")
private WebElement saveBtn;
private AlertComponent alertComponent = null;
public CreateResourceDetailsDialog(WebDriver driver) {
super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getWaitTimeShort()), this);
}
public AlertComponent getAlertArea() {
if (alertComponent == null) {
alertComponent = new AlertComponent(driver);
}
return alertComponent;
}
public void fillResourceDetails(ResourceModel resourceModel) {
weToDSelect(resourceTypeDdl).selectValue(resourceModel.getResourceTypeIdentifier());
weToDInput(resourceIdentifierInput).fill(resourceModel.getIdentifierValue());
weToDInput(resourceSchemeInput).fill(resourceModel.getIdentifierScheme());
weToDSelect(resourceVisibilityDdl).selectValue(resourceModel.getVisibility());
}
public Boolean tryClickOnSave() {
try {
wait.forElementToBeClickable(saveBtn);
if (weToDButton(saveBtn).isEnabled()) {
weToDButton(saveBtn).click();
wait.forXMillis(data.getWaitTimeoutShortMilliseconds());
return true;
} else {
return false;
}
} catch (Exception e) {
return false;
}
}