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.clientresponsiveness;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoClientResponsivenessEventsAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-EventsView
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-EventsView";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickLibraryLink();
40          waitAndClickByLinkText("Client Responsiveness");
41          waitAndClickByLinkText("Events");
42      }
43  
44      protected void testClientResponsivenessEventsClick() throws Exception {
45      	waitAndClickByName("inputField1");
46          acceptAlert();
47          waitAndClickByName("inputField2");
48          acceptAlert();
49      	waitAndClickByXpath("//input[@name='inputField3' and @value='blue']");
50      	waitForElementPresentByXpath("//div[@style='border: 1px solid rgb(153, 153, 153); width: auto; background-color: rgb(0, 0, 255);']");
51      	waitAndClickByName("inputField4");
52          acceptAlert();
53      	waitAndClickByXpath("//input[@name='inputField5' and @value='1']");
54          acceptAlert();
55      }
56      
57      protected void testClientResponsivenessEventsChangeFocusBlur() throws Exception {
58      	waitAndClickByLinkText("OnChange, OnFocus, OnBlur Examples");
59      	selectByName("inputField6","Navy");
60      	waitForElementPresentByXpath("//div[@id='Demo-Events-Example2A' and @style='background-color: rgb(0, 0, 128);']");
61      	fireEvent("inputField7", "focus");
62      }
63      
64      protected void testClientResponsivenessEventsMouseEvent() throws Exception {
65      	waitAndClickByLinkText("Mouse Events");
66      	fireMouseOverEventByXpath("//div[@data-label='Checkbox' and @data-parent='Demo-Events-Example3']");
67      	waitForElementPresentByXpath("//div[@style='border: 10px solid rgb(153, 153, 153); width: 50%; overflow; hidden; font-size: 3em; margin-left: 0px;']");
68      	waitAndClickByXpath("//input[@name='inputField8' and @value='red']");
69      	fireMouseOverEventByName("inputField8");
70      	waitForElementPresentByXpath("//div[@style='width: auto; background-color: rgb(255, 0, 0);']");
71      	waitAndClickByXpath("//div[@class='kr-photo uif-boxLayoutVerticalItem pull-left clearfix']");
72      }
73      
74      protected void testClientResponsivenessEventsMouseEventOnButtons() throws Exception {
75      	waitAndClickByLinkText("Mouse Events on Buttons");
76      	waitForElementPresentByXpath("//button[@style='margin-top:10px;']");
77      }
78      
79      protected void testClientResponsivenessEventsGroupAndSectionEvents() throws Exception {
80      	waitAndClickByLinkText("Group and Section Events");
81      	fireMouseOverEventByXpath("//div[@data-parent='Demo-Events-Example5']");
82      	waitForElementPresentByXpath("//div[@data-parent='Demo-Events-Example5' and @style='height: 200px; width: 300px; background-color: rgb(255, 255, 255);']");
83      }
84      
85      protected void testClientResponsivenessEventsOnKeyPressUpDown() throws Exception {
86      	waitAndClickByLinkText("OnKeyPress, OnKeyUp, OnKeyDown Examples");
87      	waitAndTypeByName("inputField13","a");
88          acceptAlert();
89      }
90  
91      
92      @Test
93      public void testClientResponsivenessEventsBookmark() throws Exception {
94      	testClientResponsivenessEventsAll();
95      }
96  
97      @Test
98      public void testClientResponsivenessEventsNav() throws Exception {
99      	testClientResponsivenessEventsAll();
100     }  
101     
102     private void testClientResponsivenessEventsAll() throws Exception {
103     	testClientResponsivenessEventsClick();
104     	testClientResponsivenessEventsChangeFocusBlur();
105     	testClientResponsivenessEventsMouseEvent();
106     	testClientResponsivenessEventsMouseEventOnButtons();
107     	testClientResponsivenessEventsGroupAndSectionEvents();
108     	testClientResponsivenessEventsOnKeyPressUpDown();
109     	passed();
110     }
111 }