Skip to content

Commit

Permalink
tests for cases gui
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Oct 11, 2019
1 parent 06dfcac commit d6f8e06
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 6 deletions.
Expand Up @@ -9,6 +9,8 @@
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.page.cases.*;
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage;
import com.evolveum.midpoint.schrodinger.page.user.UserPage;
import com.evolveum.midpoint.schrodinger.util.ConstantsUtil;
import com.evolveum.midpoint.testing.schrodinger.TestBase;
import org.testng.Assert;
Expand Down Expand Up @@ -67,6 +69,56 @@ public void test100openCasesAndCheckMenuEnabled() {
Assert.assertFalse(isCaseMenuItemActive(ConstantsUtil.MENU_ALL_REQUESTS_MENU_ITEM_LABEL_TEXT, false));
}

@Test
public void isCaseCreated(){
importObject(ConstantsUtil.ROLE_WITH_ADMIN_APPROVER_XML,true);

UserPage user = basicPage.newUser();
user.selectTabBasic()
.form()
.addAttributeValue("name", ConstantsUtil.CASE_CREATION_TEST_USER_NAME)
.and()
.and()
.clickSave();

ListUsersPage users = basicPage.listUsers();
users
.table()
.search()
.byName()
.inputValue(ConstantsUtil.CASE_CREATION_TEST_USER_NAME)
.updateSearch()
.and()
.clickByName(ConstantsUtil.CASE_CREATION_TEST_USER_NAME)
.selectTabAssignments()
.clickAddAssignemnt()
.selectType(ConstantsUtil.ASSIGNMENT_TYPE_SELECTOR_ROLE)
.table()
.search()
.byName()
.inputValue(ConstantsUtil.CASE_CREATION_TEST_ROLE_NAME)
.updateSearch()
.and()
.selectCheckboxByName(ConstantsUtil.CASE_CREATION_TEST_ROLE_NAME)
.and()
.clickAdd()
.and()
.clickSave()
.feedback()
.isInfo();

AllCasesPage allCasesPage = basicPage.listAllCases();
allCasesPage
.table()
.search()
.byName()
.inputValue(ConstantsUtil.CASE_CREATION_TEST_CASE_NAME)
.updateSearch()
.and()
.clickByName(ConstantsUtil.CASE_CREATION_TEST_CASE_NAME);

}

private boolean isCaseMenuItemActive(String menuIdentifier, boolean checkByLabelText){
SelenideElement casesMenuItemElement;
if (!checkByLabelText) {
Expand Down
Expand Up @@ -11,6 +11,7 @@
import com.evolveum.midpoint.schrodinger.page.resource.ListResourcesPage;
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage;
import com.evolveum.midpoint.schrodinger.page.user.UserPage;
import com.evolveum.midpoint.schrodinger.util.ConstantsUtil;
import com.evolveum.midpoint.testing.schrodinger.TestBase;
import org.apache.commons.io.FileUtils;
import org.testng.Assert;
Expand Down Expand Up @@ -81,7 +82,7 @@ public void assignOrgUnit(){
.clickByName(TEST_USER_GUYBRUSH_NAME)
.selectTabAssignments()
.clickAddAssignemnt()
.selectType(TYPE_SELECTOR_ORG)
.selectType(ConstantsUtil.ASSIGNMENT_TYPE_SELECTOR_ORG)
.table()
.search()
.byName()
Expand Down
@@ -0,0 +1,20 @@
<role oid="00000001-0001-0001-0001-000000000001"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3">
<name>Role with admin approver</name>
<assignment>
<policyRule>
<policyConstraints>
<assignment>
<operation>add</operation>
</assignment>
</policyConstraints>
<policyActions>
<approval>
<approverRef oid="00000000-0000-0000-0000-000000000002" type="UserType"/>
</approval>
</policyActions>
</policyRule>
</assignment>
</role>
Expand Up @@ -11,5 +11,5 @@
/**
* Created by Kate Honchar
*/
public class AllApprovalsPage extends BasicPage {
public class AllApprovalsPage extends CasesPage {
}
Expand Up @@ -11,5 +11,6 @@
/**
* Created by Kate Honchar
*/
public class AllCasesPage extends BasicPage {
public class AllCasesPage extends CasesPage {

}
Expand Up @@ -11,6 +11,6 @@
/**
* Created by Kate Honchar.
*/
public class AllManualCasesPage extends BasicPage {
public class AllManualCasesPage extends CasesPage {

}
Expand Up @@ -11,5 +11,5 @@
/**
* Created by Viliam Repan (lazyman).
*/
public class AllRequestsPage extends BasicPage {
public class AllRequestsPage extends CasesPage {
}
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.page.cases;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab;
import com.evolveum.midpoint.schrodinger.component.AssignmentsTab;
import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage;

/**
* Created by Kate Honchar.
*/
public class CasePage extends AssignmentHolderDetailsPage {

@Override
public AssignmentHolderBasicTab<CasePage> selectTabBasic(){
SelenideElement element = findTabPanel().clickTab("pageAdminFocus.basic")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new AssignmentHolderBasicTab<CasePage>(this, element);
}

@Override
public AssignmentsTab<CasePage> selectTabAssignments(){
SelenideElement element = findTabPanel().clickTab("pageAdminFocus.assignments");

return new AssignmentsTab<CasePage>(this, element);
}
}
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.page.cases;

import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable;
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage;
import com.evolveum.midpoint.schrodinger.page.user.UserPage;

/**
* Created by Kate Honchar.
*/
public class CasesListTable extends AssignmentHolderObjectListTable<CasesPage, CasePage> {

public CasesListTable(CasesPage parent, SelenideElement parentElement){
super(parent, parentElement);
}

@Override
public CasePage getObjectDetailsPage(){
return new CasePage();
}
}
@@ -0,0 +1,20 @@
/**
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.page.cases;

import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListPage;

/**
* Created by Kate Honchar
*/
public class CasesPage extends AssignmentHolderObjectListPage<CasesListTable> {

@Override
public CasesListTable table() {
return new CasesListTable(this, getTableBoxElement());
}
}
Expand Up @@ -11,6 +11,6 @@
/**
* Created by Kate Honchar
*/
public class MyCasesPage extends BasicPage {
public class MyCasesPage extends CasesPage {

}
Expand Up @@ -136,6 +136,7 @@ public AssignmentHolderBasicTab<UserPage> selectTabBasic(){
return new AssignmentHolderBasicTab<UserPage>(this, element);
}

@Override
public AssignmentsTab<UserPage> selectTabAssignments(){
SelenideElement element = findTabPanel().clickTab("pageAdminFocus.assignments");

Expand Down
Expand Up @@ -6,6 +6,8 @@
*/
package com.evolveum.midpoint.schrodinger.util;

import java.io.File;

/**
* Created by Kate Honchar
*/
Expand All @@ -23,5 +25,19 @@ public class ConstantsUtil {
public static final String MENU_ALL_REQUESTS_MENU_ITEM_LABEL_TEXT = "All requests";
public static final String MENU_ALL_APPROVALS_MENU_ITEM_LABEL_TEXT = "All approvals";

//object attribute values
public static final String CASE_CREATION_TEST_USER_NAME = "caseCreationTestUser";
public static final String CASE_CREATION_TEST_ROLE_NAME = "Role with admin approver";
public static final String CASE_CREATION_TEST_CASE_NAME = "Approving and executing change of user \"caseCreationTestUser\"";

//files to import
public static final File ROLE_WITH_ADMIN_APPROVER_XML = new File("./src/test/resources/role-with-admin-approver.xml");

//add new assignment popup - tabs names
public static final String ASSIGNMENT_TYPE_SELECTOR_ROLE = "Role";
public static final String ASSIGNMENT_TYPE_SELECTOR_ORG_TREE = "Org. tree view";
public static final String ASSIGNMENT_TYPE_SELECTOR_ORG = "Org";
public static final String ASSIGNMENT_TYPE_SELECTOR_SERVICE = "Service";
public static final String ASSIGNMENT_TYPE_SELECTOR_RESOURCE = "Resource";

}

0 comments on commit d6f8e06

Please sign in to comment.