1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.wysiwyg.test.ui; |
21 |
|
|
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.Map; |
24 |
|
|
25 |
|
import org.junit.*; |
26 |
|
import org.openqa.selenium.By; |
27 |
|
import org.xwiki.test.ui.AbstractTest; |
28 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
29 |
|
import org.xwiki.test.ui.po.FormElement; |
30 |
|
import org.xwiki.test.ui.po.editor.ObjectEditPage; |
31 |
|
import org.xwiki.wysiwyg.test.po.WYSIWYGEditPage; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 92% |
Uncovered Elements: 2 (25) |
Complexity: 6 |
Complexity Density: 0.35 |
|
39 |
|
public abstract class AbstractWYSIWYGEditorTest extends AbstractTest |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
public static SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
protected WYSIWYGEditPage editPage; |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
51 |
1 |
@BeforeClass... |
52 |
|
public static void configure() |
53 |
|
{ |
54 |
1 |
authenticationRule.authenticate(); |
55 |
1 |
enableAllEditingFeatures(); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
9 |
@Before... |
59 |
|
public void setUp() throws Exception |
60 |
|
{ |
61 |
9 |
editPage = WYSIWYGEditPage.gotoPage(getTestClassName(), getTestMethodName()).waitUntilPageIsLoaded(); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
67 |
1 |
private static void enableAllEditingFeatures()... |
68 |
|
{ |
69 |
1 |
Map<String, String> config = new HashMap<String, String>(); |
70 |
1 |
config.put("plugins", "submit readonly line separator embed text valign list " |
71 |
|
+ "indent history format symbol link image " + "table macro import color justify font"); |
72 |
1 |
config.put("toolBar", "bold italic underline strikethrough teletype | subscript superscript | " |
73 |
|
+ "justifyleft justifycenter justifyright justifyfull | unorderedlist orderedlist | outdent indent | " |
74 |
|
+ "undo redo | format | fontname fontsize forecolor backcolor | hr removeformat symbol | " |
75 |
|
+ " paste | macro:velocity"); |
76 |
1 |
updateConfiguration(config); |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
@param |
84 |
|
|
|
|
| 85.7% |
Uncovered Elements: 2 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
85 |
1 |
private static void updateConfiguration(Map<String, String> config)... |
86 |
|
{ |
87 |
1 |
ObjectEditPage oep = ObjectEditPage.gotoPage("XWiki", "WysiwygEditorConfig"); |
88 |
1 |
FormElement form = oep.getObjectsOfClass("XWiki.WysiwygEditorConfigClass").get(0); |
89 |
1 |
boolean save = false; |
90 |
1 |
for (Map.Entry<String, String> entry : config.entrySet()) { |
91 |
2 |
String propertyId = "XWiki.WysiwygEditorConfigClass_0_" + entry.getKey(); |
92 |
2 |
if (!entry.getValue().equals(form.getFieldValue(By.id(propertyId)))) { |
93 |
2 |
form.setFieldValue(By.id(propertyId), entry.getValue()); |
94 |
2 |
save = true; |
95 |
|
} |
96 |
|
} |
97 |
1 |
if (save) { |
98 |
1 |
oep.clickSaveAndContinue(); |
99 |
|
} |
100 |
|
} |
101 |
|
} |