View Javadoc

1   /**
2    * Copyright 2005-2013 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.sampleu.krad.reference;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  
23  /**
24   * Tests the Component section in Rice.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class AddressTypeAft extends WebDriverLegacyITBase {
29  
30      /**
31       * AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Address%20Type&channelUrl="
32       * + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
33       * "org.kuali.rice.kim.impl.identity.address.EntityAddressTypeBo&renderReturnLink=true";
34       */
35      public static final String BOOKMARK_URL =
36              AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Address%20Type&channelUrl=" + WebDriverUtils
37                      .getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
38                      "org.kuali.rice.kim.impl.identity.address.EntityAddressTypeBo&renderReturnLink=true";
39  
40      protected void clickSearch() throws InterruptedException {
41          waitAndClickButtonByText("Search");
42      }
43  
44      @Override
45      protected String getBookmarkUrl() {
46          return BOOKMARK_URL;
47      }
48  
49      @Override
50      protected void navigate() throws InterruptedException {
51          waitAndClickKRAD();
52          waitAndClickByLinkText("Address Type");
53      }
54  
55      //Code for KRAD Test Package.
56      protected void testAddressType() throws Exception {
57          selectFrameIframePortlet();
58          clickSearch();
59  
60          String[][] data = {{"HM", "Home", "b"},
61                             {"OTH", "Other", "c"},
62                             {"WRK", "Work", "a"}};
63          assertTextPresent(data);
64      }
65  
66      protected void testAddressTypeNoResults() throws Exception {
67          selectFrameIframePortlet();
68          waitAndClickByXpath("//input[@value='N']");
69          clickSearch();
70          waitForTextPresent("No values match this search.");
71      }
72  
73      @Test
74      public void testAddressTypeBookmark() throws Exception {
75          testAddressType();
76          assertTextPresent("return value"); // bookmark should have return values as BOOKMARK_URL has renderReturnLink=true
77          passed();
78      }
79  
80      @Test
81      public void testAddressTypeNoResultsBookmark() throws Exception {
82          testAddressTypeNoResults();
83          passed();
84      }
85  
86      @Test
87      public void testAddressTypeNav() throws Exception {
88          testAddressType();
89          assertTextNotPresent("return value"); // navigation should not have return values
90          passed();
91      }
92  
93      @Test
94      public void testAddressTypeNoResultsNav() throws Exception {
95          testAddressTypeNoResults();
96          passed();
97      }
98  }