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 |
|
|
25 |
|
import org.openqa.selenium.By; |
26 |
|
import org.openqa.selenium.WebElement; |
27 |
|
import org.openqa.selenium.support.FindBy; |
28 |
|
import org.xwiki.test.ui.po.diff.DocumentDiffSummary; |
29 |
|
import org.xwiki.test.ui.po.diff.EntityDiff; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 7 |
Complexity Density: 0.64 |
|
37 |
|
public class ChangesPane extends BaseElement |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@FindBy(id = "changescontent") |
43 |
|
private WebElement container; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@FindBy(id = "changes-info-box-from") |
49 |
|
private WebElement fromVersionSummary; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@FindBy(id = "changes-info-box-to") |
55 |
|
private WebElement toVersionSummary; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@FindBy(id = "changes-info-comment") |
61 |
|
private WebElement changeComment; |
62 |
|
|
63 |
|
@FindBy(className = "diff-summary") |
64 |
|
private WebElement diffSummary; |
65 |
|
|
66 |
|
|
67 |
|
@return |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
1 |
public String getFromVersionSummary()... |
70 |
|
{ |
71 |
1 |
return fromVersionSummary.getText(); |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
@return |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
1 |
public String getToVersionSummary()... |
78 |
|
{ |
79 |
1 |
return toVersionSummary.getText(); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
@return |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
1 |
public String getChangeComment()... |
86 |
|
{ |
87 |
1 |
return changeComment.getText(); |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
@return |
92 |
|
|
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
1 |
public boolean hasNoChanges()... |
95 |
|
{ |
96 |
1 |
return getDriver().findElementsWithoutWaiting(container, |
97 |
|
By.xpath("div[@class = 'infomessage' and . = 'No changes']")).size() > 0 |
98 |
|
&& getChangedEntities().isEmpty(); |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
@return |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
2 |
public DocumentDiffSummary getDiffSummary()... |
105 |
|
{ |
106 |
2 |
return new DocumentDiffSummary(this.diffSummary); |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
@return |
111 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
112 |
3 |
public List<String> getChangedEntities()... |
113 |
|
{ |
114 |
3 |
List<WebElement> elements = getDriver().findElementsWithoutWaiting(By.xpath("//dl[@class = 'diff-group']/dt")); |
115 |
3 |
List<String> labels = new ArrayList<>(); |
116 |
3 |
for (WebElement element : elements) { |
117 |
7 |
labels.add(element.getText().trim()); |
118 |
|
} |
119 |
3 |
return labels; |
120 |
|
} |
121 |
|
|
122 |
|
|
123 |
|
@param |
124 |
|
@return |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
10 |
public EntityDiff getEntityDiff(String label)... |
127 |
|
{ |
128 |
10 |
return new EntityDiff(this.container.findElement(By |
129 |
|
.xpath("//dd[parent::dl[@class = 'diff-group'] and preceding-sibling::dt[normalize-space(.) = '" + label |
130 |
|
+ "']]"))); |
131 |
|
} |
132 |
|
} |