1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.test.po; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.WebElement; |
26 |
|
import org.xwiki.extension.ExtensionId; |
27 |
|
import org.xwiki.test.ui.po.BaseElement; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 93.8% |
Uncovered Elements: 2 (32) |
Complexity: 11 |
Complexity Density: 0.65 |
|
35 |
|
public class DependencyPane extends BaseElement |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
private final WebElement container; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
@param |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
15 |
public DependencyPane(WebElement container)... |
48 |
|
{ |
49 |
15 |
this.container = container; |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
@return |
54 |
|
|
55 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
56 |
11 |
public String getStatus()... |
57 |
|
{ |
58 |
11 |
String[] classNames = container.getAttribute("class").split("\\s+"); |
59 |
11 |
if (classNames.length < 2) { |
60 |
0 |
return null; |
61 |
|
} |
62 |
11 |
return classNames[1].substring("extension-item-".length()); |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
@return |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
68 |
11 |
public String getStatusMessage()... |
69 |
|
{ |
70 |
11 |
List<WebElement> found = getDriver().findElementsWithoutWaiting(container, By.className("extension-status")); |
71 |
11 |
return found.size() > 0 ? found.get(0).getText() : null; |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
@return |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
77 |
19 |
public WebElement getLink()... |
78 |
|
{ |
79 |
19 |
By linkLocator = By.cssSelector("a.extension-link"); |
80 |
19 |
List<WebElement> found = getDriver().findElementsWithoutWaiting(container, linkLocator); |
81 |
19 |
return found.isEmpty() ? null : found.get(0); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
@return |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
87 |
14 |
public String getName()... |
88 |
|
{ |
89 |
14 |
WebElement link = getLink(); |
90 |
14 |
if (link != null) { |
91 |
13 |
return link.getText(); |
92 |
|
} |
93 |
|
|
94 |
1 |
String innerText = container.getText(); |
95 |
1 |
return innerText.substring(0, innerText.indexOf(getVersion())); |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
@return |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
15 |
public String getVersion()... |
102 |
|
{ |
103 |
15 |
return getDriver().findElementWithoutWaiting(container, By.className("extension-version")).getText(); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
7 |
public ExtensionId getId()... |
110 |
|
{ |
111 |
7 |
return new ExtensionId(getName(), getVersion()); |
112 |
|
} |
113 |
|
} |