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; |
21 |
|
|
22 |
|
import org.apache.commons.lang.RandomStringUtils; |
23 |
|
import org.junit.Assert; |
24 |
|
import org.junit.Rule; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.tag.test.po.TaggablePage; |
27 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
28 |
|
import org.xwiki.test.ui.po.InlinePage; |
29 |
|
import org.xwiki.test.ui.po.ViewPage; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (53) |
Complexity: 6 |
Complexity Density: 0.13 |
|
37 |
|
public class EditInlineTest extends AbstractTest |
38 |
|
{ |
39 |
|
@Rule |
40 |
|
public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil()); |
41 |
|
|
42 |
|
|
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
44 |
1 |
@Test... |
45 |
|
public void testEditButtonTriggersInlineEditing() |
46 |
|
{ |
47 |
|
|
48 |
|
|
49 |
1 |
ViewPage vp = getUtil().gotoPage("XWiki", "Admin"); |
50 |
1 |
vp.edit(); |
51 |
1 |
Assert.assertTrue(new ViewPage().isInlinePage()); |
52 |
|
} |
53 |
|
|
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
public void testInlineEditCanChangeTitle() |
57 |
|
{ |
58 |
1 |
String title = RandomStringUtils.randomAlphanumeric(4); |
59 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline&title=" + title); |
60 |
1 |
InlinePage inlinePage = new InlinePage(); |
61 |
|
|
62 |
1 |
Assert.assertEquals(title, inlinePage.getDocumentTitle()); |
63 |
|
|
64 |
1 |
Assert.assertTrue(inlinePage.getBreadcrumbContent().contains(title)); |
65 |
|
|
66 |
1 |
ViewPage viewPage = inlinePage.clickSaveAndView(); |
67 |
1 |
Assert.assertEquals(title, viewPage.getDocumentTitle()); |
68 |
|
} |
69 |
|
|
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
71 |
1 |
@Test... |
72 |
|
public void testInlineEditCanChangeParent() |
73 |
|
{ |
74 |
|
|
75 |
1 |
getUtil().setHierarchyMode("parentchild"); |
76 |
|
|
77 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline&parent=Main.SomeParent"); |
78 |
1 |
ViewPage vp = new InlinePage().clickSaveAndView(); |
79 |
|
|
80 |
|
|
81 |
1 |
Assert.assertTrue(vp.hasBreadcrumbContent("SomeParent", false)); |
82 |
|
|
83 |
|
|
84 |
1 |
getUtil().setHierarchyMode("reference"); |
85 |
|
} |
86 |
|
|
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
88 |
1 |
@Test... |
89 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
90 |
|
public void testInlineEditPreservesTitle() |
91 |
|
{ |
92 |
1 |
String title = RandomStringUtils.randomAlphanumeric(4); |
93 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "title=" + title); |
94 |
1 |
ViewPage vp = new ViewPage(); |
95 |
1 |
Assert.assertEquals(title, vp.getDocumentTitle()); |
96 |
1 |
InlinePage ip = vp.editInline(); |
97 |
1 |
ViewPage vp2 = ip.clickSaveAndView(); |
98 |
1 |
Assert.assertEquals(title, vp2.getDocumentTitle()); |
99 |
|
} |
100 |
|
|
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
102 |
1 |
@Test... |
103 |
|
public void testInlineEditPreservesParent() |
104 |
|
{ |
105 |
|
|
106 |
1 |
getUtil().setHierarchyMode("parentchild"); |
107 |
|
|
108 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "parent=Blog.WebHome"); |
109 |
1 |
ViewPage vp = new ViewPage(); |
110 |
1 |
Assert.assertTrue(vp.hasBreadcrumbContent("Blog", false)); |
111 |
|
|
112 |
1 |
InlinePage ip = vp.editInline(); |
113 |
1 |
ViewPage vp2 = ip.clickSaveAndView(); |
114 |
1 |
Assert.assertTrue(vp2.hasBreadcrumbContent("Blog", false)); |
115 |
|
|
116 |
|
|
117 |
1 |
getUtil().setHierarchyMode("reference"); |
118 |
|
|
119 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline"); |
120 |
1 |
InlinePage ip2 = new InlinePage(); |
121 |
1 |
ip2.clickSaveAndView(); |
122 |
|
|
123 |
|
|
124 |
1 |
getUtil().setHierarchyMode("parentchild"); |
125 |
|
|
126 |
1 |
ViewPage vp3 = getUtil().gotoPage(getTestClassName(), getTestMethodName()); |
127 |
1 |
Assert.assertTrue(vp3.hasBreadcrumbContent("Blog", false)); |
128 |
|
|
129 |
|
|
130 |
1 |
getUtil().setHierarchyMode("reference"); |
131 |
|
} |
132 |
|
|
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
134 |
1 |
@Test... |
135 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
136 |
|
public void testInlineEditPreservesTags() |
137 |
|
{ |
138 |
1 |
String tag1 = RandomStringUtils.randomAlphanumeric(4); |
139 |
1 |
String tag2 = RandomStringUtils.randomAlphanumeric(4); |
140 |
1 |
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "tags=" + tag1 + "%7C" + tag2); |
141 |
1 |
TaggablePage taggablePage = new TaggablePage(); |
142 |
1 |
Assert.assertTrue(taggablePage.hasTag(tag1)); |
143 |
1 |
Assert.assertTrue(taggablePage.hasTag(tag2)); |
144 |
1 |
taggablePage.editInline().clickSaveAndView(); |
145 |
1 |
taggablePage = new TaggablePage(); |
146 |
1 |
Assert.assertTrue(taggablePage.hasTag(tag1)); |
147 |
1 |
Assert.assertTrue(taggablePage.hasTag(tag2)); |
148 |
|
} |
149 |
|
} |