1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.travel.krad.test;
18
19 import edu.samplu.common.ITUtil;
20 import edu.samplu.common.UpgradedSeleniumITBase;
21 import org.junit.Assert;
22 import org.junit.Ignore;
23 import org.junit.Test;
24
25 import static junit.framework.Assert.*;
26
27
28
29
30
31
32 public class ConfigurationTestViewIT extends UpgradedSeleniumITBase {
33 @Override
34 public String getTestUrl() {
35 return ITUtil.PORTAL;
36 }
37
38 private String idPrefix = "ConfigurationTestView-ProgressiveRender-";
39
40 String addLineIdSuffix = "InputField_add_control";
41
42 @Test
43
44
45
46 public void testConfigurationTestView() throws Exception {
47 openConfigurationTestView();
48
49
50 String styleValue = getAttribute("//span[@id='" + idPrefix + "TextInputField_label_span']@style");
51
52 Assert.assertTrue(idPrefix + "textInputField label does not contain expected style", styleValue.replace(" ", "").contains(
53 "color:red"));
54
55
56 selectFrame("iframeportlet");
57
58 String refreshTextSelectLocator = "id=" + idPrefix + "RefreshTextField_control";
59 String[] options1 = getSelectOptions(refreshTextSelectLocator);
60 String dropDownSelectLocator = "id=" + idPrefix + "DropDown_control";
61 select(dropDownSelectLocator, "label=Vegetables");
62 waitAndClick("//option[@value='Vegetables']");
63 Thread.sleep(3000);
64
65 String[] options2 = getSelectOptions(refreshTextSelectLocator);
66
67 assertFalse("Field 1 selection did not change Field 2 options https://jira.kuali.org/browse/KULRICE-8163 Configuration Test View Conditional Options doesn't change Field 2 options based on Field 1 selection", options1[options1.length - 1].equalsIgnoreCase(options2[options2.length - 1]));
68
69 select(dropDownSelectLocator, "label=None");
70 Thread.sleep(3000);
71 assertEquals("true", getAttribute(refreshTextSelectLocator+ "@disabled"));
72
73 }
74
75
76
77
78 private void openConfigurationTestView() throws InterruptedException {
79 waitAndClick("link=KRAD");
80 waitAndClick("link=Configuration Test View");
81 waitForPageToLoad();
82 }
83
84
85
86
87
88 @Test
89 public void testAddLineWithSpecificTime() throws Exception{
90 openConfigurationTestView();
91 confirmAddLineControlsPresent();
92
93 String startTimeId = "id=" +idPrefix + "StartTime" + addLineIdSuffix;
94 selectFrame("iframeportlet");
95 focus(startTimeId);
96 String inputTime = "7:06";
97 waitAndType(startTimeId, inputTime);
98 String amPmSelectLocator = "id=" + idPrefix + "StartTimeAmPm" + addLineIdSuffix;
99
100 select(amPmSelectLocator, "label=PM");
101 assertEquals("PM", getSelectedLabel(amPmSelectLocator));
102 Thread.sleep(5000);
103 waitAndClick("//button");
104 Thread.sleep(5000);
105
106 assertTrue("line (//input[@value='7:06'])is not present https://jira.kuali.org/browse/KULRICE-8162 Configuration Test View Time Info add line button doesn't addline", isElementPresent("//input[@value='7:06']"));
107
108 }
109
110
111
112
113
114 @Test
115 public void testAddLineWithAllDay() throws Exception{
116 openConfigurationTestView();
117 confirmAddLineControlsPresent();
118
119 String startTimeId = "id=" +idPrefix + "StartTime" + addLineIdSuffix;
120 selectFrame("iframeportlet");
121 focus(startTimeId);
122 String inputTime = "5:20";
123 waitAndType(startTimeId, inputTime);
124
125 String allDaySelector = "id=" + idPrefix + "AllDay" + addLineIdSuffix;
126 focus(allDaySelector);
127 Thread.sleep(5000);
128 waitAndClick(allDaySelector);
129
130
131
132
133
134
135
136
137
138
139 Thread.sleep(5000);
140 waitAndClick("css=div#ConfigurationTestView-ProgressiveRender-TimeInfoSection button");
141 Thread.sleep(5000);
142
143
144
145 }
146
147
148
149
150 private void confirmAddLineControlsPresent() {
151 String[] addLineIds = {"StartTime", "StartTimeAmPm", "AllDay"};
152
153 for (String id: addLineIds) {
154 String tagId = "id=" + idPrefix + id + addLineIdSuffix;
155 assertTrue("Did not find id " + tagId, isElementPresent(tagId));
156 }
157 }
158
159
160
161
162
163 @Test
164 @Ignore("count rows through CSS or XPATH fails")
165 public void testAddLineAllDay() throws Exception{
166 openConfigurationTestView();
167 confirmAddLineControlsPresent();
168
169
170 String cssCountRows = "div#ConfigurationTestView-ProgressiveRender-TimeInfoSection.uif-group div#ConfigurationTestView-ProgressiveRender-TimeInfoSection_disclosureContent.uif-disclosureContent table tbody tr";
171 int rowCount = (getCssCount(cssCountRows)).intValue();
172
173 String allDayId = "id=" + idPrefix + "AllDay" + addLineIdSuffix;
174 focus(allDayId);
175 Thread.sleep(5000);
176 waitAndClick(allDayId);
177 waitAndClick("css=div#ConfigurationTestView-ProgressiveRender-TimeInfoSection button");
178 Thread.sleep(5000);
179
180
181 assertEquals("line was not added", rowCount + 1, (getCssCount(cssCountRows)).intValue());
182 }
183 }