View Javadoc

1   /*
2    * Copyright 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/ecl1.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.mainmenu.test;
17  
18  import static org.junit.Assert.*;
19  
20  import java.util.Calendar;
21  
22  import org.junit.After;
23  import org.junit.Assert;
24  import org.junit.Before;
25  import org.junit.Ignore;
26  import org.junit.Test;
27  import org.openqa.selenium.By;
28  import org.openqa.selenium.support.ui.Select;
29  
30  import com.thoughtworks.selenium.Selenium;
31  
32  import edu.samplu.common.AdminMenuITBase;
33  import edu.samplu.common.ITUtil;
34  import edu.samplu.common.MainMenuLookupITBase;
35  import edu.samplu.common.MainMenuLookupLegacyITBase;
36  import edu.samplu.common.MenuITBase;
37  import edu.samplu.common.UpgradedSeleniumITBase;
38  
39  /**
40   * TODO vchauhan don't forget to fill this in.
41   * 
42   * @author Kuali Rice Team (rice.collab@kuali.org)
43   */
44  public class PeopleFlowCreateNewLegacyIT extends MainMenuLookupLegacyITBase {
45    
46       
47      
48      @Test
49      public void testPeopleFlow() throws Exception {
50          
51          //Click Main Menu and Create New
52          gotoMenuLinkLocator();
53          waitAndClick(By.linkText(getCreateNewLinkLocator()));
54          //Save docId
55          waitForElementPresent("div[data-headerfor='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
56          String docId = getText("div[data-headerfor='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
57           
58          
59          driver.findElement(By.name("document.documentHeader.documentDescription")).clear();
60          driver.findElement(By.name("document.documentHeader.documentDescription")).sendKeys("Description for Document");
61          new Select(driver.findElement(By.name("document.newMaintainableObject.dataObject.namespaceCode"))).selectByVisibleText("KUALI - Kuali Systems");
62          driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).clear();
63          driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).sendKeys("Document Name" + ITUtil.DTS);
64          
65          //Add Row1
66          driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
67          driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("kr");
68          driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
69          Thread.sleep(3000);
70          //Add Row2
71          driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
72          driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("admin");
73          driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
74          Thread.sleep(3000);
75          
76          //Blanket approve
77          driver.findElement(By.cssSelector("div[data-parent='PeopleFlow-MaintenanceView'] > div.uif-footer button~button~button")).click();
78          Thread.sleep(5000);
79          //Close the Doc
80          driver.findElement(By.id("uif-close")).click();
81          Thread.sleep(3000);
82          
83          
84          driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
85          driver.findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
86          Thread.sleep(5000);
87          driver.switchTo().frame("iframeportlet");
88  
89          driver.findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
90          Thread.sleep(5000);
91          assertEquals("FINAL", driver.findElement(By.xpath("//table[@id='row']/tbody/tr/td[4]")).getText());
92          driver.switchTo().defaultContent();
93          driver.findElement(By.name("imageField")).click();
94  
95      }
96  
97      /**
98       * This overridden method ...
99       * 
100      * @see edu.samplu.common.MainMenuLookupITBase#lookupAssertions()
101      */
102     @Override
103     public void lookupAssertions() {
104         // nothing
105 
106     }
107 
108     /**
109      * This overridden method ...
110      * 
111      * @see edu.samplu.common.MenuITBase#getLinkLocator()
112      */
113     @Override
114     protected String getLinkLocator() {
115         return "People Flow";
116     }
117 
118     
119     @Ignore // No Need to     
120     @Test
121     @Override
122     public void testLookUp() throws Exception {}
123 }