View Javadoc
1   /**
2    * Copyright 2005-2016 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.Ignore;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
21  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
22  import org.kuali.rice.testtools.selenium.WebDriverUtils;
23  
24  /**
25   * Tests the Component section in Rice.
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class AddressTypeAft extends WebDriverLegacyITBase {
30  
31      /**
32       * AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Address%20Type&channelUrl="
33       * + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
34       * "org.kuali.rice.kim.impl.identity.address.EntityAddressTypeBo&renderReturnLink=true";
35       */
36      public static final String BOOKMARK_URL =
37              AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Address%20Type&channelUrl=" + WebDriverUtils
38                      .getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
39                      "org.kuali.rice.kim.impl.identity.address.EntityAddressTypeBo&renderReturnLink=true";
40  
41      protected void clickSearch() throws InterruptedException {
42          waitAndClickSearchByText();
43      }
44  
45      @Override
46      protected String getBookmarkUrl() {
47          return BOOKMARK_URL;
48      }
49  
50      @Override
51      protected void navigate() throws InterruptedException {
52          waitAndClickKRAD();
53          waitAndClickByLinkText("Address Type");
54      }
55  
56      //Code for KRAD Test Package.
57      protected void testAddressType() throws Exception {
58          selectFrameIframePortlet();
59  
60          //Search by "Both" Filter in Active Indicator
61          clickSearch();
62          String[][] data = {{"HM", "Home", "b"},
63                  {"OTH", "Other", "c"},
64                  {"WRK", "Work", "a"}};
65          assertTextPresent(data);
66          waitAndClickClearValues();
67  
68          //Search by "Yes" Filter in Active Indicator
69          waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
70          clickSearch();
71          assertTextPresent(data);
72          waitAndClickClearValues();
73  
74          //Search by "No" Filter in Active Indicator
75          waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='N']");
76          clickSearch();
77          waitForTextPresent("No values match this search.");
78          waitAndClickClearValues();
79  
80          //Search by Address Type Code Filter
81          waitAndTypeByName("lookupCriteria[code]","HM");
82          clickSearch();
83          String[] assertSearchResultForTypeCode = {"HM", "Home", "b"};
84          assertTextPresent(assertSearchResultForTypeCode);
85          waitAndClickClearValues();
86  
87          //Search by Address Type Name Filter
88          waitAndTypeByName("lookupCriteria[name]","Home");
89          clickSearch();
90          String[] assertSearchResultForTypeName = {"HM", "Home", "b"};
91          assertTextPresent(assertSearchResultForTypeName);
92          waitAndClickClearValues();
93      }
94  
95      protected void testAddressTypeNoResults() throws Exception {
96          selectFrameIframePortlet();
97          waitAndClickByXpath("//input[@value='N']");
98          clickSearch();
99          waitForTextPresent("No values match this search.");
100     }
101 
102     @Test
103     public void testAddressTypeBookmark() throws Exception {
104         testAddressType();
105 //        assertTextPresent("return value"); // bookmark should have return values as BOOKMARK_URL has renderReturnLink=true
106         passed();
107     }
108 
109     @Test
110     public void testAddressTypeNoResultsBookmark() throws Exception {
111         testAddressTypeNoResults();
112         passed();
113     }
114 
115     @Test
116     public void testAddressTypeNav() throws Exception {
117         testAddressType();
118         assertTextNotPresent("return value"); // navigation should not have return values
119         passed();
120     }
121 
122     @Test
123     public void testAddressTypeNoResultsNav() throws Exception {
124         testAddressTypeNoResults();
125         passed();
126     }
127 }