Skip to content

Commit

Permalink
object list test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jun 2, 2020
1 parent dc22124 commit 7259612
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
Expand Up @@ -79,6 +79,8 @@ public void configureArchetypeObjectListView(){
.$(Schrodinger.byDataId("edit"))
.click();

Selenide.sleep(MidPoint.TIMEOUT_SHORT_4_S);

SelenideElement modalWindow = $(By.className("wicket-modal"))
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

Expand All @@ -96,7 +98,7 @@ public void configureArchetypeObjectListView(){
.clickByName(ARCHETYPE_OBJECT_NAME);

Assert.assertTrue(prismForm
.compareInputAttributeValue(COLLECTION_REF_ATTRIBUTE_NAME, ARCHETYPE_OBJECT_NAME + ": ArchetypeType"));
.compareInputAttributeValueInNewContainer(COLLECTION_REF_ATTRIBUTE_NAME, ARCHETYPE_OBJECT_NAME + ": ArchetypeType"));

adminGuiTab
.getParent()
Expand Down
Expand Up @@ -109,7 +109,24 @@ public PrismForm<T> showEmptyAttributes(String containerName) {

public Boolean compareInputAttributeValue(String name, String expectedValue) {
SelenideElement property = findProperty(name);
SelenideElement value = property.parent().$(By.xpath(".//input[contains(@class,\"form-control\")]"));
SelenideElement value = property.parent().$(By.xpath(".//input[contains(@class,\"form-control\")]"))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);
String valueElement = value.getValue();

if (!valueElement.isEmpty()) {
return valueElement.equals(expectedValue);
} else {
return expectedValue.isEmpty();
}

}

//seems that the property fields in new container are wrapped to extra parent, that is why we need one extra parent() call
//needs to be checked
public Boolean compareInputAttributeValueInNewContainer(String name, String expectedValue) {
SelenideElement property = findProperty(name);
SelenideElement value = property.parent().parent().$(By.xpath(".//input[contains(@class,\"form-control\")]"))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);
String valueElement = value.getValue();

if (!valueElement.isEmpty()) {
Expand Down Expand Up @@ -365,12 +382,17 @@ public PrismForm<T> addNewContainerValue(String containerHeaderKey, String newCo
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S)
.click();

panelHeader
Selenide.sleep(MidPoint.TIMEOUT_SHORT_4_S);

SelenideElement newContainerElement = panelHeader
.parent()
.parent()
.$(By.linkText(newContainerHeaderKey))
.shouldBe(Condition.visible)
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);
.$(Schrodinger.byElementValue("a", newContainerHeaderKey));

Selenide.sleep(MidPoint.TIMEOUT_SHORT_4_S);

newContainerElement.scrollTo();
newContainerElement.screenshot();

return this;
}
Expand Down

0 comments on commit 7259612

Please sign in to comment.