View Javadoc
1   /**
2    * Copyright 2005-2015 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.general;
17  
18  import org.junit.Ignore;
19  import org.junit.Test;
20  
21  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
22  import org.kuali.rice.testtools.selenium.WebDriverUtils;
23  import org.openqa.selenium.By;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class LibraryGeneralFeaturesRichMessagesAft extends WebDriverLegacyITBase {
29  
30      /**
31       * /kr-krad/kradsampleapp?viewId=Demo-RichMessagesView&methodToCall=start
32       */
33      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-RichMessagesView&methodToCall=start";
34  
35      @Override
36      protected String getBookmarkUrl() {
37          return BOOKMARK_URL;
38      }
39  
40      @Override
41      protected void navigate() throws Exception {
42          waitAndClickLibraryLink();
43          waitAndClickByLinkText("General Features");
44          waitAndClickByLinkText("Rich Messages");
45      }
46  
47      protected void testGeneralFeaturesRichMessagesHtml() throws Exception {
48          selectByName("exampleShown", "Html");
49          waitForElementPresentByName("//p[@data-parent='Demo-RichMessages-Example1']/b");
50          assertElementPresentByXpath("//p[@data-parent='Demo-RichMessages-Example1']/br");
51      }
52      
53      protected void testGeneralFeaturesRichMessagesCompByIndex() throws Exception {
54          selectByName("exampleShown", "Comp. by Index");
55          waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example2']/div/input");
56          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example2']/a[@class='uif-link inlineBlock']");
57      }
58      
59      protected void testGeneralFeaturesRichMessagesCompById() throws Exception {
60          selectByName("exampleShown", "Comp by id");
61          waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example3']/div/label");
62          assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example3']/div/input");
63      }
64      
65      protected void testGeneralFeaturesRichMessagesColor() throws Exception {
66          selectByName("exampleShown", "Color");
67          waitForElementPresentByName("//p[@data-parent='Demo-RichMessages-Example4']/span[@style='color: green;']");
68          assertElementPresentByXpath("//p[@data-parent='Demo-RichMessages-Example4']/span[@style='color: blue;']");
69      }
70      
71      protected void testGeneralFeaturesRichMessagesCss() throws Exception {
72          selectByName("exampleShown", "CSS");
73          waitForElementPresentByName("//p[@data-parent='Demo-RichMessages-Example5']/span[@class='uif-text-underline uif-text-larger']");
74      }
75      
76      protected void testGeneralFeaturesRichMessagesLink() throws Exception {
77          selectByName("exampleShown", "Link");
78          waitForElementPresentByName("//p[@data-parent='Demo-RichMessages-Example13']/a");
79      }
80      
81      protected void testGeneralFeaturesRichMessagesAction() throws Exception {
82          selectByName("exampleShown", "Action");
83          waitAndClick(By.xpath("//p[@data-parent='Demo-RichMessages-Example14'][1]/a"));
84          waitForProgressLoading();
85          assertJgrowlText("Sample Message Text. Data passed: none");
86          waitAndClick(By.className("jGrowl-close"));
87  
88          waitAndClick(By.xpath("//p[@data-parent='Demo-RichMessages-Example14'][2]/a"));
89          waitForProgressLoading();
90          assertJgrowlText("Sample Message Text. Data passed: none");
91          waitAndClick(By.className("jGrowl-close"));
92  
93          waitAndClick(By.xpath("//p[@data-parent='Demo-RichMessages-Example14'][3]/a"));
94          waitForProgressLoading();
95          assertJgrowlText("Sample Message Text. Data passed: You passed data");
96          waitAndClick(By.className("jGrowl-close"));
97  
98          waitAndClick(By.xpath("//p[@data-parent='Demo-RichMessages-Example14'][4]/a"));
99          waitForProgressLoading();
100         assertJgrowlText("Sample Message Text. Data passed: none");
101         waitAndClick(By.className("jGrowl-close"));
102     }
103 
104     protected void testGeneralFeaturesRichMessagesActionCustom() throws InterruptedException {
105         selectByName("exampleShown", "Action");
106         waitAndClick(By.xpath("//p[@data-parent='Demo-RichMessages-Example14'][5]/a"));
107         WebDriverUtils.waitToAcceptAlert(getDriver(), WebDriverUtils.configuredImplicityWait() * 2,
108                 this.getClass().toString());
109         waitForProgressLoading();
110         assertJgrowlText("Sample Message Text. Data passed: none");
111         waitAndClick(By.className("jGrowl-close"));
112     }
113 
114     protected void testGeneralFeaturesRichMessagesCombine() throws Exception {
115         selectByName("exampleShown", "Combine");
116         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example6']/button");
117         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example6']/span/div/input");
118     }
119     
120     protected void testGeneralFeaturesRichMessagesInLabels() throws Exception {
121         selectByName("exampleShown", "In Labels");
122         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example7']/label/span[@style='color: green;']");
123         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example7']/input");
124     }
125     
126     protected void testGeneralFeaturesRichMessagesWInputField() throws Exception {
127         selectByName("exampleShown", "W/ InputField");
128         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example8']/div/button");
129         assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example8']/input");
130     }
131     
132     protected void testGeneralFeaturesRichMessagesWSpringEL() throws Exception {
133         selectByName("exampleShown", "W/ SpringEL");
134         waitForElementPresentByName("//p[@data-parent='Demo-RichMessages-Example9']/span[@style='color: green;']");
135     }
136     
137     protected void testGeneralFeaturesRichMessagesImages() throws Exception {
138         selectByName("exampleShown", "Images");
139         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example10']/ul/li/img");
140     }
141     
142     protected void testGeneralFeaturesRichMessagesEscapeChar() throws Exception {
143         selectByName("exampleShown", "Escape char");
144         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example11']/span[@style='color: green;']/b");
145     }
146     
147     protected void testGeneralFeaturesRichMessagesEscapeCheckboxRadio() throws Exception {
148         selectByName("exampleShown", "Checkboxes/Radio");
149         waitForElementPresentByName("//div[@data-parent='Demo-RichMessages-Example12']/fieldset/span/label/span[@style='color: blue;']");
150     }
151     
152     @Test
153     public void testGeneralFeaturesRichMessagesBookmark() throws Exception {
154         testRichMessages();
155         passed();
156     }
157 
158     @Test
159     public void testGeneralFeaturesRichMessagesNav() throws Exception {
160         testRichMessages();
161         passed();
162     }
163 
164     @Test
165     @Ignore // convenience method for page redesign
166     public void testHtmlNav() throws Exception {
167         testGeneralFeaturesRichMessagesHtml();
168     }
169 
170     @Test
171     @Ignore // convenience method for page redesign
172     public void testGeneralFeaturesRichMessagesCompByIndexNav() throws Exception {
173         testGeneralFeaturesRichMessagesCompByIndex();
174     }
175 
176     @Test
177     @Ignore // convenience method for page redesign
178     public void testGeneralFeaturesRichMessagesCssNav() throws Exception {
179         testGeneralFeaturesRichMessagesCss();
180     }
181 
182     @Test
183     @Ignore // convenience method for page redesign
184     public void testGeneralFeaturesRichMessagesCombineNav() throws Exception {
185         testGeneralFeaturesRichMessagesCombine();
186     }
187 
188     @Test
189     @Ignore // convenience method for page redesign
190     public void testGeneralFeaturesRichMessagesWInputFieldNav() throws Exception {
191         testGeneralFeaturesRichMessagesWInputField();
192     }
193 
194     @Test
195     @Ignore // convenience method for page redesign
196     public void testGeneralFeaturesRichMessagesWSpringELNav() throws Exception {
197         testGeneralFeaturesRichMessagesWSpringEL();
198     }
199 
200 
201     @Test
202     @Ignore // convenience method for page redesign
203     public void testGeneralFeaturesRichMessagesImagesNav() throws Exception {
204         testGeneralFeaturesRichMessagesImages();
205     }
206 
207     @Test
208     @Ignore // convenience method for page redesign
209     public void testGeneralFeaturesRichMessagesEscapeCheckboxRadioNav() throws Exception {
210         testGeneralFeaturesRichMessagesEscapeCheckboxRadio();
211     }
212 
213     @Test
214     @Ignore // convenience method for page redesign
215     public void testGeneralFeaturesRichMessagesInLabelsNav() throws Exception {
216         testGeneralFeaturesRichMessagesInLabels();
217     }
218 
219     @Test
220     @Ignore // convenience method for page redesign
221     public void testGeneralFeaturesRichMessagesCompByIdNav() throws Exception {
222         testGeneralFeaturesRichMessagesCompById();
223     }
224 
225     @Test
226     @Ignore // convenience method for page redesign
227     public void testGeneralFeaturesRichMessagesActionNav() throws Exception {
228         testGeneralFeaturesRichMessagesAction();
229     }
230 
231     @Test
232     public void testGeneralFeaturesRichMessagesActionCustomBookmark() throws Exception {
233         testGeneralFeaturesRichMessagesActionCustom();
234         passed();
235     }
236 
237     @Test
238     public void testGeneralFeaturesRichMessagesActionCustomNav() throws Exception {
239         testGeneralFeaturesRichMessagesActionCustom();
240         passed();
241     }
242 
243     private void testRichMessages() throws Exception {
244         testGeneralFeaturesRichMessagesHtml();
245         testGeneralFeaturesRichMessagesCompByIndex();
246         testGeneralFeaturesRichMessagesColor();
247         testGeneralFeaturesRichMessagesCss();
248         testGeneralFeaturesRichMessagesLink();
249         testGeneralFeaturesRichMessagesCombine();
250         testGeneralFeaturesRichMessagesWInputField();
251         testGeneralFeaturesRichMessagesWSpringEL();
252         testGeneralFeaturesRichMessagesImages();
253         testGeneralFeaturesRichMessagesEscapeChar();
254         testGeneralFeaturesRichMessagesEscapeCheckboxRadio();
255         testGeneralFeaturesRichMessagesInLabels();
256         testGeneralFeaturesRichMessagesCompById();
257         testGeneralFeaturesRichMessagesAction(); // flakiest last
258     }
259 }