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 static org.junit.Assert.assertEquals;
19  
20  import edu.samplu.common.AdminMenuLegacyITBase;
21  import edu.samplu.common.ITUtil;
22  import edu.samplu.common.WebDriverLegacyITBase;
23  
24  import org.junit.Test;
25  import org.openqa.selenium.By;
26  
27  /**
28   * tests the Parameter section in Rice.
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class ParameterLegacyIT extends AdminMenuLegacyITBase {
33      /**
34       * This overridden method ...
35       * 
36       * @see edu.samplu.common.MenuLegacyITBase#getLinkLocator()
37       */
38      String docId;
39      String parameterName;
40      @Override
41      protected String getLinkLocator() {
42          return "Parameter";
43      }
44      @Test
45      public void testParameter() throws Exception {
46          
47          super.gotoCreateNew();
48          waitForPageToLoad();
49          docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
50          //Enter details for Parameter.
51          waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter");
52          selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
53          waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
54          waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
55          parameterName = "TestIndicator" + ITUtil.DTS_TWO;
56          waitAndTypeByName("document.newMaintainableObject.name", parameterName);
57          waitAndTypeByName("document.newMaintainableObject.value", "Y");
58          waitAndTypeByName("document.newMaintainableObject.description", "for testing");
59          selectOptionByName("document.newMaintainableObject.parameterTypeCode", "HELP");
60          waitAndClickByXpath("//input[@name='document.newMaintainableObject.evaluationOperatorCode' and @value='A']");
61      
62          waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
63          waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
64          waitForPageToLoad();
65          assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
66          selectTopFrame();
67          waitAndClickByXpath("//a[@title='Document Search']");
68          waitForPageToLoad();
69          selectFrame("iframeportlet");
70          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
71          Thread.sleep(2000);
72          assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
73          assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
74          selectTopFrame();
75          System.out.println("--------------------------------New Parameter Created-------------------------");
76          
77          //Lookup
78          super.gotoMenuLinkLocator();
79          waitAndTypeByName("name", parameterName);
80          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
81          isElementPresentByLinkText(parameterName);
82          waitAndClickByLinkText(parameterName);
83          waitForPageToLoad();
84          Thread.sleep(2000);
85          switchToWindow("Kuali :: Inquiry");        
86          Thread.sleep(2000);
87          assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
88          assertEquals("Y", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim());
89          waitAndClickByXpath("//*[@title='close this window']");
90          switchToWindow("null");
91          System.out.println("--------------------------------Lookup And View Successful-------------------------");
92          
93          //edit
94          selectFrame("iframeportlet");
95          waitAndClickByLinkText("edit");
96          waitForPageToLoad();
97          docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
98          waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
99  	    clearTextByName("document.newMaintainableObject.value");
100 	    waitAndTypeByName("document.newMaintainableObject.value", "N");
101         waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
102         waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
103         waitForPageToLoad();
104         assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
105         selectTopFrame();
106         waitAndClickByXpath("//a[@title='Document Search']");
107         waitForPageToLoad();
108         selectFrame("iframeportlet");
109         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
110         Thread.sleep(2000);
111         assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
112         assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
113         selectTopFrame();
114         System.out.println("-----------------------------------Parameter Edited-------------------------");
115         
116         //Verify if its edited
117         super.gotoMenuLinkLocator();
118         waitAndTypeByName("name", parameterName);
119         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
120         isElementPresentByLinkText(parameterName);
121         waitAndClickByLinkText(parameterName);
122         waitForPageToLoad();
123         Thread.sleep(2000);
124         switchToWindow("Kuali :: Inquiry");
125         Thread.sleep(2000);
126         assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
127         assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim());
128         waitAndClickByXpath("//*[@title='close this window']");
129         switchToWindow("null");
130         
131         
132         //copy
133         selectFrame("iframeportlet");
134         waitAndClickByLinkText("copy");
135         waitForPageToLoad();
136         docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
137         waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
138         selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
139         waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
140         waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
141         parameterName = "TestIndicator" + ITUtil.DTS_TWO;
142         waitAndTypeByName("document.newMaintainableObject.name", parameterName);
143         waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
144         waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
145         waitForPageToLoad();
146         assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
147         selectTopFrame();
148         waitAndClickByXpath("//a[@title='Document Search']");
149         waitForPageToLoad();
150         selectFrame("iframeportlet");
151         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
152         Thread.sleep(2000);
153         assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
154         assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
155         selectTopFrame();
156         System.out.println("-----------------------------------Parameter Edited-------------------------");
157         
158         //Verify if its copied
159         super.gotoMenuLinkLocator();
160         waitAndTypeByName("name", parameterName);
161         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
162         isElementPresentByLinkText(parameterName);
163         waitAndClickByLinkText(parameterName);
164         waitForPageToLoad();
165         Thread.sleep(2000);
166         switchToWindow("Kuali :: Inquiry");
167         Thread.sleep(2000);
168         assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
169         assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim());
170         waitAndClickByXpath("//*[@title='close this window']");
171         switchToWindow("null");
172     }
173 
174     
175 }