View Javadoc
1   /**
2    * Copyright 2005-2015 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.widgets;
17  
18  import org.junit.Test;
19  import org.kuali.rice.krad.demo.uif.library.LibraryBase;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LibraryWidgetsGrowlAft extends LibraryBase {
26  
27  	   /**
28       * /kr-krad/kradsampleapp?viewId=Demo-GrowlsView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-GrowlsView&methodToCall=start";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          navigateToLibraryDemo("Widgets", "Growls");
40      }
41  
42      protected void testWidgetsGrowlServerSide() throws Exception {
43          selectByName("exampleShown","Server-side Growls");
44  
45          //check if growl text is present
46          assertTextNotPresent("Sample Message Text. Data passed: none");
47  
48          //create growl
49          waitAndClickButtonByText("Growl");
50  
51          waitForProgressLoading();
52  
53          // get growl text
54          String growlText = findElement(By.className("jGrowl-message")).getText();
55  
56          //check growl text is present
57          assertTrue(growlText.equals("Sample Message Text. Data passed: none"));
58      }
59  
60      protected void testWidgetsGrowlClientSide() throws Exception {
61          selectByName("exampleShown","Client-side Growls");
62  
63          //create growl
64          waitAndClickByXpath("//section[@id='Demo-Growls-Example2']/button");
65  
66          //give it a half second to display
67          Thread.sleep(500);
68  
69          // get growl text and assert it is what we expect
70          String growlText = findElement(By.className("growlUI")).getText();
71          assertTrue(growlText.equals("Growl Test\nThis is a test growl message"));
72      }
73  
74      @Test
75      public void testWidgetsGrowlBookmark() throws Exception {
76          testWidgetsGrowlClientSide();
77          testWidgetsGrowlServerSide();
78          passed();
79      }
80  
81      @Test
82      public void testWidgetsGrowlNav() throws Exception {
83          testWidgetsGrowlClientSide();
84          testWidgetsGrowlServerSide();
85          passed();
86      }
87  }