View Javadoc

1   /*
2    * Copyright 2006-2012 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.krad.configview;
18  
19  import com.thoughtworks.selenium.Selenium;
20  import junit.framework.Assert;
21  import org.junit.After;
22  import org.junit.Before;
23  import org.junit.Test;
24  import org.openqa.selenium.WebDriver;
25  import org.openqa.selenium.WebDriverBackedSelenium;
26  import org.openqa.selenium.firefox.FirefoxDriver;
27  
28  /**
29   * Selenium test that tests collections
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class CollectionsIT {
34      private Selenium selenium;
35  
36      @Before
37      public void setUp() throws Exception {
38          WebDriver driver = new FirefoxDriver();
39          String baseUrl = "http://localhost:8080/";
40          selenium = new WebDriverBackedSelenium(driver, baseUrl);
41  
42          // open Collections test view
43          selenium.open(
44                  "http://localhost:8080/kr-dev/kr-krad/uicomponents?viewId=ConfigurationTestView-Collections&methodToCall=start");
45          selenium.type("name=__login_user", "admin");
46          selenium.click("//input[@value='Login']");
47          selenium.waitForPageToLoad("30000");
48      }
49  
50      /**
51       * Test action column placement in table layout collections
52       */
53      @Test
54      public void testActionColumnPlacement() throws Exception {
55          // check if actions column RIGHT by default
56          Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-collection1']//tr[2]/td[6]//button[contains(.,\"delete\")]"));
57          // check if actions column is LEFT
58          Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-collection2']//tr[2]/td[1]//button[contains(.,\"delete\")]"));
59          // check if actions column is 3rd in a sub collection
60          Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-subCollection2_line0']//tr[2]/td[3]//button[contains(.,\"delete\")]"));
61      }
62  
63      @After
64      public void tearDown() throws Exception {
65          selenium.stop();
66      }
67  
68  }