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.junit.Assert; |
23 |
|
import org.junit.Rule; |
24 |
|
import org.junit.Test; |
25 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
26 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
27 |
|
import org.xwiki.test.ui.po.HistoryPane; |
28 |
|
import org.xwiki.test.ui.po.ViewPage; |
29 |
|
import org.xwiki.test.ui.po.editor.WikiEditPage; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 2 |
Complexity Density: 0.08 |
|
37 |
|
public class VersionTest extends AbstractTest |
38 |
|
{ |
39 |
|
@Rule |
40 |
|
public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil()); |
41 |
|
|
42 |
|
private static final String PAGE_NAME = "HistoryTest"; |
43 |
|
|
44 |
|
private static final String SPACE_NAME = "HistorySpaceTest"; |
45 |
|
|
46 |
|
private static final String TITLE = "Page Title"; |
47 |
|
|
48 |
|
private static final String CONTENT1 = "First version of Content"; |
49 |
|
|
50 |
|
private static final String CONTENT2 = "Second version of Content"; |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
52 |
1 |
@Test... |
53 |
|
@IgnoreBrowsers({ |
54 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), |
55 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") |
56 |
|
}) |
57 |
|
public void testRollbackToFirstVersion() throws Exception |
58 |
|
{ |
59 |
1 |
getUtil().rest().deletePage(SPACE_NAME, PAGE_NAME); |
60 |
|
|
61 |
|
|
62 |
1 |
ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE); |
63 |
|
|
64 |
|
|
65 |
1 |
WikiEditPage wikiEditPage = vp.editWiki(); |
66 |
1 |
wikiEditPage.setContent(CONTENT2); |
67 |
1 |
wikiEditPage.clickSaveAndView(); |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
1 |
vp.waitForDocExtraPaneActive("comments"); |
72 |
|
|
73 |
|
|
74 |
1 |
HistoryPane historyTab = vp.openHistoryDocExtraPane(); |
75 |
1 |
vp = historyTab.rollbackToVersion("1.1"); |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
1 |
vp.waitForDocExtraPaneActive("comments"); |
81 |
|
|
82 |
1 |
Assert.assertEquals("First version of Content", vp.getContent()); |
83 |
|
|
84 |
1 |
historyTab = vp.openHistoryDocExtraPane(); |
85 |
1 |
Assert.assertEquals("Rollback to version 1.1", historyTab.getCurrentVersionComment()); |
86 |
1 |
Assert.assertEquals("Administrator", historyTab.getCurrentAuthor()); |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
92 |
1 |
@Test... |
93 |
|
@IgnoreBrowsers({ |
94 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), |
95 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") |
96 |
|
}) |
97 |
|
public void testDeleteLatestVersion() throws Exception |
98 |
|
{ |
99 |
1 |
getUtil().rest().deletePage(SPACE_NAME, PAGE_NAME); |
100 |
|
|
101 |
|
|
102 |
1 |
ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE); |
103 |
|
|
104 |
|
|
105 |
1 |
WikiEditPage wikiEditPage = vp.editWiki(); |
106 |
1 |
wikiEditPage.setContent(CONTENT2); |
107 |
1 |
wikiEditPage.clickSaveAndView(); |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
1 |
vp.waitForDocExtraPaneActive("comments"); |
112 |
|
|
113 |
|
|
114 |
1 |
HistoryPane historyTab = vp.openHistoryDocExtraPane(); |
115 |
1 |
Assert.assertEquals("2.1", historyTab.getCurrentVersion()); |
116 |
1 |
historyTab = historyTab.deleteVersion("2.1"); |
117 |
|
|
118 |
|
|
119 |
1 |
Assert.assertEquals("1.1", historyTab.getCurrentVersion()); |
120 |
1 |
Assert.assertEquals("Administrator", historyTab.getCurrentAuthor()); |
121 |
|
} |
122 |
|
} |