1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.xclass.test.po; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.WebElement; |
24 |
|
import org.openqa.selenium.support.FindBy; |
25 |
|
import org.xwiki.test.ui.po.DocumentPicker; |
26 |
|
import org.xwiki.test.ui.po.InlinePage; |
27 |
|
import org.xwiki.test.ui.po.LiveTableElement; |
28 |
|
import org.xwiki.test.ui.po.ViewPage; |
29 |
|
import org.xwiki.test.ui.po.editor.ClassEditPage; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 15 |
Complexity Density: 0.5 |
|
37 |
|
public class ClassSheetPage extends ViewPage |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@FindBy(partialLinkText = "View the template page") |
43 |
|
private WebElement templateLink; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@FindBy(partialLinkText = "View the sheet page") |
49 |
|
private WebElement sheetLink; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@FindBy(xpath = "//*[contains(@class, 'warningmessage')]//a[. = 'class editor']") |
55 |
|
private WebElement defineClassLink; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@FindBy(linkText = "add or modify the class properties") |
61 |
|
private WebElement editClassLink; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@FindBy(xpath = "//input[@class = 'button' and @value = 'Create the sheet']") |
67 |
|
private WebElement createSheetButton; |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
@FindBy(xpath = "//*[contains(@class, 'warningmessage')]//a[. = 'Bind the sheet to the class \u00BB']") |
73 |
|
private WebElement bindSheetLink; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@FindBy(xpath = "//input[@class = 'button' and @value = 'Create the template']") |
79 |
|
private WebElement createTemplateButton; |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@FindBy(xpath = "//*[contains(@class, 'warningmessage')]//a[contains(., ' object to the template \u00BB')]") |
85 |
|
private WebElement addObjectToTemplateLink; |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
private DocumentPicker documentPicker; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
@FindBy(xpath = "//input[@class = 'button' and @value = 'Create this page']") |
96 |
|
private WebElement createDocumentButton; |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
private LiveTableElement classEntriesLiveTable = new LiveTableElement("classEntries"); |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
@return |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
108 |
7 |
public ViewPage clickTemplateLink()... |
109 |
|
{ |
110 |
7 |
templateLink.click(); |
111 |
7 |
return new ViewPage(); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@return |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
119 |
1 |
public ViewPage clickSheetLink()... |
120 |
|
{ |
121 |
1 |
sheetLink.click(); |
122 |
1 |
return new ViewPage(); |
123 |
|
} |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
@return |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
130 |
1 |
public ClassEditPage clickDefineClassLink()... |
131 |
|
{ |
132 |
1 |
defineClassLink.click(); |
133 |
1 |
return new ClassEditPage(); |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
@return |
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
141 |
1 |
public ClassEditPage clickEditClassLink()... |
142 |
|
{ |
143 |
1 |
editClassLink.click(); |
144 |
1 |
return new ClassEditPage(); |
145 |
|
} |
146 |
|
|
147 |
|
|
148 |
|
@param |
149 |
|
@param |
150 |
|
@param |
151 |
|
@return |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
153 |
2 |
public boolean hasProperty(String name, String prettyName, String type)... |
154 |
|
{ |
155 |
|
|
156 |
2 |
String xpath = String.format("//li[. = '%s (%s: %s)']", prettyName, name, type); |
157 |
2 |
return getDriver().findElementsWithoutWaiting(By.xpath(xpath)).size() == 1; |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
@return |
164 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
165 |
1 |
public ClassSheetPage clickCreateSheetButton()... |
166 |
|
{ |
167 |
1 |
createSheetButton.click(); |
168 |
|
|
169 |
1 |
return new ClassSheetPage(); |
170 |
|
} |
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
@return |
176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
177 |
1 |
public ClassSheetPage clickBindSheetLink()... |
178 |
|
{ |
179 |
1 |
bindSheetLink.click(); |
180 |
|
|
181 |
1 |
return new ClassSheetPage(); |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
@return |
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
189 |
1 |
public ClassSheetPage clickCreateTemplateButton()... |
190 |
|
{ |
191 |
1 |
createTemplateButton.click(); |
192 |
1 |
return new ClassSheetPage(); |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
@return |
199 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
200 |
1 |
public ClassSheetPage clickAddObjectToTemplateLink()... |
201 |
|
{ |
202 |
1 |
addObjectToTemplateLink.click(); |
203 |
1 |
return new ClassSheetPage(); |
204 |
|
} |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
206 |
5 |
public DocumentPicker getNewPagePicker()... |
207 |
|
{ |
208 |
5 |
if (this.documentPicker == null) { |
209 |
2 |
this.documentPicker = new DocumentPicker(); |
210 |
|
} |
211 |
5 |
return this.documentPicker; |
212 |
|
} |
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
@return |
218 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
219 |
2 |
public InlinePage clickCreateDocumentButton()... |
220 |
|
{ |
221 |
2 |
createDocumentButton.click(); |
222 |
2 |
return new InlinePage(); |
223 |
|
} |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
@param |
229 |
|
@param |
230 |
|
@return |
231 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
232 |
2 |
public InlinePage createNewDocument(String spaceName, String pageName)... |
233 |
|
{ |
234 |
2 |
getNewPagePicker().setParent(spaceName); |
235 |
2 |
getNewPagePicker().setName(pageName); |
236 |
2 |
return clickCreateDocumentButton(); |
237 |
|
} |
238 |
|
|
239 |
|
|
240 |
|
@param |
241 |
|
@return |
242 |
|
|
243 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
244 |
1 |
public boolean hasDocument(String documentName)... |
245 |
|
{ |
246 |
1 |
this.classEntriesLiveTable.filterColumn("xwiki-livetable-classEntries-filter-2", documentName); |
247 |
|
|
248 |
1 |
return this.classEntriesLiveTable.getRowCount() > 0; |
249 |
|
} |
250 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
251 |
10 |
@Override... |
252 |
|
public ClassSheetPage waitUntilPageIsLoaded() |
253 |
|
{ |
254 |
10 |
this.classEntriesLiveTable.waitUntilReady(); |
255 |
10 |
return this; |
256 |
|
} |
257 |
|
} |