1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.selenium; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Test; |
24 |
|
import org.xwiki.test.selenium.framework.AbstractXWikiTestCase; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@version |
30 |
|
|
|
|
| 98.6% |
Uncovered Elements: 1 (74) |
Complexity: 2 |
Complexity Density: 0.03 |
|
31 |
|
public class AllDocsTest extends AbstractXWikiTestCase |
32 |
|
{ |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 98.6% |
Uncovered Elements: 1 (73) |
Complexity: 2 |
Complexity Density: 0.03 |
1PASS
|
|
47 |
1 |
@Test... |
48 |
|
public void testTableViewActions() |
49 |
|
{ |
50 |
|
|
51 |
|
|
52 |
1 |
open("Main", "AllDocs"); |
53 |
|
|
54 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
55 |
1 |
if (isAuthenticated()) { |
56 |
1 |
logout(); |
57 |
|
} |
58 |
1 |
assertElementNotPresent("//td[text()='Actions']"); |
59 |
|
|
60 |
|
|
61 |
1 |
loginAsAdmin(); |
62 |
1 |
String spaceName = this.getClass().getSimpleName(); |
63 |
1 |
String pageName = getTestMethodName(); |
64 |
1 |
open(spaceName, pageName, "edit", "editor=wiki&title=Actions+test"); |
65 |
1 |
clickEditSaveAndContinue(); |
66 |
|
|
67 |
|
|
68 |
1 |
open("Main", "AllDocs"); |
69 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
70 |
1 |
assertElementPresent("//th[normalize-space(text())='Actions']"); |
71 |
|
|
72 |
|
|
73 |
1 |
getSelenium().focus("doc.location"); |
74 |
1 |
getSelenium().typeKeys("doc.location", "ViewActions"); |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
79 |
1 |
assertElementPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "']"); |
80 |
|
|
81 |
|
|
82 |
1 |
open("Main", "AllDocs"); |
83 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
84 |
1 |
getSelenium().focus("doc.author"); |
85 |
1 |
getSelenium().typeKeys("doc.author", "SomeUnknownAuthor"); |
86 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", ""); |
87 |
1 |
assertElementNotPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "']"); |
88 |
|
|
89 |
|
|
90 |
1 |
open("Main", "AllDocs"); |
91 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
92 |
1 |
getSelenium().focus("doc.location"); |
93 |
1 |
getSelenium().typeKeys("doc.location", "view"); |
94 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
95 |
1 |
assertElementPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "']"); |
96 |
1 |
clickLinkWithLocator("//a[contains(@class, 'actioncopy') and contains(@href, '" + pageName + "')]"); |
97 |
|
|
98 |
1 |
setFieldValue("targetSpaceName", "Sandbox"); |
99 |
1 |
setFieldValue("targetPageName", pageName + "New"); |
100 |
1 |
clickLinkWithLocator("//input[@value='Copy']"); |
101 |
1 |
open("Main", "AllDocs"); |
102 |
1 |
getSelenium().focus("doc.location"); |
103 |
1 |
getSelenium().typeKeys("doc.location", "Sandbox"); |
104 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
105 |
1 |
assertElementPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "New']"); |
106 |
|
|
107 |
|
|
108 |
1 |
open("Main", "AllDocs"); |
109 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
110 |
1 |
getSelenium().focus("doc.location"); |
111 |
1 |
getSelenium().typeKeys("doc.location", "actionsNew"); |
112 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
113 |
1 |
clickLinkWithLocator("//tbody/tr/td/a[text()='rename']"); |
114 |
1 |
setFieldValue("newPageName", pageName + "NewRenamed"); |
115 |
1 |
clickLinkWithLocator("//input[@value='Rename']"); |
116 |
1 |
open("Main", "AllDocs"); |
117 |
1 |
getSelenium().focus("doc.location"); |
118 |
1 |
getSelenium().typeKeys("doc.location", "renamed"); |
119 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
120 |
1 |
assertElementPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "NewRenamed']"); |
121 |
|
|
122 |
|
|
123 |
1 |
open("Main", "AllDocs"); |
124 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
125 |
1 |
getSelenium().focus("doc.location"); |
126 |
1 |
getSelenium().typeKeys("doc.location", "renamed"); |
127 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
128 |
1 |
clickLinkWithLocator("//tbody/tr/td/a[text()='delete']"); |
129 |
1 |
clickLinkWithLocator("//button[contains(text(), 'Yes')]"); |
130 |
1 |
assertTextPresent("The page has been deleted."); |
131 |
1 |
open("Main", "AllDocs"); |
132 |
1 |
getSelenium().focus("doc.location"); |
133 |
1 |
getSelenium().typeKeys("doc.location", "actions"); |
134 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
135 |
1 |
assertElementNotPresent("//td[contains(@class, 'doc_location')]//a[text()='" + pageName + "NewRenamed']"); |
136 |
|
|
137 |
|
|
138 |
1 |
open("Main", "AllDocs"); |
139 |
1 |
waitForTextContains("//span[@class='xwiki-livetable-pagination-content']", "1 2"); |
140 |
1 |
getSelenium().focus("doc.location"); |
141 |
1 |
getSelenium().typeKeys("doc.location", pageName); |
142 |
1 |
waitForTextPresent("//span[@class='xwiki-livetable-pagination-content']", "1"); |
143 |
1 |
clickLinkWithLocator("//tbody/tr/td/a[text()='rights']"); |
144 |
1 |
Assert.assertEquals("Editing access rights for Actions test", getTitle()); |
145 |
|
} |
146 |
|
} |