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.library.general;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.SmokeTestBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoLibraryGeneralFeaturesRichMessagesSmokeTest extends SmokeTestBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-RichMessages-View&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-RichMessages-View&methodToCall=start";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickById("Demo-LibraryLink", "");
40          waitAndClickByLinkText("General Features");
41          waitAndClickByLinkText("Rich Messages");
42      }
43  
44      protected void testGeneralFeaturesRichMessagesHtml() throws Exception {
45         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example1']/b");
46         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example1']/br");
47      }
48      
49      protected void testGeneralFeaturesRichMessagesCompByIndex() throws Exception {
50          waitAndClickByLinkText("Comp. by Index");
51          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example2']/div/input");
52          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example2']/a[@class='uif-link inlineBlock']");
53      }
54      
55      protected void testGeneralFeaturesRichMessagesCompById() throws Exception {
56          waitAndClickByLinkText("Comp by id");
57          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example3']/div/span/label");
58          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example3']/div/input");
59      }
60      
61      protected void testGeneralFeaturesRichMessagesColor() throws Exception {
62          waitAndClickByLinkText("Color");
63          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example4']/span[@style='color: green;']");
64          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example4']/span[@style='color: blue;']");
65      }
66      
67      protected void testGeneralFeaturesRichMessagesCss() throws Exception {
68          waitAndClickByLinkText("CSS");
69          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example5']/span[@class='fl-text-underline fl-text-larger']");
70      }
71      
72      protected void testGeneralFeaturesRichMessagesLink() throws Exception {
73          waitAndClickByLinkText("Link");
74          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example13']/a");
75      }
76      
77      protected void testGeneralFeaturesRichMessagesAction() throws Exception {
78          waitAndClickByLinkText("Action");
79          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14']");
80          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][2]");
81          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][3]");
82          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][4]");
83          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][5]");
84      }
85      
86      protected void testGeneralFeaturesRichMessagesCombine() throws Exception {
87          waitAndClickByLinkText("Combine");
88          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example6']/button");
89          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example6']/span/div/input");
90      }
91      
92      protected void testGeneralFeaturesRichMessagesInLabels() throws Exception {
93          waitAndClickByLinkText("In Labels");
94          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example7']/span/label/span[@style='color: green;']");
95          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example7']/input");
96      }
97      
98      protected void testGeneralFeaturesRichMessagesWInputField() throws Exception {
99          waitAndClickByLinkText("W/ InputField");
100         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example8']/div/button");
101         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example8']/input");
102     }
103     
104     protected void testGeneralFeaturesRichMessagesWSpringEL() throws Exception {
105         waitAndClickByLinkText("W/ SpringEL");
106         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example9']/span[@style='color: green;']");
107     }
108     
109     protected void testGeneralFeaturesRichMessagesImages() throws Exception {
110         waitAndClickByLinkText("Images");
111         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example10']/ul/li/img");
112     }
113     
114     protected void testGeneralFeaturesRichMessagesEscapeChar() throws Exception {
115         waitAndClickByLinkText("Escape char");
116         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example11']/span[@style='color: green;']/b");
117     }
118     
119     protected void testGeneralFeaturesRichMessagesEscapeCheckboxRadio() throws Exception {
120         waitAndClickByLinkText("Checkboxes/Radio");
121         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example12']/fieldset/span/label/span[@style='color: blue;']");
122     }
123     
124     @Test
125     public void testGeneralFeaturesRichMessagesBookmark() throws Exception {
126         testGeneralFeaturesRichMessagesHtml();
127         testGeneralFeaturesRichMessagesCompByIndex();
128         testGeneralFeaturesRichMessagesCompById();
129         testGeneralFeaturesRichMessagesColor();
130         testGeneralFeaturesRichMessagesCss();
131         testGeneralFeaturesRichMessagesLink();
132         testGeneralFeaturesRichMessagesAction();
133         testGeneralFeaturesRichMessagesCombine();
134         testGeneralFeaturesRichMessagesInLabels();
135         testGeneralFeaturesRichMessagesWInputField();
136         testGeneralFeaturesRichMessagesWSpringEL();
137         testGeneralFeaturesRichMessagesImages();
138         testGeneralFeaturesRichMessagesEscapeChar();
139         testGeneralFeaturesRichMessagesEscapeCheckboxRadio();
140         passed();
141     }
142 
143     @Test
144     public void testGeneralFeaturesRichMessagesNav() throws Exception {
145         testGeneralFeaturesRichMessagesHtml();
146         testGeneralFeaturesRichMessagesCompByIndex();
147         testGeneralFeaturesRichMessagesCompById();
148         testGeneralFeaturesRichMessagesColor();
149         testGeneralFeaturesRichMessagesCss();
150         testGeneralFeaturesRichMessagesLink();
151         testGeneralFeaturesRichMessagesAction();
152         testGeneralFeaturesRichMessagesCombine();
153         testGeneralFeaturesRichMessagesInLabels();
154         testGeneralFeaturesRichMessagesWInputField();
155         testGeneralFeaturesRichMessagesWSpringEL();
156         testGeneralFeaturesRichMessagesImages();
157         testGeneralFeaturesRichMessagesEscapeChar();
158         testGeneralFeaturesRichMessagesEscapeCheckboxRadio();
159         passed();
160     }  
161 }