Skip to content

Commit

Permalink
schrodinger: assignment archetype test
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 13, 2019
1 parent cf7fec9 commit 320e993
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.evolveum.midpoint.testing.schrodinger.scenarios;

import com.evolveum.midpoint.testing.schrodinger.TestBase;
import org.testng.annotations.Test;

import java.io.File;

/**
* Created by honchar
*/
public class AssignmentArchetypeTest extends TestBase {

private static final File ARCHETYPE_BUSINESS_ROLE_FILE = new File("src/test/resources/configuration/objects/archetypes/archetype-business-role.xml");
private static final String RELATIONS_CONTAINER_HEADER_KEY = "Relations";
private static final String RELATION_CONTAINER_HEADER_KEY = "Relation";
private static final String NEWLY_ADDED_RELATION_CONTAINER_HEADER_KEY = "RelationDefinitionType.details";

@Test(priority = 0)
public void importArchetypeBusinessRole() {
importObject(ARCHETYPE_BUSINESS_ROLE_FILE);
}

@Test
public void configureRelationDefinitions(){
//TODO wait till MID-5144 fix
// basicPage
// .roleManagement()
// .form()
// .expandContainerPropertiesPanel(RELATIONS_CONTAINER_HEADER_KEY)
// .addNewContainerValue(RELATION_CONTAINER_HEADER_KEY, NEWLY_ADDED_RELATION_CONTAINER_HEADER_KEY)
// .expandContainerPropertiesPanel(NEWLY_ADDED_RELATION_CONTAINER_HEADER_KEY)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.evolveum.midpoint.schrodinger.component.common.PrismForm;
import com.evolveum.midpoint.schrodinger.component.configuration.AdminGuiTab;
import com.evolveum.midpoint.schrodinger.component.modal.ObjectBrowserModal;
import com.evolveum.midpoint.schrodinger.page.configuration.ImportObjectPage;
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;
import com.evolveum.midpoint.testing.schrodinger.TestBase;
Expand Down Expand Up @@ -37,23 +36,14 @@ public class ObjectListArchetypeTests extends TestBase {
private static final String NEW_GUI_OBJECT_LIST_VIEW_HEADER = "New gui object list view";
private static final String NEW_OBJECT_LIST_VIEW_CONTAINER_KEY = "GuiObjectListViewType.details";
private static final String COLLECTION_HEADER = "Collection";
public static final String OBJECT_LIST_ARCHETYPE_TESTS_GROUP = "bjectListArchetypeTests";

@Test(priority = 0)
@Test(priority = 0, groups = OBJECT_LIST_ARCHETYPE_TESTS_GROUP)
public void importEmployeeArchetype() throws IOException, ConfigurationException {

ImportObjectPage importPage = basicPage.importObject();
Assert.assertTrue(
importPage
.getObjectsFromFile()
.chooseFile(EMPLOYEE_ARCHETYPE_FILE)
.checkOverwriteExistingObject()
.clickImport()
.feedback()
.isSuccess()
);
importObject(EMPLOYEE_ARCHETYPE_FILE, true);
}

@Test(priority = 1, dependsOnMethods ={"importEmployeeArchetype"})
@Test(priority = 1, dependsOnMethods ={"importEmployeeArchetype"}, groups = OBJECT_LIST_ARCHETYPE_TESTS_GROUP)
public void configureArchetypeObjectListView(){
AdminGuiTab adminGuiTab = basicPage.adminGui();
PrismForm<AdminGuiTab> prismForm = adminGuiTab.form();
Expand Down Expand Up @@ -103,7 +93,7 @@ public void configureArchetypeObjectListView(){



@Test(priority = 2, dependsOnMethods ={"configureArchetypeObjectListView"})
@Test(priority = 2, dependsOnMethods ={"configureArchetypeObjectListView"}, groups = OBJECT_LIST_ARCHETYPE_TESTS_GROUP)
public void actualizeArchetypeConfiguration() {
basicPage.loggedUser().logout();
midPoint.login()
Expand All @@ -129,7 +119,7 @@ public void actualizeArchetypeConfiguration() {

}

@Test(priority = 3, dependsOnMethods ={"configureArchetypeObjectListView"})
@Test(priority = 3, dependsOnMethods ={"actualizeArchetypeConfiguration"}, groups = OBJECT_LIST_ARCHETYPE_TESTS_GROUP)
public void createNewEmployeeUser(){
ListUsersPage collectionListPage = basicPage.listUsers(ARCHETYPE_PLURAL_LABEL);

Expand All @@ -156,5 +146,27 @@ public void createNewEmployeeUser(){

}

@Test(priority = 4, dependsOnMethods ={"actualizeArchetypeConfiguration"})
public void checkNewObjectButtonWithDropdown(){
ListUsersPage userListPage = basicPage.listUsers();
Assert.assertTrue(userListPage
.table()
.getToolbarButton("fa fa-plus")
.exists());

SelenideElement newObjectButton = userListPage
.table()
.getToolbarButton("fa fa-plus");
newObjectButton.click();

newObjectButton
.$(By.tagName("ul"))
.shouldBe(Condition.visible)
.waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S)
.$(Schrodinger.byElementAttributeValue("i", "class", ARCHETYPE_ICON_CSS_STYLE))
.$(Schrodinger.byElementAttributeValue("i", "class", "fa fa-user")); //standard user icon

}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
~ Copyright (c) 2019 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<archetype oid="018e7340-199a-11e9-ad93-2b136d1c7ecf"
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"
xmlns:org='http://midpoint.evolveum.com/xml/ns/public/common/org-3'>
<name>Business Role</name>
<archetypePolicy>
<display>
<label>Business Role</label>
<pluralLabel>Business Roles</pluralLabel>
<icon>
<cssClass>fe fe-business</cssClass>
<color>green</color>
</icon>
</display>
</archetypePolicy>
<assignment>
<assignmentRelation>
<description>This archetype is applicable to roles.</description>
<holderType>RoleType</holderType>
</assignmentRelation>
</assignment>
<inducement>
<assignmentRelation>
<description>Any user can have business role (can be a member).</description>
<holderType>UserType</holderType>
<relation>org:approver</relation>
</assignmentRelation>
<assignmentRelation>
<description>Only employees may be owners/approvers for business role.</description>
<holderType>UserType</holderType>
<holderArchetypeRef oid="7135e68c-ee53-11e8-8025-170b77da3fd6"/> <!-- Employee archetype -->
<relation>org:owner</relation>
</assignmentRelation>
</inducement>
</archetype>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.evolveum.midpoint.schrodinger.component.configuration;

import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.component.common.PrismForm;
import com.evolveum.midpoint.schrodinger.page.configuration.SystemPage;

/**
* Created by honchar
*/
public class RoleManagementTab extends Component<SystemPage> {

public RoleManagementTab(SystemPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}

public PrismForm<RoleManagementTab> form(){
return new PrismForm<>(this, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public AdminGuiTab adminGui() {
return new SystemPage().adminGuiTab();
}

public RoleManagementTab roleManagement() {
clickConfigurationMenu("PageAdmin.menu.top.configuration.basic", "PageAdmin.menu.top.configuration.roleManagement");
return new SystemPage().roleManagementTab();
}

public InternalsConfigurationPage internalsConfiguration() {
clickConfigurationMenu("PageAdmin.menu.top.configuration.internals", null);
return new InternalsConfigurationPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ public AdminGuiTab adminGuiTab() {
SelenideElement element = null;
return new AdminGuiTab(this, element);
}

public RoleManagementTab roleManagementTab(){
return new RoleManagementTab(this, null);
}
}

0 comments on commit 320e993

Please sign in to comment.