Skip to content

Commit

Permalink
adding tests for preview page
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Mar 20, 2020
1 parent 8820f87 commit c2559ac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
6 changes: 6 additions & 0 deletions testing/schrodingertest/pom.xml
Expand Up @@ -133,6 +133,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.repo</groupId>
<artifactId>task-api</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Expand Up @@ -147,7 +147,6 @@ public void afterClass() {
aboutPage
.clickSwitchToFactoryDefaults()
.clickYes();

}

protected void importObject(File source, Boolean overrideExistingObject) {
Expand Down
Expand Up @@ -26,8 +26,6 @@
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType;

import org.springframework.test.annotation.DirtiesContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

import com.evolveum.midpoint.schrodinger.component.prism.show.PreviewChangesTab;
Expand Down Expand Up @@ -59,23 +57,19 @@ public void test001createUser() {

PreviewPage previewPage = null;

PrismForm<AssignmentHolderBasicTab<UserPage>> f = user.selectTabBasic()
PreviewPage f = user.selectTabBasic()
.form()
.addAttributeValue("name", "jack")
.addAttributeValue(UserType.F_GIVEN_NAME, "Jack")
.setPasswordFieldsValues(PasswordType.F_VALUE,"asd123");

Selenide.screenshot("after password");
previewPage = f.and()
.setPasswordFieldsValues(PasswordType.F_VALUE,"asd123")
.and()
.and()
.clickPreview();
//@formatter:on

Selenide.screenshot("preview");
ScenePanel<PreviewChangesTab> primaryDeltaScene = previewPage.selectPanelByName("jack").primaryDeltas();
assertTrue(primaryDeltaScene.isExpanded(), "Primary deltas should be expanded");

Selenide.screenshot("deltas");
List<ScenePanel> deltas = primaryDeltaScene.objectDeltas();
assertEquals(3, deltas.size(), "Unexpected number of primary deltas");

Expand Down Expand Up @@ -106,8 +100,6 @@ public void test002modifyUser() {
.clickPreviewChanges();
//@formatter:on

Selenide.screenshot("modfifyUser, preview change");

ScenePanel<PreviewChangesTab> primaryDeltaScene = previewPage.selectPanelByName("jack").primaryDeltas();
assertTrue(primaryDeltaScene.isExpanded(), "Primary deltas should be expanded");

Expand Down Expand Up @@ -139,7 +131,7 @@ public void test003assignRolePreview() {
.search()
.byName()
.inputValue(ROLE_USER_PREVIEW_NAME)
.and()
.updateSearch()
.and()
.selectCheckboxByName(ROLE_USER_PREVIEW_NAME)
.and()
Expand Down
1 change: 1 addition & 0 deletions testing/schrodingertest/testng-integration.xml
Expand Up @@ -55,6 +55,7 @@
<test name="Schrodinger.UserTest" preserve-order="true" parallel="false" verbose="3" enabled="true">
<classes>
<class name="com.evolveum.midpoint.testing.schrodinger.UserTest"/>
<class name="com.evolveum.midpoint.testing.schrodinger.page.PreviewPageTest"/>
</classes>
</test>
<test name="Schrodinger.UsersTest" preserve-order="true" parallel="false" verbose="3" enabled="true">
Expand Down
Expand Up @@ -371,7 +371,7 @@ public SelenideElement getMenuItemElement(String topLevelMenuKey, String mainMen
return mainMenu;
}
SelenideElement menuItem = mainMenu.$(Schrodinger.byDataResourceKey(menuItemKey));
menuItem.waitUntil(Condition.visible, MidPoint.TIMEOUT_MEDIUM_6_S);
menuItem.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);

return menuItem;
}
Expand Down Expand Up @@ -401,7 +401,7 @@ private SelenideElement getMainMenuItemElement(String topLevelMenuKey, String ma
topLevelMenuChevron.shouldHave(Condition.cssClass("fa-chevron-down")).waitUntil(Condition.cssClass("fa-chevron-down"), MidPoint.TIMEOUT_DEFAULT_2_S);
}

SelenideElement mainMenu = topLevelMenu.$(Schrodinger.byDataResourceKey(mainMenuKey), index);
SelenideElement mainMenu = topLevelMenu.$(Schrodinger.byDataResourceKey("span", mainMenuKey), index);
mainMenu.shouldBe(Condition.visible);

SelenideElement mainMenuLi = mainMenu.parent().parent();
Expand Down

0 comments on commit c2559ac

Please sign in to comment.