1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.ui.appwithinminutes; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.appwithinminutes.test.po.StaticListClassFieldEditPane; |
27 |
|
import org.xwiki.appwithinminutes.test.po.StaticListItemsEditor; |
28 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
29 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (47) |
Complexity: 3 |
Complexity Density: 0.07 |
|
37 |
|
public class StaticListClassFieldTest extends AbstractClassEditorTest |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
43 |
1 |
@Test... |
44 |
|
@IgnoreBrowsers({ |
45 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
46 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
47 |
|
}) |
48 |
|
public void testDisplayType() |
49 |
|
{ |
50 |
|
|
51 |
1 |
StaticListClassFieldEditPane staticListField = |
52 |
|
new StaticListClassFieldEditPane(editor.addField("Static List").getName()); |
53 |
|
|
54 |
1 |
Assert.assertEquals("checkbox", staticListField.getPreviewInputType()); |
55 |
|
|
56 |
|
|
57 |
1 |
staticListField.openConfigPanel(); |
58 |
1 |
staticListField.getMultipleSelectionCheckBox().click(); |
59 |
|
|
60 |
|
|
61 |
1 |
staticListField.getItemByValue("value1").click(); |
62 |
1 |
staticListField.getItemByValue("value3").click(); |
63 |
|
|
64 |
|
|
65 |
1 |
staticListField.getDisplayTypeSelect().selectByVisibleText("select"); |
66 |
1 |
staticListField.closeConfigPanel(); |
67 |
|
|
68 |
|
|
69 |
1 |
Assert.assertEquals("select", staticListField.getPreviewInputType()); |
70 |
|
|
71 |
1 |
Assert.assertEquals(Arrays.asList("value1", "value3"), staticListField.getDefaultSelectedValues()); |
72 |
|
|
73 |
|
|
74 |
1 |
staticListField.setDefaultValue("value2"); |
75 |
|
|
76 |
|
|
77 |
1 |
staticListField.openConfigPanel(); |
78 |
1 |
staticListField.getDisplayTypeSelect().selectByVisibleText("radio"); |
79 |
1 |
staticListField.closeConfigPanel(); |
80 |
|
|
81 |
1 |
Assert.assertEquals("radio", staticListField.getPreviewInputType()); |
82 |
|
|
83 |
1 |
Assert.assertEquals("value2", staticListField.getDefaultValue()); |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
89 |
1 |
@Test... |
90 |
|
@IgnoreBrowsers({ |
91 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
92 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
93 |
|
}) |
94 |
|
public void testMultipleSelect() |
95 |
|
{ |
96 |
|
|
97 |
1 |
StaticListClassFieldEditPane staticListField = |
98 |
|
new StaticListClassFieldEditPane(editor.addField("Static List").getName()); |
99 |
|
|
100 |
|
|
101 |
1 |
staticListField.openConfigPanel(); |
102 |
|
|
103 |
|
|
104 |
1 |
staticListField.getMultipleSelectionCheckBox().click(); |
105 |
1 |
Assert.assertTrue(staticListField.getMultipleSelectionCheckBox().isSelected()); |
106 |
1 |
staticListField.getDisplayTypeSelect().selectByVisibleText("radio"); |
107 |
1 |
Assert.assertFalse(staticListField.getMultipleSelectionCheckBox().isSelected()); |
108 |
|
|
109 |
|
|
110 |
1 |
staticListField.getMultipleSelectionCheckBox().click(); |
111 |
1 |
Assert.assertEquals("checkbox", |
112 |
|
staticListField.getDisplayTypeSelect().getFirstSelectedOption().getAttribute("value")); |
113 |
|
|
114 |
|
|
115 |
1 |
Assert.assertEquals("1", staticListField.getSizeInput().getAttribute("value")); |
116 |
1 |
staticListField.getDisplayTypeSelect().selectByVisibleText("select"); |
117 |
1 |
Assert.assertEquals("3", staticListField.getSizeInput().getAttribute("value")); |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
123 |
1 |
@Test... |
124 |
|
@IgnoreBrowsers({ |
125 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
126 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
127 |
|
}) |
128 |
|
public void testItemsEditor() |
129 |
|
{ |
130 |
|
|
131 |
1 |
StaticListClassFieldEditPane staticListField = |
132 |
|
new StaticListClassFieldEditPane(editor.addField("Static List").getName()); |
133 |
|
|
134 |
|
|
135 |
1 |
staticListField.openConfigPanel(); |
136 |
1 |
StaticListItemsEditor itemsEditor = staticListField.getItemsEditor(); |
137 |
|
|
138 |
|
|
139 |
1 |
itemsEditor.remove("value2"); |
140 |
|
|
141 |
|
|
142 |
1 |
itemsEditor.add("foo", "bar"); |
143 |
|
|
144 |
1 |
itemsEditor.add("", "XWiki"); |
145 |
|
|
146 |
|
|
147 |
1 |
itemsEditor.setLabel("XWiki", "XWiki Enterprise"); |
148 |
|
|
149 |
|
|
150 |
1 |
itemsEditor.moveBefore("XWiki", "value1"); |
151 |
|
|
152 |
1 |
Assert.assertEquals(4, itemsEditor.size()); |
153 |
|
|
154 |
|
|
155 |
1 |
staticListField.getDisplayTypeSelect().selectByVisibleText("select"); |
156 |
1 |
staticListField.getMultipleSelectionCheckBox().click(); |
157 |
1 |
Assert.assertEquals("4", staticListField.getSizeInput().getAttribute("value")); |
158 |
|
|
159 |
|
|
160 |
1 |
staticListField.closeConfigPanel(); |
161 |
|
|
162 |
1 |
Assert.assertNull(staticListField.getItemByValue("value2")); |
163 |
|
|
164 |
1 |
staticListField.getItemByValue("XWiki").click(); |
165 |
|
|
166 |
1 |
staticListField.getItemByValue("value1").click(); |
167 |
1 |
Assert.assertEquals(Arrays.asList("XWiki", "value1"), staticListField.getDefaultSelectedValues()); |
168 |
|
} |
169 |
|
} |