001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.krad.library.general;
017
018 import org.junit.Test;
019
020 import org.kuali.rice.testtools.selenium.SmokeTestBase;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLibraryGeneralFeaturesRichMessagesSmokeTest extends SmokeTestBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-RichMessages-View&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-RichMessages-View&methodToCall=start";
031
032 @Override
033 protected String getBookmarkUrl() {
034 return BOOKMARK_URL;
035 }
036
037 @Override
038 protected void navigate() throws Exception {
039 waitAndClickById("Demo-LibraryLink", "");
040 waitAndClickByLinkText("General Features");
041 waitAndClickByLinkText("Rich Messages");
042 }
043
044 protected void testGeneralFeaturesRichMessagesHtml() throws Exception {
045 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example1']/b");
046 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example1']/br");
047 }
048
049 protected void testGeneralFeaturesRichMessagesCompByIndex() throws Exception {
050 waitAndClickByLinkText("Comp. by Index");
051 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example2']/div/input");
052 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example2']/a[@class='uif-link inlineBlock']");
053 }
054
055 protected void testGeneralFeaturesRichMessagesCompById() throws Exception {
056 waitAndClickByLinkText("Comp by id");
057 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example3']/div/span/label");
058 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example3']/div/input");
059 }
060
061 protected void testGeneralFeaturesRichMessagesColor() throws Exception {
062 waitAndClickByLinkText("Color");
063 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example4']/span[@style='color: green;']");
064 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example4']/span[@style='color: blue;']");
065 }
066
067 protected void testGeneralFeaturesRichMessagesCss() throws Exception {
068 waitAndClickByLinkText("CSS");
069 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example5']/span[@class='fl-text-underline fl-text-larger']");
070 }
071
072 protected void testGeneralFeaturesRichMessagesLink() throws Exception {
073 waitAndClickByLinkText("Link");
074 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example13']/a");
075 }
076
077 protected void testGeneralFeaturesRichMessagesAction() throws Exception {
078 waitAndClickByLinkText("Action");
079 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14']");
080 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][2]");
081 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][3]");
082 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][4]");
083 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example14'][5]");
084 }
085
086 protected void testGeneralFeaturesRichMessagesCombine() throws Exception {
087 waitAndClickByLinkText("Combine");
088 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example6']/button");
089 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example6']/span/div/input");
090 }
091
092 protected void testGeneralFeaturesRichMessagesInLabels() throws Exception {
093 waitAndClickByLinkText("In Labels");
094 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example7']/span/label/span[@style='color: green;']");
095 assertElementPresentByXpath("//div[@data-parent='Demo-RichMessages-Example7']/input");
096 }
097
098 protected void testGeneralFeaturesRichMessagesWInputField() throws Exception {
099 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 }