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 org.kuali.rice.krad.labs.kitchensink;
17  
18  import org.junit.Ignore;
19  import org.junit.Test;
20  import org.openqa.selenium.JavascriptExecutor;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LabsLookupsAft extends LabsKitchenSinkBase {
26  
27      /**
28       * /kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page6&lightbox=true
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page6&lightbox=true";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37  	@Override
38  	protected void navigate() throws Exception {
39  		navigateToKitchenSink("Lookups, etc");
40  	}
41  
42      @Test
43      @Ignore //Ignore this test due to the issues found in KULRICE-13108.  They will fail until a solution can be found.
44      public void testAjaxLookupBookmark() throws Exception {
45          testAjaxLookup();
46          passed();
47      }
48  
49      @Test
50      @Ignore //Ignore this test due to the issues found in KULRICE-13108.  They will fail until a solution can be found.
51      public void testAjaxLookupNav() throws Exception {
52          testAjaxLookup();
53          passed();
54      }
55  
56  	@Test
57      public void testLookupsBookmark() throws Exception {
58          testLookups();
59          passed();
60      }
61  
62      @Test
63      public void testLookupsNav() throws Exception {
64          testLookups();
65          passed();
66      }
67  
68      protected void testAjaxLookup() throws InterruptedException {
69          clearTextByName("field79");
70          waitAndTypeByName("field79", "a3");
71          ((JavascriptExecutor)driver).executeScript("document.getElementsByName('field79')[0].blur();");
72          waitForTextPresent("Travel Account 3");
73      }
74  
75      protected void testLookups() throws InterruptedException {
76  // a2 link is now gone, bug or feature?
77  //        waitAndClickByLinkText("a2");
78  //        gotoLightBox();
79  //        assertTextPresent(new String[] {"Travel Account Number:", "a2", "Travel Account Name:", "Travel Account 2", "Code And Description:", "EAT - Expense"});
80  //        waitAndClickButtonByText("Close");
81  
82          clearTextByName("field72");
83      	waitAndTypeByName("field72", "a2");
84          fireEvent("field72", "blur");
85          waitAndClickByName("field76"); // force blur on field72
86      	waitForTextPresent("Travel Account 2");
87  
88          clearTextByName("field76");
89      	waitAndTypeByName("field76", "a1");
90          fireEvent("field76", "blur");
91          waitForTextPresent("Travel Account 1");
92  
93          waitAndClickByXpath("//button[@class='btn btn-default uif-action icon-search']");
94      	gotoLightBoxIframe();
95          waitAndClickSearchByText();
96      	waitAndClickReturnValue();
97          waitAndClickByXpath("//div[@data-parent='refreshLookups1']/div/div/button[@class='btn btn-default uif-action icon-search']");
98          gotoLightBoxIframe();
99          waitAndClickSearchByText();
100         waitAndClickReturnValue();
101 
102         clearTextByName("field70");
103         waitAndTypeByName("field70", "a1");
104         waitAndClickByXpath("//button[@title='Direct Inquiry']");
105         gotoLightBox();
106         assertTextPresent(new String[] {"Travel Account Number:", "a1", "Travel Account Name:", "Travel Account 1", "Code And Description:", "IAT - Income"});
107         waitAndClickButtonByText("Close");
108     }
109 }