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.travel.test;
17  
18  import edu.samplu.common.ITUtil;
19  import edu.samplu.common.UpgradedSeleniumITBase;
20  import org.junit.Test;
21  
22  import static org.junit.Assert.assertEquals;
23  /**
24   * tests that user 'admin', can initiate, save and submit a FiscalOfficerInfo maintenance document
25   * resulting in a final document
26   * 
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class FiscalOfficerInfoMaintenanceNewIT extends UpgradedSeleniumITBase {
30      @Override
31      public String getTestUrl() {
32          return ITUtil.PORTAL;
33      }
34  
35      @Test
36      public void testUntitled() throws Exception {
37          waitAndClick("link=KRAD");
38          waitForPageToLoad50000();
39          waitAndClick("//a[@title='FiscalOfficerInfo Maintenance (New)']");
40          waitForPageToLoad50000();
41          selectFrame("iframeportlet");
42          // String docId = getText("//span[contains(@id , '_attribute_span')][position()=1]");
43          checkForIncidentReport("", "https://jira.kuali.org/browse/KULRICE-7723 FiscalOfficerInfoMaintenanceNewIT.testUntitled need a better name and user permission error");
44          String docId = getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
45          waitAndType("//input[@name='document.documentHeader.documentDescription']", "New FO Doc");
46          waitAndType("//input[@name='document.newMaintainableObject.dataObject.id']", "5");
47          waitAndType("//input[@name='document.newMaintainableObject.dataObject.userName']", "Jigar");
48          
49  //        waitAndType("newCollectionLines['document.newMaintainableObject.dataObject.accounts'].number", "123123");
50  //        waitAndType("xpath = //input[@name='document.newMaintainableObject.dataObject.accounts[0].number']", "123123");
51  //        waitAndType("//input[contains(@name , '.number')]", "123123");
52  //        waitAndType("newCollectionLines['document.newMaintainableObject.dataObject.accounts'].name", "ChrisTravelAcc");
53  //        waitAndType("xpath = //input[@name='document.newMaintainableObject.dataObject.accounts[0].name']", "ChrisTravelAcc");
54  //        waitAndType("//input[contains(@name , '.name')]", "JustinTravelAcc");
55  //        waitAndClick("add");
56  //        waitAndClick("//input[@value='add']");
57  //        System.out.println("adding Row");
58  //        selenium.wait(90000);
59      
60          waitAndClick("//button[@value='save']");
61          
62          int docIdInt = Integer.valueOf(docId).intValue(); 
63          
64          waitForPageToLoad50000();
65          selectFrame("relative=up");
66          waitAndClick("//img[@alt='action list']");
67          waitForPageToLoad50000();
68          selectFrame("iframeportlet");
69          if(isElementPresent("link=Last")){
70              waitAndClick("link=Last");
71              waitForPageToLoad50000();
72              waitAndClick("link="+docIdInt);
73          } else {                                  
74              waitAndClick("link="+docIdInt);
75          }
76          
77          Thread.sleep(5000); 
78          String[] windowTitles = getAllWindowTitles();
79          selectWindow(windowTitles[1]);
80          windowFocus();
81          assertEquals(windowTitles[1], getTitle());
82          
83          //------submit-----//
84          selectFrame("relative=up");
85          waitAndClick("//button[@value='submit']");
86          waitForPageToLoad50000();
87          close();
88          //------submit over---//        
89          
90          //----step 2----//  
91          selectWindow("null");
92          windowFocus();
93          waitAndClick("//img[@alt='doc search']");
94          waitForPageToLoad50000();
95          assertEquals(windowTitles[0], getTitle());
96          selectFrame("iframeportlet");
97          waitAndClick("//input[@name='methodToCall.search' and @value='search']");
98          waitForPageToLoad50000();
99          //----step 2 over ----//
100         
101         //-----Step 3 verifies that doc is final-------//        
102         assertEquals("FINAL", getText("//table[@id='row']/tbody/tr[1]/td[4]"));
103         selectFrame("relative=up");
104         waitAndClick("link=Main Menu");
105         waitForPageToLoad50000();
106         assertEquals(windowTitles[0], getTitle());
107         System.out.println("---------------------- :: Test complete :: ----------------------");
108         //-----Step 3 verified that doc is final -------//      
109      
110     }
111 }