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.widgets;
17  
18  import org.junit.Test;
19  import org.kuali.rice.krad.demo.uif.library.DemoLibraryBase;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoWidgetsGrowlAft extends DemoLibraryBase {
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          //give it a second to display
52          Thread.sleep(1000);
53  
54          // get growl text
55          String growlText = findElement(By.className("jGrowl-message")).getText();
56  
57          //check growl text is present
58          assertTrue(growlText.equals("Sample Message Text. Data passed: none"));
59      }
60  
61      protected void testWidgetsGrowlClientSide() throws Exception {
62          selectByName("exampleShown","Client-side Growls");
63  
64          //create growl
65          waitAndClickByXpath("//section[@id='Demo-Growls-Example2']/button");
66  
67          //give it a half second to display
68          Thread.sleep(500);
69  
70          // get growl text and assert it is what we expect
71          String growlText = findElement(By.className("growlUI")).getText();
72          assertTrue(growlText.equals("Growl Test\nThis is a test growl message"));
73      }
74  
75      @Test
76      public void testWidgetsGrowlBookmark() throws Exception {
77          testWidgetsGrowlClientSide();
78          testWidgetsGrowlServerSide();
79          passed();
80      }
81  
82      @Test
83      public void testWidgetsGrowlNav() throws Exception {
84          testWidgetsGrowlClientSide();
85          testWidgetsGrowlServerSide();
86          passed();
87      }
88  }