Skip to content

Commit

Permalink
OrganizationStructureTests, PolyStringTests, many modiffications,addi…
Browse files Browse the repository at this point in the history
…tions and refactoring
  • Loading branch information
matusmacik committed May 30, 2018
1 parent ac85e57 commit bed18c5
Show file tree
Hide file tree
Showing 20 changed files with 204 additions and 177 deletions.
Expand Up @@ -25,7 +25,7 @@ public MidPoint(EnvironmentConfiguration environment) {

private void init() {
environment.validate();
//System.setProperty("webdriver.chrome.driver","C:\\Users\\matus\\chromedriver\\chromedriver.exe"); // TODO workaround, find proper way how to resolve
// System.setProperty("webdriver.chrome.driver","C:\\Users\\matus\\chromedriver\\chromedriver.exe"); // TODO workaround, find proper way how to resolve
System.setProperty("selenide.browser", environment.getDriver().name().toLowerCase());
System.setProperty("selenide.baseUrl", environment.getBaseUrl());

Expand Down
Expand Up @@ -18,7 +18,7 @@ public Popover(T parent, SelenideElement parentElement) {
}

public Popover<T> inputValue(String input) {
getParentElement().$(By.cssSelector("input.form-control.input-sm")).setValue(input);
getParentElement().$(Schrodinger.byDataId("textInput")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).setValue(input);

return this;
}
Expand Down
Expand Up @@ -101,6 +101,27 @@ public PrismForm<T> showEmptyAttributes(String containerName) {
return this;
}

public Boolean compareAttibuteValue(String name, String expectedValue) {
SelenideElement property = findProperty(name);
SelenideElement value = property.$(By.xpath(".//input[contains(@class,\"form-control\")]"));
String valueElemen = value.getValue();

if (!valueElemen.isEmpty()) {

return valueElemen.equals(expectedValue);

} else if (!expectedValue.isEmpty()) {

return false;

} else {

return true;

}

}

public PrismForm<T> addAttributeValue(QName name, String value) {
SelenideElement property = findProperty(name);

Expand Down Expand Up @@ -155,10 +176,10 @@ private SelenideElement findProperty(String name) {

if (doesElementAttrValueExist) {
element = $(Schrodinger.byElementAttributeValue(null, "contains",
Schrodinger.DATA_S_QNAME, "#" + name));
Schrodinger.DATA_S_QNAME, "#" + name)).waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT);

} else {
element = $(By.xpath("//span[@data-s-id=\"label\"][text()=\"" + name + "\"]/.."))
element = $(By.xpath("//span[@data-s-id=\"label\"][contains(.,\"" + name + "\")]/.."))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).parent();
}

Expand Down
Expand Up @@ -45,6 +45,7 @@ public Popover<Search<T>> byName() {
popover = popoverElement;
break;
}
popover = popoverElement;
}
return new Popover<>(this, popover);
}
Expand Down
Expand Up @@ -7,6 +7,7 @@
* Created by matus on 5/9/2018.
*/
public abstract class AbstractTable<T> extends Table<T> {

public AbstractTable(T parent, SelenideElement parentElement) {
super(parent, parentElement);
}
Expand Down
Expand Up @@ -60,6 +60,6 @@ public Table<T> selectAll() {

public boolean currentTableContains(String name) {

return $(Schrodinger.byElementValue("Span", name)).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).is(Condition.visible);
return $(Schrodinger.byElementValue("Span", name)).is(Condition.visible);
}
}

This file was deleted.

Expand Up @@ -4,10 +4,8 @@
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.component.common.DropDown;
import com.evolveum.midpoint.schrodinger.component.common.table.Table;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;

Expand All @@ -19,26 +17,26 @@ public QuickSearch(T parent, SelenideElement parentElement) {
super(parent, parentElement);
}

public QuickSearch<T> inputValue(String name){
$(Schrodinger.byElementAttributeValue("input","name","searchInput")).setValue(name);
public QuickSearch<T> inputValue(String name) {
$(Schrodinger.byElementAttributeValue("input", "name", "searchInput")).setValue(name);

return this;
}

//TODO rethink
public Table clickSearch(){
$(Schrodinger.byElementAttributeValue("button","data-s-id","searchButton"))
public Table clickSearch() {
$(Schrodinger.byElementAttributeValue("button", "data-s-id", "searchButton"))
.click();

return new Table("null",null);
return new Table("null", null);
}

public QuickSearchDropDown<QuickSearch<T>> clickSearchFor(){
$(Schrodinger.bySelfOrDescendantElementAttributeValue("button","data-toggle","dropdown","class","sr-only"))
.waitUntil(Condition.appears,MidPoint.TIMEOUT_DEFAULT).click();
SelenideElement dropDown = $(Schrodinger.byElementAttributeValue("ul","role","menu"))
.waitUntil(Condition.visible,MidPoint.TIMEOUT_DEFAULT);
public QuickSearchDropDown<QuickSearch<T>> clickSearchFor() {
$(Schrodinger.byDescendantOrSelfElementAttributeValue("button", "data-toggle", "dropdown", "class", "sr-only"))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).click();
SelenideElement dropDown = $(Schrodinger.byElementAttributeValue("ul", "role", "menu"))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT);

return new QuickSearchDropDown<>(this,dropDown);
return new QuickSearchDropDown<>(this, dropDown);
}
}
Expand Up @@ -22,7 +22,6 @@
import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.component.FocusSetAssignmentsModal;
import com.evolveum.midpoint.schrodinger.component.common.PrismFormWithActionButtons;
import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTable;
import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView;
import com.evolveum.midpoint.schrodinger.page.user.UserPage;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;
Expand Down Expand Up @@ -58,7 +57,7 @@ public PrismFormWithActionButtons<AbstractTableWithPrismView<UserAssignmentsTab>
@Override
public AbstractTableWithPrismView<UserAssignmentsTab> selectCheckboxByName(String name) {

$(Schrodinger.byFollowingSiblingElementValue("td", "class", "check", "data-s-id", "3", name))
$(Schrodinger.byFollowingSiblingEnclosedValue("td", "class", "check", "data-s-id", "3", name))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).click();

return this;
Expand All @@ -67,7 +66,7 @@ public AbstractTableWithPrismView<UserAssignmentsTab> selectCheckboxByName(Strin
@Override
public AbstractTableWithPrismView<UserAssignmentsTab> unassignByName(String name) {

$(Schrodinger.byAncestorElementValue("button", "title", "Unassign", "data-s-id", "3", name))
$(Schrodinger.byAncestorPrecedingSiblingElementValue("button", "title", "Unassign", null, null, name))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).click();

return this;
Expand Down
Expand Up @@ -66,7 +66,7 @@ public PrismForm<AbstractTable<UserProjectionsTab>> clickByName(String name) {
@Override
public AbstractTable<UserProjectionsTab> selectCheckboxByName(String name) {

$(Schrodinger.byFollowingSiblingElementValue("input", "type", "checkbox", "class", "check-table-label", name))
$(Schrodinger.byFollowingSiblingEnclosedValue("input", "type", "checkbox", "class", "check-table-label", name))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).click();

return this;
Expand Down

This file was deleted.

@@ -1,7 +1,7 @@
package com.evolveum.midpoint.schrodinger.page.resource;

import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.component.resource.ResourcesTablePage;
import com.evolveum.midpoint.schrodinger.component.resource.ResourcesPageTable;
import com.evolveum.midpoint.schrodinger.page.BasicPage;
import org.openqa.selenium.By;

Expand All @@ -12,9 +12,9 @@
*/
public class ListResourcesPage extends BasicPage {

public ResourcesTablePage<ListResourcesPage> table() {
public ResourcesPageTable<ListResourcesPage> table() {
SelenideElement table = $(By.cssSelector(".box.boxed-table.object-resource-box"));

return new ResourcesTablePage<>(this, table);
return new ResourcesPageTable<>(this, table);
}
}
@@ -1,10 +1,15 @@
package com.evolveum.midpoint.schrodinger.page.resource;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.common.FeedbackBox;
import com.evolveum.midpoint.schrodinger.component.resource.ResourceAccountsTab;
import com.evolveum.midpoint.schrodinger.component.resource.ResourceConfigurationTab;
import com.evolveum.midpoint.schrodinger.page.BasicPage;
import com.evolveum.midpoint.schrodinger.page.configuration.AboutPage;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;

Expand All @@ -18,4 +23,20 @@ public ResourceConfigurationTab clickEditResourceConfiguration() {
return new ResourceConfigurationTab(new EditResourceConfigurationPage(), null);
}

public ResourceAccountsTab<ViewResourcePage> clicAccountsTab() {

$(Schrodinger.byDataResourceKey("schrodinger", "PageResource.tab.content.account")).parent()
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT).click();

SelenideElement tabContent = $(By.cssSelector(".tab-pane.active"))
.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT);

return new ResourceAccountsTab<>(this, tabContent);
}

public FeedbackBox<ViewResourcePage> feedback() {
SelenideElement feedback = $(By.cssSelector("div.feedbackContainer"));

return new FeedbackBox<>(this, feedback);
}
}
@@ -1,9 +1,21 @@
package com.evolveum.midpoint.schrodinger.page.task;

import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.component.common.FeedbackBox;
import com.evolveum.midpoint.schrodinger.page.BasicPage;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;

/**
* Created by Viliam Repan (lazyman).
*/
public class ListTasksPage extends BasicPage {

public FeedbackBox<ListTasksPage> feedback() {
SelenideElement feedback = $(By.cssSelector("div.feedbackContainer"));

return new FeedbackBox<>(this, feedback);
}

}

0 comments on commit bed18c5

Please sign in to comment.