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  
17  package edu.samplu.admin.test;
18  
19  import static org.junit.Assert.assertEquals;
20  
21  import org.junit.Test;
22  
23  import edu.samplu.common.AdminMenuLegacyITBase;
24  import edu.samplu.common.ITUtil;
25  
26  /**
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class PermissionLegacyIT extends AdminMenuLegacyITBase {
30  
31      String docId;
32      String permissionName;
33  
34      @Override
35      protected String getLinkLocator() {
36          return "Permission";
37      }
38      
39      @Test
40      public void testPerson() throws Exception {
41          super.gotoCreateNew();
42          waitForPageToLoad();
43          Thread.sleep(2000);
44          /*assertElementPresentByXpath("//*[@name='methodToCall.route' and @alt='submit']",
45                  "save button does not exist on the page");*/
46          waitForElementPresentByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
47          docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
48          waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
49          waitForPageToLoad();
50          assertElementPresentByXpath("//div[contains(.,'Document Description (Description) is a required field.')]/img[@alt='error']");
51          waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Adding Permission removeme");
52          waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
53          waitForPageToLoad();
54          assertElementPresentByXpath("//div[@class='error']");
55          assertElementPresentByXpath("//div[contains(.,'Template (Template) is a required field.')]/img[@alt='error']");
56          assertElementPresentByXpath("//div[contains(.,'Permission Namespace (Permission Namespace) is a required field.')]/img[@alt='error']");
57          assertElementPresentByXpath("//div[contains(.,'Permission Name (Permission Name) is a required field.')]/img[@alt='error']");
58          System.out.println("------------------------------------Validation Test Successful--------------------------");
59          
60          
61          selectOptionByName("document.newMaintainableObject.templateId", "36");
62          selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-SYS");
63          permissionName = "removeme" + ITUtil.DTS_TWO;
64          waitAndTypeByName("document.newMaintainableObject.name", permissionName);
65          waitAndTypeByName("document.newMaintainableObject.description", "namespaceCode=KR*");
66          checkByName("document.newMaintainableObject.active");
67          waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
68          waitForPageToLoad();
69          assertElementPresentByXpath("//div[contains(div,'Document was successfully saved.')]");
70          assertEquals("SAVED", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
71          waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
72          waitForPageToLoad();
73          assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]",
74                  "Document is not submitted successfully");
75          assertEquals("ENROUTE", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
76          System.out.println("------------------------------------Permission document submitted successfully--------------------------");
77          
78          selectTopFrame();
79          super.gotoMenuLinkLocator();
80          waitForPageToLoad();
81          waitAndTypeByName("name", permissionName);
82          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
83          isElementPresentByLinkText(permissionName);
84          System.out.println("----------------------------------Lookup successful-----------------------------");
85          
86          waitAndClickByLinkText("edit");
87          waitForPageToLoad();
88          Thread.sleep(2000);
89          waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Editing Permission removeme");
90          uncheckByName("document.newMaintainableObject.active");
91          waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
92          waitForPageToLoad();
93          assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]",
94                  "Document is not submitted successfully");
95          System.out.println("------------------------------------Inactivation of Permission successfull--------------------------");
96          
97          selectTopFrame();
98          super.gotoMenuLinkLocator();
99          waitForPageToLoad();
100         waitAndTypeByName("name", permissionName);
101         waitAndClickByXpath("//input[@title='Active Indicator - No']");
102         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
103         isElementPresentByLinkText(permissionName);
104         
105 
106         
107     }
108 
109 }