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.regex.Matcher; |
23 |
|
import java.util.regex.Pattern; |
24 |
|
|
25 |
|
import org.openqa.selenium.By; |
26 |
|
import org.openqa.selenium.WebElement; |
27 |
|
import org.xwiki.test.ui.po.BaseElement; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 4 |
Complexity Density: 0.67 |
|
35 |
|
public class ProgressBarPane extends BaseElement |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
private static final Pattern PERCENT_PATTERN = Pattern.compile("(\\d+)%"); |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
private final WebElement container; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
1 |
public ProgressBarPane(WebElement container)... |
53 |
|
{ |
54 |
1 |
this.container = container; |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
@return |
59 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
60 |
1 |
public int getPercent()... |
61 |
|
{ |
62 |
1 |
WebElement progressBar = getDriver().findElementWithoutWaiting(container, By.className("ui-progress-bar")); |
63 |
1 |
String style = progressBar.getAttribute("style"); |
64 |
1 |
Matcher matcher = PERCENT_PATTERN.matcher(style); |
65 |
1 |
return matcher.find() ? Integer.parseInt(matcher.group(1)) : -1; |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
@return |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
2 |
public String getMessage()... |
72 |
|
{ |
73 |
2 |
return getDriver().findElementWithoutWaiting(container, By.className("ui-progress-message")).getText(); |
74 |
|
} |
75 |
|
} |