public Paging<T> pageSize(int size) { Validate.isTrue(size > 0, "Size must be larger than zero."); SelenideElement parent = getParentElement(); SelenideElement button = parent.$(By.cssSelector(".btn.btn-default.dropdown-toggle")); button.click(); button.parent().$(By.className("dropdown-menu")).$$x(".//a").first().click(); SelenideElement popover = parent.$$(By.className("popover-title")) .findBy(Condition.text("Page size")).parent(); //todo fix localization popover.$(By.tagName("input")).setValue(Integer.toString(size)); popover.$(By.tagName("button")).click(); return this; }
public Popover<Search<T>> byName() { SelenideElement linksContainer = getParentElement().$(Schrodinger.byDataId("div", "linksContainer")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S); try { linksContainer.$(Schrodinger.byDataId("a", "basic")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); } catch (Throwable t) { // all is ok, basic search is already selected option, TODO: Schrodinger should provide easy method to check component existence } getParentElement().$(Schrodinger.byDataId("a", "mainButton")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); ElementsCollection popoverElements = getParentElement().$$(Schrodinger.byDataId("popover")); SelenideElement popover = null; for (SelenideElement popoverElement : popoverElements) { if (popoverElement.isDisplayed()) { popover = popoverElement; break; } popover = popoverElement; } return new Popover<>(this, popover); }
public PrismForm<T> addAttributeValue(QName name, String value) { SelenideElement property = findProperty(name); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(value); } // todo implement return this; }
public PrismForm<T> changeAttributeValue(String name, String oldValue, String newValue) { SelenideElement property = findProperty(name); $(By.className("prism-properties")).waitUntil(Condition.appears,MidPoint.TIMEOUT_MEDIUM_6_S); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(newValue); } // todo implement return this; }
public PrismForm<T> addProtectedAttributeValue(String protectedAttributeName, String value) { SelenideElement property = findProperty(protectedAttributeName); ElementsCollection values = property.$$(By.xpath(".//input[contains(@class,\"form-control\")]")); for (SelenideElement valueElemen : values) { valueElemen.setValue(value).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S); } return this; }
public PrismForm<T> setPasswordFieldsValues(QName name, String value) { SelenideElement property = findProperty(name); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() > 0) { ElementsCollection passwordInputs = values.first().$$(By.tagName("input")); if (passwordInputs != null){ passwordInputs.forEach(inputElement -> inputElement.setValue(value)); } } return this; }
public PrismForm<T> setDropDownAttributeValue(QName name, String value) { SelenideElement property = findProperty(name); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() > 0) { SelenideElement dropDown = values.first().$(By.tagName("select")); if (dropDown != null){ dropDown.selectOptionContainingText(value); } } return this; }
public PrismForm<T> addAttributeValue(String name, String value) { SelenideElement property = findProperty(name); $(By.className("prism-properties")).waitUntil(Condition.appears,MidPoint.TIMEOUT_MEDIUM_6_S); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(value); } // todo implement return this; }