1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.annotation.test.ui; |
21 |
|
|
22 |
|
import java.lang.String; |
23 |
|
import org.junit.Assert; |
24 |
|
import org.junit.Rule; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.annotation.test.po.AnnotatableViewPage; |
27 |
|
import org.xwiki.test.ui.AbstractTest; |
28 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
29 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
30 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 2 |
Complexity Density: 0.1 |
|
38 |
|
public class AnnotationsTest extends AbstractTest |
39 |
|
{ |
40 |
|
@Rule |
41 |
|
public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
private static final String CONTENT = "{{velocity}}#set ($showannotations = false){{/velocity}}" |
46 |
|
+ "It's an easy-to-edit website that will help you work better together. This Wiki is made of pages " |
47 |
|
+ "sorted by spaces. You're currently in the Main space, looking at its home page (WebHome)."; |
48 |
|
|
49 |
|
private static final String ANNOTATED_TEXT_1 = "work better together"; |
50 |
|
|
51 |
|
private static final String ANNOTATION_TEXT_1 = "XWiki motto"; |
52 |
|
|
53 |
|
private static final String ANNOTATED_TEXT_2 = "WebHome"; |
54 |
|
|
55 |
|
private static final String ANNOTATION_TEXT_2 = "Every Space has it's own webhome"; |
56 |
|
|
57 |
|
private static final String ANNOTATED_TEXT_3 = "Main space"; |
58 |
|
|
59 |
|
private static final String ANNOTATION_TEXT_3 = "Each XWiki instance has a Main space"; |
60 |
|
|
61 |
|
private static final String ANNOTATED_TEXT_4 = "easy-to-edit website"; |
62 |
|
|
63 |
|
private static final String ANNOTATION_TEXT_4 = "Yes, we have our WYSIWYG"; |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
65 |
1 |
@Test... |
66 |
|
@IgnoreBrowsers({ |
67 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
68 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
69 |
|
}) |
70 |
|
public void addAndDeleteAnnotations() |
71 |
|
{ |
72 |
1 |
getUtil().deletePage(getTestClassName(), getTestMethodName()); |
73 |
1 |
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage( |
74 |
|
getUtil().createPage(getTestClassName(), getTestMethodName(), CONTENT, null)); |
75 |
|
|
76 |
1 |
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_1, ANNOTATION_TEXT_1); |
77 |
1 |
Assert.assertEquals(ANNOTATION_TEXT_1, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_1)); |
78 |
1 |
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_2, ANNOTATION_TEXT_2); |
79 |
1 |
Assert.assertEquals(ANNOTATION_TEXT_2, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_2)); |
80 |
1 |
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_3, ANNOTATION_TEXT_3); |
81 |
1 |
Assert.assertEquals(ANNOTATION_TEXT_3, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_3)); |
82 |
1 |
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_4, ANNOTATION_TEXT_4); |
83 |
1 |
Assert.assertEquals(ANNOTATION_TEXT_4, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_4)); |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
1 |
annotatableViewPage.showAnnotationsPane(); |
88 |
1 |
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_1); |
89 |
1 |
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_2); |
90 |
1 |
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_3); |
91 |
1 |
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_4); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
98 |
1 |
@Test... |
99 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
100 |
|
public void annotationsShouldNotBeShownInXWiki10Syntax() |
101 |
|
{ |
102 |
1 |
getUtil().deletePage(getTestClassName(), getTestMethodName()); |
103 |
|
|
104 |
|
|
105 |
1 |
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage( |
106 |
|
getUtil().createPage(getTestClassName(), getTestMethodName(), |
107 |
|
"#set ($showannotations = false)\nSome content", |
108 |
|
"AnnotationsTest in XWiki 1.0 Syntax", "xwiki/1.0")); |
109 |
|
|
110 |
1 |
annotatableViewPage.showAnnotationsPane(); |
111 |
|
|
112 |
1 |
Assert.assertTrue(annotatableViewPage.checkIfAnnotationsAreDisabled()); |
113 |
1 |
annotatableViewPage.simulateCTRL_M(); |
114 |
1 |
annotatableViewPage.waitforAnnotationWarningNotification(); |
115 |
|
} |
116 |
|
} |