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.po; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
import java.util.Locale; |
25 |
|
import java.util.regex.Matcher; |
26 |
|
import java.util.regex.Pattern; |
27 |
|
|
28 |
|
import org.apache.commons.lang3.LocaleUtils; |
29 |
|
import org.openqa.selenium.By; |
30 |
|
import org.openqa.selenium.JavascriptExecutor; |
31 |
|
import org.openqa.selenium.WebElement; |
32 |
|
import org.openqa.selenium.support.FindBy; |
33 |
|
import org.openqa.selenium.support.FindBys; |
34 |
|
import org.xwiki.test.ui.po.editor.ClassEditPage; |
35 |
|
import org.xwiki.test.ui.po.editor.ObjectEditPage; |
36 |
|
import org.xwiki.test.ui.po.editor.RightsEditPage; |
37 |
|
import org.xwiki.test.ui.po.editor.WYSIWYGEditPage; |
38 |
|
import org.xwiki.test.ui.po.editor.WikiEditPage; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@version |
44 |
|
@since |
45 |
|
|
|
|
| 73.8% |
Uncovered Elements: 43 (164) |
Complexity: 53 |
Complexity Density: 0.5 |
|
46 |
|
public class BasePage extends BaseElement |
47 |
|
{ |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@FindBy(id = "xwikimaincontainer") |
52 |
|
private WebElement mainContainerDiv; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@FindBy(id = "contentmenu") |
58 |
|
private WebElement contentMenuBar; |
59 |
|
|
60 |
|
@FindBy(xpath = "//div[@id='tmCreate']/a[contains(@role, 'button')]") |
61 |
|
private WebElement tmCreate; |
62 |
|
|
63 |
|
@FindBy(xpath = "//div[@id='tmMoreActions']/a[contains(@role, 'button')]") |
64 |
|
private WebElement moreActionsMenu; |
65 |
|
|
66 |
|
@FindBy(id = "tmDrawerActivator") |
67 |
|
private WebElement drawerActivator; |
68 |
|
|
69 |
|
@FindBy(xpath = "//input[@id='tmWatchDocument']/../span[contains(@class, 'bootstrap-switch-label')]") |
70 |
|
private WebElement watchDocumentLink; |
71 |
|
|
72 |
|
@FindBy(id = "tmPage") |
73 |
|
private WebElement pageMenu; |
74 |
|
|
75 |
|
@FindBys({ @FindBy(id = "tmRegister"), @FindBy(tagName = "a") }) |
76 |
|
private WebElement registerLink; |
77 |
|
|
78 |
|
@FindBy(xpath = "//a[@id='tmLogin']") |
79 |
|
private WebElement loginLink; |
80 |
|
|
81 |
|
@FindBy(xpath = "//a[@id='tmUser']") |
82 |
|
private WebElement userLink; |
83 |
|
|
84 |
|
@FindBy(xpath = "//li[contains(@class, 'navbar-avatar')]//img[contains(@class, 'avatar')]") |
85 |
|
private WebElement userAvatarImage; |
86 |
|
|
87 |
|
@FindBy(id = "document-title") |
88 |
|
private WebElement documentTitle; |
89 |
|
|
90 |
|
@FindBy(xpath = "//input[@id='tmWatchSpace']/../span[contains(@class, 'bootstrap-switch-label')]") |
91 |
|
private WebElement watchSpaceLink; |
92 |
|
|
93 |
|
@FindBy(xpath = "//input[@id='tmWatchWiki']/../span[contains(@class, 'bootstrap-switch-label')]") |
94 |
|
private WebElement watchWikiLink; |
95 |
|
|
96 |
|
@FindBy(css = "#tmMoreActions a[title='Children']") |
97 |
|
private WebElement childrenLink; |
98 |
|
|
99 |
|
@FindBy(id = "tmNotifications") |
100 |
|
private WebElement notificationsMenu; |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@FindBy(id = "companylogo") |
106 |
|
protected WebElement logo; |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
114 |
1343 |
public BasePage()... |
115 |
|
{ |
116 |
1343 |
super(); |
117 |
1343 |
waitUntilPageJSIsLoaded(); |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0 |
public String getPageTitle()... |
121 |
|
{ |
122 |
0 |
return getDriver().getTitle(); |
123 |
|
} |
124 |
|
|
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
6 |
public String getPageURL()... |
127 |
|
{ |
128 |
6 |
return getDriver().getCurrentUrl(); |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
@return |
134 |
|
@see |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
49 |
public String getMetaDataValue(String metaName)... |
137 |
|
{ |
138 |
49 |
return getDriver().findElement(By.xpath("/html")).getAttribute("data-xwiki-" + metaName); |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
@param |
143 |
|
@return |
144 |
|
@since |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
6 |
public String getHTMLMetaDataValue(String metaName)... |
147 |
|
{ |
148 |
6 |
return getDriver().findElement(By.xpath("//meta[@name='" + metaName + "']")).getAttribute("content"); |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
|
@return |
153 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
154 |
19 |
public boolean isAuthenticated()... |
155 |
|
{ |
156 |
19 |
return getDriver().hasElementWithoutWaiting(By.id("tmUser")); |
157 |
|
} |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
@return |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
164 |
2 |
public boolean isNewDocument()... |
165 |
|
{ |
166 |
2 |
return (Boolean) ((JavascriptExecutor) getDriver()).executeScript("return XWiki.docisnew"); |
167 |
|
} |
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
@param |
173 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
174 |
67 |
protected void clickEditSubMenuEntry(String id)... |
175 |
|
{ |
176 |
67 |
clickSubMenuEntryFromMenu(By.xpath("//div[@id='tmEdit']/a[contains(@role, 'button')]"), id); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
182 |
24 |
public void edit()... |
183 |
|
{ |
184 |
24 |
WebElement editMenuButton = |
185 |
|
getDriver().findElement(By.xpath("//div[@id='tmEdit']/a[contains(@role, 'button')]")); |
186 |
|
|
187 |
24 |
if ("dropdown".equals(editMenuButton.getAttribute("data-toggle"))) { |
188 |
20 |
clickEditSubMenuEntry("tmEditDefault"); |
189 |
|
} else { |
190 |
4 |
editMenuButton.click(); |
191 |
|
} |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
0 |
public String getEditURL()... |
198 |
|
{ |
199 |
0 |
return getDriver().findElement(By.xpath("//div[@id='tmEdit']//a")).getAttribute("href"); |
200 |
|
} |
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
205 |
16 |
public WikiEditPage editWiki()... |
206 |
|
{ |
207 |
16 |
clickEditSubMenuEntry("tmEditWiki"); |
208 |
16 |
return new WikiEditPage(); |
209 |
|
} |
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
214 |
1 |
public WYSIWYGEditPage editWYSIWYG()... |
215 |
|
{ |
216 |
1 |
clickEditSubMenuEntry("tmEditWysiwyg"); |
217 |
1 |
return new WYSIWYGEditPage(); |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
223 |
7 |
public <T extends InlinePage> T editInline()... |
224 |
|
{ |
225 |
7 |
clickEditSubMenuEntry("tmEditInline"); |
226 |
7 |
return createInlinePage(); |
227 |
|
} |
228 |
|
|
229 |
|
|
230 |
|
@link |
231 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
232 |
6 |
@SuppressWarnings("unchecked")... |
233 |
|
protected <T extends InlinePage> T createInlinePage() |
234 |
|
{ |
235 |
6 |
return (T) new InlinePage(); |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
241 |
1 |
public RightsEditPage editRights()... |
242 |
|
{ |
243 |
1 |
clickEditSubMenuEntry("tmEditRights"); |
244 |
1 |
return new RightsEditPage(); |
245 |
|
} |
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
250 |
17 |
public ObjectEditPage editObjects()... |
251 |
|
{ |
252 |
17 |
clickEditSubMenuEntry("tmEditObject"); |
253 |
17 |
return new ObjectEditPage(); |
254 |
|
} |
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
259 |
5 |
public ClassEditPage editClass()... |
260 |
|
{ |
261 |
5 |
clickEditSubMenuEntry("tmEditClass"); |
262 |
5 |
return new ClassEditPage(); |
263 |
|
} |
264 |
|
|
265 |
|
|
266 |
|
@since |
267 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
268 |
14 |
public void sendKeys(CharSequence... keys)... |
269 |
|
{ |
270 |
14 |
this.mainContainerDiv.sendKeys(keys); |
271 |
|
} |
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
@return |
278 |
|
@since |
279 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
280 |
26 |
public BasePage waitUntilPageIsLoaded()... |
281 |
|
{ |
282 |
26 |
getDriver().waitUntilElementIsVisible(By.id("footerglobal")); |
283 |
26 |
return this; |
284 |
|
} |
285 |
|
|
286 |
|
|
287 |
|
@since |
288 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
289 |
11 |
public void toggleDrawer()... |
290 |
|
{ |
291 |
11 |
By drawer = By.id("tmDrawer"); |
292 |
11 |
if (getDriver().findElementWithoutWaiting(drawer).isDisplayed()) { |
293 |
|
|
294 |
0 |
this.mainContainerDiv.click(); |
295 |
0 |
getDriver().waitUntilElementDisappears(drawer); |
296 |
|
} else { |
297 |
|
|
298 |
11 |
this.drawerActivator.click(); |
299 |
11 |
getDriver().waitUntilElementIsVisible(drawer); |
300 |
|
} |
301 |
|
} |
302 |
|
|
303 |
|
|
304 |
|
@since |
305 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
306 |
4 |
public void toggleActionMenu()... |
307 |
|
{ |
308 |
4 |
this.moreActionsMenu.click(); |
309 |
|
} |
310 |
|
|
311 |
|
|
312 |
|
@since |
313 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
314 |
1 |
public void clickMoreActionsSubMenuEntry(String id)... |
315 |
|
{ |
316 |
1 |
clickSubMenuEntryFromMenu(By.xpath("//div[@id='tmMoreActions']/a[contains(@role, 'button')]"), id); |
317 |
|
} |
318 |
|
|
319 |
|
|
320 |
|
@since |
321 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
322 |
14 |
public void clickAdminActionsSubMenuEntry(String id)... |
323 |
|
{ |
324 |
14 |
clickSubMenuEntryFromMenu(By.xpath("//div[@id='tmAdminActions']/a[contains(@role, 'button')]"), id); |
325 |
|
} |
326 |
|
|
327 |
|
|
328 |
|
@since |
329 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
330 |
82 |
private void clickSubMenuEntryFromMenu(By menuBy, String id)... |
331 |
|
{ |
332 |
|
|
333 |
82 |
getDriver().findElement(menuBy).click(); |
334 |
|
|
335 |
82 |
getDriver().waitUntilElementIsVisible(By.id(id)); |
336 |
|
|
337 |
82 |
getDriver().findElement(By.id(id)).click(); |
338 |
|
} |
339 |
|
|
340 |
|
|
341 |
|
@return |
342 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
343 |
0 |
private boolean isExtraSmallScreen()... |
344 |
|
{ |
345 |
0 |
return getDriver().manage().window().getSize().getWidth() < 768; |
346 |
|
} |
347 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
348 |
0 |
private By getTopMenuToggleSelector(String menuId)... |
349 |
|
{ |
350 |
0 |
String side = isExtraSmallScreen() ? "left" : "right"; |
351 |
0 |
return By.xpath("//li[@id='" + menuId + "']//a[contains(@class, 'dropdown-split-" + side + "')]"); |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
|
@since |
356 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
357 |
15 |
public CreatePagePage createPage()... |
358 |
|
{ |
359 |
15 |
this.tmCreate.click(); |
360 |
15 |
return new CreatePagePage(); |
361 |
|
} |
362 |
|
|
363 |
|
|
364 |
|
@since |
365 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
366 |
3 |
public CopyPage copy()... |
367 |
|
{ |
368 |
3 |
clickAdminActionsSubMenuEntry("tmActionCopy"); |
369 |
3 |
return new CopyPage(); |
370 |
|
} |
371 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
372 |
2 |
public RenamePage rename()... |
373 |
|
{ |
374 |
2 |
clickAdminActionsSubMenuEntry("tmActionRename"); |
375 |
2 |
return new RenamePage(); |
376 |
|
} |
377 |
|
|
378 |
|
|
379 |
|
@since |
380 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
381 |
9 |
public ConfirmationPage delete()... |
382 |
|
{ |
383 |
9 |
clickAdminActionsSubMenuEntry("tmActionDelete"); |
384 |
9 |
return new ConfirmationPage(); |
385 |
|
} |
386 |
|
|
387 |
|
|
388 |
|
@since |
389 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
390 |
1 |
public boolean canDelete()... |
391 |
|
{ |
392 |
1 |
toggleActionMenu(); |
393 |
|
|
394 |
|
|
395 |
1 |
boolean canDelete = getDriver().hasElementWithoutWaiting(By.id("tmActionDelete")); |
396 |
1 |
toggleActionMenu(); |
397 |
1 |
return canDelete; |
398 |
|
} |
399 |
|
|
400 |
|
|
401 |
|
@since |
402 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
403 |
1 |
public void watchDocument()... |
404 |
|
{ |
405 |
1 |
toggleNotificationsMenu(); |
406 |
1 |
this.watchDocumentLink.click(); |
407 |
1 |
toggleActionMenu(); |
408 |
|
} |
409 |
|
|
410 |
|
|
411 |
|
@since |
412 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
413 |
0 |
public boolean hasLoginLink()... |
414 |
|
{ |
415 |
|
|
416 |
|
|
417 |
0 |
return !getDriver().findElementsWithoutWaiting(By.id("tmLogin")).isEmpty(); |
418 |
|
} |
419 |
|
|
420 |
|
|
421 |
|
@since |
422 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
423 |
4 |
public LoginPage login()... |
424 |
|
{ |
425 |
4 |
toggleDrawer(); |
426 |
4 |
this.loginLink.click(); |
427 |
4 |
return new LoginPage(); |
428 |
|
} |
429 |
|
|
430 |
|
|
431 |
|
@since |
432 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
433 |
2 |
public String getCurrentUser()... |
434 |
|
{ |
435 |
2 |
return this.userLink.getText(); |
436 |
|
} |
437 |
|
|
438 |
|
|
439 |
|
@since |
440 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
441 |
0 |
public List<Locale> getLocales()... |
442 |
|
{ |
443 |
0 |
List<WebElement> elements = |
444 |
|
getDriver().findElementsWithoutWaiting(By.xpath("//ul[@id='tmLanguages_menu']/li/a")); |
445 |
0 |
List<Locale> locales = new ArrayList<>(elements.size()); |
446 |
0 |
for (WebElement element : elements) { |
447 |
0 |
String href = element.getAttribute("href"); |
448 |
0 |
Matcher matcher = Pattern.compile(".*\\?.*language=([^=&]*)").matcher(href); |
449 |
0 |
if (matcher.matches()) { |
450 |
0 |
String locale = matcher.group(1); |
451 |
0 |
locales.add(LocaleUtils.toLocale(locale)); |
452 |
|
} |
453 |
|
} |
454 |
|
|
455 |
0 |
return locales; |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
|
@since |
460 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
461 |
0 |
public ViewPage clickLocale(Locale locale)... |
462 |
|
{ |
463 |
|
|
464 |
0 |
toggleDrawer(); |
465 |
|
|
466 |
|
|
467 |
0 |
WebElement languagesElement = getDriver().findElementWithoutWaiting(By.xpath("//a[@id='tmLanguages']")); |
468 |
0 |
languagesElement.click(); |
469 |
|
|
470 |
|
|
471 |
0 |
WebElement localeElement = getDriver().findElementWithoutWaiting( |
472 |
|
By.xpath("//ul[@id='tmLanguages_menu']/li/a[contains(@href,'language=" + locale + "')]")); |
473 |
0 |
localeElement.click(); |
474 |
|
|
475 |
0 |
return new ViewPage(); |
476 |
|
} |
477 |
|
|
478 |
|
|
479 |
|
@since |
480 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
481 |
3 |
public void logout()... |
482 |
|
{ |
483 |
3 |
toggleDrawer(); |
484 |
3 |
getDriver().findElement(By.id("tmLogout")).click(); |
485 |
|
|
486 |
|
|
487 |
|
|
488 |
3 |
getUtil().recacheSecretToken(); |
489 |
|
} |
490 |
|
|
491 |
|
|
492 |
|
@since |
493 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
494 |
0 |
public RegistrationPage register()... |
495 |
|
{ |
496 |
0 |
toggleDrawer(); |
497 |
0 |
this.registerLink.click(); |
498 |
0 |
return new RegistrationPage(); |
499 |
|
} |
500 |
|
|
501 |
|
|
502 |
|
@since |
503 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
504 |
42 |
public String getDocumentTitle()... |
505 |
|
{ |
506 |
42 |
return this.documentTitle.getText(); |
507 |
|
} |
508 |
|
|
509 |
|
|
510 |
|
@since |
511 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
512 |
2 |
public void watchSpace()... |
513 |
|
{ |
514 |
2 |
toggleNotificationsMenu(); |
515 |
2 |
this.watchSpaceLink.click(); |
516 |
2 |
toggleNotificationsMenu(); |
517 |
|
} |
518 |
|
|
519 |
|
|
520 |
|
@since |
521 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
522 |
1 |
public void watchWiki()... |
523 |
|
{ |
524 |
1 |
toggleNotificationsMenu(); |
525 |
1 |
this.watchWikiLink.click(); |
526 |
1 |
toggleNotificationsMenu(); |
527 |
|
} |
528 |
|
|
529 |
|
|
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
@since |
536 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
537 |
1347 |
public void waitUntilPageJSIsLoaded()... |
538 |
|
{ |
539 |
|
|
540 |
1347 |
getDriver().waitUntilJavascriptCondition("return window.Prototype != null && window.Prototype.Version != null"); |
541 |
|
|
542 |
|
|
543 |
|
|
544 |
1347 |
getDriver().waitUntilJavascriptCondition("return window.jQuery != null && window.jQuery().dropdown != null"); |
545 |
|
} |
546 |
|
|
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
@return |
551 |
|
@since |
552 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
553 |
1 |
public ChildrenViewer viewChildren()... |
554 |
|
{ |
555 |
1 |
toggleActionMenu(); |
556 |
1 |
this.childrenLink.click(); |
557 |
1 |
return new ChildrenViewer(); |
558 |
|
} |
559 |
|
|
560 |
|
|
561 |
|
|
562 |
|
|
563 |
|
@return |
564 |
|
@since |
565 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
566 |
0 |
public boolean hasNotificationsMenu()... |
567 |
|
{ |
568 |
0 |
return getDriver().hasElementWithoutWaiting(By.id("tmNotifications")); |
569 |
|
} |
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
|
574 |
|
@since |
575 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
576 |
7 |
public void toggleNotificationsMenu()... |
577 |
|
{ |
578 |
7 |
boolean hasMenu = isNotificationsMenuOpen(); |
579 |
7 |
this.notificationsMenu.click(); |
580 |
7 |
if (hasMenu) { |
581 |
3 |
getDriver().waitUntilElementDisappears(this.notificationsMenu, By.className("dropdown-menu")); |
582 |
|
} else { |
583 |
4 |
getDriver().waitUntilElementIsVisible(this.notificationsMenu, By.className("dropdown-menu")); |
584 |
|
} |
585 |
|
} |
586 |
|
|
587 |
|
|
588 |
|
@return |
589 |
|
@since |
590 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
591 |
7 |
public boolean isNotificationsMenuOpen()... |
592 |
|
{ |
593 |
7 |
return this.notificationsMenu.findElement(By.className("dropdown-menu")).isDisplayed(); |
594 |
|
} |
595 |
|
|
596 |
|
|
597 |
|
@return |
598 |
|
@since |
599 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
600 |
0 |
public String getErrorContent()... |
601 |
|
{ |
602 |
0 |
return getDriver() |
603 |
|
.findElementWithoutWaiting(By.xpath("//div[@id = 'mainContentArea']/pre[contains(@class, 'xwikierror')]")) |
604 |
|
.getText(); |
605 |
|
} |
606 |
|
} |