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.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 LibraryCollectionFeaturesMultiValueLookupAft 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          waitAndClickLibraryLink();
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          waitAndClickSearchByText();
50          assertButtonDisabledByText("return selected");
51  
52          jGrowl("Check Travel Account 1 checkbox");
53          waitAndClickByValue("IAT:Travel Account 1:a1");
54          assertButtonEnabledByText("return selected");
55  
56          jGrowl("Uncheck Travel Account 1 checkbox");
57          waitAndClickByValue("IAT:Travel Account 1:a1");
58          assertButtonDisabledByText("return selected");
59  
60          waitAndClickByName("selectedCollectionLines['lookupResults']");
61  
62          waitAndClickButtonByText("return selected");
63          Thread.sleep(3000);
64          assertTextPresent("a1");
65  
66          assertEquals("IAT", waitAndGetAttributeByName("emptyCollection[0].field1", "value"));
67          assertEquals("Travel Account 1", waitAndGetAttributeByName("emptyCollection[0].field2", "value"));
68          assertEquals("a1", waitAndGetAttributeByName("emptyCollection[0].field3", "value"));
69      }
70  
71      private void lightBoxLookupAddMultipleLines() throws InterruptedException {
72          waitAndClickByLinkText("Lookup/Add Multiple Lines");
73          gotoLightBox();
74          gotoLightBoxIframe();
75      }
76  
77      @Test
78      public void testMultiValueLookupBookmark() throws InterruptedException {
79          testMultiValueLookup();
80          passed();
81      }
82  
83      @Test
84      public void testMultiValueLookupNav() throws InterruptedException {
85          testMultiValueLookup();
86          passed();
87      }
88  
89      @Test
90      public void testMultivalueLookUpSelectThisPageBookmark() throws Exception {
91          lightBoxLookupAddMultipleLines();
92          testMultiValueSelectAllThisPage();
93          passed();
94      }
95  
96      @Test
97      public void testMultivalueLookUpSelectThisPageNav() throws Exception {
98          lightBoxLookupAddMultipleLines();
99          testMultiValueSelectAllThisPage();
100         passed();
101     }
102 
103     @Test
104     public void testMultivalueLookUpSelectAllPagesBookmark() throws Exception {
105         lightBoxLookupAddMultipleLines();
106         testMultiValueSelectAllPages();
107         passed();
108     }
109 
110     @Test
111     public void testMultivalueLookUpSelectAllPagesNav() throws Exception {
112         lightBoxLookupAddMultipleLines();
113         testMultiValueSelectAllPages();
114         passed();
115     }
116 }