Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 15, 2019
2 parents 2ec6618 + 64819d7 commit 81f2587
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 58 deletions.
Expand Up @@ -159,10 +159,18 @@ public boolean isVisible(){

protected void populateAssignmentDetailsPanel(ListItem<AssignmentEditorDto> item){
AssignmentEditorPanel editor = new AssignmentEditorPanel(ID_ROW, item.getModel()){
private static final long serialVersionUID = 1L;

@Override
protected boolean ignoreMandatoryAttributes(){
return AssignmentTablePanel.this.ignoreMandatoryAttributes();
}

@Override
protected boolean isRelationEditable(){
return AssignmentTablePanel.this.isRelationEditable();
}

};
item.add(editor);

Expand Down Expand Up @@ -299,6 +307,10 @@ public void onClick(AjaxRequestTarget target) {
return items;
}

protected boolean isRelationEditable(){
return true;
}

protected void showAllAssignments(AjaxRequestTarget target) {

}
Expand Down
Expand Up @@ -117,6 +117,8 @@ public void initLayout() {

AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL,
assignmentsModel){
private static final long serialVersionUID = 1L;

@Override
protected List<InlineMenuItem> createAssignmentMenu() {
List<InlineMenuItem> items = new ArrayList<>();
Expand All @@ -138,11 +140,17 @@ public void onClick(AjaxRequestTarget target) {
items.add(item);
return items;
}

@Override
public IModel<String> getLabel() {
return createStringResource("PageAssignmentsList.assignmentsToRequest");
}
public IModel<String> getLabel() {
return createStringResource("PageAssignmentsList.assignmentsToRequest");
}

@Override
protected boolean isRelationEditable() {
return false;
}

};
mainForm.add(panel);

Expand All @@ -153,23 +161,23 @@ public List<UserType> getObject() {
return getSessionStorage().getRoleCatalog().getTargetUserList();
}
},
true, createStringResource("AssignmentCatalogPanel.selectTargetUser")){
true, createStringResource("AssignmentCatalogPanel.selectTargetUser")) {
private static final long serialVersionUID = 1L;

@Override
protected String getUserButtonLabel(){
protected String getUserButtonLabel() {
return getTargetUserSelectionButtonLabel(getModelObject());
}

@Override
protected void onDeleteSelectedUsersPerformed(AjaxRequestTarget target){
protected void onDeleteSelectedUsersPerformed(AjaxRequestTarget target) {
super.onDeleteSelectedUsersPerformed(target);
getSessionStorage().getRoleCatalog().setTargetUserList(new ArrayList<>());
targetUserChangePerformed(target);
}

@Override
protected void multipleUsersSelectionPerformed(AjaxRequestTarget target, List<UserType> usersList){
protected void multipleUsersSelectionPerformed(AjaxRequestTarget target, List<UserType> usersList) {
getSessionStorage().getRoleCatalog().setTargetUserList(usersList);
targetUserChangePerformed(target);
}
Expand Down Expand Up @@ -278,9 +286,7 @@ private void onSingleUserRequestPerformed(AjaxRequestTarget target) {
result.recomputeStatus();
}

findBackgroundTaskOperation(result);
if (backgroundTaskOperationResult != null
&& StringUtils.isNotEmpty(backgroundTaskOperationResult.getAsynchronousOperationReference())){
if (hasBackgroundTaskOperation(result)){
result.setMessage(createStringResource("PageAssignmentsList.requestInProgress").getString());
showResult(result);
clearStorage();
Expand Down Expand Up @@ -340,9 +346,7 @@ private void onMultiUserRequestPerformed(AjaxRequestTarget target) {
"Failed to execute operaton " + result.getOperation(), e);
target.add(getFeedbackPanel());
}
findBackgroundTaskOperation(result);
if (backgroundTaskOperationResult != null
&& StringUtils.isNotEmpty(backgroundTaskOperationResult.getAsynchronousOperationReference())) {
if (hasBackgroundTaskOperation(result)) {
result.setMessage(createStringResource("PageAssignmentsList.requestInProgress").getString());
showResult(result);
clearStorage();
Expand Down Expand Up @@ -411,24 +415,9 @@ private ContainerDelta handleAssignmentDeltas(ObjectDelta<UserType> focusDelta,
}


private void findBackgroundTaskOperation(OperationResult result){
if (backgroundTaskOperationResult != null) {
return;
} else {
List<OperationResult> subresults = result.getSubresults();
if (subresults == null || subresults.size() == 0) {
return;
}
for (OperationResult subresult : subresults) {
if (subresult.getOperation().equals(OPERATION_WF_TASK_CREATED)) {
backgroundTaskOperationResult = subresult;
return;
} else {
findBackgroundTaskOperation(subresult);
}
}
}
return;
private boolean hasBackgroundTaskOperation(OperationResult result){
String caseOid = OperationResult.referenceToCaseOid(result.findAsynchronousOperationReference());
return StringUtils.isNotEmpty(caseOid);
}

private void handleModifyAssignmentDelta(AssignmentEditorDto assDto,
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void isCaseCreated(){
.inputValue(ConstantsUtil.CASE_CREATION_TEST_CASE_NAME)
.updateSearch()
.and()
.clickByName(ConstantsUtil.CASE_CREATION_TEST_CASE_NAME);
.containsLinkTextPartially(ConstantsUtil.CASE_CREATION_TEST_CASE_NAME);

}

Expand Down
Expand Up @@ -57,19 +57,23 @@ public void configureArchetypeObjectListView(){
prismForm
.expandContainerPropertiesPanel(OBJECT_COLLECTION_VIEWS_HEADER)
.addNewContainerValue(OBJECT_COLLECTION_VIEW_HEADER, NEW_GUI_OBJECT_LIST_VIEW_HEADER)
.expandContainerPropertiesPanel(NEW_OBJECT_LIST_VIEW_CONTAINER_KEY)
.expandContainerPropertiesPanel(NEW_OBJECT_LIST_VIEW_CONTAINER_NEW_VALUE_KEY)
.expandContainerPropertiesPanel(COLLECTION_HEADER);

//set UserType
SelenideElement newGuiObjectListViewPropertiesPanel = prismForm.getPrismPropertiesPanel(NEW_OBJECT_LIST_VIEW_CONTAINER_KEY);
SelenideElement newGuiObjectListViewPropertiesPanel = prismForm.getPrismPropertiesPanel(NEW_OBJECT_LIST_VIEW_CONTAINER_NEW_VALUE_KEY);
//todo fix! it takes Type input from the first collection container!
newGuiObjectListViewPropertiesPanel
.$(Schrodinger.byDataResourceKey("Type"))
.$(By.tagName("select"))
.selectOptionContainingText("User");

//set archetypeRef
SelenideElement collectionRefPropertyPanel = prismForm.findProperty(COLLECTION_REF_ATTRIBUTE_NAME);
collectionRefPropertyPanel
newGuiObjectListViewPropertiesPanel
.$(Schrodinger.byElementValue("span", COLLECTION_REF_ATTRIBUTE_NAME))
.parent()
.parent()
.parent()
.$(Schrodinger.byDataId("edit"))
.click();

Expand Down
5 changes: 5 additions & 0 deletions testing/schrodingertest/testng-integration-schrodinger.xml
Expand Up @@ -42,4 +42,9 @@
<class name="com.evolveum.midpoint.testing.schrodinger.scenarios.ObjectListArchetypeTests"/>
</classes>
</test>
<test name="Schrodinger.scenarios.CaseTests" preserve-order="true" parallel="false" verbose="3" enabled="true">
<classes>
<class name="com.evolveum.midpoint.testing.schrodinger.scenarios.CaseTests"/>
</classes>
</test>
</suite>
Expand Up @@ -92,7 +92,6 @@
<inbound>
<trace>true</trace>
<authoritative>true</authoritative>
<tolerant>false</tolerant> <!-- FIXME -->
<strength>strong</strength>
<expression>
<assignmentTargetSearch>
Expand Down Expand Up @@ -123,21 +122,23 @@
import com.evolveum.midpoint.schema.constants.*
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;

if (assignment.target != null) {
log.info("### (association) target roleType " + assignment.target.roleType)
inRange = 'group'.equals(assignment.target.subtype)
log.info("########## (association) inRange: " + inRange)
return inRange
}

if (assignment.targetRef != null) {
role = midpoint.getObject(RoleType.class, assignment.targetRef.oid)
log.info("### (association) role name " + role.name.orig)
log.info("### (association) role.roleType " + role.subtype)
inRange = ('group').equals(role.subtype)
log.info("########## (association) inRange: " + inRange)
return inRange
if (assignment.targetRef.object != null) {
log.info("### (association) target roleType " + assignment.targetRef.objectable.roleType)
inRange = 'group'.equals(assignment.targetRef.objectable..subtype)
log.info("########## (association) inRange: " + inRange)
return inRange
} else {
role = midpoint.getObject(RoleType.class, assignment.targetRef.oid)
log.info("### (association) role name " + role.name.orig)
log.info("### (association) role.roleType " + role.subtype)
inRange = ('group').equals(role.subtype)
log.info("########## (association) inRange: " + inRange)
return inRange
}
}

return false
</code>
</script>
</condition>
Expand Down
Expand Up @@ -107,8 +107,8 @@
<displayName>Ship</displayName>
<inbound>
<expression>
<allowEmptyValues>false</allowEmptyValues>
<script>
<allowEmptyValues>false</allowEmptyValues> <!-- FIXME -->
<code>'The crew of ' + input</code>
</script>
</expression>
Expand Down
Expand Up @@ -10,6 +10,7 @@
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.page.BasicPage;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;
Expand All @@ -22,9 +23,19 @@ public abstract class AssignmentHolderObjectListPage<T extends AssignmentHolderO
public abstract T table();

protected SelenideElement getTableBoxElement(){
SelenideElement box = $(By.cssSelector(".box.boxed-table.object-user-box"))
StringBuilder tableStyle = new StringBuilder(".box.boxed-table");
String additionalTableClass = getTableAdditionalClass();
if (StringUtils.isNotEmpty(additionalTableClass)){
tableStyle.append(".");
tableStyle.append(additionalTableClass);
}
SelenideElement box = $(By.cssSelector(".box.boxed-table"))
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);
return box;
}

protected String getTableAdditionalClass(){
return null;
}

}
Expand Up @@ -99,7 +99,7 @@ public PrismForm<T> showEmptyAttributes(String containerName) {

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

if (!valueElement.isEmpty()) {
Expand Down Expand Up @@ -274,7 +274,8 @@ public PrismForm<T> addNewContainerValue(String containerHeaderKey, String newCo
SelenideElement panelHeader = $(By.linkText(containerHeaderKey))
.parent()
.parent();
panelHeader.$(Schrodinger.byDataId("addButton"))
panelHeader.scrollTo();
panelHeader.find(By.className("fa-plus-circle"))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S)
.click();

Expand All @@ -291,11 +292,12 @@ public PrismForm<T> addNewContainerValue(String containerHeaderKey, String newCo
public SelenideElement getPrismPropertiesPanel(String containerHeaderKey){
expandContainerPropertiesPanel(containerHeaderKey);

SelenideElement containerHeaderPanel = $(Schrodinger.byDataResourceKey("div", containerHeaderKey));
SelenideElement containerHeaderPanel = $(Schrodinger.byDataResourceKey("a", containerHeaderKey));
return containerHeaderPanel
.parent()
.$(By.className("prism-properties"))
.shouldBe(Condition.visible)
.parent()
.parent()
.find(By.className("prism-properties"))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);

}
Expand Down
Expand Up @@ -17,6 +17,7 @@
import org.openqa.selenium.By;


import static com.codeborne.selenide.Selectors.byPartialLinkText;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.$;

Expand Down Expand Up @@ -69,6 +70,10 @@ public boolean containsText(String value){
return $(byText(value)).waitUntil(Condition.visible, MidPoint.TIMEOUT_MEDIUM_6_S).is(Condition.visible);
}

public boolean containsLinkTextPartially(String value){
return $(byPartialLinkText(value)).waitUntil(Condition.visible, MidPoint.TIMEOUT_MEDIUM_6_S).is(Condition.visible);
}

public boolean buttonToolBarExists(){
return $(Schrodinger.byDataId("buttonToolbar")).exists();
}
Expand Down
Expand Up @@ -13,6 +13,7 @@
import com.evolveum.midpoint.schrodinger.component.common.FeedbackBox;
import com.evolveum.midpoint.schrodinger.component.user.UsersPageTable;
import com.evolveum.midpoint.schrodinger.page.BasicPage;
import com.evolveum.midpoint.schrodinger.util.ConstantsUtil;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;
Expand All @@ -26,4 +27,10 @@ public class ListUsersPage extends AssignmentHolderObjectListPage<UsersPageTable
public UsersPageTable table() {
return new UsersPageTable(this, getTableBoxElement());
}

@Override
protected String getTableAdditionalClass(){
return ConstantsUtil.OBJECT_USER_BOX_COLOR;
}

}
Expand Up @@ -40,4 +40,6 @@ public class ConstantsUtil {
public static final String ASSIGNMENT_TYPE_SELECTOR_SERVICE = "Service";
public static final String ASSIGNMENT_TYPE_SELECTOR_RESOURCE = "Resource";

//styles
public static final String OBJECT_USER_BOX_COLOR = "object-user-box";
}

0 comments on commit 81f2587

Please sign in to comment.