1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.blog.test.ui; |
21 |
|
|
22 |
|
import java.lang.Exception;import java.lang.String;import org.junit.Assert; |
23 |
|
|
24 |
|
import org.junit.Before; |
25 |
|
import org.junit.Rule; |
26 |
|
import org.junit.Test; |
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 |
|
import org.xwiki.blog.test.po.ManageCategoriesPage; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 5 |
Complexity Density: 0.23 |
|
39 |
|
public class BlogCategoriesTest extends AbstractTest |
40 |
|
{ |
41 |
|
@Rule |
42 |
|
public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
private static final String CATEGORY = "The \"Do\"s & Don'ts"; |
48 |
|
|
49 |
|
private static final String CATEGORY_RENAME = "New \"categor'y\""; |
50 |
|
|
51 |
|
private static final String CATEGORY_RENAME_2 = |
52 |
|
"A category with [[//wiki// syntax]] # || onclick=\"alert('fail');return false;\""; |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
54 |
1 |
@Before... |
55 |
|
public void setUp() throws Exception |
56 |
|
{ |
57 |
|
|
58 |
1 |
getUtil().deletePage("Blog", CATEGORY); |
59 |
1 |
getUtil().deletePage("Blog", CATEGORY_RENAME); |
60 |
1 |
getUtil().deletePage("Blog", CATEGORY_RENAME_2); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
63 |
1 |
@Test... |
64 |
|
@IgnoreBrowsers({ |
65 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
66 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
67 |
|
}) |
68 |
|
public void testCategoryAddRenameRemove() |
69 |
|
{ |
70 |
1 |
categoryAdd(CATEGORY); |
71 |
1 |
categoryRename(CATEGORY, CATEGORY_RENAME); |
72 |
1 |
categoryRename(CATEGORY_RENAME, CATEGORY_RENAME_2); |
73 |
1 |
categoryRemove(CATEGORY_RENAME_2); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
81 |
1 |
private void categoryAdd(String name)... |
82 |
|
{ |
83 |
1 |
ManageCategoriesPage categoriesPage = ManageCategoriesPage.gotoPage(); |
84 |
1 |
Assert.assertFalse(categoriesPage.isCategoryPresent(name)); |
85 |
|
|
86 |
1 |
categoriesPage.clickAddCategory(); |
87 |
1 |
categoriesPage.addCategory(name); |
88 |
1 |
Assert.assertTrue(categoriesPage.isCategoryPresent(name)); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@param |
95 |
|
@param |
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
97 |
2 |
private void categoryRename(String fromName, String toName)... |
98 |
|
{ |
99 |
2 |
ManageCategoriesPage categoriesPage = ManageCategoriesPage.gotoPage(); |
100 |
2 |
Assert.assertTrue(categoriesPage.isCategoryPresent(fromName)); |
101 |
2 |
Assert.assertFalse(categoriesPage.isCategoryPresent(toName)); |
102 |
|
|
103 |
2 |
categoriesPage.renameCategory(fromName, toName); |
104 |
2 |
Assert.assertFalse(categoriesPage.isCategoryPresent(fromName)); |
105 |
2 |
Assert.assertTrue(categoriesPage.isCategoryPresent(toName)); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
@param |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
113 |
1 |
private void categoryRemove(String name)... |
114 |
|
{ |
115 |
1 |
ManageCategoriesPage categoriesPage = ManageCategoriesPage.gotoPage(); |
116 |
1 |
Assert.assertTrue(categoriesPage.isCategoryPresent(name)); |
117 |
|
|
118 |
1 |
categoriesPage.deleteCategory(name); |
119 |
1 |
Assert.assertFalse(categoriesPage.isCategoryPresent(name)); |
120 |
|
} |
121 |
|
} |