View Javadoc

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