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.apache.commons.lang3.RandomStringUtils; |
24 |
|
import org.junit.Before; |
25 |
|
import org.junit.Rule; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
28 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
29 |
|
import org.xwiki.test.ui.po.ViewPage; |
30 |
|
import org.xwiki.test.ui.po.editor.EditPage.Editor; |
31 |
|
import org.xwiki.test.ui.po.editor.WYSIWYGEditPage; |
32 |
|
import org.xwiki.test.ui.po.editor.WikiEditPage; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 4 |
Complexity Density: 0.19 |
|
40 |
|
public class EditWikiTest extends AbstractTest |
41 |
|
{ |
42 |
|
@Rule |
43 |
|
public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil()); |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
private WikiEditPage editPage; |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
50 |
3 |
@Before... |
51 |
|
public void setUp() throws Exception |
52 |
|
{ |
53 |
3 |
getUtil().rest().deletePage(getTestClassName(), getTestMethodName()); |
54 |
3 |
this.editPage = WikiEditPage.gotoPage(getTestClassName(), getTestMethodName()); |
55 |
|
} |
56 |
|
|
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
58 |
1 |
@Test... |
59 |
|
public void testSaveAndContinueSavesAsMinorEdit() |
60 |
|
{ |
61 |
|
|
62 |
1 |
Assert.assertTrue(this.editPage.isNewDocument()); |
63 |
1 |
this.editPage.setContent("abc1"); |
64 |
1 |
this.editPage.clickSaveAndView(); |
65 |
1 |
Assert.assertEquals("1.1", this.editPage.getMetaDataValue("version")); |
66 |
|
|
67 |
1 |
this.editPage = WikiEditPage.gotoPage(getTestClassName(), getTestMethodName()); |
68 |
1 |
Assert.assertFalse(this.editPage.isNewDocument()); |
69 |
1 |
this.editPage.setContent("abc2"); |
70 |
1 |
this.editPage.setMinorEdit(false); |
71 |
1 |
this.editPage.clickSaveAndContinue(); |
72 |
1 |
this.editPage.clickCancel(); |
73 |
1 |
Assert.assertEquals("1.2", this.editPage.getMetaDataValue("version")); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
80 |
1 |
@Test... |
81 |
|
@IgnoreBrowsers({ |
82 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
83 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
84 |
|
}) |
85 |
|
public void testSwitchToWysiwygWithAdvancedContent() |
86 |
|
{ |
87 |
|
|
88 |
1 |
this.editPage.setContent("{{html}}<hr/>{{/html}}"); |
89 |
|
|
90 |
1 |
getDriver().makeConfirmDialogSilent(false); |
91 |
|
|
92 |
1 |
WYSIWYGEditPage wysiwygEditPage = this.editPage.editWYSIWYG(); |
93 |
|
|
94 |
1 |
Assert.assertEquals(Editor.WYSIWYG, wysiwygEditPage.getEditor()); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
@see |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
100 |
1 |
@Test... |
101 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146") |
102 |
|
public void testPreviewDisplaysPageTitle() |
103 |
|
{ |
104 |
1 |
String title = RandomStringUtils.randomAlphanumeric(3); |
105 |
1 |
this.editPage.setTitle(title); |
106 |
1 |
this.editPage.clickPreview(); |
107 |
|
|
108 |
1 |
Assert.assertEquals(title, new ViewPage().getDocumentTitle()); |
109 |
|
} |
110 |
|
} |