/
M9OrganizationalStructure.java
270 lines (242 loc) · 12.6 KB
/
M9OrganizationalStructure.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
* 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.testing.schrodinger.labs;
import com.evolveum.midpoint.schrodinger.page.login.FormLoginPage;
import com.evolveum.midpoint.schrodinger.page.org.OrgPage;
import com.evolveum.midpoint.schrodinger.page.org.OrgTreePage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
/**
* @author skublik
*/
public class M9OrganizationalStructure extends AbstractLabTest{
private static final File ARCHETYPE_ORG_COMPANY_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-org-company.xml");
private static final File ARCHETYPE_ORG_FUNCTIONAL_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-org-functional.xml");
private static final File ARCHETYPE_ORG_GROUP_LIST_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-org-group-list.xml");
private static final File ARCHETYPE_ORG_GROUP_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-org-group.xml");
private static final File ORG_EXAMPLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "org/org-example.xml");
private static final File ORG_SECRET_OPS_FILE = new File(LAB_OBJECTS_DIRECTORY + "org/org-secret-ops.xml");
@Test(groups={"M9"}, dependsOnGroups={"M8"})
public void mod09test01ImportStaticOrgStructure() {
importObject(ARCHETYPE_ORG_FUNCTIONAL_FILE, true, true);
importObject(ARCHETYPE_ORG_COMPANY_FILE, true);
importObject(ARCHETYPE_ORG_GROUP_FILE, true);
importObject(ARCHETYPE_ORG_GROUP_LIST_FILE, true);
basicPage.loggedUser().logoutIfUserIsLogin();
FormLoginPage login = midPoint.formLogin();
login.login(getUsername(), getPassword());
importObject(ORG_EXAMPLE_FILE, true);
OrgTreePage orgTree = basicPage.orgStructure();
Assert.assertTrue(orgTree.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.containsChildOrg("ExAmPLE, Inc. - Functional Structure", "Executive Division", "Sales Department",
"Human Resources", "Technology Division", "IT Administration Department", "Software Department", "Java Development"));
Assert.assertTrue(orgTree.selectTabWithRootOrg("Groups")
.getOrgHierarchyPanel()
.containsChildOrg("Groups", "Active Employees", "Administrators", "Contractors", "Former Employees",
"Inactive Employees", "Security"));
importObject(ORG_SECRET_OPS_FILE, true);
Assert.assertTrue(basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.containsChildOrg("Secret Operations", "Transportation and Logistics Department"));
}
@Test(dependsOnMethods = {"mod09test01ImportStaticOrgStructure"}, groups={"M9"}, dependsOnGroups={"M8"})
public void mod09test02CreateStaticOrgStructure() {
basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.selectOrgInTree("Transportation and Logistics Department")
.and()
.getMemberPanel()
.newMember("Create Organization type member with default relation");
new OrgPage()
.selectTabBasic()
.form()
.addAttributeValue(OrgType.F_NAME, "0919")
.addAttributeValue(OrgType.F_DISPLAY_NAME, "Warp Speed Research")
.and()
.and()
.clickSave()
.feedback()
.isSuccess();
Assert.assertTrue(basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.expandOrg("Transportation and Logistics Department")
.showTreeNodeDropDownMenu("Warp Speed Research")
.edit()
.selectTabBasic()
.form()
.compareInputAttributeValue("name", "0919"));
showUser("kirk").selectTabAssignments()
.clickAddAssignemnt("New Organization type assignment with default relation")
.table()
.paging()
.next()
.and()
.and()
.table()
.selectCheckboxByName("0919")
.and()
.clickAdd()
.and()
.clickSave()
.feedback()
.isSuccess();
Assert.assertTrue(basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.expandOrg("Transportation and Logistics Department")
.selectOrgInTree("Warp Speed Research")
.and()
.getMemberPanel()
.selectType("User")
.table()
.containsText("kirk"));
showUser("kirk").selectTabAssignments()
.table()
.selectCheckboxByName("Warp Speed Research")
.removeByName("Warp Speed Research")
.and()
.and()
.clickSave()
.feedback()
.isSuccess();
}
@Test(dependsOnMethods = {"mod09test02CreateStaticOrgStructure"}, groups={"M9"}, dependsOnGroups={"M8"})
public void mod09test03OrganizationActingAsARole() {
Assert.assertFalse(basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.expandOrg("Transportation and Logistics Department")
.selectOrgInTree("Warp Speed Research")
.and()
.getMemberPanel()
.selectType("User")
.table()
.containsText("kirk"));
basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.showTreeNodeDropDownMenu("Warp Speed Research")
.edit()
.selectTabInducements()
.clickAddInducement()
.table()
.search()
.byName()
.inputValue("Secret Projects I")
.updateSearch()
.and()
.selectCheckboxByName("Secret Projects I")
.and()
.clickAdd()
.and()
.clickSave()
.feedback()
.isSuccess();
basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.selectOrgInTree("Warp Speed Research")
.and()
.getMemberPanel()
.table()
.clickHeaderActionDropDown()
.assign()
.selectType("User")
.table()
.search()
.byName()
.inputValue("kirk")
.updateSearch()
.and()
.selectCheckboxByName("kirk")
.and()
.clickAdd()
.and()
.and()
.and()
.feedback()
.isInfo();
Assert.assertTrue(basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.expandOrg("Transportation and Logistics Department")
.selectOrgInTree("Warp Speed Research")
.and()
.getMemberPanel()
.selectType("User")
.table()
.containsText("kirk"));
Assert.assertTrue(
showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")
.form()
.compareInputAttributeValues("groups", "Internal Employees",
"Essential Documents", "Teleportation", "Time Travel"));
basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.expandOrg("Secret Operations")
.expandOrg("Transportation and Logistics Department")
.showTreeNodeDropDownMenu("Warp Speed Research")
.edit()
.selectTabInducements()
.clickAddInducement()
.selectType("Role")
.table()
.search()
.byName()
.inputValue("Secret Projects II")
.updateSearch()
.and()
.selectCheckboxByName("Secret Projects II")
.and()
.clickAdd()
.and()
.clickSave()
.feedback()
.isSuccess();
Assert.assertTrue(
showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")
.form()
.compareInputAttributeValues("groups", "Internal Employees",
"Essential Documents", "Teleportation", "Time Travel"));
basicPage.orgStructure()
.selectTabWithRootOrg("ExAmPLE, Inc. - Functional Structure")
.getOrgHierarchyPanel()
.selectOrgInTree("Warp Speed Research")
.and()
.getMemberPanel()
.table()
.clickHeaderActionDropDown()
.recompute()
.clickYes()
.and()
.and()
.and()
.feedback()
.isInfo();
Assert.assertTrue(
showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")
.form()
.compareInputAttributeValues("groups", "Internal Employees",
"Essential Documents", "Teleportation", "Time Travel", "Lucky Numbers",
"Presidential Candidates Motivation"));
Assert.assertTrue(showUser("kirk").selectTabAssignments()
.selectTypeAllDirectIndirect()
.containsIndirectAssignments("Secret Projects II"));
}
}