View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.samplu.admin.test;
17  
18  import edu.samplu.common.ITUtil;
19  import edu.samplu.common.WebDriverLegacyITBase;
20  import org.junit.Assert;
21  import org.junit.Test;
22  import org.openqa.selenium.By;
23  
24  /**
25   * tests creating and cancelling new and edit Role maintenance screens
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class IdentityPersonRole extends WebDriverLegacyITBase{
30  
31      public static final String EDIT_URL = ITUtil.getBaseUrlString() + "/kim/identityManagementPersonDocument.do?returnLocation=" + ITUtil.PORTAL_URL_ENCODED + "&principalId=LTID&docTypeName=IdentityManagementPersonDocument&methodToCall=docHandler&command=initiate";
32      public static final String TEST_URL = ITUtil.PORTAL + "?channelTitle=Person&channelUrl=" + ITUtil.getBaseUrlString() +
33              "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.kim.api.identity.Person&docFormKey=88888888&returnLocation=" +
34              ITUtil.PORTAL_URL + "&hideReturnLink=true";
35      private int userCnt = Integer.valueOf(System.getProperty("test.role.user.cnt", "176"));
36      private int userCntStart = Integer.valueOf(System.getProperty("test.role.user.cnt.start", "0"));
37      private String idBase = System.getProperty("test.role.user.base", "lt");
38      public static final String ADMIN_ROLE_ID = "63";
39      public static final String KRMS_ADMIN_ROLE_ID = "98";
40  
41      @Override
42      public void fail(String message) {
43          Assert.fail(message);
44      }
45  
46      @Override
47      public String getTestUrl() {
48          return TEST_URL;
49      }
50  
51      @Test
52      public void testPersonRole() throws InterruptedException {
53          String id = "";
54          String format = "%0" + (userCnt + "").length() + "d";
55          for(int i = userCntStart; i < userCnt; i++) {
56              id = idBase + String.format(format, i);
57              open(EDIT_URL.replace("LTID", id));
58              checkForIncidentReport();
59              waitAndTypeByName("document.documentHeader.documentDescription", "Admin permissions for " + id); // don't make unique
60  
61              selectByName("newAffln.affiliationTypeCode", "Affiliate");
62              selectOptionByName("newAffln.campusCode", "BL");
63              checkByName("newAffln.dflt");
64              waitAndClickByName("methodToCall.addAffln.anchor");
65  
66              waitAndClick(By.id("tab-Membership-imageToggle"));
67              waitAndType(By.id("newRole.roleId"), ADMIN_ROLE_ID);
68              driver.findElement(By.name("methodToCall.addRole.anchor")).click();
69  
70              waitAndType(By.id("newRole.roleId"), KRMS_ADMIN_ROLE_ID);
71              driver.findElement(By.name("methodToCall.addRole.anchor")).click();
72              waitAndClickByName("methodToCall.blanketApprove");
73              waitForPageToLoad();
74          }
75          passed();
76      }
77  }