1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.index.test.po; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.WebElement; |
26 |
|
import org.openqa.selenium.support.FindBy; |
27 |
|
import org.xwiki.test.ui.po.BaseElement; |
28 |
|
import org.xwiki.test.ui.po.CreatePagePage; |
29 |
|
import org.xwiki.test.ui.po.ViewPage; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 95% |
Uncovered Elements: 1 (20) |
Complexity: 4 |
Complexity Density: 0.27 |
|
37 |
|
public class SpacesMacroPane extends BaseElement |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@FindBy(linkText = "Create a new space") |
43 |
|
private WebElement spaceCreateFormToggleSwitch; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@FindBy(id = "spSpaceCreateTextInput") |
49 |
|
private WebElement spaceNameTextField; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@param |
55 |
|
@return |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
57 |
1 |
public CreatePagePage createSpace(String spaceName)... |
58 |
|
{ |
59 |
1 |
this.spaceCreateFormToggleSwitch.click(); |
60 |
1 |
this.spaceNameTextField.clear(); |
61 |
1 |
this.spaceNameTextField.sendKeys(spaceName); |
62 |
1 |
this.spaceNameTextField.submit(); |
63 |
1 |
return new CreatePagePage(); |
64 |
|
} |
65 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
66 |
1 |
public SpaceIndexPage clickSpaceIndex(String spaceName)... |
67 |
|
{ |
68 |
1 |
String escapedSpaceName = getUtil().escapeURL(spaceName); |
69 |
|
|
70 |
|
|
71 |
1 |
for (WebElement liElement : getDriver().findElementsWithoutWaiting(By.xpath("//li[contains(@class, 'xitem')]"))) |
72 |
|
{ |
73 |
3 |
List<WebElement> elements = getDriver().findElementsWithoutWaiting(liElement, |
74 |
|
By.xpath(".//a[contains(@href, 'SpaceIndex?space=" + escapedSpaceName + "')]")); |
75 |
3 |
if (!elements.isEmpty()) { |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
1 |
getDriver().executeJavascript("arguments[0].setAttribute('class', '')", liElement); |
81 |
|
|
82 |
|
|
83 |
1 |
elements.get(0).click(); |
84 |
1 |
return new SpaceIndexPage(); |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
0 |
throw new RuntimeException("Was unable to click on space index for [" + spaceName + "]"); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@param |
95 |
|
@return |
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
97 |
1 |
public ViewPage clickSpaceHome(String spaceName)... |
98 |
|
{ |
99 |
1 |
getDriver().findElement(By.xpath("//div[@class = 'spSpaceName']/a[. = '" + spaceName + "']")).click(); |
100 |
1 |
return new ViewPage(); |
101 |
|
} |
102 |
|
} |