1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.wysiwyg; |
21 |
|
|
22 |
|
import org.junit.Test; |
23 |
|
import org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase; |
24 |
|
|
25 |
|
import static org.junit.Assert.*; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (56) |
Complexity: 4 |
Complexity Density: 0.08 |
|
33 |
|
public class CacheTest extends AbstractWysiwygTestCase |
34 |
|
{ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
39 |
1 |
@Test... |
40 |
|
public void testPreserveUnsavedRichContentAgainstBackButton() |
41 |
|
{ |
42 |
|
|
43 |
1 |
typeText("1"); |
44 |
1 |
clickEditCancelEdition(); |
45 |
1 |
getSelenium().goBack(); |
46 |
1 |
waitPage(); |
47 |
1 |
waitForEditorToLoad(); |
48 |
|
|
49 |
|
|
50 |
1 |
typeText("2"); |
51 |
1 |
getSelenium().click("//a[. = '" + getTestMethodName() + "']"); |
52 |
1 |
waitPage(); |
53 |
1 |
getSelenium().goBack(); |
54 |
1 |
waitPage(); |
55 |
1 |
waitForEditorToLoad(); |
56 |
|
|
57 |
|
|
58 |
1 |
typeText("3"); |
59 |
1 |
switchToSource(); |
60 |
1 |
assertSourceText("321"); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
67 |
1 |
@Test... |
68 |
|
public void testPreserveUnsavedSourceAgainstBackButton() |
69 |
|
{ |
70 |
1 |
switchToSource(); |
71 |
|
|
72 |
|
|
73 |
1 |
getSourceTextArea().sendKeys("a"); |
74 |
1 |
clickEditCancelEdition(); |
75 |
1 |
getSelenium().goBack(); |
76 |
1 |
waitPage(); |
77 |
1 |
waitForEditorToLoad(); |
78 |
|
|
79 |
|
|
80 |
1 |
getSourceTextArea().sendKeys("b"); |
81 |
1 |
getSelenium().click("//a[. = '" + getTestMethodName() + "']"); |
82 |
1 |
waitPage(); |
83 |
1 |
getSelenium().goBack(); |
84 |
1 |
waitPage(); |
85 |
1 |
waitForEditorToLoad(); |
86 |
|
|
87 |
|
|
88 |
1 |
getSourceTextArea().sendKeys("c"); |
89 |
1 |
assertSourceText("abc"); |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
96 |
1 |
@Test... |
97 |
|
public void testPreserveSelectedEditorAgainstBackButton() |
98 |
|
{ |
99 |
|
|
100 |
1 |
assertFalse(getSourceTextArea().isEnabled()); |
101 |
|
|
102 |
|
|
103 |
1 |
switchToSource(); |
104 |
1 |
clickEditCancelEdition(); |
105 |
1 |
getSelenium().goBack(); |
106 |
1 |
waitPage(); |
107 |
1 |
waitForEditorToLoad(); |
108 |
|
|
109 |
|
|
110 |
1 |
assertTrue(getSourceTextArea().isEnabled()); |
111 |
|
|
112 |
|
|
113 |
1 |
switchToWysiwyg(); |
114 |
1 |
getSelenium().click("//a[. = '" + getTestMethodName() + "']"); |
115 |
1 |
waitPage(); |
116 |
1 |
getSelenium().goBack(); |
117 |
1 |
waitPage(); |
118 |
1 |
waitForEditorToLoad(); |
119 |
|
|
120 |
|
|
121 |
1 |
assertFalse(getSourceTextArea().isEnabled()); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
@see |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
127 |
1 |
@Test... |
128 |
|
public void testBackForwardCache() |
129 |
|
{ |
130 |
|
|
131 |
1 |
clickEditCancelEdition(); |
132 |
1 |
clickEditPageInWysiwyg(); |
133 |
1 |
waitForEditorToLoad(); |
134 |
|
|
135 |
1 |
typeText("123"); |
136 |
|
|
137 |
1 |
getSelenium().goBack(); |
138 |
1 |
waitPage(); |
139 |
|
|
140 |
|
|
141 |
1 |
getSelenium().runScript("window.history.forward()"); |
142 |
1 |
waitPage(); |
143 |
|
|
144 |
1 |
waitForEditorToLoad(); |
145 |
|
|
146 |
1 |
assertEquals("123", getRichTextArea().getText()); |
147 |
|
} |
148 |
|
} |