1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.administration.test.po; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.WebElement; |
24 |
|
import org.openqa.selenium.support.FindBy; |
25 |
|
import org.xwiki.model.reference.DocumentReference; |
26 |
|
import org.xwiki.model.reference.SpaceReference; |
27 |
|
import org.xwiki.test.ui.po.ViewPage; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 62.5% |
Uncovered Elements: 21 (56) |
Complexity: 21 |
Complexity Density: 0.6 |
|
35 |
|
public class AdministrationPage extends ViewPage |
36 |
|
{ |
37 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Localization')]") |
38 |
|
WebElement localizationLink; |
39 |
|
|
40 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Import')]") |
41 |
|
WebElement importLink; |
42 |
|
|
43 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Registration')]") |
44 |
|
WebElement registrationLink; |
45 |
|
|
46 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Users')]") |
47 |
|
WebElement usersLink; |
48 |
|
|
49 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Rights')]") |
50 |
|
WebElement rightsLink; |
51 |
|
|
52 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Annotations')]") |
53 |
|
WebElement annotationsLink; |
54 |
|
|
55 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Extension Manager')]") |
56 |
|
WebElement extensionsLink; |
57 |
|
|
58 |
|
@FindBy(xpath = "//a[contains(@href, 'section=WYSIWYG')]") |
59 |
|
WebElement wysiwygLink; |
60 |
|
|
61 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Elements')]") |
62 |
|
private WebElement pageElementsLink; |
63 |
|
|
64 |
|
@FindBy(xpath = "//a[contains(@href, 'section=Presentation')]") |
65 |
|
private WebElement presentationLink; |
66 |
|
|
67 |
|
@FindBy(id = "goto-select") |
68 |
|
WebElement spaceAdminSelect; |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
70 |
31 |
public static AdministrationPage gotoPage()... |
71 |
|
{ |
72 |
31 |
getUtil().gotoPage(getSpace(), getPage(), "admin"); |
73 |
31 |
return new AdministrationPage(); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@return |
81 |
|
@since |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
83 |
4 |
public static AdministrationPage gotoSpaceAdministrationPage(SpaceReference spaceReference)... |
84 |
|
{ |
85 |
4 |
DocumentReference documentReference = new DocumentReference("WebPreferences", spaceReference); |
86 |
4 |
getUtil().gotoPage(documentReference, "admin"); |
87 |
|
|
88 |
4 |
return new AdministrationPage(); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@param |
95 |
|
@return |
96 |
|
@since |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
98 |
4 |
public static AdministrationPage gotoSpaceAdministrationPage(String spaceReferenceString)... |
99 |
|
{ |
100 |
4 |
SpaceReference spaceReference = new SpaceReference(getUtil().resolveSpaceReference(spaceReferenceString)); |
101 |
4 |
return gotoSpaceAdministrationPage(spaceReference); |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0 |
public static String getURL()... |
105 |
|
{ |
106 |
0 |
return getUtil().getURL(getSpace(), getPage()); |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
31 |
public static String getSpace()... |
110 |
|
{ |
111 |
31 |
return "XWiki"; |
112 |
|
} |
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
31 |
public static String getPage()... |
115 |
|
{ |
116 |
31 |
return "XWikiPreferences"; |
117 |
|
} |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
119 |
14 |
public LocalizationAdministrationSectionPage clickLocalizationSection()... |
120 |
|
{ |
121 |
14 |
this.localizationLink.click(); |
122 |
14 |
return new LocalizationAdministrationSectionPage(); |
123 |
|
} |
124 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
125 |
5 |
public ImportAdministrationSectionPage clickImportSection()... |
126 |
|
{ |
127 |
5 |
this.importLink.click(); |
128 |
5 |
return new ImportAdministrationSectionPage(); |
129 |
|
} |
130 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
131 |
0 |
public AdministrationSectionPage clickRegistrationSection()... |
132 |
|
{ |
133 |
0 |
this.registrationLink.click(); |
134 |
0 |
return new AdministrationSectionPage("register"); |
135 |
|
} |
136 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
137 |
0 |
public UsersAdministrationSectionPage clickUsersSection()... |
138 |
|
{ |
139 |
0 |
this.usersLink.click(); |
140 |
0 |
return new UsersAdministrationSectionPage(); |
141 |
|
} |
142 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
143 |
0 |
public GlobalRightsAdministrationSectionPage clickGlobalRightsSection()... |
144 |
|
{ |
145 |
0 |
this.rightsLink.click(); |
146 |
0 |
return new GlobalRightsAdministrationSectionPage(); |
147 |
|
} |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
149 |
0 |
public AnnotationsPage clickAnnotationsSection()... |
150 |
|
{ |
151 |
0 |
this.annotationsLink.click(); |
152 |
0 |
return new AnnotationsPage(); |
153 |
|
} |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
155 |
1 |
public WYSIWYGEditorAdministrationSectionPage clickWYSIWYGEditorSection()... |
156 |
|
{ |
157 |
1 |
this.wysiwygLink.click(); |
158 |
1 |
return new WYSIWYGEditorAdministrationSectionPage(); |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
@since |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
164 |
2 |
public PresentationAdministrationSectionPage clickPresentationSection()... |
165 |
|
{ |
166 |
2 |
this.presentationLink.click(); |
167 |
2 |
return new PresentationAdministrationSectionPage(); |
168 |
|
} |
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
@return |
174 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
175 |
0 |
public PageElementsAdministrationSectionPage clickPageElementsSection()... |
176 |
|
{ |
177 |
0 |
pageElementsLink.click(); |
178 |
0 |
return new PageElementsAdministrationSectionPage(); |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
|
@since |
183 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
184 |
8 |
public ViewPage clickSection(String categoryName, String sectionName)... |
185 |
|
{ |
186 |
8 |
getDriver().findElement(By.xpath( |
187 |
|
"//div[contains(@class, 'admin-menu')]" |
188 |
|
+ "/ul/li/span/a[text() = '" + categoryName + "']" |
189 |
|
+ "/../../ul/li/span/a[text() = '" + sectionName + "']")).click(); |
190 |
8 |
return new ViewPage(); |
191 |
|
} |
192 |
|
|
193 |
|
|
194 |
|
@since |
195 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
196 |
0 |
public boolean hasSection(String categoryName, String sectionName)... |
197 |
|
{ |
198 |
0 |
return getDriver().hasElement(By.xpath( |
199 |
|
"//div[contains(@class, 'admin-menu')]" |
200 |
|
+ "/ul/li/span/a[text() = '" + categoryName + "']" |
201 |
|
+ "/../../ul/li/span/a[text() = '" + sectionName + "']")); |
202 |
|
} |
203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
23 |
public boolean hasSection(String sectionName)... |
205 |
|
{ |
206 |
23 |
return getDriver().hasElement(By.xpath("//*[contains(@class, 'admin-menu')]//a[contains(@href, 'section=" |
207 |
|
+ sectionName + "')]")); |
208 |
|
} |
209 |
|
|
210 |
|
|
211 |
|
@since |
212 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
213 |
0 |
public boolean hasNotSection(String categoryName, String sectionName)... |
214 |
|
{ |
215 |
0 |
return getDriver().findElementsWithoutWaiting(By.xpath( |
216 |
|
"//div[contains(@class, 'admin-menu')]" |
217 |
|
+ "/ul/li/span/a[text() = '" + categoryName + "']" |
218 |
|
+ "/../../ul/li/span/a[text() = '" + sectionName + "']")).size() == 0; |
219 |
|
} |
220 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
221 |
11 |
public boolean hasNotSection(String sectionName)... |
222 |
|
{ |
223 |
11 |
return getDriver().findElementsWithoutWaiting( |
224 |
|
By.xpath("//*[contains(@class, 'admin-menu')]//a[contains(@href, 'section=" |
225 |
|
+ sectionName + "')]")).size() == 0; |
226 |
|
} |
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
234 |
1 |
public AdministrationPage selectSpaceToAdminister(String spaceName)... |
235 |
|
{ |
236 |
|
|
237 |
|
|
238 |
1 |
return gotoSpaceAdministrationPage(spaceName); |
239 |
|
} |
240 |
|
} |