1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.administration.test.po; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.WebElement; |
26 |
|
import org.openqa.selenium.support.FindBy; |
27 |
|
import org.xwiki.test.ui.po.InlinePage; |
28 |
|
import org.xwiki.test.ui.po.Select; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@version |
34 |
|
@since |
35 |
|
|
|
|
| 24.5% |
Uncovered Elements: 37 (49) |
Complexity: 18 |
Complexity Density: 0.64 |
|
36 |
|
public class TemplateProviderInlinePage extends InlinePage |
37 |
|
{ |
38 |
|
public static final String ACTION_SAVEANDEDIT = "saveandedit"; |
39 |
|
|
40 |
|
public static final String ACTION_EDITONLY = "edit"; |
41 |
|
|
42 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_template") |
43 |
|
private WebElement templateInput; |
44 |
|
|
45 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_name") |
46 |
|
private WebElement templateNameInput; |
47 |
|
|
48 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_type") |
49 |
|
private WebElement templateTypeSelect; |
50 |
|
|
51 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_terminal") |
52 |
|
private WebElement terminalSelect; |
53 |
|
|
54 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_action") |
55 |
|
private WebElement templateActionSelect; |
56 |
|
|
57 |
|
private LocationPicker creationRestrictionsPicker = |
58 |
|
new LocationPicker("XWiki.TemplateProviderClass_0_creationRestrictions"); |
59 |
|
|
60 |
|
@FindBy(name = "XWiki.TemplateProviderClass_0_creationRestrictionsAreSuggestions") |
61 |
|
private WebElement creationRestrictionsAreSuggestionsCheckbox; |
62 |
|
|
63 |
|
private LocationPicker visibilityRestrictionsPicker = |
64 |
|
new LocationPicker("XWiki.TemplateProviderClass_0_visibilityRestrictions"); |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0 |
public String getTemplateName()... |
67 |
|
{ |
68 |
0 |
return this.templateNameInput.getAttribute("value"); |
69 |
|
} |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
71 |
3 |
public void setTemplateName(String value)... |
72 |
|
{ |
73 |
3 |
this.templateNameInput.clear(); |
74 |
3 |
this.templateNameInput.sendKeys(value); |
75 |
|
} |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
0 |
public String getTemplate()... |
78 |
|
{ |
79 |
0 |
return this.templateInput.getAttribute("value"); |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
82 |
3 |
public void setTemplate(String value)... |
83 |
|
{ |
84 |
3 |
this.templateInput.clear(); |
85 |
3 |
this.templateInput.sendKeys(value); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0 |
public boolean isPageTemplate()... |
89 |
|
{ |
90 |
0 |
return this.templateTypeSelect.findElement(By.xpath("//option[@value='page']")).isSelected(); |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
93 |
0 |
public void setPageTemplate(boolean isPageTemplate)... |
94 |
|
{ |
95 |
0 |
Select select = new Select(this.templateTypeSelect); |
96 |
|
|
97 |
0 |
String value; |
98 |
0 |
if (isPageTemplate) { |
99 |
0 |
value = "page"; |
100 |
|
} else { |
101 |
0 |
value = "space"; |
102 |
|
} |
103 |
|
|
104 |
0 |
select.selectByValue(value); |
105 |
|
} |
106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
0 |
public boolean isTerminal()... |
108 |
|
{ |
109 |
0 |
return this.terminalSelect.findElement(By.xpath("//option[@value='1']")).isSelected(); |
110 |
|
} |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
112 |
0 |
public void setTerminal(boolean isTerminal)... |
113 |
|
{ |
114 |
0 |
Select select = new Select(this.terminalSelect); |
115 |
|
|
116 |
0 |
String value; |
117 |
0 |
if (isTerminal) { |
118 |
0 |
value = "1"; |
119 |
|
} else { |
120 |
0 |
value = "0"; |
121 |
|
} |
122 |
|
|
123 |
0 |
select.selectByValue(value); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
|
@return |
128 |
|
@since |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
0 |
public List<String> getVisibilityRestrictions()... |
131 |
|
{ |
132 |
0 |
return this.visibilityRestrictionsPicker.getValue(); |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
@param |
137 |
|
@since |
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
1 |
public void setVisibilityRestrictions(List<String> spaces)... |
140 |
|
{ |
141 |
1 |
this.visibilityRestrictionsPicker.setValue(spaces); |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
@param |
146 |
|
@since |
147 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
1 |
public void setCreationRestrictions(List<String> spaces)... |
149 |
|
{ |
150 |
1 |
this.creationRestrictionsPicker.setValue(spaces); |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
@return |
155 |
|
@since |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0 |
public List<String> getCreationRestrictions()... |
158 |
|
{ |
159 |
0 |
return this.creationRestrictionsPicker.getValue(); |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
@param |
167 |
|
@link@link |
168 |
|
@since |
169 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
170 |
1 |
public void setActionOnCreate(String actionName)... |
171 |
|
{ |
172 |
1 |
this.templateActionSelect.findElement(By.xpath("//option[@value='" + actionName + "']")).click(); |
173 |
|
} |
174 |
|
|
175 |
|
|
176 |
|
@return |
177 |
|
@since |
178 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
0 |
public boolean isCreationRestrictionsSuggestions()... |
180 |
|
{ |
181 |
0 |
return this.creationRestrictionsAreSuggestionsCheckbox.isSelected(); |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
@param |
186 |
|
@since |
187 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
188 |
0 |
public void setCreationRestrictionsSuggestions(boolean selected)... |
189 |
|
{ |
190 |
0 |
if (this.creationRestrictionsAreSuggestionsCheckbox.isSelected() != selected) { |
191 |
0 |
this.creationRestrictionsAreSuggestionsCheckbox.click(); |
192 |
|
} |
193 |
|
} |
194 |
|
} |