Skip to content

Commit

Permalink
schrodinger: button menu items for case table
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Oct 31, 2020
1 parent b252c56 commit c599c6d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
Expand Up @@ -28,6 +28,8 @@
import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;

import org.openqa.selenium.By;

/**
* Created by Viliam Repan (lazyman).
*/
Expand Down Expand Up @@ -117,4 +119,10 @@ public InlineMenu<T> clickInlineMenuButtonByTitle(String title) {
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click();
return this;
}

public InlineMenu<T> clickInlineMenuButtonByIconClass(String iconClass) {
getParentElement().$(By.cssSelector(iconClass))
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click();
return this;
}
}
Expand Up @@ -11,6 +11,7 @@

import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable;
import com.evolveum.midpoint.schrodinger.component.common.InlineMenu;
import com.evolveum.midpoint.schrodinger.component.modal.ConfirmationModal;
import com.evolveum.midpoint.schrodinger.component.modal.FocusSetAssignmentsModal;
import com.evolveum.midpoint.schrodinger.component.table.TableHeaderDropDownMenu;
Expand Down Expand Up @@ -50,6 +51,15 @@ protected SelenideElement clickAndGetHeaderDropDownMenu() {
return dropDownMenu;
}

public InlineMenu<TableWithPageRedirect<T>> getHeaderInlineMenuPanel() {
SelenideElement element = getParentElement().find("th:last-child div.btn-group");
if (element == null) {
return null;
}

return new InlineMenu<>(this, element);
}

protected void clickMenu(String columnTitleKey, String rowValue, String menuItemKey) {
clickMenuItem(columnTitleKey, rowValue, menuItemKey);
}
Expand All @@ -59,6 +69,11 @@ protected <P extends TableWithPageRedirect<T>> ConfirmationModal<P> clickMenuIt
return new ConfirmationModal<P>((P) this, Utils.getModalWindowSelenideElement());
}

protected <P extends TableWithPageRedirect<T>> ConfirmationModal<P> clickButtonMenuItemWithConfirmation(String columnTitleKey, String rowValue, String iconClass) {
clickMenuItemButton(columnTitleKey, rowValue, iconClass);
return new ConfirmationModal<P>((P) this, Utils.getModalWindowSelenideElement());
}

protected <P extends TableWithPageRedirect> FocusSetAssignmentsModal<P> clickMenuItemWithFocusSetAssignmentsModal(String columnTitleKey, String rowValue, String menuItemKey) {
clickMenuItem(columnTitleKey, rowValue, menuItemKey);
return new FocusSetAssignmentsModal<P>((P) this, Utils.getModalWindowSelenideElement());
Expand All @@ -85,4 +100,22 @@ private void clickMenuItem(String columnTitleKey, String rowValue, String menuIt
}
}

/**
* click button menu for the row specified by columnTitleKey and rowValue
* or click button menu from header if no row is specified
* @param columnTitleKey
* @param rowValue
* @param iconClass
*/
private void clickMenuItemButton(String columnTitleKey, String rowValue, String iconClass){
if (columnTitleKey == null && rowValue == null) {
getHeaderInlineMenuPanel()
.clickInlineMenuButtonByIconClass(iconClass);
} else {
rowByColumnResourceKey(columnTitleKey, rowValue)
.getInlineMenu()
.clickInlineMenuButtonByIconClass(iconClass);
}
}

}
Expand Up @@ -10,6 +10,7 @@
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable;
import com.evolveum.midpoint.schrodinger.component.modal.ConfirmationModal;
import com.evolveum.midpoint.schrodinger.component.table.TableHeaderDropDownMenu;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;

Expand All @@ -35,4 +36,28 @@ public CasePage getObjectDetailsPage(){
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S);
return new CasePage();
}

public ConfirmationModal<CasesListTable> stopCase() {
return stopCase(null, null);
}

public ConfirmationModal<CasesListTable> stopCaseByName(String name) {
return stopCase("ObjectType.name", null);
}

public ConfirmationModal<CasesListTable> stopCase(String columnTitleKey, String rowValue) {
return clickButtonMenuItemWithConfirmation(columnTitleKey, rowValue, "fa.fa-stop");
}

public ConfirmationModal<CasesListTable> deleteCase() {
return stopCase(null, null);
}

public ConfirmationModal<CasesListTable> deleteCaseByName(String name) {
return stopCase("ObjectType.name", null);
}

public ConfirmationModal<CasesListTable> deleteCase(String columnTitleKey, String rowValue) {
return clickButtonMenuItemWithConfirmation(columnTitleKey, rowValue, "fa.fa-minus");
}
}

0 comments on commit c599c6d

Please sign in to comment.