1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.controls;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21
22
23
24
25 public class LibraryControlTextAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TextControlView&methodToCall=start";
31
32
33
34
35 private static final String DEFAULT_TXT_FIELD_XPATH = "//section[@id='Demo-TextControl-Example1']/div/input[@type='text' and @name='inputField1']";
36
37
38
39
40 private static final String SIZE_TXT_FIELD_XPATH = "//section[@id='Demo-TextControl-Example2']/div/input[@type='text' and @name='inputField2']";
41
42
43
44
45 private static final String EXPAND_TXT_FIELD_XPATH = "//a[@title='Expand']";
46
47
48
49
50 private static final String DISABLED_TXT_FIELD_XPATH = "//section[@id='Demo-TextControl-Example4']/div/input[@type='text' and @name='inputField4' and @disabled='disabled']";
51
52
53
54
55 private static final String WATERMARK_TXT_FIELD_XPATH = "//section[@id='Demo-TextControl-Example7']/div/input[@type='text' and @name='inputField5' and @placeholder='watermark text ']";
56
57
58
59
60 private static final String EVAL_DISABLED_ON_KEY_UP_TXT_FIELD_XPATH_BEFORE = "//section[@id='Demo-TextControl-Example8']/div/input[@type='text' and @name='inputField7' and @disabled='disabled']";
61
62
63
64
65 private static final String EVAL_DISABLED_ON_UP_EVENT_TXT_FIELD_XPATH_AFTER = "//section[@id='Demo-TextControl-Example8']/div/input[@type='text' and @name='inputField7']";
66
67
68
69
70 private static final String ENABLE_WHEN_CHANGED_TXT_FIELD_XPATH_BEFORE = "//section[@id='Demo-TextControl-Example9']/div/input[@type='text' and @name='inputField9' and @disabled='disabled']";
71
72
73
74
75 private static final String ENABLE_WHEN_CHANGED_TXT_FIELD_XPATH_AFTER = "//section[@id='Demo-TextControl-Example9']/div/input[@type='text' and @name='inputField9']";
76
77
78
79
80 private static final String DISABLE_WHEN_CHANGED_TXT_FIELD_XPATH_AFTER = "//section[@id='Demo-TextControl-Example10']/div/input[@type='text' and @name='inputField11' and @disabled]";
81
82
83
84
85 private static final String DISABLE_WHEN_CHANGED_TXT_FIELD_XPATH_BEFORE = "//section[@id='Demo-TextControl-Example10']/div/input[@type='text' and @name='inputField11']";
86
87 @Override
88 protected String getBookmarkUrl() {
89 return BOOKMARK_URL;
90 }
91
92 @Override
93 protected void navigate() throws Exception {
94 waitAndClickLibraryLink();
95 waitAndClickByLinkText("Controls");
96 waitAndClickByLinkText("Text");
97 }
98
99 protected void testLibraryControlTextDefault() throws Exception {
100 waitAndClickByLinkText("Default");
101 waitForElementPresentByXpath(DEFAULT_TXT_FIELD_XPATH);
102 waitAndTypeByXpath(DEFAULT_TXT_FIELD_XPATH,"HiText!");
103 }
104
105 protected void testLibraryControlTextSize() throws Exception {
106 waitAndClickByLinkText("Size");
107 waitForElementPresentByXpath(SIZE_TXT_FIELD_XPATH);
108 waitAndTypeByXpath(SIZE_TXT_FIELD_XPATH,"HiTextHiTextHiTextHiTextHiTextHiTextHiTextHiTextHiTextHiText");
109 }
110
111 protected void testLibraryControlTextExpand() throws Exception {
112 waitAndClickByLinkText("Text expand");
113 waitForElementPresentByXpath(EXPAND_TXT_FIELD_XPATH);
114 }
115
116 protected void testLibraryControlTextDisabled() throws Exception {
117 waitAndClickByLinkText("Disabled");
118 waitForElementPresentByXpath(DISABLED_TXT_FIELD_XPATH);
119 }
120
121 protected void testLibraryControlTextWatermarkText() throws Exception {
122 waitAndClickByLinkText("WatermarkText");
123 waitForElementPresentByXpath(WATERMARK_TXT_FIELD_XPATH);
124 }
125
126 protected void testLibraryControlTextEvaluateDisabledOnKeyUp() throws Exception {
127 waitAndClickByLinkText("Evaluate disabled on key up");
128 assertElementPresentByXpath(EVAL_DISABLED_ON_KEY_UP_TXT_FIELD_XPATH_BEFORE);
129 waitAndTypeByName("inputField6","a");
130 assertElementPresentByXpath(EVAL_DISABLED_ON_UP_EVENT_TXT_FIELD_XPATH_AFTER);
131 }
132
133 protected void testLibraryControlTextEnableWhenChanged() throws Exception {
134 waitAndClickByLinkText("Enable when changed");
135 assertElementPresentByXpath(ENABLE_WHEN_CHANGED_TXT_FIELD_XPATH_BEFORE);
136 waitAndTypeByName("inputField8","a");
137 typeTab();
138 assertElementPresentByXpath(ENABLE_WHEN_CHANGED_TXT_FIELD_XPATH_AFTER);
139 }
140
141 protected void testLibraryControlTextDisableWhenChanged() throws Exception {
142 waitAndClickByLinkText("Disable when changed");
143 assertElementPresentByXpath(DISABLE_WHEN_CHANGED_TXT_FIELD_XPATH_BEFORE);
144 waitAndTypeByName("inputField10","a");
145 typeTab();
146 assertElementPresentByXpath(DISABLE_WHEN_CHANGED_TXT_FIELD_XPATH_AFTER);
147 }
148
149 @Test
150 public void testControlTextBookmark() throws Exception {
151 testLibraryControlTextDefault();
152 testLibraryControlTextSize();
153 testLibraryControlTextExpand();
154 testLibraryControlTextDisabled();
155 testLibraryControlTextWatermarkText();
156 testLibraryControlTextEvaluateDisabledOnKeyUp();
157 testLibraryControlTextEnableWhenChanged();
158 testLibraryControlTextDisableWhenChanged();
159 passed();
160 }
161
162 @Test
163 public void testControlTextNav() throws Exception {
164 testLibraryControlTextDefault();
165 testLibraryControlTextSize();
166 testLibraryControlTextExpand();
167 testLibraryControlTextDisabled();
168 testLibraryControlTextWatermarkText();
169 testLibraryControlTextEvaluateDisabledOnKeyUp();
170 testLibraryControlTextEnableWhenChanged();
171 testLibraryControlTextDisableWhenChanged();
172 passed();
173 }
174 }