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  import static org.junit.Assert.assertTrue;
20  
21  import org.junit.After;
22  import org.junit.Before;
23  import org.junit.Test;
24  
25  import com.thoughtworks.selenium.DefaultSelenium;
26  import com.thoughtworks.selenium.Selenium;
27  
28  /**
29   * tests that user 'admin', on blanket approving a new Country maintenance document, results in a final document
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class LocationCountryBlanketAppIT {
34      private Selenium selenium;
35      @Before
36      public void setUp() throws Exception {
37          selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
38          selenium.start();
39      }
40  
41      @Test
42      public void testCountry() throws Exception {
43          selenium.open(System.getProperty("remote.public.url"));
44          assertEquals("Login", selenium.getTitle());
45          selenium.type("__login_user", "admin");
46          selenium.click("//input[@value='Login']");
47          selenium.waitForPageToLoad("30000");
48          assertEquals("Kuali Portal Index", selenium.getTitle());
49          selenium.click("link=Administration");
50          selenium.waitForPageToLoad("30000");
51          assertEquals("Kuali Portal Index", selenium.getTitle());
52          selenium.click("link=Country");
53          selenium.waitForPageToLoad("30000");
54          assertEquals("Kuali Portal Index", selenium.getTitle());
55          selenium.selectFrame("iframeportlet");
56          selenium.click("//img[@alt='create new']");
57          selenium.waitForPageToLoad("30000");
58          String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
59          assertTrue(selenium.isElementPresent("methodToCall.cancel"));
60          selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Country");
61          selenium.type("//input[@id='document.newMaintainableObject.code']", "CT");
62          selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test Country");
63          selenium.type("//input[@id='document.newMaintainableObject.alternateCode']", "VTC");
64          selenium.click("methodToCall.blanketApprove");
65          selenium.waitForPageToLoad("30000");
66          selenium.selectWindow("null");
67          selenium.click("//img[@alt='doc search']");
68          selenium.waitForPageToLoad("30000");
69          assertEquals("Kuali Portal Index", selenium.getTitle());
70          selenium.selectFrame("iframeportlet");
71          selenium.click("//input[@name='methodToCall.search' and @value='search']");
72          selenium.waitForPageToLoad("30000");
73        
74          docId= "link=" + docId;
75          assertTrue(selenium.isElementPresent(docId));       
76          if(selenium.isElementPresent(docId)){            
77              assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
78          }else{
79              assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));            
80              assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
81          }
82      }
83  
84      @After
85      public void tearDown() throws Exception {
86          selenium.stop();
87      }
88  }