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.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.openqa.selenium.By; |
26 |
|
import org.openqa.selenium.WebDriver; |
27 |
|
import org.openqa.selenium.WebElement; |
28 |
|
import org.openqa.selenium.support.ui.ExpectedCondition; |
29 |
|
import org.xwiki.test.ui.XWikiWebDriver; |
30 |
|
import org.xwiki.test.ui.po.BaseElement; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 6 |
Complexity Density: 0.6 |
|
38 |
|
public class ExtensionDependenciesPane extends BaseElement |
39 |
|
{ |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
private final WebElement container; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@param |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
8 |
public ExtensionDependenciesPane(WebElement container)... |
51 |
|
{ |
52 |
8 |
this.container = container; |
53 |
|
} |
54 |
|
|
55 |
|
|
56 |
|
@return |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
58 |
2 |
public List<DependencyPane> getDirectDependencies()... |
59 |
|
{ |
60 |
|
|
61 |
2 |
getDriver().waitUntilCondition(new ExpectedCondition<WebElement>() |
62 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
63 |
3 |
@Override... |
64 |
|
public WebElement apply(WebDriver driver) |
65 |
|
{ |
66 |
3 |
return ((XWikiWebDriver) driver).findElementsWithoutWaiting(container, |
67 |
|
By.className("extension-item-loading")).size() > 0 ? null : container; |
68 |
|
} |
69 |
|
}); |
70 |
2 |
return getDependenciesAfter("This extension depends on:"); |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
@return |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
2 |
public List<DependencyPane> getBackwardDependencies()... |
77 |
|
{ |
78 |
2 |
return getDependenciesAfter("This extension is required by:"); |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
@param |
83 |
|
@return |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
85 |
9 |
List<DependencyPane> getDependenciesAfter(String label)... |
86 |
|
{ |
87 |
9 |
By xpath = |
88 |
|
By.xpath(".//*[contains(@class, 'dependency-item') and ancestor::dd[preceding-sibling::dt[starts-with(., '" |
89 |
|
+ label + "')]]]"); |
90 |
9 |
List<DependencyPane> dependencies = new ArrayList<DependencyPane>(); |
91 |
9 |
for (WebElement element : getDriver().findElementsWithoutWaiting(container, xpath)) { |
92 |
15 |
dependencies.add(new DependencyPane(element)); |
93 |
|
} |
94 |
9 |
return dependencies; |
95 |
|
} |
96 |
|
} |