View Javadoc
1   /**
2    * Copyright 2005-2014 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.Keys;
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      private static final String IFRAME_XPATH="//iframe[@class='fancybox-iframe']";
33      
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39  	@Override
40  	protected void navigate() throws Exception {
41  		navigateToKitchenSink("Lookups, etc");
42  	}
43  
44      @Test
45      @Ignore // https://jira.kuali.org/browse/RICEQA-434 AFT Failures in CI that pass locally
46      public void testAjaxLookupBookmark() throws Exception {
47          testAjaxLookup();
48          passed();
49      }
50  
51      @Test
52      @Ignore // https://jira.kuali.org/browse/RICEQA-434 AFT Failures in CI that pass locally
53      public void testAjaxLookupNav() throws Exception {
54          testAjaxLookup();
55          passed();
56      }
57  
58  	@Test
59      public void testLookupsBookmark() throws Exception {
60          testLookups();
61          passed();
62      }
63  
64      @Test
65      public void testLookupsNav() throws Exception {
66          testLookups();
67          passed();
68      }
69  
70      // this has been failing in CI
71      protected void testAjaxLookup() throws InterruptedException {
72          clearTextByName("field79");
73          waitAndTypeByName("field79", "a3");
74          driver.switchTo().activeElement().sendKeys(Keys.TAB);
75  //        fireEvent("field79", "blur");
76  //        waitAndClickByName("field60"); // force blur on field79
77          waitForTextPresent("Travel Account 3");
78      }
79  
80      protected void testLookups() throws InterruptedException {
81  // a2 link is now gone, bug or feature?
82  //        waitAndClickByLinkText("a2");
83  //        gotoLightBox();
84  //        assertTextPresent(new String[] {"Travel Account Number:", "a2", "Travel Account Name:", "Travel Account 2", "Code And Description:", "EAT - Expense"});
85  //        waitAndClickButtonByText("Close");
86  
87          clearTextByName("field72");
88      	waitAndTypeByName("field72", "a2");
89          fireEvent("field72", "blur");
90          waitAndClickByName("field76"); // force blur on field72
91      	waitForTextPresent("Travel Account 2");
92  
93          clearTextByName("field76");
94      	waitAndTypeByName("field76", "a1");
95          fireEvent("field76", "blur");
96          waitForTextPresent("Travel Account 1");
97  
98      	waitAndClickByXpath("//a[@class='uif-actionLink icon-search']");
99      	gotoIframeByXpath(IFRAME_XPATH);
100         waitAndClickButtonByText("Search");
101     	waitAndClickReturnValue();
102     	waitAndClickByXpath("//div[@data-parent='refreshLookups1']/div/span/a");
103     	gotoIframeByXpath(IFRAME_XPATH);
104         waitAndClickButtonByText("Search");
105         waitAndClickReturnValue();
106 
107         clearTextByName("field70");
108         waitAndTypeByName("field70", "a1");
109         waitAndClickByXpath("//input[@title='Direct Inquiry']");
110         gotoLightBox();
111         assertTextPresent(new String[] {"Travel Account Number:", "a1", "Travel Account Name:", "Travel Account 1", "Code And Description:", "IAT - Income"});
112         waitAndClickButtonByText("Close");
113     }
114 }