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