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.demo.uif.library;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import edu.samplu.krad.demo.uif.library.DemoLibraryBase;
20  import org.junit.Test;
21  import edu.samplu.common.SmokeTestBase;
22  import org.kuali.rice.krad.uif.UifConstants;
23  import org.openqa.selenium.By;
24  import org.openqa.selenium.WebElement;
25  import org.openqa.selenium.interactions.Actions;
26  
27  import java.text.SimpleDateFormat;
28  import java.util.Date;
29  import java.util.List;
30  
31  /**
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public class DemoLibraryWidgetsGrowlSmokeTest extends DemoLibraryBase {
35  
36      /**
37       * /kr-krad/kradsampleapp?viewId=Demo-Growls-View&methodToCall=start
38       */
39      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Growls-View&methodToCall=start";
40  
41      @Override
42      protected String getBookmarkUrl() {
43          return BOOKMARK_URL;
44      }
45  
46      @Override
47      protected void navigate() throws Exception {
48          waitAndClickById("Demo-LibraryLink", "");
49          waitAndClickByLinkText("Widgets");
50          waitAndClickByLinkText("Growls");
51      }
52  
53      protected void testWidgetsGrowlDefault() throws Exception {
54  
55          //check if growl text is present
56          assertTextNotPresent("Sample Message Text. Data passed: none");
57  
58          //create growl
59          waitAndClick(By.id("u100085"));
60  
61          //give it a second to display
62          Thread.sleep(1000);
63  
64          //check growl text is present
65          assertTextPresent("Sample Message Text. Data passed: none");
66      }
67  
68      protected void testWidgetsDatePickerWidget() throws Exception {
69          waitAndClickByLinkText(">> Open Library Navigation");
70          waitAndClickByLinkText("Suggest");
71          waitAndClickByLinkText("Tooltip");
72          select(By.id("Demo-LargeExampleDropdown_control"), "Tooltip On Focus");
73  
74          //focus label
75          fireMouseOverEvent(By.id("u100101_label"));
76          Thread.sleep(1000);
77          WebElement tooltipFocusLabel = driver.findElement(By.xpath("//div[@data-for=\"u100101_label\"]")).findElement(
78                  By.className("jquerybubblepopup-innerHtml"));
79          if (!tooltipFocusLabel.isDisplayed()) {
80              fail("Tooltip help for label not displayed.");
81          }
82          if (!tooltipFocusLabel.getText().equals("Click on the text box for a tool tip")) {
83              fail("Incorrect inner html text for label focus tooltip.");
84          }
85  
86          //focus control
87          waitAndClickById("u100101_control");
88          Thread.sleep(1000);
89          WebElement tooltipFocusControl = driver.findElement(By.xpath("//div[@data-for=\"u100101_control\"]"))
90                  .findElement(By.className("jquerybubblepopup-innerHtml"));
91          if (!tooltipFocusControl.isDisplayed()) {
92              fail("Tooltip help for control not displayed.");
93          }
94          if (!tooltipFocusControl.getText().equals("This tooltip appears when the field receives focus")) {
95              fail("Incorrect inner html text for tooltip focus control.");
96          }
97      }
98  
99      @Test
100     public void testWidgetsGrowlBookmark() throws Exception {
101         testWidgetsGrowlDefault();
102         driver.close();
103         passed();
104     }
105 
106     @Test
107     public void testWidgetsGrowlNav() throws Exception {
108         testWidgetsGrowlDefault();
109         driver.close();
110         passed();
111     }
112 }