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.Test;
21  import org.openqa.selenium.By;
22  
23  /**
24   * tests creating and cancelling new and edit Role maintenance screens
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class IdentityPersonRoleWDIT extends WebDriverLegacyITBase{
29  
30      public static final String EDIT_URL = ITUtil.getBaseUrlString() + "/kim/identityManagementPersonDocument.do?returnLocation=" + ITUtil.PORTAL_URL_ENCODED + "&principalId=LTID&docTypeName=IdentityManagementPersonDocument&methodToCall=docHandler&command=initiate";
31      public static final String TEST_URL = ITUtil.PORTAL + "?channelTitle=Person&channelUrl=" + ITUtil.getBaseUrlString() +
32              "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.kim.api.identity.Person&docFormKey=88888888&returnLocation=" +
33              ITUtil.PORTAL_URL + "&hideReturnLink=true";
34      private int userCnt = Integer.valueOf(System.getProperty("test.role.user.cnt", "151"));
35      private int userCntStart = Integer.valueOf(System.getProperty("test.role.user.cnt.start", "0"));
36      private String idBase = System.getProperty("test.role.user.base", "lt");
37      public static final String ADMIN_ROLE_ID = "63";
38      public static final String KRMS_ADMIN_ROLE_ID = "98";
39  
40      @Override
41      public String getTestUrl() {
42          return TEST_URL;
43      }
44      @Test
45      /**
46       */
47      public void testPersonRole() throws InterruptedException {
48  //        String easyFrame = null;
49  //        String match = "easyXDM_default";
50  //        String source = driver.getPageSource();
51  //        if (source.indexOf(match) > -1) {
52  //            easyFrame = source.substring(source.indexOf(match, source.indexOf(match) + 20));
53  //            easyFrame = easyFrame.substring(0, easyFrame.indexOf("_provider")) + "_provider";
54  //        }
55  
56          String id = "";
57          String format = "%0" + (userCnt + "").length() + "d";
58          for(int i = userCntStart; i < userCnt; i++) {
59              id = idBase + String.format(format, i);
60              open(EDIT_URL.replace("LTID", id));
61              waitAndTypeByName("document.documentHeader.documentDescription", "Admin permissions for " + id); // don't make unique
62  
63              selectByName("newAffln.affiliationTypeCode", "Affiliate");
64              selectOptionByName("newAffln.campusCode", "BL");
65              checkByName("newAffln.dflt");
66              waitAndClickByName("methodToCall.addAffln.anchor");
67  
68              waitAndClick(By.id("tab-Membership-imageToggle"));
69              waitAndType(By.id("newRole.roleId"), ADMIN_ROLE_ID);
70              driver.findElement(By.name("methodToCall.addRole.anchor")).click();
71  
72              waitAndType(By.id("newRole.roleId"), KRMS_ADMIN_ROLE_ID);
73              driver.findElement(By.name("methodToCall.addRole.anchor")).click();
74              waitAndClickByName("methodToCall.blanketApprove");
75              waitForPageToLoad();
76          }
77          passed();
78      }
79  }