diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ObjectListArchetypeTests.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ObjectListArchetypeTests.java index 06e902dd22f..77bcac209a4 100644 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ObjectListArchetypeTests.java +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ObjectListArchetypeTests.java @@ -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); @@ -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() diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java index e1474d7f807..c1217d0f2dd 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java @@ -109,7 +109,24 @@ public PrismForm 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()) { @@ -365,12 +382,17 @@ public PrismForm 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; }