1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.wysiwyg.framework; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.xwiki.test.ui.XWikiWebDriver; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
@version |
29 |
|
|
|
|
| 70% |
Uncovered Elements: 6 (20) |
Complexity: 10 |
Complexity Density: 1 |
|
30 |
|
public class TreeSuggestionsPane |
31 |
|
{ |
32 |
|
private final XWikiWebDriver driver; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@param |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
26 |
public TreeSuggestionsPane(XWikiWebDriver driver)... |
40 |
|
{ |
41 |
26 |
this.driver = driver; |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0 |
public void selectSpace(String spaceName)... |
50 |
|
{ |
51 |
0 |
select(spaceName, "space"); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
16 |
public void selectPage(String pageTitle)... |
60 |
|
{ |
61 |
16 |
select(pageTitle, "document"); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
@param |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
5 |
public void selectAttachment(String fileName)... |
70 |
|
{ |
71 |
5 |
select(fileName, "attachment"); |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
@param |
78 |
|
@param |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
21 |
private void select(String value, String type)... |
81 |
|
{ |
82 |
21 |
this.driver.findElementByXPath(getSuggestionSelector(value, type)).click(); |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
@return |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
public boolean hasSpace(String spaceName)... |
90 |
|
{ |
91 |
0 |
return hasSuggestion(spaceName, "space"); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
@param |
96 |
|
@return |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
4 |
public boolean hasPage(String pageTitle)... |
99 |
|
{ |
100 |
4 |
return hasSuggestion(pageTitle, "document"); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
@param |
105 |
|
@return |
106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
0 |
public boolean hasAttachment(String fileName)... |
108 |
|
{ |
109 |
0 |
return hasSuggestion(fileName, "attachment"); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@param |
114 |
|
@param |
115 |
|
@return |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
117 |
4 |
private boolean hasSuggestion(String value, String type)... |
118 |
|
{ |
119 |
4 |
return this.driver.hasElementWithoutWaiting(By.xpath(getSuggestionSelector(value, type))); |
120 |
|
} |
121 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
25 |
private String getSuggestionSelector(String value, String type)... |
123 |
|
{ |
124 |
25 |
return String.format("//div[contains(@class, 'xtree-finder-suggestions')]" |
125 |
|
+ "//div[contains(@class, 'suggestItem') and contains(@class, '%s')]" |
126 |
|
+ "//div[@class = 'value' and contains(., '%s')]", type, value); |
127 |
|
} |
128 |
|
} |