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; |
21 |
|
|
22 |
|
import org.junit.Test; |
23 |
|
import org.openqa.selenium.By; |
24 |
|
import org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase; |
25 |
|
import org.xwiki.test.wysiwyg.framework.XWikiExplorer; |
26 |
|
|
27 |
|
import static org.junit.Assert.*; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@version |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (466) |
Complexity: 31 |
Complexity Density: 0.07 |
|
35 |
|
public class ImageTest extends AbstractWysiwygTestCase |
36 |
|
{ |
37 |
|
public static final String MENU_IMAGE = "Image"; |
38 |
|
|
39 |
|
public static final String MENU_INSERT_ATTACHED_IMAGE = "Attached Image..."; |
40 |
|
|
41 |
|
public static final String MENU_INSERT_EXTERNAL_IMAGE = "External Image..."; |
42 |
|
|
43 |
|
public static final String MENU_EDIT_IMAGE = "Edit Image..."; |
44 |
|
|
45 |
|
public static final String MENU_REMOVE_IMAGE = "Remove Image"; |
46 |
|
|
47 |
|
public static final String STEP_SELECTOR = "xSelectorAggregatorStep"; |
48 |
|
|
49 |
|
public static final String STEP_EXPLORER = "xImagesExplorer"; |
50 |
|
|
51 |
|
public static final String STEP_EXTERNAL_IMAGE = "xExternalImage"; |
52 |
|
|
53 |
|
public static final String STEP_CONFIG = "xImageConfig"; |
54 |
|
|
55 |
|
public static final String STEP_CURRENT_PAGE_SELECTOR = "xImagesSelector"; |
56 |
|
|
57 |
|
public static final String STEP_UPLOAD = "xUploadPanel"; |
58 |
|
|
59 |
|
public static final String TAB_CURRENT_PAGE = "Current page"; |
60 |
|
|
61 |
|
public static final String TAB_ALL_PAGES = "All pages"; |
62 |
|
|
63 |
|
public static final String BUTTON_SELECT = "Select"; |
64 |
|
|
65 |
|
public static final String BUTTON_INSERT_IMAGE = "Insert Image"; |
66 |
|
|
67 |
|
public static final String BUTTON_CHANGE_IMAGE = "Change Image"; |
68 |
|
|
69 |
|
public static final String BUTTON_IMAGE_SETTINGS = "Image Settings"; |
70 |
|
|
71 |
|
public static final String BUTTON_PREVIOUS = "Previous"; |
72 |
|
|
73 |
|
public static final String INPUT_WIDTH = "//div[contains(@class, \"xSizePanel\")]//input[1]"; |
74 |
|
|
75 |
|
public static final String INPUT_HEIGHT = "//div[contains(@class, \"xSizePanel\")]//input[2]"; |
76 |
|
|
77 |
|
public static final String INPUT_ALT = "//div[contains(@class, \"xAltPanel\")]//input"; |
78 |
|
|
79 |
|
public static final String IMAGES_LIST = "//div[contains(@class, 'xListBox')]"; |
80 |
|
|
81 |
|
public static final String FILE_UPLOAD_INPUT = "//input[contains(@class, 'gwt-FileUpload')]"; |
82 |
|
|
83 |
|
public static final String INPUT_EXTERNAL_IMAGE_LOCATION = "//input[@title = 'Image location']"; |
84 |
|
|
85 |
|
public static final String ERROR_MSG_CLASS = "xErrorMsg"; |
86 |
|
|
87 |
|
public static final String SPACE_SELECTOR = "//div[@class=\"xPageChooser\"]//select[1]"; |
88 |
|
|
89 |
|
public static final String PAGE_SELECTOR = "//div[@class=\"xPageChooser\"]//select[2]"; |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
private XWikiExplorer explorer; |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
96 |
18 |
@Override... |
97 |
|
public void setUp() |
98 |
|
{ |
99 |
18 |
super.setUp(); |
100 |
|
|
101 |
18 |
this.explorer = new XWikiExplorer(getDriver()); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
107 |
1 |
@Test... |
108 |
|
public void testInsertImageFromAllPages() |
109 |
|
{ |
110 |
1 |
String imageSpace = "XWiki"; |
111 |
1 |
String imagePage = "AdminSheet"; |
112 |
1 |
String imageFile = "registration.png"; |
113 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
114 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
115 |
|
|
116 |
1 |
clickTab(TAB_ALL_PAGES); |
117 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
118 |
1 |
selectImage(imageSpace, imagePage, imageFile); |
119 |
1 |
clickButtonWithText(BUTTON_SELECT); |
120 |
1 |
waitForStepToLoad(STEP_CONFIG); |
121 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
122 |
1 |
waitForDialogToClose(); |
123 |
|
|
124 |
1 |
switchToSource(); |
125 |
1 |
assertSourceText("[[image:" + imageSpace + "." + imagePage + "@" + imageFile + "]]"); |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
131 |
1 |
@Test... |
132 |
|
public void testInsertAndEditImageFromAllPages() |
133 |
|
{ |
134 |
1 |
String imageSpace = "Blog"; |
135 |
1 |
String imagePage = "Categories"; |
136 |
1 |
String imageFile = "icon.png"; |
137 |
|
|
138 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
139 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
140 |
|
|
141 |
1 |
clickTab(TAB_ALL_PAGES); |
142 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
143 |
1 |
selectImage(imageSpace, imagePage, imageFile); |
144 |
1 |
clickButtonWithText(BUTTON_SELECT); |
145 |
1 |
waitForStepToLoad(STEP_CONFIG); |
146 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
147 |
1 |
moveCaret("document.body", 1); |
148 |
1 |
typeText("x"); |
149 |
|
|
150 |
|
|
151 |
1 |
selectNode("document.body.firstChild"); |
152 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
153 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
154 |
|
|
155 |
1 |
assertImageSelected(imageSpace, imagePage, imageFile); |
156 |
1 |
clickButtonWithText(BUTTON_SELECT); |
157 |
1 |
waitForStepToLoad(STEP_CONFIG); |
158 |
|
|
159 |
1 |
assertEquals(imageFile, getSelenium().getValue(INPUT_ALT)); |
160 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
161 |
|
|
162 |
1 |
switchToSource(); |
163 |
1 |
assertSourceText("[[image:" + imageSpace + "." + imagePage + "@" + imageFile + "]]x"); |
164 |
|
} |
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
169 |
1 |
@Test... |
170 |
|
public void testInsertAndEditImageWithParameters() |
171 |
|
{ |
172 |
1 |
String imageSpace = "XWiki"; |
173 |
1 |
String imagePage = "AdminSheet"; |
174 |
1 |
String imageFile = "rights.png"; |
175 |
|
|
176 |
1 |
applyStyleTitle1(); |
177 |
1 |
typeText("H"); |
178 |
1 |
typeEnter(); |
179 |
|
|
180 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
181 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
182 |
|
|
183 |
1 |
clickTab(TAB_ALL_PAGES); |
184 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
185 |
1 |
selectImage(imageSpace, imagePage, imageFile); |
186 |
1 |
clickButtonWithText(BUTTON_SELECT); |
187 |
1 |
waitForStepToLoad(STEP_CONFIG); |
188 |
|
|
189 |
1 |
getSelenium().type(INPUT_WIDTH, "200"); |
190 |
1 |
getSelenium().type(INPUT_ALT, "No parking sign"); |
191 |
1 |
selectAlignment("CENTER"); |
192 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
193 |
|
|
194 |
|
|
195 |
1 |
getRichTextArea().executeScript("window.getSelection().collapseToEnd()"); |
196 |
|
|
197 |
1 |
typeText("x"); |
198 |
|
|
199 |
1 |
switchToSource(); |
200 |
1 |
assertSourceText("= H =\n\n[[image:XWiki.AdminSheet@rights.png||alt=\"No parking sign\" " |
201 |
|
+ "style=\"display: block; margin-left: auto; margin-right: auto;\" width=\"200\"]]" + "x"); |
202 |
1 |
switchToWysiwyg(); |
203 |
|
|
204 |
|
|
205 |
1 |
selectNode("document.body.getElementsByTagName('img')[0]"); |
206 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
207 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
208 |
|
|
209 |
1 |
assertImageSelected(imageSpace, imagePage, imageFile); |
210 |
1 |
clickButtonWithText(BUTTON_SELECT); |
211 |
1 |
waitForStepToLoad(STEP_CONFIG); |
212 |
1 |
assertEquals("200", getSelenium().getValue(INPUT_WIDTH)); |
213 |
1 |
assertEquals("No parking sign", getSelenium().getValue(INPUT_ALT)); |
214 |
1 |
assertTrue(isAlignmentSelected("CENTER")); |
215 |
|
|
216 |
1 |
getSelenium().type(INPUT_WIDTH, ""); |
217 |
1 |
getSelenium().type(INPUT_HEIGHT, ""); |
218 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
219 |
1 |
waitForDialogToClose(); |
220 |
|
|
221 |
1 |
switchToSource(); |
222 |
1 |
assertSourceText("= H =\n\n[[image:XWiki.AdminSheet@rights.png||alt=\"No parking sign\" " |
223 |
|
+ "style=\"display: block; margin-left: auto; margin-right: auto;\"]]x"); |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
230 |
1 |
@Test... |
231 |
|
public void testDefaultSelection() |
232 |
|
{ |
233 |
1 |
String imageSpace = "XWiki"; |
234 |
1 |
String imagePage = "AdminSheet"; |
235 |
1 |
String imageFile1 = "import.png"; |
236 |
1 |
String imageFile2 = "lf.png"; |
237 |
|
|
238 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
239 |
1 |
waitForStepSelector(); |
240 |
|
|
241 |
1 |
assertElementPresent("//div[contains(@class, \"" + STEP_CURRENT_PAGE_SELECTOR + "\")]"); |
242 |
|
|
243 |
1 |
clickTab(TAB_ALL_PAGES); |
244 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
245 |
1 |
selectImage(imageSpace, imagePage, imageFile1); |
246 |
1 |
clickButtonWithText(BUTTON_SELECT); |
247 |
1 |
waitForStepToLoad(STEP_CONFIG); |
248 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
249 |
1 |
waitForDialogToClose(); |
250 |
|
|
251 |
1 |
moveCaret("document.body", 1); |
252 |
|
|
253 |
1 |
typeText("x"); |
254 |
|
|
255 |
|
|
256 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
257 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
258 |
|
|
259 |
1 |
assertElementPresent("//div[contains(@class, \"" + STEP_CURRENT_PAGE_SELECTOR + "\")]"); |
260 |
|
|
261 |
1 |
clickTab(TAB_ALL_PAGES); |
262 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
263 |
|
|
264 |
1 |
assertEquals(imageSpace, getSelenium().getSelectedValue(SPACE_SELECTOR)); |
265 |
1 |
assertEquals(imagePage, getSelenium().getSelectedValue(PAGE_SELECTOR)); |
266 |
|
|
267 |
1 |
selectImage(imageFile2); |
268 |
1 |
clickButtonWithText(BUTTON_SELECT); |
269 |
1 |
waitForStepToLoad(STEP_CONFIG); |
270 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
271 |
1 |
waitForDialogToClose(); |
272 |
|
|
273 |
1 |
switchToSource(); |
274 |
1 |
assertSourceText("[[image:XWiki.AdminSheet@import.png]]x[[image:XWiki.AdminSheet@lf.png]]"); |
275 |
|
} |
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
280 |
1 |
@Test... |
281 |
|
public void testPreviousPreservesSelection() |
282 |
|
{ |
283 |
1 |
String imageSpace = "XWiki"; |
284 |
1 |
String imagePage = "AdminSheet"; |
285 |
1 |
String imageFile1 = "export.png"; |
286 |
1 |
String imageFile2 = "import.png"; |
287 |
|
|
288 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
289 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
290 |
1 |
clickTab(TAB_ALL_PAGES); |
291 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
292 |
1 |
selectImage(imageSpace, imagePage, imageFile1); |
293 |
|
|
294 |
1 |
clickButtonWithText(BUTTON_SELECT); |
295 |
1 |
waitForStepToLoad(STEP_CONFIG); |
296 |
1 |
clickButtonWithText(BUTTON_CHANGE_IMAGE); |
297 |
|
|
298 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
299 |
|
|
300 |
1 |
getDriver().waitUntilElementIsVisible( |
301 |
|
By.xpath("//*[contains(@class, \"" + STEP_EXPLORER + "\")]//*[contains(@class, \"" |
302 |
|
+ STEP_CURRENT_PAGE_SELECTOR + "\")]")); |
303 |
1 |
assertImageSelected(imageSpace, imagePage, imageFile1); |
304 |
|
|
305 |
1 |
selectImage(imageSpace, imagePage, imageFile2); |
306 |
1 |
clickButtonWithText(BUTTON_SELECT); |
307 |
1 |
waitForStepToLoad(STEP_CONFIG); |
308 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
309 |
|
|
310 |
|
|
311 |
1 |
switchToSource(); |
312 |
1 |
assertSourceText("[[image:" + imageSpace + "." + imagePage + "@" + imageFile2 + "]]"); |
313 |
|
} |
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
318 |
1 |
@Test... |
319 |
|
public void testRemoveImage() |
320 |
|
{ |
321 |
1 |
switchToSource(); |
322 |
1 |
setSourceText("[[image:xwiki:XWiki.AdminSheet@import.png]]Mmmh, cheese!" |
323 |
|
+ "[[image:xwiki:XWiki.AdminSheet@export.png]]"); |
324 |
1 |
switchToWysiwyg(); |
325 |
1 |
selectNode("document.body.firstChild.childNodes[2]"); |
326 |
1 |
clickMenu(MENU_IMAGE); |
327 |
1 |
assertTrue(isMenuEnabled(MENU_REMOVE_IMAGE)); |
328 |
1 |
clickMenu(MENU_REMOVE_IMAGE); |
329 |
|
|
330 |
1 |
switchToSource(); |
331 |
1 |
assertSourceText("[[image:xwiki:XWiki.AdminSheet@import.png]]Mmmh, cheese!"); |
332 |
1 |
switchToWysiwyg(); |
333 |
|
|
334 |
1 |
selectNode("document.body.firstChild.firstChild"); |
335 |
1 |
typeDelete(); |
336 |
|
|
337 |
1 |
switchToSource(); |
338 |
1 |
assertSourceText("Mmmh, cheese!"); |
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
344 |
1 |
@Test... |
345 |
|
public void testNewImageOptionLoadsFileUploadStep() |
346 |
|
{ |
347 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
348 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
349 |
|
|
350 |
|
|
351 |
1 |
getDriver().waitUntilElementIsVisible(By.className("xNewImagePreview")); |
352 |
1 |
getSelenium().click("//div[contains(@class, \"xNewImagePreview\")]"); |
353 |
1 |
clickButtonWithText(BUTTON_SELECT); |
354 |
|
|
355 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
356 |
1 |
closeDialog(); |
357 |
|
|
358 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
359 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
360 |
1 |
clickTab(TAB_ALL_PAGES); |
361 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
362 |
|
|
363 |
|
|
364 |
1 |
String newImageLocator = "//div[@class = 'xImagesExplorer']//div[@class = 'xNewImagePreview']"; |
365 |
1 |
waitForElement(newImageLocator); |
366 |
1 |
getSelenium().click(newImageLocator); |
367 |
1 |
clickButtonWithText(BUTTON_SELECT); |
368 |
|
|
369 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
370 |
1 |
closeDialog(); |
371 |
|
} |
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
377 |
1 |
@Test... |
378 |
|
public void testEditImagePreservesFullReferences() |
379 |
|
{ |
380 |
1 |
switchToSource(); |
381 |
1 |
setSourceText("[[image:xwiki:XWiki.AdminSheet@import.png]] [[image:XWiki.AdminSheet@export.png]]"); |
382 |
1 |
switchToWysiwyg(); |
383 |
|
|
384 |
|
|
385 |
1 |
selectNode("document.body.firstChild.firstChild"); |
386 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
387 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
388 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
389 |
1 |
assertImageSelected("XWiki", "AdminSheet", "import.png"); |
390 |
|
|
391 |
1 |
clickButtonWithText(BUTTON_SELECT); |
392 |
1 |
waitForStepToLoad(STEP_CONFIG); |
393 |
|
|
394 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
395 |
1 |
waitForDialogToClose(); |
396 |
|
|
397 |
|
|
398 |
1 |
selectNode("document.body.firstChild.childNodes[2]"); |
399 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
400 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
401 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
402 |
1 |
assertImageSelected("XWiki", "AdminSheet", "export.png"); |
403 |
|
|
404 |
1 |
clickButtonWithText(BUTTON_SELECT); |
405 |
1 |
waitForStepToLoad(STEP_CONFIG); |
406 |
|
|
407 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
408 |
1 |
waitForDialogToClose(); |
409 |
|
|
410 |
1 |
switchToSource(); |
411 |
1 |
assertSourceText("[[image:xwiki:XWiki.AdminSheet@import.png]] [[image:XWiki.AdminSheet@export.png]]"); |
412 |
|
} |
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (38) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
419 |
1 |
@Test... |
420 |
|
public void testEditImageWithLink() |
421 |
|
{ |
422 |
|
|
423 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
424 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
425 |
|
|
426 |
1 |
clickTab(TAB_ALL_PAGES); |
427 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
428 |
1 |
selectImage("XWiki", "AdminSheet", "registration.png"); |
429 |
1 |
clickButtonWithText(BUTTON_SELECT); |
430 |
1 |
waitForStepToLoad(STEP_CONFIG); |
431 |
|
|
432 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
433 |
1 |
waitForDialogToClose(); |
434 |
|
|
435 |
1 |
selectNode("document.body.firstChild"); |
436 |
|
|
437 |
|
|
438 |
1 |
clickMenu(LinkTest.MENU_LINK); |
439 |
1 |
clickMenu(LinkTest.MENU_WIKI_PAGE); |
440 |
1 |
waitForDialogToLoad(); |
441 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
442 |
|
|
443 |
1 |
clickTab(TAB_ALL_PAGES); |
444 |
1 |
waitForStepToLoad(LinkTest.STEP_EXPLORER); |
445 |
1 |
explorer.waitForIt().findAndSelectPage("First blog post"); |
446 |
1 |
clickButtonWithText(BUTTON_SELECT); |
447 |
1 |
waitForStepToLoad("xLinkConfig"); |
448 |
1 |
assertEquals("registration.png", getInputValue(LinkTest.LABEL_INPUT_TITLE)); |
449 |
|
|
450 |
1 |
assertFalse(getSelenium().isEditable("//input[@title=\"" + LinkTest.LABEL_INPUT_TITLE + "\"]")); |
451 |
|
|
452 |
1 |
clickButtonWithText("Create Link"); |
453 |
1 |
waitForDialogToClose(); |
454 |
|
|
455 |
|
|
456 |
1 |
selectNode("document.body.firstChild.firstChild"); |
457 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
458 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
459 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
460 |
1 |
assertImageSelected("XWiki", "AdminSheet", "registration.png"); |
461 |
1 |
selectImage("Sandbox", "WebHome", "XWikiLogo.png"); |
462 |
1 |
clickButtonWithText(BUTTON_SELECT); |
463 |
1 |
waitForStepToLoad(STEP_CONFIG); |
464 |
|
|
465 |
1 |
getSelenium().type(INPUT_ALT, ""); |
466 |
|
|
467 |
|
|
468 |
|
|
469 |
|
|
470 |
|
|
471 |
1 |
getSelenium().type(INPUT_WIDTH, ""); |
472 |
1 |
getSelenium().type(INPUT_HEIGHT, ""); |
473 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
474 |
1 |
waitForDialogToClose(); |
475 |
|
|
476 |
1 |
switchToSource(); |
477 |
1 |
assertSourceText("[[[[image:Sandbox.WebHome@XWikiLogo.png]]>>doc:Blog.BlogIntroduction]]"); |
478 |
|
} |
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
|
483 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
484 |
1 |
@Test... |
485 |
|
public void testNewImageOptionIsSelectedByDefault() |
486 |
|
{ |
487 |
|
|
488 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
489 |
|
|
490 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
491 |
1 |
assertElementPresent("//div[@class = 'xImagesSelector']//" + "div[contains(@class, 'xListItem-selected')]" |
492 |
|
+ "//div[contains(@class, 'xNewImagePreview')]"); |
493 |
|
|
494 |
1 |
clickTab(TAB_ALL_PAGES); |
495 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
496 |
1 |
assertElementPresent("//div[@class = 'xImagesExplorer']//" + "div[contains(@class, 'xListItem-selected')]" |
497 |
|
+ "//div[contains(@class, 'xNewImagePreview')]"); |
498 |
1 |
closeDialog(); |
499 |
|
|
500 |
|
|
501 |
1 |
switchToSource(); |
502 |
1 |
setSourceText("[[image:xwiki:Sandbox.WebHome@XWikiLogo.png]]"); |
503 |
1 |
switchToWysiwyg(); |
504 |
1 |
selectNode("document.body.firstChild.firstChild"); |
505 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
506 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
507 |
|
|
508 |
1 |
clickTab(TAB_CURRENT_PAGE); |
509 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
510 |
1 |
assertElementPresent("//div[@class = 'xImagesSelector']//" + "div[contains(@class, 'xListItem-selected')]" |
511 |
|
+ "//div[contains(@class, 'xNewImagePreview')]"); |
512 |
1 |
closeDialog(); |
513 |
|
} |
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
518 |
1 |
@Test... |
519 |
|
public void testErrorIsHiddenOnNextDisplay() |
520 |
|
{ |
521 |
|
|
522 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
523 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
524 |
1 |
assertElementPresent("//*[contains(@class, 'xListItem-selected')]//*[contains(@class, 'xNewImagePreview')]"); |
525 |
1 |
clickButtonWithText(BUTTON_SELECT); |
526 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
527 |
1 |
clickButtonWithText(BUTTON_IMAGE_SETTINGS); |
528 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
529 |
1 |
assertFieldErrorIsPresent("The file path was not set", FILE_UPLOAD_INPUT); |
530 |
1 |
clickButtonWithText(BUTTON_PREVIOUS); |
531 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
532 |
1 |
clickButtonWithText(BUTTON_SELECT); |
533 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
534 |
1 |
assertFieldErrorIsNotPresent(); |
535 |
|
|
536 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
537 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
538 |
1 |
assertFieldErrorIsPresent("The file path was not set", FILE_UPLOAD_INPUT); |
539 |
1 |
closeDialog(); |
540 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
541 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
542 |
1 |
assertElementPresent("//*[contains(@class, 'xListItem-selected')]//*[contains(@class, 'xNewImagePreview')]"); |
543 |
1 |
clickButtonWithText(BUTTON_SELECT); |
544 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
545 |
1 |
assertFieldErrorIsNotPresent(); |
546 |
1 |
closeDialog(); |
547 |
|
} |
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (32) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
552 |
1 |
@Test... |
553 |
|
public void testFastNavigationToSelectImage() |
554 |
|
{ |
555 |
|
|
556 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
557 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
558 |
|
|
559 |
1 |
getSelenium().click("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); |
560 |
1 |
getSelenium().doubleClick("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); |
561 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
562 |
1 |
closeDialog(); |
563 |
|
|
564 |
|
|
565 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
566 |
1 |
waitForStepToLoad(STEP_CURRENT_PAGE_SELECTOR); |
567 |
1 |
getSelenium().click("//div[contains(@class, \"xNewImagePreview\")]"); |
568 |
1 |
getSelenium().typeKeys(IMAGES_LIST, "\\13"); |
569 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
570 |
1 |
closeDialog(); |
571 |
|
|
572 |
|
|
573 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
574 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
575 |
1 |
clickTab(TAB_ALL_PAGES); |
576 |
1 |
selectLocation("XWiki", "AdminSheet"); |
577 |
1 |
getSelenium().click(getImageLocator("registration.png")); |
578 |
1 |
getSelenium().doubleClick(getImageLocator("registration.png")); |
579 |
1 |
waitForStepToLoad(STEP_CONFIG); |
580 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
581 |
|
|
582 |
1 |
switchToSource(); |
583 |
1 |
setSourceText("[[image:XWiki.AdminSheet@registration.png]]"); |
584 |
1 |
switchToWysiwyg(); |
585 |
|
|
586 |
|
|
587 |
1 |
moveCaret("document.body", 0); |
588 |
|
|
589 |
|
|
590 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
591 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
592 |
1 |
clickTab(TAB_ALL_PAGES); |
593 |
1 |
selectLocation("XWiki", "AdminSheet"); |
594 |
1 |
getSelenium().click("//div[@class = '" + STEP_EXPLORER + "']//div[contains(@class, \"xNewImagePreview\")]"); |
595 |
1 |
getSelenium().typeKeys("//div[@class = '" + STEP_EXPLORER + "']" + IMAGES_LIST, "\\13"); |
596 |
1 |
waitForStepToLoad(STEP_UPLOAD); |
597 |
1 |
closeDialog(); |
598 |
|
} |
599 |
|
|
600 |
|
|
601 |
|
@see |
602 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
603 |
1 |
@Test... |
604 |
|
public void testUneditableAttributesArePreserved() |
605 |
|
{ |
606 |
|
|
607 |
1 |
switchToSource(); |
608 |
1 |
setSourceText("[[image:XWiki.AdminSheet@export.png||id=\"foobar\" " |
609 |
|
+ "title=\"abc\" foo=\"bar\" style=\"margin-top:12px\"]]"); |
610 |
1 |
switchToWysiwyg(); |
611 |
|
|
612 |
|
|
613 |
1 |
selectNode("document.body.firstChild.firstChild"); |
614 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
615 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
616 |
1 |
clickButtonWithText(BUTTON_SELECT); |
617 |
1 |
waitForStepToLoad(STEP_CONFIG); |
618 |
1 |
getSelenium().type(INPUT_WIDTH, "75px"); |
619 |
1 |
getSelenium().type(INPUT_HEIGHT, "7.5em"); |
620 |
1 |
selectAlignment("RIGHT"); |
621 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
622 |
1 |
waitForDialogToClose(); |
623 |
|
|
624 |
|
|
625 |
1 |
switchToSource(); |
626 |
1 |
assertSourceText("[[image:XWiki.AdminSheet@export.png||foo=\"bar\" id=\"foobar\" " |
627 |
|
+ "style=\"margin-top: 12px; height: 7.5em; float: right;\" title=\"abc\" width=\"75px\"]]"); |
628 |
|
} |
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
633 |
1 |
@Test... |
634 |
|
public void testInsertImageFromPageWithSpecialCharactersInName() |
635 |
|
{ |
636 |
|
|
637 |
1 |
String spaceName = this.getClass().getSimpleName() + ":x.y@z"; |
638 |
1 |
String escapedSpaceName = spaceName.replaceAll("([\\:\\.])", "\\\\$1"); |
639 |
1 |
String pageName = getTestMethodName() + ":a.b@c"; |
640 |
1 |
String escapedPageName = pageName.replace(".", "\\."); |
641 |
1 |
String pageFullName = String.format("%s.%s", escapedSpaceName, escapedPageName); |
642 |
1 |
deletePage(spaceName, pageName); |
643 |
1 |
assertTrue(copyPage("XWiki", "AdminSheet", escapedSpaceName, pageName)); |
644 |
|
|
645 |
|
|
646 |
1 |
open(this.getClass().getSimpleName(), getTestMethodName(), "edit", "editor=wysiwyg"); |
647 |
1 |
waitForEditorToLoad(); |
648 |
|
|
649 |
|
|
650 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
651 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
652 |
1 |
clickTab(TAB_ALL_PAGES); |
653 |
1 |
selectLocation(spaceName, pageName); |
654 |
1 |
getSelenium().click(getImageLocator("export.png")); |
655 |
1 |
clickButtonWithText(BUTTON_SELECT); |
656 |
1 |
waitForStepToLoad(STEP_CONFIG); |
657 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
658 |
1 |
waitForDialogToClose(); |
659 |
|
|
660 |
|
|
661 |
1 |
switchToSource(); |
662 |
1 |
assertSourceText(String.format("[[image:%s@export.png]]", pageFullName)); |
663 |
1 |
switchToWysiwyg(); |
664 |
|
|
665 |
|
|
666 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
667 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
668 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
669 |
1 |
assertImageSelected(spaceName, pageName, "export.png"); |
670 |
1 |
selectImage(spaceName, pageName, "import.png"); |
671 |
1 |
clickButtonWithText(BUTTON_SELECT); |
672 |
1 |
waitForStepToLoad(STEP_CONFIG); |
673 |
1 |
getSelenium().type(INPUT_ALT, ""); |
674 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
675 |
1 |
waitForDialogToClose(); |
676 |
|
|
677 |
|
|
678 |
1 |
switchToSource(); |
679 |
1 |
assertSourceText(String.format("[[image:%s@import.png]]", pageFullName)); |
680 |
|
} |
681 |
|
|
682 |
|
|
683 |
|
|
684 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
685 |
1 |
@Test... |
686 |
|
public void testEditedImageIsSelected() |
687 |
|
{ |
688 |
|
|
689 |
1 |
switchToSource(); |
690 |
1 |
setSourceText("image:XWiki.AdminSheet@users.png\n\nimage:XWiki.AdminSheet@export.png"); |
691 |
1 |
switchToWysiwyg(); |
692 |
|
|
693 |
|
|
694 |
1 |
selectNode("document.body.getElementsByTagName('img')[0]"); |
695 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
696 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
697 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
698 |
1 |
assertImageSelected("XWiki", "AdminSheet", "users.png"); |
699 |
1 |
closeDialog(); |
700 |
|
|
701 |
|
|
702 |
1 |
selectNode("document.body.getElementsByTagName('img')[1]"); |
703 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
704 |
1 |
waitForStepToLoad(STEP_SELECTOR); |
705 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
706 |
1 |
assertImageSelected("XWiki", "AdminSheet", "export.png"); |
707 |
|
|
708 |
|
|
709 |
1 |
selectImage("presentation.png"); |
710 |
1 |
getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); |
711 |
1 |
getDriver().waitUntilElementIsVisible( |
712 |
|
By.xpath("//*[contains(@class, \"" + STEP_EXPLORER + "\")]//*[contains(@class, \"" |
713 |
|
+ STEP_CURRENT_PAGE_SELECTOR + "\")]")); |
714 |
1 |
waitForElement(getImageLocator("export.png")); |
715 |
|
} |
716 |
|
|
717 |
|
|
718 |
|
|
719 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
720 |
1 |
@Test... |
721 |
|
public void testInsertExternalImage() |
722 |
|
{ |
723 |
1 |
openImageDialog(MENU_INSERT_EXTERNAL_IMAGE); |
724 |
1 |
waitForStepToLoad(STEP_EXTERNAL_IMAGE); |
725 |
|
|
726 |
|
|
727 |
1 |
clickButtonWithText(BUTTON_IMAGE_SETTINGS); |
728 |
1 |
waitForStepToLoad(STEP_EXTERNAL_IMAGE); |
729 |
1 |
assertFieldErrorIsPresent("Please specify the image location.", INPUT_EXTERNAL_IMAGE_LOCATION); |
730 |
|
|
731 |
|
|
732 |
1 |
String imageURL = "http://www.xwiki.org/xwiki/skins/toucan/logo.png"; |
733 |
1 |
getSelenium().type(INPUT_EXTERNAL_IMAGE_LOCATION, imageURL); |
734 |
1 |
clickButtonWithText(BUTTON_IMAGE_SETTINGS); |
735 |
1 |
waitForStepToLoad(STEP_CONFIG); |
736 |
|
|
737 |
|
|
738 |
1 |
assertEquals(imageURL, getSelenium().getValue(INPUT_ALT)); |
739 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
740 |
1 |
waitForDialogToClose(); |
741 |
|
|
742 |
|
|
743 |
1 |
switchToSource(); |
744 |
1 |
assertSourceText(String.format("[[image:%s]]", imageURL)); |
745 |
|
} |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
750 |
1 |
@Test... |
751 |
|
public void testEditExternalImage() |
752 |
|
{ |
753 |
|
|
754 |
1 |
switchToSource(); |
755 |
1 |
String imageURL = "http://www.xwiki.org/xwiki/skins/toucan/logo.png"; |
756 |
1 |
String alternativeText = "xyz"; |
757 |
1 |
setSourceText(String.format("[[image:%s||alt=\"%s\" title=\"abc\"]]", imageURL, alternativeText)); |
758 |
1 |
switchToWysiwyg(); |
759 |
|
|
760 |
|
|
761 |
1 |
selectNode("document.body.getElementsByTagName('img')[0]"); |
762 |
1 |
openImageDialog(MENU_EDIT_IMAGE); |
763 |
1 |
waitForStepToLoad(STEP_EXTERNAL_IMAGE); |
764 |
1 |
assertEquals(imageURL, getSelenium().getValue(INPUT_EXTERNAL_IMAGE_LOCATION)); |
765 |
|
|
766 |
|
|
767 |
1 |
imageURL = "http://www.xwiki.org/xwiki/skins/colibri/logo.png"; |
768 |
1 |
getSelenium().type(INPUT_EXTERNAL_IMAGE_LOCATION, imageURL); |
769 |
|
|
770 |
1 |
clickButtonWithText(BUTTON_INSERT_IMAGE); |
771 |
1 |
waitForDialogToClose(); |
772 |
|
|
773 |
|
|
774 |
1 |
switchToSource(); |
775 |
|
|
776 |
1 |
setSourceText(String.format("[[image:%s||alt=\"%s\" title=\"abc\"]]", imageURL, alternativeText)); |
777 |
|
} |
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
782 |
1 |
@Test... |
783 |
|
public void testImageSelectionLimitedToCurrentPage() |
784 |
|
{ |
785 |
1 |
String allPagesTabLocator = |
786 |
|
"//*[contains(@class, 'xStepsTabs')]//*[@class = 'gwt-TabBarItem' and . = '" + TAB_ALL_PAGES + "']"; |
787 |
1 |
String location = getSelenium().getLocation(); |
788 |
|
|
789 |
|
|
790 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
791 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
792 |
1 |
assertElementPresent(allPagesTabLocator); |
793 |
|
|
794 |
|
|
795 |
1 |
open("XWiki", "WysiwygEditorConfig", "edit", "editor=object"); |
796 |
1 |
expandObject("XWiki.WysiwygEditorConfigClass", 0); |
797 |
1 |
checkField("XWiki.WysiwygEditorConfigClass_0_imageSelectionLimited"); |
798 |
1 |
clickEditSaveAndContinue(); |
799 |
|
|
800 |
1 |
try { |
801 |
1 |
open(location); |
802 |
1 |
waitForEditorToLoad(); |
803 |
|
|
804 |
|
|
805 |
1 |
openImageDialog(MENU_INSERT_ATTACHED_IMAGE); |
806 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
807 |
1 |
assertElementNotPresent(allPagesTabLocator); |
808 |
|
} finally { |
809 |
|
|
810 |
1 |
open("XWiki", "WysiwygEditorConfig", "edit", "editor=object"); |
811 |
1 |
expandObject("XWiki.WysiwygEditorConfigClass", 0); |
812 |
1 |
checkField("XWiki.WysiwygEditorConfigClass_0_imageSelectionLimited_false"); |
813 |
1 |
clickEditSaveAndContinue(); |
814 |
|
} |
815 |
|
} |
816 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
817 |
80 |
private void waitForStepToLoad(String stepClass)... |
818 |
|
{ |
819 |
80 |
getDriver().waitUntilElementIsVisible(By.className(stepClass)); |
820 |
|
} |
821 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
822 |
9 |
private void selectImage(String space, String page, String filename)... |
823 |
|
{ |
824 |
9 |
selectLocation(space, page); |
825 |
9 |
selectImage(filename); |
826 |
|
} |
827 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
828 |
12 |
private void selectLocation(String space, String page)... |
829 |
|
{ |
830 |
|
|
831 |
|
|
832 |
12 |
waitForElement(SPACE_SELECTOR + "/option[. = '" + space + "']"); |
833 |
12 |
getSelenium().select(SPACE_SELECTOR, space); |
834 |
|
|
835 |
12 |
waitForElement(PAGE_SELECTOR + "/option[. = '" + page + "']"); |
836 |
12 |
getSelenium().select(PAGE_SELECTOR, page); |
837 |
|
|
838 |
|
|
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
|
843 |
|
|
844 |
12 |
getSelenium().typeKeys(PAGE_SELECTOR, "\t"); |
845 |
|
|
846 |
12 |
getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); |
847 |
12 |
waitForElement("//*[@class = '" + STEP_EXPLORER + "']//*[contains(@class, '" + STEP_CURRENT_PAGE_SELECTOR |
848 |
|
+ "')]"); |
849 |
|
} |
850 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
851 |
11 |
private void selectImage(String filename)... |
852 |
|
{ |
853 |
11 |
waitForElement(getImageLocator(filename)); |
854 |
11 |
getSelenium().click(getImageLocator(filename)); |
855 |
|
} |
856 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
857 |
26 |
private String getImageLocator(String filename)... |
858 |
|
{ |
859 |
26 |
return "//div[@class=\"xImagesSelector\"]//img[@title=\"" + filename + "\"]"; |
860 |
|
} |
861 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
862 |
9 |
private void assertImageSelected(String space, String page, String filename)... |
863 |
|
{ |
864 |
9 |
getDriver().waitUntilElementIsVisible(By.xpath(SPACE_SELECTOR + "/option[. = \"" + space + "\"]")); |
865 |
9 |
assertEquals(space, getSelenium().getSelectedLabel(SPACE_SELECTOR)); |
866 |
|
|
867 |
9 |
getDriver().waitUntilElementIsVisible(By.xpath(PAGE_SELECTOR + "/option[. = \"" + page + "\"]")); |
868 |
9 |
assertEquals(page, getSelenium().getSelectedLabel(PAGE_SELECTOR)); |
869 |
|
|
870 |
9 |
assertImageSelected(filename); |
871 |
|
} |
872 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
873 |
14 |
private void clickTab(String tabName)... |
874 |
|
{ |
875 |
14 |
String tabSelector = "//div[.='" + tabName + "']"; |
876 |
14 |
getSelenium().click(tabSelector); |
877 |
|
} |
878 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
879 |
9 |
private void assertImageSelected(String filename)... |
880 |
|
{ |
881 |
9 |
String imageItem = |
882 |
|
"//div[@class=\"xImagesSelector\"]//div[contains(@class, \"xListItem-selected\")]//img[@title=\"" |
883 |
|
+ filename + "\"]"; |
884 |
9 |
assertElementPresent(imageItem); |
885 |
|
} |
886 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
887 |
2 |
private void selectAlignment(String alignment)... |
888 |
|
{ |
889 |
2 |
getSelenium().click( |
890 |
|
"//div[contains(@class, \"AlignPanel\")]//input[@name=\"alignment\" and @value=\"" + alignment + "\"]"); |
891 |
|
} |
892 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
893 |
1 |
public boolean isAlignmentSelected(String alignment)... |
894 |
|
{ |
895 |
1 |
return getDriver().hasElementWithoutWaiting( |
896 |
|
By.xpath("//div[contains(@class, \"AlignPanel\")]//input[@name=\"alignment\" and @value=\"" + alignment |
897 |
|
+ "\" and @checked=\"\"]")); |
898 |
|
} |
899 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
900 |
31 |
private void openImageDialog(String menuName)... |
901 |
|
{ |
902 |
31 |
clickMenu(MENU_IMAGE); |
903 |
31 |
assertTrue(isMenuEnabled(menuName)); |
904 |
31 |
clickMenu(menuName); |
905 |
31 |
waitForDialogToLoad(); |
906 |
|
} |
907 |
|
|
908 |
|
|
909 |
|
|
910 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
911 |
1 |
private void waitForStepSelector()... |
912 |
|
{ |
913 |
1 |
getDriver().waitUntilElementIsVisible( |
914 |
|
By.xpath("//table[contains(@class, 'xStepsTabs') and not(contains(@class, 'loading'))]")); |
915 |
|
} |
916 |
|
} |