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.demo.uif.library.collections;
17  
18  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
19  import org.junit.Test;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoCollectionFeaturesMultiValueLookupAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-LightTableView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionLookupView&methodToCall=start";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          jGrowl("Click the Library Link");
40          waitAndClickById("Demo-LibraryLink", "");
41          waitAndClickByLinkText("Collection Features");
42          waitAndClickByLinkText("Multi-Value Lookup");
43      }
44  
45      protected void testMultiValueLookup() throws InterruptedException {
46          lightBoxLookupAddMultipleLines();
47  
48          waitAndTypeByName("lookupCriteria[number]", "a1");
49          waitAndClickButtonByText("Search");
50          acceptAlertIfPresent();
51          assertButtonDisabledByText("return selected");
52  
53          jGrowl("Check Travel Account 1 checkbox");
54          waitAndClickByValue("IAT:Travel Account 1:a1");
55          assertButtonEnabledByText("return selected");
56  
57          jGrowl("Uncheck Travel Account 1 checkbox");
58          waitAndClickByValue("IAT:Travel Account 1:a1");
59          assertButtonDisabledByText("return selected");
60  
61          waitAndClickButtonByText("return selected");
62          Thread.sleep(3000);
63          assertTextPresent("a1"); // TODO better assertion once NullPointer is resolved
64      }
65  
66      private void lightBoxLookupAddMultipleLines() throws InterruptedException {
67          waitAndClickByLinkText("Lookup/Add Multiple Lines");
68  
69          driver.switchTo().frame(driver.findElement(By.cssSelector(".fancybox-iframe")));
70          selectTopFrame();
71          gotoIframeByXpath("//iframe[@class='fancybox-iframe']");
72      }
73  
74      @Test
75      public void testMultiValueLookupBookmark() throws InterruptedException {
76          testMultiValueLookup();
77          passed();
78      }
79  
80      @Test
81      public void testMultiValueLookupNav() throws InterruptedException {
82          testMultiValueLookup();
83          passed();
84      }
85  
86      @Test
87      public void testMultivalueLookUpSelectThisPageBookmark() throws Exception {
88          lightBoxLookupAddMultipleLines();
89          testMultiValueSelectAllThisPage();
90          passed();
91      }
92  
93      @Test
94      public void testMultivalueLookUpSelectThisPageNav() throws Exception {
95          lightBoxLookupAddMultipleLines();
96          testMultiValueSelectAllThisPage();
97          passed();
98      }
99  
100     @Test
101     public void testMultivalueLookUpSelectAllPagesBookmark() throws Exception {
102         lightBoxLookupAddMultipleLines();
103         testMultiValueSelectAllPages();
104         passed();
105     }
106 
107     @Test
108     public void testMultivalueLookUpSelectAllPagesNav() throws Exception {
109         lightBoxLookupAddMultipleLines();
110         testMultiValueSelectAllPages();
111         passed();
112     }
113 }