| 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 java.io.UnsupportedEncodingException; |
| 23 |
|
import java.net.URLEncoder; |
| 24 |
|
|
| 25 |
|
import org.junit.Test; |
| 26 |
|
import org.openqa.selenium.By; |
| 27 |
|
import org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase; |
| 28 |
|
import org.xwiki.test.wysiwyg.framework.XWikiExplorer; |
| 29 |
|
|
| 30 |
|
import static org.junit.Assert.*; |
| 31 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1,088) |
Complexity: 57 |
Complexity Density: 0.06 |
|
| 32 |
|
public class LinkTest extends AbstractWysiwygTestCase |
| 33 |
|
{ |
| 34 |
|
public static final String MENU_LINK = "Link"; |
| 35 |
|
|
| 36 |
|
public static final String MENU_WEB_PAGE = "Web Page..."; |
| 37 |
|
|
| 38 |
|
public static final String MENU_EMAIL_ADDRESS = "Email Address..."; |
| 39 |
|
|
| 40 |
|
public static final String MENU_WIKI_PAGE = "Wiki Page..."; |
| 41 |
|
|
| 42 |
|
public static final String MENU_ATTACHMENT = "Attached File..."; |
| 43 |
|
|
| 44 |
|
public static final String MENU_LINK_EDIT = "Edit Link..."; |
| 45 |
|
|
| 46 |
|
public static final String MENU_LINK_REMOVE = "Remove Link"; |
| 47 |
|
|
| 48 |
|
public static final String BUTTON_SELECT = "Select"; |
| 49 |
|
|
| 50 |
|
public static final String BUTTON_LINK_SETTINGS = "Link Settings"; |
| 51 |
|
|
| 52 |
|
public static final String BUTTON_CREATE_LINK = "Create Link"; |
| 53 |
|
|
| 54 |
|
public static final String CURRENT_PAGE_TAB = "Current page"; |
| 55 |
|
|
| 56 |
|
public static final String ALL_PAGES_TAB = "All pages"; |
| 57 |
|
|
| 58 |
|
public static final String RECENT_PAGES_TAB = "My recent changes"; |
| 59 |
|
|
| 60 |
|
public static final String SEARCH_TAB = "Search"; |
| 61 |
|
|
| 62 |
|
public static final String STEP_EXPLORER = "xExplorerPanel"; |
| 63 |
|
|
| 64 |
|
public static final String LABEL_INPUT_TITLE = "Type the label of the created link."; |
| 65 |
|
|
| 66 |
|
public static final String ERROR_MSG_CLASS = "xErrorMsg"; |
| 67 |
|
|
| 68 |
|
public static final String ITEMS_LIST = "//div[contains(@class, 'xListBox')]"; |
| 69 |
|
|
| 70 |
|
public static final String TREE_EXPLORER = "//div[contains(@class, 'xExplorer')]"; |
| 71 |
|
|
| 72 |
|
public static final String FILE_UPLOAD_INPUT = "//input[contains(@class, 'gwt-FileUpload')]"; |
| 73 |
|
|
| 74 |
|
public static final String PAGE_LOCATION = "Located in xwiki \u00BB %s \u00BB %s"; |
| 75 |
|
|
| 76 |
|
public static final String NEW_PAGE_FROM_SEARCH_LOCATOR = "//div[contains(@class, 'xPagesSearch')]" |
| 77 |
|
+ "//div[contains(@class, 'xListItem')]/div[contains(@class, 'xNewPagePreview')]"; |
| 78 |
|
|
| 79 |
|
public static final String NEW_ATTACHMENT = "//div[@class = 'xAttachmentsSelector']" |
| 80 |
|
+ "//div[contains(@class, \"xListItem\")]" + "/div[contains(@class, \"xNewFilePreview\")]"; |
| 81 |
|
|
| 82 |
|
public static final String NEW_ATTACHMENT_SELECTED = "//div[@class = 'xAttachmentsSelector']" |
| 83 |
|
+ "//div[contains(@class, \"xListItem-selected\")]" + "/div[contains(@class, \"xNewFilePreview\")]"; |
| 84 |
|
|
| 85 |
|
public static final String ABSOLUTE_DOCUMENT_REFERENCE = "xwiki:%s.%s"; |
| 86 |
|
|
| 87 |
|
public static final String ABSOLUTE_ATTACHMENT_REFERENCE = ABSOLUTE_DOCUMENT_REFERENCE + "@%s"; |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
private XWikiExplorer explorer; |
| 93 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 94 |
50 |
@Override... |
| 95 |
|
public void setUp() |
| 96 |
|
{ |
| 97 |
50 |
super.setUp(); |
| 98 |
|
|
| 99 |
50 |
this.explorer = new XWikiExplorer(getDriver()); |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 105 |
1 |
@Test... |
| 106 |
|
public void testCreateLinkToExistingPage() |
| 107 |
|
{ |
| 108 |
1 |
String linkLabel = "x"; |
| 109 |
1 |
typeText(linkLabel); |
| 110 |
1 |
selectNodeContents("document.body.firstChild"); |
| 111 |
|
|
| 112 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 113 |
|
|
| 114 |
1 |
clickTab(ALL_PAGES_TAB); |
| 115 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 116 |
|
|
| 117 |
1 |
explorer.waitForIt().findAndSelectPage("News"); |
| 118 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 119 |
|
|
| 120 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 121 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 122 |
|
|
| 123 |
|
|
| 124 |
1 |
waitForDialogToClose(); |
| 125 |
|
|
| 126 |
1 |
switchToSource(); |
| 127 |
1 |
assertSourceText("[[" + linkLabel + ">>doc:Blog.News]]"); |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
|
| 131 |
|
|
| 132 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 133 |
1 |
@Test... |
| 134 |
|
public void testCreateLinkToNewPage() |
| 135 |
|
{ |
| 136 |
1 |
String linkLabel = "a"; |
| 137 |
1 |
String newPageName = "AliceInWonderwiki"; |
| 138 |
1 |
typeText(linkLabel); |
| 139 |
1 |
selectNodeContents("document.body.firstChild"); |
| 140 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 141 |
|
|
| 142 |
1 |
clickTab(ALL_PAGES_TAB); |
| 143 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 144 |
1 |
explorer.waitForIt().findAndSelectPage("Home").selectNewPage("Main"); |
| 145 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 146 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 147 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", newPageName); |
| 148 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 149 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 150 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 151 |
|
|
| 152 |
1 |
waitForDialogToClose(); |
| 153 |
|
|
| 154 |
1 |
switchToSource(); |
| 155 |
1 |
assertSourceText("[[" + linkLabel + ">>doc:Main." + newPageName + "]]"); |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
@see |
| 162 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
| 163 |
1 |
@Test... |
| 164 |
|
public void testCreateLinkToNewPageInNewSpace() |
| 165 |
|
{ |
| 166 |
1 |
String linkLabel = "b"; |
| 167 |
1 |
String newSpace = "Bob"; |
| 168 |
1 |
String newPage = "Cat"; |
| 169 |
1 |
typeText(linkLabel); |
| 170 |
1 |
selectNodeContents("document.body.firstChild"); |
| 171 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 172 |
|
|
| 173 |
1 |
clickTab(ALL_PAGES_TAB); |
| 174 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 175 |
1 |
explorer.waitForIt().find("document:xwiki:" + newSpace + "." + newPage); |
| 176 |
|
|
| 177 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 178 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 179 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 180 |
|
|
| 181 |
1 |
waitForDialogToClose(); |
| 182 |
|
|
| 183 |
1 |
switchToSource(); |
| 184 |
1 |
assertSourceText("[[" + linkLabel + ">>doc:" + newSpace + "." + newPage + "]]"); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
| 190 |
1 |
@Test... |
| 191 |
|
public void testCreateLinkToWebPage() |
| 192 |
|
{ |
| 193 |
1 |
String linkLabel = "x"; |
| 194 |
1 |
String url = "http://www.xwiki.org"; |
| 195 |
1 |
typeText(linkLabel); |
| 196 |
1 |
selectNodeContents("document.body.firstChild"); |
| 197 |
|
|
| 198 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 199 |
|
|
| 200 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 201 |
1 |
typeInInput("Web page address", url); |
| 202 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 203 |
1 |
waitForDialogToClose(); |
| 204 |
|
|
| 205 |
1 |
switchToSource(); |
| 206 |
1 |
assertSourceText("[[" + linkLabel + ">>url:" + url + "]]"); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 212 |
1 |
@Test... |
| 213 |
|
public void testCreateLinkToWebPageWithChangedLabel() |
| 214 |
|
{ |
| 215 |
1 |
String linkLabel = "x"; |
| 216 |
1 |
String url = "http://www.xwiki.org"; |
| 217 |
1 |
typeText(linkLabel); |
| 218 |
1 |
selectAllContent(); |
| 219 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 220 |
|
|
| 221 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 222 |
1 |
String newLabel = "xwiki rox"; |
| 223 |
1 |
typeInInput(LABEL_INPUT_TITLE, newLabel); |
| 224 |
1 |
typeInInput("Web page address", url); |
| 225 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 226 |
1 |
waitForDialogToClose(); |
| 227 |
|
|
| 228 |
1 |
switchToSource(); |
| 229 |
1 |
assertSourceText("[[" + newLabel + ">>url:" + url + "]]"); |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
| 235 |
1 |
@Test... |
| 236 |
|
public void testCreateLinkToEmailAddress() |
| 237 |
|
{ |
| 238 |
1 |
String linkLabel = "c"; |
| 239 |
1 |
String email = "carol@xwiki.org"; |
| 240 |
1 |
typeText(linkLabel); |
| 241 |
1 |
selectNodeContents("document.body.firstChild"); |
| 242 |
1 |
openLinkDialog(MENU_EMAIL_ADDRESS); |
| 243 |
|
|
| 244 |
1 |
typeInInput("Email address", email); |
| 245 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 246 |
1 |
waitForDialogToClose(); |
| 247 |
|
|
| 248 |
1 |
switchToSource(); |
| 249 |
1 |
assertSourceText("[[" + linkLabel + ">>mailto:" + email + "]]"); |
| 250 |
|
} |
| 251 |
|
|
| 252 |
|
|
| 253 |
|
|
| 254 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 255 |
1 |
@Test... |
| 256 |
|
public void testCreateLinkWithNewLabel() |
| 257 |
|
{ |
| 258 |
1 |
String linkLabel = "xwiki"; |
| 259 |
1 |
String linkURL = "www.xwiki.org"; |
| 260 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 261 |
|
|
| 262 |
1 |
typeInInput("Web page address", linkURL); |
| 263 |
1 |
typeInInput(LABEL_INPUT_TITLE, linkLabel); |
| 264 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 265 |
1 |
waitForDialogToClose(); |
| 266 |
|
|
| 267 |
1 |
switchToSource(); |
| 268 |
1 |
assertSourceText("[[" + linkLabel + ">>url:http://" + linkURL + "]]"); |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 274 |
1 |
@Test... |
| 275 |
|
public void testCreateLinkPreservesLabelFormatting() |
| 276 |
|
{ |
| 277 |
1 |
typeText("1"); |
| 278 |
1 |
clickBoldButton(); |
| 279 |
1 |
typeText("2"); |
| 280 |
1 |
clickBoldButton(); |
| 281 |
1 |
typeText("3"); |
| 282 |
1 |
selectAllContent(); |
| 283 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 284 |
|
|
| 285 |
|
|
| 286 |
1 |
assertEquals("123", getInputValue(LABEL_INPUT_TITLE)); |
| 287 |
1 |
typeInInput("Web page address", "www.xwiki.org"); |
| 288 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 289 |
|
|
| 290 |
1 |
waitForDialogToClose(); |
| 291 |
1 |
switchToSource(); |
| 292 |
1 |
assertSourceText("[[1**2**3>>url:http://www.xwiki.org]]"); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
|
| 296 |
|
|
| 297 |
|
|
| 298 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 299 |
1 |
@Test... |
| 300 |
|
public void testCreateThenEditLink() |
| 301 |
|
{ |
| 302 |
|
|
| 303 |
1 |
applyStyleTitle1(); |
| 304 |
1 |
applyStylePlainText(); |
| 305 |
1 |
typeText("1"); |
| 306 |
1 |
String linkLabel = "xwiki"; |
| 307 |
1 |
String linkURL = "http://www.xwiki.com"; |
| 308 |
1 |
String newLinkURL = "http://www.xwiki.org"; |
| 309 |
|
|
| 310 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 311 |
|
|
| 312 |
1 |
typeInInput("Web page address", linkURL); |
| 313 |
1 |
typeInInput(LABEL_INPUT_TITLE, linkLabel); |
| 314 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 315 |
1 |
waitForDialogToClose(); |
| 316 |
|
|
| 317 |
1 |
moveCaret("document.body.firstChild.childNodes[1].firstChild", 5); |
| 318 |
1 |
triggerToolbarUpdate(); |
| 319 |
|
|
| 320 |
1 |
clickMenu(MENU_LINK); |
| 321 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 322 |
|
|
| 323 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 324 |
1 |
typeText("2"); |
| 325 |
1 |
switchToSource(); |
| 326 |
1 |
assertSourceText("1[[" + linkLabel + ">>url:" + linkURL + "]]2"); |
| 327 |
1 |
switchToWysiwyg(); |
| 328 |
|
|
| 329 |
1 |
select("document.body.firstChild", 1, "document.body.firstChild.childNodes[1].firstChild", 5); |
| 330 |
|
|
| 331 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 332 |
|
|
| 333 |
1 |
assertEquals(linkLabel, getInputValue(LABEL_INPUT_TITLE)); |
| 334 |
1 |
assertEquals(linkURL, getInputValue("Web page address")); |
| 335 |
|
|
| 336 |
1 |
typeInInput("Web page address", newLinkURL); |
| 337 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 338 |
1 |
waitForDialogToClose(); |
| 339 |
|
|
| 340 |
1 |
switchToSource(); |
| 341 |
1 |
assertSourceText("1[[" + linkLabel + ">>url:" + newLinkURL + "]]2"); |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
|
| 345 |
|
|
| 346 |
|
|
| 347 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (48) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
| 348 |
1 |
@Test... |
| 349 |
|
public void testCreateAndEditLinkOnImage() |
| 350 |
|
{ |
| 351 |
1 |
clickMenu("Image"); |
| 352 |
1 |
clickMenu("Attached Image..."); |
| 353 |
|
|
| 354 |
1 |
waitForDialogToLoad(); |
| 355 |
|
|
| 356 |
|
|
| 357 |
1 |
clickTab(ALL_PAGES_TAB); |
| 358 |
|
|
| 359 |
1 |
String imageSpace = "XWiki"; |
| 360 |
1 |
waitForCondition("selenium.isElementPresent('" + ImageTest.SPACE_SELECTOR + "/option[@value=\"" + imageSpace |
| 361 |
|
+ "\"]');"); |
| 362 |
1 |
getSelenium().select(ImageTest.SPACE_SELECTOR, imageSpace); |
| 363 |
|
|
| 364 |
1 |
String imagePage = "AdminSheet"; |
| 365 |
1 |
waitForCondition("selenium.isElementPresent('" + ImageTest.PAGE_SELECTOR + "/option[@value=\"" + imagePage |
| 366 |
|
+ "\"]');"); |
| 367 |
1 |
getSelenium().select(ImageTest.PAGE_SELECTOR, imagePage); |
| 368 |
|
|
| 369 |
1 |
getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); |
| 370 |
|
|
| 371 |
1 |
String imageSelector = "//div[@class=\"xImagesSelector\"]//img[@title=\"presentation.png\"]"; |
| 372 |
1 |
waitForCondition("selenium.isElementPresent('" + imageSelector + "');"); |
| 373 |
1 |
getSelenium().click(imageSelector); |
| 374 |
|
|
| 375 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 376 |
1 |
waitForStepToLoad("xImageConfig"); |
| 377 |
1 |
clickButtonWithText("Insert Image"); |
| 378 |
|
|
| 379 |
1 |
waitForDialogToClose(); |
| 380 |
|
|
| 381 |
|
|
| 382 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 383 |
|
|
| 384 |
1 |
clickTab(ALL_PAGES_TAB); |
| 385 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 386 |
1 |
explorer.waitForIt().findAndSelectPage("Sandbox"); |
| 387 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 388 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 389 |
1 |
assertEquals("presentation.png", getInputValue(LABEL_INPUT_TITLE)); |
| 390 |
|
|
| 391 |
1 |
assertElementPresent("//input[@title=\"" + LABEL_INPUT_TITLE + "\" and @disabled=\"\"]"); |
| 392 |
|
|
| 393 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 394 |
1 |
waitForDialogToClose(); |
| 395 |
|
|
| 396 |
1 |
switchToSource(); |
| 397 |
1 |
assertSourceText("[[[[image:XWiki.AdminSheet@presentation.png]]>>doc:Sandbox.WebHome]]"); |
| 398 |
1 |
switchToWysiwyg(); |
| 399 |
|
|
| 400 |
|
|
| 401 |
1 |
moveCaret("document.body", 1); |
| 402 |
1 |
typeText("x"); |
| 403 |
|
|
| 404 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 405 |
1 |
typeInInput(LABEL_INPUT_TITLE, "bar"); |
| 406 |
1 |
typeInInput("Web page address", "http://bar.myxwiki.org"); |
| 407 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 408 |
1 |
waitForDialogToClose(); |
| 409 |
|
|
| 410 |
|
|
| 411 |
1 |
selectNode("document.body.firstChild.firstChild"); |
| 412 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 413 |
|
|
| 414 |
|
|
| 415 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 416 |
1 |
explorer.findAndSelectPage("Space Index"); |
| 417 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 418 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 419 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 420 |
1 |
waitForDialogToClose(); |
| 421 |
|
|
| 422 |
1 |
switchToSource(); |
| 423 |
1 |
assertSourceText("[[[[image:XWiki.AdminSheet@presentation.png]]>>doc:Main.SpaceIndex]]x[[bar>>url:http://bar.myxwiki.org]]"); |
| 424 |
|
} |
| 425 |
|
|
| 426 |
|
|
| 427 |
|
|
| 428 |
|
|
| 429 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (52) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
| 430 |
1 |
@Test... |
| 431 |
|
public void testDetectAndUnlinkSelectedAnchor() |
| 432 |
|
{ |
| 433 |
1 |
switchToSource(); |
| 434 |
1 |
setSourceText("foo [[bar>>http://xwiki.org]] [[far>>Main.WebHome]] [[alice>>Main.NewPage]] " |
| 435 |
|
+ "[[carol>>mailto:carol@xwiki.org]] [[b**o**b>>http://xwiki.org]] blog webhome [[Blog.WebHome]] " |
| 436 |
|
+ "[[image:XWiki.AdminSheet@presentation.png>>Blog.Photos]]"); |
| 437 |
1 |
switchToWysiwyg(); |
| 438 |
|
|
| 439 |
|
|
| 440 |
1 |
moveCaret("document.body.firstChild.firstChild", 2); |
| 441 |
1 |
clickMenu(MENU_LINK); |
| 442 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_REMOVE)); |
| 443 |
1 |
assertTrue(isMenuEnabled(MENU_WIKI_PAGE)); |
| 444 |
1 |
assertTrue(isMenuEnabled(MENU_WEB_PAGE)); |
| 445 |
1 |
assertTrue(isMenuEnabled(MENU_EMAIL_ADDRESS)); |
| 446 |
1 |
clickMenu(MENU_LINK); |
| 447 |
|
|
| 448 |
|
|
| 449 |
1 |
moveCaret("document.body.firstChild.childNodes[1].firstChild", 2); |
| 450 |
1 |
clickMenu(MENU_LINK); |
| 451 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_EDIT)); |
| 452 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 453 |
|
|
| 454 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 455 |
|
|
| 456 |
|
|
| 457 |
1 |
select("document.body.firstChild", 3, "document.body.firstChild", 4); |
| 458 |
1 |
clickMenu(MENU_LINK); |
| 459 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_EDIT)); |
| 460 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 461 |
|
|
| 462 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 463 |
|
|
| 464 |
|
|
| 465 |
1 |
select("document.body.firstChild.childNodes[4]", 1, "document.body.firstChild.childNodes[6]", 0); |
| 466 |
1 |
clickMenu(MENU_LINK); |
| 467 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_EDIT)); |
| 468 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 469 |
|
|
| 470 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 471 |
|
|
| 472 |
|
|
| 473 |
1 |
select("document.body.firstChild.childNodes[6]", 1, "document.body.firstChild.childNodes[7].firstChild", 5); |
| 474 |
1 |
clickMenu(MENU_LINK); |
| 475 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_EDIT)); |
| 476 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 477 |
|
|
| 478 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 479 |
|
|
| 480 |
|
|
| 481 |
1 |
select("document.body.firstChild.childNodes[9].childNodes[1].firstChild", 0, |
| 482 |
|
"document.body.firstChild.childNodes[9].childNodes[1].firstChild", 1); |
| 483 |
1 |
clickMenu(MENU_LINK); |
| 484 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_EDIT)); |
| 485 |
1 |
assertTrue(isMenuEnabled(MENU_LINK_REMOVE)); |
| 486 |
|
|
| 487 |
1 |
clickMenu(MENU_LINK_REMOVE); |
| 488 |
|
|
| 489 |
|
|
| 490 |
1 |
select("document.body.firstChild.childNodes[12]", 5, |
| 491 |
|
"document.body.firstChild.childNodes[13].firstChild.firstChild", 4); |
| 492 |
1 |
clickMenu(MENU_LINK); |
| 493 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_EDIT)); |
| 494 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_REMOVE)); |
| 495 |
1 |
assertFalse(isMenuEnabled(MENU_WEB_PAGE)); |
| 496 |
1 |
assertFalse(isMenuEnabled(MENU_EMAIL_ADDRESS)); |
| 497 |
1 |
assertFalse(isMenuEnabled(MENU_WIKI_PAGE)); |
| 498 |
1 |
clickMenu(MENU_LINK); |
| 499 |
|
|
| 500 |
|
|
| 501 |
1 |
select("document.body.firstChild.childNodes[13].firstChild.firstChild", 4, |
| 502 |
|
"document.body.firstChild.childNodes[15]", 1); |
| 503 |
1 |
clickMenu(MENU_LINK); |
| 504 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_EDIT)); |
| 505 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_REMOVE)); |
| 506 |
1 |
assertFalse(isMenuEnabled(MENU_WEB_PAGE)); |
| 507 |
1 |
assertFalse(isMenuEnabled(MENU_EMAIL_ADDRESS)); |
| 508 |
1 |
assertFalse(isMenuEnabled(MENU_WIKI_PAGE)); |
| 509 |
|
|
| 510 |
1 |
switchToSource(); |
| 511 |
1 |
assertSourceText("foo bar far alice carol b**o**b blog webhome [[Blog.WebHome]] " |
| 512 |
|
+ "[[image:XWiki.AdminSheet@presentation.png>>Blog.Photos]]"); |
| 513 |
|
} |
| 514 |
|
|
| 515 |
|
|
| 516 |
|
|
| 517 |
|
|
| 518 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 519 |
1 |
@Test... |
| 520 |
|
public void testEditLinkInList() |
| 521 |
|
{ |
| 522 |
1 |
switchToSource(); |
| 523 |
1 |
setSourceText("* one\n* [[two>>http://www.xwiki.com]]\n** three"); |
| 524 |
1 |
switchToWysiwyg(); |
| 525 |
|
|
| 526 |
|
|
| 527 |
1 |
moveCaret("document.body.firstChild.childNodes[1].firstChild.firstChild", 1); |
| 528 |
|
|
| 529 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 530 |
|
|
| 531 |
|
|
| 532 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 533 |
1 |
assertEquals("two", getInputValue(LABEL_INPUT_TITLE)); |
| 534 |
1 |
assertEquals("http://www.xwiki.com", getInputValue("Web page address")); |
| 535 |
1 |
typeInInput("Web page address", "http://www.xwiki.org"); |
| 536 |
|
|
| 537 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 538 |
1 |
waitForDialogToClose(); |
| 539 |
|
|
| 540 |
1 |
switchToSource(); |
| 541 |
1 |
assertSourceText("* one\n* [[two>>http://www.xwiki.org]]\n** three"); |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
|
| 545 |
|
|
| 546 |
|
|
| 547 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (57) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
| 548 |
1 |
@Test... |
| 549 |
|
public void testValidationOnLinkInsert() |
| 550 |
|
{ |
| 551 |
|
|
| 552 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 553 |
|
|
| 554 |
1 |
clickTab(ALL_PAGES_TAB); |
| 555 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 556 |
|
|
| 557 |
1 |
explorer.waitForIt().findAndSelectPage("Home"); |
| 558 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 559 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 560 |
|
|
| 561 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 562 |
|
|
| 563 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 564 |
|
+ "']", "xLinkConfig"); |
| 565 |
|
|
| 566 |
|
|
| 567 |
1 |
typeInInput(LABEL_INPUT_TITLE, "foo"); |
| 568 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 569 |
|
|
| 570 |
1 |
waitForDialogToClose(); |
| 571 |
|
|
| 572 |
1 |
switchToSource(); |
| 573 |
1 |
assertSourceText("[[foo>>doc:Main.WebHome]]"); |
| 574 |
|
|
| 575 |
|
|
| 576 |
1 |
setSourceText(""); |
| 577 |
1 |
switchToWysiwyg(); |
| 578 |
|
|
| 579 |
|
|
| 580 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 581 |
|
|
| 582 |
1 |
clickTab(ALL_PAGES_TAB); |
| 583 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 584 |
|
|
| 585 |
1 |
explorer.waitForIt().findAndSelectPage("Sandbox Test Page 1"); |
| 586 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 587 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 588 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 589 |
|
|
| 590 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 591 |
|
+ "']", "xLinkConfig"); |
| 592 |
|
|
| 593 |
|
|
| 594 |
1 |
typeInInput(LABEL_INPUT_TITLE, "foo"); |
| 595 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 596 |
|
|
| 597 |
1 |
switchToSource(); |
| 598 |
1 |
assertSourceText("[[foo>>doc:Sandbox.TestPage1]]"); |
| 599 |
|
|
| 600 |
|
|
| 601 |
1 |
setSourceText(""); |
| 602 |
1 |
switchToWysiwyg(); |
| 603 |
|
|
| 604 |
|
|
| 605 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 606 |
|
|
| 607 |
|
|
| 608 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 609 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 610 |
|
+ "']", "xLinkToUrl"); |
| 611 |
1 |
assertFieldErrorIsPresentInStep("The web page address was not set", "//input[@title='Web page address']", |
| 612 |
|
"xLinkToUrl"); |
| 613 |
|
|
| 614 |
1 |
typeInInput("Web page address", "http://www.xwiki.org"); |
| 615 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 616 |
|
|
| 617 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 618 |
|
+ "']", "xLinkToUrl"); |
| 619 |
|
|
| 620 |
1 |
assertFieldErrorIsNotPresent("The web page address was not set", "//input[@title='Web page address']"); |
| 621 |
|
|
| 622 |
|
|
| 623 |
1 |
typeInInput(LABEL_INPUT_TITLE, "xwiki"); |
| 624 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 625 |
1 |
waitForDialogToClose(); |
| 626 |
|
|
| 627 |
1 |
switchToSource(); |
| 628 |
1 |
assertSourceText("[[xwiki>>url:http://www.xwiki.org]]"); |
| 629 |
|
|
| 630 |
|
|
| 631 |
1 |
setSourceText(""); |
| 632 |
1 |
switchToWysiwyg(); |
| 633 |
|
|
| 634 |
|
|
| 635 |
1 |
openLinkDialog(MENU_EMAIL_ADDRESS); |
| 636 |
|
|
| 637 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 638 |
|
|
| 639 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 640 |
|
+ "']", "xLinkToUrl"); |
| 641 |
1 |
assertFieldErrorIsPresentInStep("The email address was not set", "//input[@title='Email address']", |
| 642 |
|
"xLinkToUrl"); |
| 643 |
|
|
| 644 |
1 |
typeInInput(LABEL_INPUT_TITLE, "alice"); |
| 645 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 646 |
|
|
| 647 |
1 |
assertFieldErrorIsPresentInStep("The email address was not set", "//input[@title='Email address']", |
| 648 |
|
"xLinkToUrl"); |
| 649 |
1 |
assertFieldErrorIsNotPresent("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 650 |
|
+ "']"); |
| 651 |
|
|
| 652 |
1 |
typeInInput("Email address", "alice@wonderla.nd"); |
| 653 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 654 |
|
|
| 655 |
1 |
waitForDialogToClose(); |
| 656 |
|
|
| 657 |
1 |
switchToSource(); |
| 658 |
1 |
assertSourceText("[[alice>>mailto:alice@wonderla.nd]]"); |
| 659 |
|
} |
| 660 |
|
|
| 661 |
|
|
| 662 |
|
|
| 663 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 664 |
1 |
@Test... |
| 665 |
|
public void testCannotCreateLinkAroundBlockElements() |
| 666 |
|
{ |
| 667 |
1 |
setContent("<p>foo</p><p>bar</p>"); |
| 668 |
1 |
select("document.body.firstChild.firstChild", 2, "document.body.childNodes[1].firstChild", 2); |
| 669 |
1 |
clickMenu(MENU_LINK); |
| 670 |
1 |
assertFalse(isMenuEnabled(MENU_WEB_PAGE)); |
| 671 |
1 |
assertFalse(isMenuEnabled(MENU_WIKI_PAGE)); |
| 672 |
1 |
assertFalse(isMenuEnabled(MENU_EMAIL_ADDRESS)); |
| 673 |
1 |
assertFalse(isMenuEnabled(MENU_ATTACHMENT)); |
| 674 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_EDIT)); |
| 675 |
1 |
assertFalse(isMenuEnabled(MENU_LINK_REMOVE)); |
| 676 |
|
} |
| 677 |
|
|
| 678 |
|
|
| 679 |
|
|
| 680 |
|
|
| 681 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 682 |
1 |
@Test... |
| 683 |
|
public void testLinkLocationIsPreservedOnPrevious() |
| 684 |
|
{ |
| 685 |
1 |
String linkLabel = "x"; |
| 686 |
1 |
typeText(linkLabel); |
| 687 |
1 |
selectNodeContents("document.body.firstChild"); |
| 688 |
|
|
| 689 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 690 |
|
|
| 691 |
1 |
clickTab(ALL_PAGES_TAB); |
| 692 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 693 |
|
|
| 694 |
1 |
explorer.waitForIt().findAndSelectPage("News"); |
| 695 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 696 |
|
|
| 697 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 698 |
|
|
| 699 |
|
|
| 700 |
1 |
clickButtonWithText("Previous"); |
| 701 |
|
|
| 702 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 703 |
|
|
| 704 |
1 |
explorer.waitForPageSelected("Blog", "News"); |
| 705 |
|
|
| 706 |
|
|
| 707 |
1 |
explorer.findAndSelectPage("Activity Stream"); |
| 708 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 709 |
|
|
| 710 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 711 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 712 |
|
|
| 713 |
|
|
| 714 |
1 |
waitForDialogToClose(); |
| 715 |
|
|
| 716 |
1 |
switchToSource(); |
| 717 |
1 |
assertSourceText("[[" + linkLabel + ">>doc:Main.Activity]]"); |
| 718 |
|
} |
| 719 |
|
|
| 720 |
|
|
| 721 |
|
|
| 722 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 723 |
1 |
@Test... |
| 724 |
|
public void testCreateLinkToAttachment() |
| 725 |
|
{ |
| 726 |
1 |
String linkLabel = "x"; |
| 727 |
1 |
typeText(linkLabel); |
| 728 |
1 |
selectNodeContents("document.body.firstChild"); |
| 729 |
|
|
| 730 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 731 |
|
|
| 732 |
|
|
| 733 |
1 |
clickTab(ALL_PAGES_TAB); |
| 734 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 735 |
|
|
| 736 |
1 |
explorer.waitForIt().findAndSelectAttachment("export.png"); |
| 737 |
|
|
| 738 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 739 |
|
|
| 740 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 741 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 742 |
|
|
| 743 |
|
|
| 744 |
1 |
waitForDialogToClose(); |
| 745 |
|
|
| 746 |
1 |
switchToSource(); |
| 747 |
1 |
assertSourceText("[[" + linkLabel + ">>attach:XWiki.AdminSheet@export.png]]"); |
| 748 |
|
} |
| 749 |
|
|
| 750 |
|
|
| 751 |
|
@see |
| 752 |
|
|
| 753 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 754 |
1 |
@Test... |
| 755 |
|
public void testCreateLinkToAttachmentFromCurrentPage() |
| 756 |
|
{ |
| 757 |
|
|
| 758 |
1 |
open("Sandbox", "WebHome", "edit", "editor=wysiwyg"); |
| 759 |
1 |
waitForEditorToLoad(); |
| 760 |
|
|
| 761 |
|
|
| 762 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 763 |
1 |
clickTab(ALL_PAGES_TAB); |
| 764 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 765 |
|
|
| 766 |
1 |
explorer.waitForIt().findAndSelectAttachment("XWikiLogo.png"); |
| 767 |
|
|
| 768 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 769 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 770 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 771 |
1 |
waitForDialogToClose(); |
| 772 |
|
|
| 773 |
1 |
switchToSource(); |
| 774 |
1 |
assertTrue(getSourceText().startsWith("[[XWikiLogo.png>>attach:XWikiLogo.png")); |
| 775 |
|
} |
| 776 |
|
|
| 777 |
|
|
| 778 |
|
@see |
| 779 |
|
|
| 780 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
| 781 |
1 |
@Test... |
| 782 |
|
public void testCreateLinkToNewAttachment() |
| 783 |
|
{ |
| 784 |
|
|
| 785 |
1 |
clickEditSaveAndContinue(); |
| 786 |
1 |
clickEditPageInWysiwyg(); |
| 787 |
1 |
waitForEditorToLoad(); |
| 788 |
|
|
| 789 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 790 |
1 |
clickTab(ALL_PAGES_TAB); |
| 791 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 792 |
|
|
| 793 |
1 |
String spaceName = this.getClass().getSimpleName(); |
| 794 |
1 |
String pageName = getTestMethodName(); |
| 795 |
1 |
explorer.waitForAttachmentsSelected(spaceName, pageName).selectNewAttachment(spaceName, pageName); |
| 796 |
|
|
| 797 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 798 |
1 |
waitForStepToLoad("xUploadPanel"); |
| 799 |
|
|
| 800 |
|
} |
| 801 |
|
|
| 802 |
|
|
| 803 |
|
|
| 804 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
| 805 |
1 |
@Test... |
| 806 |
|
public void testCreateLinkToAttachmentWithParameters() |
| 807 |
|
{ |
| 808 |
1 |
String linkLabel = "XWiki.org Logo"; |
| 809 |
1 |
String linkTooltip = "Download XWiki's Logo"; |
| 810 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 811 |
|
|
| 812 |
|
|
| 813 |
1 |
clickTab(ALL_PAGES_TAB); |
| 814 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 815 |
|
|
| 816 |
1 |
explorer.waitForIt().findAndSelectAttachment("XWikiLogo.png"); |
| 817 |
|
|
| 818 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 819 |
|
|
| 820 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 821 |
|
|
| 822 |
1 |
typeInInput(LABEL_INPUT_TITLE, linkLabel); |
| 823 |
1 |
typeInInput("Type the tooltip of the created link, which appears when mouse is over the link.", linkTooltip); |
| 824 |
|
|
| 825 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 826 |
|
|
| 827 |
|
|
| 828 |
1 |
waitForDialogToClose(); |
| 829 |
|
|
| 830 |
1 |
switchToSource(); |
| 831 |
1 |
assertSourceText("[[" + linkLabel + ">>attach:Sandbox.WebHome@XWikiLogo.png||title=\"" + linkTooltip + "\"]]"); |
| 832 |
|
} |
| 833 |
|
|
| 834 |
|
|
| 835 |
|
|
| 836 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 837 |
1 |
@Test... |
| 838 |
|
public void testValidationOnLinkToAttachment() |
| 839 |
|
{ |
| 840 |
1 |
String linkLabel = "boo"; |
| 841 |
|
|
| 842 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 843 |
|
|
| 844 |
|
|
| 845 |
1 |
clickTab(ALL_PAGES_TAB); |
| 846 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 847 |
|
|
| 848 |
1 |
String attachSpace = "XWiki"; |
| 849 |
1 |
String attachPage = "AdminSheet"; |
| 850 |
1 |
String attachment = "users.png"; |
| 851 |
|
|
| 852 |
|
|
| 853 |
1 |
explorer.waitForIt().findAndSelectPage(attachPage); |
| 854 |
|
|
| 855 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 856 |
|
|
| 857 |
1 |
assertFieldErrorIsPresentInStep("No attachment was selected", TREE_EXPLORER, "xExplorerPanel"); |
| 858 |
|
|
| 859 |
|
|
| 860 |
1 |
explorer.openAttachments(attachSpace, attachPage).selectAttachment(attachSpace, attachPage, attachment); |
| 861 |
|
|
| 862 |
|
|
| 863 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 864 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 865 |
|
|
| 866 |
|
|
| 867 |
1 |
assertEquals(attachment, getInputValue(LABEL_INPUT_TITLE)); |
| 868 |
|
|
| 869 |
1 |
typeInInput(LABEL_INPUT_TITLE, ""); |
| 870 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 871 |
|
|
| 872 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 873 |
|
+ "']", "xLinkConfig"); |
| 874 |
|
|
| 875 |
1 |
typeInInput(LABEL_INPUT_TITLE, linkLabel); |
| 876 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 877 |
|
|
| 878 |
|
|
| 879 |
1 |
waitForDialogToClose(); |
| 880 |
|
|
| 881 |
1 |
switchToSource(); |
| 882 |
1 |
assertSourceText("[[" + linkLabel + ">>attach:" + attachSpace + "." + attachPage + "@" + attachment + "]]"); |
| 883 |
|
} |
| 884 |
|
|
| 885 |
|
|
| 886 |
|
|
| 887 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
| 888 |
1 |
@Test... |
| 889 |
|
public void testEditLinkToAttachment() |
| 890 |
|
{ |
| 891 |
1 |
switchToSource(); |
| 892 |
1 |
setSourceText("[[foobar>>attach:Sandbox.WebHome@XWikiLogo.png]]"); |
| 893 |
1 |
switchToWysiwyg(); |
| 894 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 895 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 896 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 897 |
1 |
explorer.waitForAttachmentSelected("Sandbox", "WebHome", "XWikiLogo.png"); |
| 898 |
1 |
explorer.findAndSelectAttachment("export.png"); |
| 899 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 900 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 901 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 902 |
1 |
waitForDialogToClose(); |
| 903 |
|
|
| 904 |
1 |
switchToSource(); |
| 905 |
1 |
assertSourceText("[[foobar>>attach:XWiki.AdminSheet@export.png]]"); |
| 906 |
|
} |
| 907 |
|
|
| 908 |
|
|
| 909 |
|
@see |
| 910 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 911 |
1 |
@Test... |
| 912 |
|
public void testEditLinkToEmailAddress() |
| 913 |
|
{ |
| 914 |
1 |
switchToSource(); |
| 915 |
1 |
setSourceText("[[test>>mailto:test@xwiki.org]]"); |
| 916 |
1 |
switchToWysiwyg(); |
| 917 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 2); |
| 918 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 919 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 920 |
1 |
assertEquals("test@xwiki.org", getInputValue("Email address")); |
| 921 |
1 |
typeInInput("Email address", "test@gmail.com"); |
| 922 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 923 |
1 |
waitForDialogToClose(); |
| 924 |
|
|
| 925 |
1 |
switchToSource(); |
| 926 |
1 |
assertSourceText("[[test>>mailto:test@gmail.com]]"); |
| 927 |
|
} |
| 928 |
|
|
| 929 |
|
|
| 930 |
|
|
| 931 |
|
|
| 932 |
|
@see |
| 933 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
| 934 |
1 |
@Test... |
| 935 |
|
public void testEditLinkPreservesCustomParameters() |
| 936 |
|
{ |
| 937 |
1 |
switchToSource(); |
| 938 |
1 |
setSourceText("[[foobar>>Main.Activity||class=\"foobarLink\"]]"); |
| 939 |
1 |
switchToWysiwyg(); |
| 940 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 941 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 942 |
|
|
| 943 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 944 |
1 |
explorer.waitForPageSelected("Main", "Activity"); |
| 945 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 946 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 947 |
1 |
typeInInput(LABEL_INPUT_TITLE, "barfoo"); |
| 948 |
1 |
typeInInput("Type the tooltip of the created link, which appears when mouse is over the link.", "Foo and bar"); |
| 949 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 950 |
1 |
waitForDialogToClose(); |
| 951 |
|
|
| 952 |
1 |
switchToSource(); |
| 953 |
1 |
assertSourceText("[[barfoo>>Main.Activity||class=\"foobarLink\" title=\"Foo and bar\"]]"); |
| 954 |
|
} |
| 955 |
|
|
| 956 |
|
|
| 957 |
|
|
| 958 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 959 |
1 |
@Test... |
| 960 |
|
public void testCreateLinkToOpenInNewWindow() |
| 961 |
|
{ |
| 962 |
1 |
String linkLabel = "XWiki rox"; |
| 963 |
1 |
String url = "http://www.xwiki.org"; |
| 964 |
|
|
| 965 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 966 |
|
|
| 967 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 968 |
1 |
typeInInput("Web page address", url); |
| 969 |
1 |
typeInInput(LABEL_INPUT_TITLE, linkLabel); |
| 970 |
|
|
| 971 |
1 |
getSelenium().check("//div[contains(@class, 'xLinkToUrl')]//span[contains(@class, 'gwt-CheckBox')]/input"); |
| 972 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 973 |
1 |
waitForDialogToClose(); |
| 974 |
|
|
| 975 |
1 |
switchToSource(); |
| 976 |
1 |
assertSourceText("[[" + linkLabel + ">>url:" + url + "||rel=\"__blank\"]]"); |
| 977 |
1 |
switchToWysiwyg(); |
| 978 |
|
|
| 979 |
|
|
| 980 |
1 |
moveCaret("document.body.firstChild.firstChild", 4); |
| 981 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 982 |
|
|
| 983 |
1 |
assertEquals(linkLabel, getInputValue(LABEL_INPUT_TITLE)); |
| 984 |
1 |
assertEquals(url, getInputValue("Web page address")); |
| 985 |
1 |
assertTrue(isChecked("//div[contains(@class, 'xLinkToUrl')]//span[contains(@class, 'gwt-CheckBox')]/input")); |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
|
| 989 |
|
|
| 990 |
|
|
| 991 |
|
@see |
| 992 |
|
@see |
| 993 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 994 |
1 |
@Test... |
| 995 |
|
public void testQuoteInLinkTooltip() |
| 996 |
|
{ |
| 997 |
1 |
String linkLabel = "x"; |
| 998 |
1 |
String url = "http://www.xwiki.org"; |
| 999 |
1 |
String tooltip = "our xwiki \"rox\""; |
| 1000 |
1 |
String tooltipTitle = "Type the tooltip of the created link, which appears when mouse is over the link."; |
| 1001 |
1 |
typeText(linkLabel); |
| 1002 |
1 |
selectNodeContents("document.body.firstChild"); |
| 1003 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 1004 |
|
|
| 1005 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 1006 |
1 |
typeInInput(tooltipTitle, tooltip); |
| 1007 |
1 |
typeInInput("Web page address", url); |
| 1008 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1009 |
1 |
waitForDialogToClose(); |
| 1010 |
|
|
| 1011 |
1 |
switchToSource(); |
| 1012 |
1 |
assertSourceText("[[" + linkLabel + ">>url:" + url + "||title=\"our xwiki ~\"rox~\"\"]]"); |
| 1013 |
1 |
switchToWysiwyg(); |
| 1014 |
|
|
| 1015 |
|
|
| 1016 |
1 |
moveCaret("document.body.firstChild.firstChild", 1); |
| 1017 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1018 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 1019 |
1 |
assertEquals(tooltip, getInputValue(tooltipTitle)); |
| 1020 |
|
} |
| 1021 |
|
|
| 1022 |
|
|
| 1023 |
|
|
| 1024 |
|
|
| 1025 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 1026 |
1 |
@Test... |
| 1027 |
|
public void testDefaultWikipageExplorerSelection() |
| 1028 |
|
{ |
| 1029 |
|
|
| 1030 |
1 |
clickEditSaveAndContinue(); |
| 1031 |
|
|
| 1032 |
1 |
String currentSpace = this.getClass().getSimpleName(); |
| 1033 |
1 |
String currentPage = getTestMethodName(); |
| 1034 |
|
|
| 1035 |
1 |
String newSpace = "XWiki"; |
| 1036 |
1 |
String newPage = "AdminSheet"; |
| 1037 |
|
|
| 1038 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1039 |
|
|
| 1040 |
|
|
| 1041 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1042 |
|
|
| 1043 |
|
|
| 1044 |
1 |
assertElementPresent("//div[contains(@class, 'gwt-TabBarItem-selected')]/div[.='" + RECENT_PAGES_TAB + "']"); |
| 1045 |
|
|
| 1046 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1047 |
|
|
| 1048 |
1 |
assertElementPresent("//div[contains(@class, 'xPagesRecent')]" |
| 1049 |
|
+ "//div[contains(@class, 'xListItem-selected')]//div[. = '" |
| 1050 |
|
+ String.format(PAGE_LOCATION, currentSpace, currentPage) + "']"); |
| 1051 |
|
|
| 1052 |
|
|
| 1053 |
1 |
clickTab(ALL_PAGES_TAB); |
| 1054 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 1055 |
|
|
| 1056 |
1 |
explorer.waitForPageSelected(currentSpace, currentPage).findAndSelectPage(newPage); |
| 1057 |
1 |
closeDialog(); |
| 1058 |
1 |
waitForDialogToClose(); |
| 1059 |
|
|
| 1060 |
|
|
| 1061 |
1 |
typeText("z"); |
| 1062 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1063 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1064 |
1 |
explorer.waitForPageSelected(newSpace, newPage); |
| 1065 |
1 |
closeDialog(); |
| 1066 |
1 |
waitForDialogToClose(); |
| 1067 |
|
} |
| 1068 |
|
|
| 1069 |
|
|
| 1070 |
|
|
| 1071 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 1072 |
1 |
@Test... |
| 1073 |
|
public void testCreateLinkToRecentPage() |
| 1074 |
|
{ |
| 1075 |
|
|
| 1076 |
1 |
clickEditSaveAndContinue(); |
| 1077 |
|
|
| 1078 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1079 |
|
|
| 1080 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1081 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1082 |
|
|
| 1083 |
1 |
assertElementPresent("//div[contains(@class, 'xPagesRecent')]" |
| 1084 |
|
+ "//div[contains(@class, 'xListItem-selected')]//div[. = '" |
| 1085 |
|
+ String.format(PAGE_LOCATION, getClass().getSimpleName(), getTestMethodName()) + "']"); |
| 1086 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1087 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1088 |
1 |
String label = "barfoo"; |
| 1089 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1090 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1091 |
1 |
waitForDialogToClose(); |
| 1092 |
|
|
| 1093 |
1 |
switchToSource(); |
| 1094 |
1 |
assertSourceText("[[" + label + ">>doc:" + getTestMethodName() + "]]"); |
| 1095 |
|
} |
| 1096 |
|
|
| 1097 |
|
|
| 1098 |
|
|
| 1099 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1100 |
1 |
@Test... |
| 1101 |
|
public void testCreateLinkToNewPageInCurrentSpace() |
| 1102 |
|
{ |
| 1103 |
1 |
String newPageName = "NewPage"; |
| 1104 |
1 |
String label = "new page label"; |
| 1105 |
|
|
| 1106 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1107 |
|
|
| 1108 |
|
|
| 1109 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1110 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1111 |
|
|
| 1112 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1113 |
|
|
| 1114 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1115 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1116 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", newPageName); |
| 1117 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1118 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1119 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1120 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1121 |
1 |
waitForDialogToClose(); |
| 1122 |
|
|
| 1123 |
1 |
switchToSource(); |
| 1124 |
1 |
assertSourceText("[[" + label + ">>doc:" + newPageName + "]]"); |
| 1125 |
|
} |
| 1126 |
|
|
| 1127 |
|
|
| 1128 |
|
|
| 1129 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 1130 |
1 |
@Test... |
| 1131 |
|
public void testDefaultSearchSelection() |
| 1132 |
|
{ |
| 1133 |
|
|
| 1134 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1135 |
|
|
| 1136 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1137 |
1 |
clickTab(SEARCH_TAB); |
| 1138 |
1 |
waitForStepToLoad("xPagesSearch"); |
| 1139 |
|
|
| 1140 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1141 |
|
|
| 1142 |
1 |
closeDialog(); |
| 1143 |
1 |
waitForDialogToClose(); |
| 1144 |
|
} |
| 1145 |
|
|
| 1146 |
|
|
| 1147 |
|
|
| 1148 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1149 |
1 |
@Test... |
| 1150 |
|
public void testCreateLinkToSearchedPage() |
| 1151 |
|
{ |
| 1152 |
1 |
String label = "foobar"; |
| 1153 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1154 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1155 |
1 |
clickTab(SEARCH_TAB); |
| 1156 |
1 |
waitForStepToLoad("xPagesSearch"); |
| 1157 |
|
|
| 1158 |
|
|
| 1159 |
1 |
typeInInput("Type a keyword to search for a wiki page", "Main.WebHome"); |
| 1160 |
1 |
clickButtonWithText("Search"); |
| 1161 |
|
|
| 1162 |
|
|
| 1163 |
1 |
String targetPageLocator = |
| 1164 |
|
"//div[contains(@class, 'xPagesSearch')]//div[contains(@class, 'xListItem')]//div[.='" |
| 1165 |
|
+ String.format(PAGE_LOCATION, "Main", "WebHome") + "']"; |
| 1166 |
1 |
waitForElement(targetPageLocator); |
| 1167 |
1 |
getSelenium().click(targetPageLocator); |
| 1168 |
|
|
| 1169 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1170 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1171 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1172 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1173 |
1 |
waitForDialogToClose(); |
| 1174 |
|
|
| 1175 |
1 |
switchToSource(); |
| 1176 |
1 |
assertSourceText("[[" + label + ">>doc:Main.WebHome]]"); |
| 1177 |
|
} |
| 1178 |
|
|
| 1179 |
|
|
| 1180 |
|
|
| 1181 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1182 |
1 |
@Test... |
| 1183 |
|
public void testCreateLinkToNewPageInCurrentSpaceFromSearch() |
| 1184 |
|
{ |
| 1185 |
1 |
String newPageName = "AnotherNewPage"; |
| 1186 |
1 |
String label = "x"; |
| 1187 |
|
|
| 1188 |
1 |
typeText(label); |
| 1189 |
|
|
| 1190 |
1 |
selectNodeContents("document.body.firstChild"); |
| 1191 |
|
|
| 1192 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1193 |
|
|
| 1194 |
|
|
| 1195 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1196 |
1 |
clickTab(SEARCH_TAB); |
| 1197 |
1 |
waitForStepToLoad("xPagesSearch"); |
| 1198 |
|
|
| 1199 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1200 |
|
|
| 1201 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1202 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1203 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", newPageName); |
| 1204 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1205 |
1 |
waitForDialogToClose(); |
| 1206 |
|
|
| 1207 |
1 |
switchToSource(); |
| 1208 |
1 |
assertSourceText("[[" + label + ">>doc:" + newPageName + "]]"); |
| 1209 |
|
} |
| 1210 |
|
|
| 1211 |
|
|
| 1212 |
|
|
| 1213 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1214 |
1 |
@Test... |
| 1215 |
|
public void testDefaultAttachmentSelectorSelection() |
| 1216 |
|
{ |
| 1217 |
|
|
| 1218 |
1 |
clickEditSaveAndContinue(); |
| 1219 |
|
|
| 1220 |
1 |
String currentSpace = this.getClass().getSimpleName(); |
| 1221 |
1 |
String currentPage = getTestMethodName(); |
| 1222 |
|
|
| 1223 |
|
|
| 1224 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1225 |
|
|
| 1226 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1227 |
|
|
| 1228 |
1 |
assertElementPresent(NEW_ATTACHMENT); |
| 1229 |
|
|
| 1230 |
1 |
clickTab(ALL_PAGES_TAB); |
| 1231 |
1 |
explorer.waitForAttachmentsSelected(currentSpace, currentPage); |
| 1232 |
1 |
closeDialog(); |
| 1233 |
1 |
waitForDialogToClose(); |
| 1234 |
|
|
| 1235 |
|
|
| 1236 |
1 |
typeText("z"); |
| 1237 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1238 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1239 |
|
|
| 1240 |
1 |
assertElementPresent(NEW_ATTACHMENT); |
| 1241 |
1 |
closeDialog(); |
| 1242 |
1 |
waitForDialogToClose(); |
| 1243 |
|
} |
| 1244 |
|
|
| 1245 |
|
|
| 1246 |
|
|
| 1247 |
|
|
| 1248 |
|
@see |
| 1249 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1250 |
1 |
@Test... |
| 1251 |
|
public void testEditRelativeLink() |
| 1252 |
|
{ |
| 1253 |
|
|
| 1254 |
1 |
String currentSpace = "Main"; |
| 1255 |
1 |
open(currentSpace, getTestMethodName(), "edit", "editor=wysiwyg"); |
| 1256 |
1 |
waitForEditorToLoad(); |
| 1257 |
|
|
| 1258 |
1 |
String pageToLinkTo = "SpaceIndex"; |
| 1259 |
1 |
switchToSource(); |
| 1260 |
1 |
setSourceText("[[the main page>>" + pageToLinkTo + "]]"); |
| 1261 |
1 |
switchToWysiwyg(); |
| 1262 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 1263 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1264 |
|
|
| 1265 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1266 |
1 |
explorer.waitForPageSelected(currentSpace, pageToLinkTo); |
| 1267 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1268 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1269 |
1 |
typeInInput(LABEL_INPUT_TITLE, "space index"); |
| 1270 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1271 |
1 |
waitForDialogToClose(); |
| 1272 |
|
|
| 1273 |
1 |
switchToSource(); |
| 1274 |
1 |
assertSourceText("[[space index>>" + pageToLinkTo + "]]"); |
| 1275 |
|
} |
| 1276 |
|
|
| 1277 |
|
|
| 1278 |
|
|
| 1279 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1280 |
1 |
@Test... |
| 1281 |
|
public void testEditRelativeLinkToAttachment() |
| 1282 |
|
{ |
| 1283 |
|
|
| 1284 |
1 |
String currentSpace = "Sandbox"; |
| 1285 |
1 |
open(currentSpace, getTestMethodName(), "edit", "editor=wysiwyg"); |
| 1286 |
1 |
waitForEditorToLoad(); |
| 1287 |
|
|
| 1288 |
1 |
String pageToLinkTo = "WebHome"; |
| 1289 |
1 |
String fileToLinkTo = "XWikiLogo.png"; |
| 1290 |
|
|
| 1291 |
1 |
switchToSource(); |
| 1292 |
1 |
setSourceText("[[XWiki Logo>>attach:" + pageToLinkTo + "@" + fileToLinkTo + "]]"); |
| 1293 |
1 |
switchToWysiwyg(); |
| 1294 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 1295 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1296 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1297 |
1 |
explorer.waitForAttachmentSelected(currentSpace, pageToLinkTo, fileToLinkTo); |
| 1298 |
|
|
| 1299 |
|
|
| 1300 |
1 |
clickTab(CURRENT_PAGE_TAB); |
| 1301 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1302 |
|
|
| 1303 |
1 |
assertElementPresent(NEW_ATTACHMENT); |
| 1304 |
|
|
| 1305 |
|
|
| 1306 |
1 |
clickTab(ALL_PAGES_TAB); |
| 1307 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1308 |
|
|
| 1309 |
1 |
explorer.waitForAttachmentSelected(currentSpace, pageToLinkTo, fileToLinkTo); |
| 1310 |
|
|
| 1311 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1312 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1313 |
1 |
typeInInput(LABEL_INPUT_TITLE, "XWiki.org Logo"); |
| 1314 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1315 |
1 |
waitForDialogToClose(); |
| 1316 |
|
|
| 1317 |
1 |
switchToSource(); |
| 1318 |
1 |
assertSourceText("[[XWiki.org Logo>>attach:" + pageToLinkTo + "@" + fileToLinkTo + "]]"); |
| 1319 |
|
|
| 1320 |
|
|
| 1321 |
1 |
setSourceText("[[attach.png>>attach:attach.png]]"); |
| 1322 |
1 |
switchToWysiwyg(); |
| 1323 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 1324 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1325 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1326 |
|
|
| 1327 |
1 |
assertElementPresent(NEW_ATTACHMENT_SELECTED); |
| 1328 |
1 |
closeDialog(); |
| 1329 |
1 |
waitForDialogToClose(); |
| 1330 |
|
} |
| 1331 |
|
|
| 1332 |
|
|
| 1333 |
|
|
| 1334 |
|
|
| 1335 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1336 |
1 |
@Test... |
| 1337 |
|
public void testValidationOnCurrentPageAttachmentsSelector() |
| 1338 |
|
{ |
| 1339 |
1 |
switchToSource(); |
| 1340 |
1 |
setSourceText("[[Export>>attach:XWiki.AdminSheet@export.png]]"); |
| 1341 |
1 |
switchToWysiwyg(); |
| 1342 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 3); |
| 1343 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1344 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1345 |
1 |
explorer.waitForAttachmentSelected("XWiki", "AdminSheet", "export.png"); |
| 1346 |
1 |
explorer.findAndSelectAttachment("import.png"); |
| 1347 |
|
|
| 1348 |
1 |
clickTab(CURRENT_PAGE_TAB); |
| 1349 |
|
|
| 1350 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1351 |
|
|
| 1352 |
1 |
assertElementPresent(NEW_ATTACHMENT_SELECTED); |
| 1353 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1354 |
1 |
waitForStepToLoad("xUploadPanel"); |
| 1355 |
1 |
assertFieldErrorIsNotPresentInStep("xUploadPanel"); |
| 1356 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1357 |
1 |
assertFieldErrorIsPresentInStep("The file path was not set", FILE_UPLOAD_INPUT, "xUploadPanel"); |
| 1358 |
|
|
| 1359 |
1 |
closeDialog(); |
| 1360 |
|
} |
| 1361 |
|
|
| 1362 |
|
|
| 1363 |
|
|
| 1364 |
|
|
| 1365 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (31) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1366 |
1 |
@Test... |
| 1367 |
|
public void testEditLinkPreservesFullReferences() |
| 1368 |
|
{ |
| 1369 |
|
|
| 1370 |
1 |
open("Sandbox", getTestMethodName(), "edit", "editor=wysiwyg"); |
| 1371 |
1 |
waitForEditorToLoad(); |
| 1372 |
|
|
| 1373 |
1 |
switchToSource(); |
| 1374 |
|
|
| 1375 |
1 |
setSourceText("[[bob>>Sandbox.WebHome]] [[alice>>Sandbox.NewPage]] " |
| 1376 |
|
+ "[[carol>>attach:Sandbox.WebHome@XWikiLogo.png]]"); |
| 1377 |
1 |
switchToWysiwyg(); |
| 1378 |
|
|
| 1379 |
|
|
| 1380 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 1); |
| 1381 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1382 |
|
|
| 1383 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1384 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 1385 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1386 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1387 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1388 |
1 |
waitForDialogToClose(); |
| 1389 |
|
|
| 1390 |
|
|
| 1391 |
1 |
moveCaret("document.body.firstChild.childNodes[2].firstChild", 2); |
| 1392 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1393 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1394 |
1 |
explorer.waitForFinderValue("document:xwiki:Sandbox.NewPage.WebHome"); |
| 1395 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1396 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1397 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1398 |
1 |
waitForDialogToClose(); |
| 1399 |
|
|
| 1400 |
|
|
| 1401 |
1 |
moveCaret("document.body.firstChild.childNodes[4].firstChild", 2); |
| 1402 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1403 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1404 |
1 |
explorer.waitForAttachmentSelected("Sandbox", "WebHome", "XWikiLogo.png"); |
| 1405 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1406 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1407 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1408 |
1 |
waitForDialogToClose(); |
| 1409 |
|
|
| 1410 |
1 |
switchToSource(); |
| 1411 |
1 |
assertSourceText("[[bob>>Sandbox.WebHome]] [[alice>>Sandbox.NewPage]] " |
| 1412 |
|
+ "[[carol>>attach:Sandbox.WebHome@XWikiLogo.png]]"); |
| 1413 |
|
} |
| 1414 |
|
|
| 1415 |
|
|
| 1416 |
|
|
| 1417 |
|
|
| 1418 |
|
|
| 1419 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1420 |
1 |
@Test... |
| 1421 |
|
public void testErrorIsHiddenOnNextDisplayOfExternalLink() |
| 1422 |
|
{ |
| 1423 |
|
|
| 1424 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 1425 |
1 |
typeInInput("Web page address", "http://www.xwiki.org"); |
| 1426 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1427 |
|
|
| 1428 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 1429 |
|
+ "']", "xLinkToUrl"); |
| 1430 |
|
|
| 1431 |
1 |
closeDialog(); |
| 1432 |
|
|
| 1433 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 1434 |
|
|
| 1435 |
1 |
assertElementNotPresent(ERROR_MSG_CLASS); |
| 1436 |
1 |
closeDialog(); |
| 1437 |
|
|
| 1438 |
|
|
| 1439 |
1 |
openLinkDialog(MENU_EMAIL_ADDRESS); |
| 1440 |
1 |
typeInInput("Email address", "xwiki@xwiki.com"); |
| 1441 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1442 |
|
|
| 1443 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[@title='" + LABEL_INPUT_TITLE |
| 1444 |
|
+ "']", "xLinkToUrl"); |
| 1445 |
|
|
| 1446 |
1 |
closeDialog(); |
| 1447 |
|
|
| 1448 |
1 |
openLinkDialog(MENU_EMAIL_ADDRESS); |
| 1449 |
|
|
| 1450 |
1 |
assertElementNotPresent(ERROR_MSG_CLASS); |
| 1451 |
1 |
closeDialog(); |
| 1452 |
|
} |
| 1453 |
|
|
| 1454 |
|
|
| 1455 |
|
|
| 1456 |
|
|
| 1457 |
|
|
| 1458 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 1459 |
1 |
@Test... |
| 1460 |
|
public void testErrorIsHiddenOnNextDisplayOfAttachmentLink() |
| 1461 |
|
{ |
| 1462 |
|
|
| 1463 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1464 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1465 |
|
|
| 1466 |
1 |
assertElementPresent(NEW_ATTACHMENT_SELECTED); |
| 1467 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1468 |
1 |
waitForStepToLoad("xUploadPanel"); |
| 1469 |
|
|
| 1470 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1471 |
1 |
assertFieldErrorIsPresentInStep("The file path was not set", FILE_UPLOAD_INPUT, "xUploadPanel"); |
| 1472 |
|
|
| 1473 |
1 |
clickButtonWithText("Previous"); |
| 1474 |
|
|
| 1475 |
|
|
| 1476 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1477 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1478 |
1 |
assertFieldErrorIsNotPresentInStep("xUploadPanel"); |
| 1479 |
|
|
| 1480 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1481 |
1 |
assertFieldErrorIsPresentInStep("The file path was not set", FILE_UPLOAD_INPUT, "xUploadPanel"); |
| 1482 |
1 |
closeDialog(); |
| 1483 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1484 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1485 |
1 |
assertElementPresent(NEW_ATTACHMENT_SELECTED); |
| 1486 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1487 |
1 |
assertFieldErrorIsNotPresentInStep("xUploadPanel"); |
| 1488 |
|
} |
| 1489 |
|
|
| 1490 |
|
|
| 1491 |
|
|
| 1492 |
|
|
| 1493 |
|
|
| 1494 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (92) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
| 1495 |
1 |
@Test... |
| 1496 |
|
public void testErrorIsHiddenOnNextDisplayOfWikipageLink() |
| 1497 |
|
{ |
| 1498 |
|
|
| 1499 |
|
|
| 1500 |
|
|
| 1501 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1502 |
1 |
waitForStepAggregatorAndAssertSelectedStep(RECENT_PAGES_TAB); |
| 1503 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1504 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1505 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1506 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1507 |
1 |
assertFieldErrorIsPresentInStep("The name of the new page was not set", "//input", "xLinkToNewPage"); |
| 1508 |
1 |
clickButtonWithText("Previous"); |
| 1509 |
1 |
waitForStepAggregatorAndAssertSelectedStep(RECENT_PAGES_TAB); |
| 1510 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1511 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1512 |
|
|
| 1513 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkToNewPage"); |
| 1514 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1515 |
1 |
assertFieldErrorIsPresentInStep("The name of the new page was not set", "//input", "xLinkToNewPage"); |
| 1516 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", "NewPage"); |
| 1517 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1518 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1519 |
1 |
clickButtonWithText("Previous"); |
| 1520 |
|
|
| 1521 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkToNewPage"); |
| 1522 |
|
|
| 1523 |
1 |
assertEquals("NewPage", getSelenium().getValue("//div[contains(@class, 'xLinkToNewPage')]//input")); |
| 1524 |
|
|
| 1525 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", ""); |
| 1526 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1527 |
1 |
assertFieldErrorIsPresentInStep("The name of the new page was not set", "//input", "xLinkToNewPage"); |
| 1528 |
1 |
closeDialog(); |
| 1529 |
|
|
| 1530 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1531 |
1 |
waitForStepAggregatorAndAssertSelectedStep(RECENT_PAGES_TAB); |
| 1532 |
1 |
assertElementPresent("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1533 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1534 |
|
|
| 1535 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkToNewPage"); |
| 1536 |
1 |
closeDialog(); |
| 1537 |
1 |
resetContent(); |
| 1538 |
|
|
| 1539 |
|
|
| 1540 |
|
|
| 1541 |
|
|
| 1542 |
1 |
switchToSource(); |
| 1543 |
1 |
setSourceText("[[the sandbox>>Sandbox.WebHome]]"); |
| 1544 |
1 |
switchToWysiwyg(); |
| 1545 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 4); |
| 1546 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1547 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1548 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 1549 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1550 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1551 |
1 |
typeInInput(LABEL_INPUT_TITLE, ""); |
| 1552 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1553 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[position() = 1]", |
| 1554 |
|
"xLinkConfig"); |
| 1555 |
|
|
| 1556 |
1 |
clickButtonWithText("Previous"); |
| 1557 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1558 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 1559 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1560 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkConfig"); |
| 1561 |
|
|
| 1562 |
1 |
typeInInput(LABEL_INPUT_TITLE, ""); |
| 1563 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1564 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[position() = 1]", |
| 1565 |
|
"xLinkConfig"); |
| 1566 |
1 |
closeDialog(); |
| 1567 |
|
|
| 1568 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1569 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1570 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 1571 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1572 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkConfig"); |
| 1573 |
|
|
| 1574 |
1 |
typeInInput(LABEL_INPUT_TITLE, ""); |
| 1575 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1576 |
1 |
assertFieldErrorIsPresentInStep("The label of the link cannot be empty", "//input[position() = 1]", |
| 1577 |
|
"xLinkConfig"); |
| 1578 |
|
|
| 1579 |
1 |
typeInInput(LABEL_INPUT_TITLE, "PageNew"); |
| 1580 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1581 |
|
|
| 1582 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1583 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1584 |
1 |
explorer.waitForPageSelected("Sandbox", "WebHome"); |
| 1585 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1586 |
1 |
assertFieldErrorIsNotPresentInStep("xLinkConfig"); |
| 1587 |
1 |
closeDialog(); |
| 1588 |
|
|
| 1589 |
|
|
| 1590 |
|
|
| 1591 |
1 |
switchToSource(); |
| 1592 |
1 |
setSourceText("[[the blog>>Blog.WebHome]]"); |
| 1593 |
1 |
switchToWysiwyg(); |
| 1594 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 4); |
| 1595 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1596 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1597 |
1 |
explorer.waitForPageSelected("Blog", "WebHome"); |
| 1598 |
|
|
| 1599 |
1 |
explorer.togglePageSelection("Blog", "WebHome"); |
| 1600 |
|
|
| 1601 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1602 |
1 |
assertFieldErrorIsPresentInStep("No page was selected", TREE_EXPLORER, "xExplorerPanel"); |
| 1603 |
1 |
explorer.findAndSelectPage("Blog"); |
| 1604 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1605 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1606 |
1 |
clickButtonWithText("Previous"); |
| 1607 |
|
|
| 1608 |
1 |
explorer.waitForPageSelected("Blog", "WebHome"); |
| 1609 |
1 |
assertFieldErrorIsNotPresentInStep("xExplorerPanel"); |
| 1610 |
|
|
| 1611 |
|
|
| 1612 |
1 |
explorer.togglePageSelection("Blog", "WebHome"); |
| 1613 |
|
|
| 1614 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1615 |
1 |
assertFieldErrorIsPresentInStep("No page was selected", TREE_EXPLORER, "xExplorerPanel"); |
| 1616 |
1 |
closeDialog(); |
| 1617 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1618 |
1 |
waitForStepAggregatorAndAssertSelectedStep(ALL_PAGES_TAB); |
| 1619 |
1 |
assertFieldErrorIsNotPresentInStep("xExplorerPanel"); |
| 1620 |
1 |
closeDialog(); |
| 1621 |
|
} |
| 1622 |
|
|
| 1623 |
|
|
| 1624 |
|
|
| 1625 |
|
|
| 1626 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 1627 |
1 |
@Test... |
| 1628 |
|
public void testFastNavigationToSelectAttachment() |
| 1629 |
|
{ |
| 1630 |
|
|
| 1631 |
|
|
| 1632 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1633 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1634 |
1 |
getSelenium().click(NEW_ATTACHMENT); |
| 1635 |
1 |
getSelenium().doubleClick(NEW_ATTACHMENT); |
| 1636 |
1 |
waitForStepToLoad("xUploadPanel"); |
| 1637 |
1 |
closeDialog(); |
| 1638 |
|
|
| 1639 |
|
|
| 1640 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1641 |
1 |
waitForStepToLoad("xAttachmentsSelector"); |
| 1642 |
1 |
getSelenium().click(NEW_ATTACHMENT); |
| 1643 |
1 |
getSelenium().typeKeys(ITEMS_LIST, "\\13"); |
| 1644 |
1 |
waitForStepToLoad("xUploadPanel"); |
| 1645 |
1 |
closeDialog(); |
| 1646 |
|
} |
| 1647 |
|
|
| 1648 |
|
|
| 1649 |
|
|
| 1650 |
|
|
| 1651 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1652 |
1 |
@Test... |
| 1653 |
|
public void testFastNavigationToSelectRecentPage() |
| 1654 |
|
{ |
| 1655 |
|
|
| 1656 |
|
|
| 1657 |
1 |
clickEditSaveAndContinue(); |
| 1658 |
1 |
String currentPageLocation = String.format(PAGE_LOCATION, this.getClass().getSimpleName(), getTestMethodName()); |
| 1659 |
1 |
String label = "barfoo"; |
| 1660 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1661 |
1 |
waitForStepAggregatorAndAssertSelectedStep(RECENT_PAGES_TAB); |
| 1662 |
1 |
getSelenium().click( |
| 1663 |
|
"//div[contains(@class, 'xPagesSelector')]//div[contains(@class, 'gwt-Label') and .='" |
| 1664 |
|
+ currentPageLocation + "']"); |
| 1665 |
1 |
getSelenium().doubleClick( |
| 1666 |
|
"//div[contains(@class, 'xPagesSelector')]//div[contains(@class, 'gwt-Label') and .='" |
| 1667 |
|
+ currentPageLocation + "']"); |
| 1668 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1669 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1670 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1671 |
1 |
waitForDialogToClose(); |
| 1672 |
|
|
| 1673 |
1 |
switchToSource(); |
| 1674 |
1 |
assertSourceText("[[" + label + ">>doc:" + getTestMethodName() + "]]"); |
| 1675 |
|
|
| 1676 |
1 |
setSourceText(""); |
| 1677 |
1 |
switchToWysiwyg(); |
| 1678 |
|
|
| 1679 |
|
|
| 1680 |
1 |
String newPageName = "NewPage"; |
| 1681 |
1 |
label = "foobar"; |
| 1682 |
|
|
| 1683 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1684 |
1 |
waitForStepAggregatorAndAssertSelectedStep(RECENT_PAGES_TAB); |
| 1685 |
|
|
| 1686 |
1 |
getSelenium().click("//div[contains(@class, 'xListItem')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1687 |
1 |
getSelenium().typeKeys(ITEMS_LIST, "\\13"); |
| 1688 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1689 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", newPageName); |
| 1690 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1691 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1692 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1693 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1694 |
1 |
waitForDialogToClose(); |
| 1695 |
|
|
| 1696 |
1 |
switchToSource(); |
| 1697 |
1 |
assertSourceText("[[" + label + ">>doc:" + newPageName + "]]"); |
| 1698 |
|
} |
| 1699 |
|
|
| 1700 |
|
|
| 1701 |
|
|
| 1702 |
|
|
| 1703 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (36) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1704 |
1 |
@Test... |
| 1705 |
|
public void testFastNavigationToSelectSearchedPage() |
| 1706 |
|
{ |
| 1707 |
|
|
| 1708 |
1 |
String label = "foobar"; |
| 1709 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1710 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1711 |
1 |
clickTab(SEARCH_TAB); |
| 1712 |
1 |
waitForStepToLoad("xPagesSearch"); |
| 1713 |
|
|
| 1714 |
|
|
| 1715 |
1 |
typeInInput("Type a keyword to search for a wiki page", "Main.WebHome"); |
| 1716 |
1 |
clickButtonWithText("Search"); |
| 1717 |
|
|
| 1718 |
|
|
| 1719 |
1 |
String targetPageLocator = |
| 1720 |
|
"//div[contains(@class, 'xPagesSearch')]//div[contains(@class, 'xListItem')]//div[.='" |
| 1721 |
|
+ String.format(PAGE_LOCATION, "Main", "WebHome") + "']"; |
| 1722 |
1 |
waitForElement(targetPageLocator); |
| 1723 |
1 |
getSelenium().click(targetPageLocator); |
| 1724 |
1 |
getSelenium().typeKeys("//div[contains(@class, 'xPagesSearch')]" + ITEMS_LIST, "\\13"); |
| 1725 |
|
|
| 1726 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1727 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1728 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1729 |
1 |
waitForDialogToClose(); |
| 1730 |
|
|
| 1731 |
1 |
switchToSource(); |
| 1732 |
1 |
assertSourceText("[[" + label + ">>doc:Main.WebHome]]"); |
| 1733 |
|
|
| 1734 |
1 |
setSourceText(""); |
| 1735 |
1 |
switchToWysiwyg(); |
| 1736 |
|
|
| 1737 |
|
|
| 1738 |
1 |
String newPageName = "PageNew"; |
| 1739 |
1 |
label = "barfoo"; |
| 1740 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1741 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1742 |
1 |
clickTab(SEARCH_TAB); |
| 1743 |
1 |
waitForStepToLoad("xPagesSearch"); |
| 1744 |
1 |
getSelenium().click(NEW_PAGE_FROM_SEARCH_LOCATOR); |
| 1745 |
1 |
getSelenium().doubleClick(NEW_PAGE_FROM_SEARCH_LOCATOR); |
| 1746 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1747 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", newPageName); |
| 1748 |
1 |
clickButtonWithText(BUTTON_LINK_SETTINGS); |
| 1749 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1750 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1751 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1752 |
1 |
waitForDialogToClose(); |
| 1753 |
|
|
| 1754 |
1 |
switchToSource(); |
| 1755 |
1 |
assertSourceText("[[" + label + ">>doc:" + newPageName + "]]"); |
| 1756 |
|
} |
| 1757 |
|
|
| 1758 |
|
|
| 1759 |
|
|
| 1760 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 1761 |
1 |
@Test... |
| 1762 |
|
public void testFilterEmptyLink() |
| 1763 |
|
{ |
| 1764 |
1 |
typeText("ab"); |
| 1765 |
|
|
| 1766 |
1 |
selectNodeContents("document.body.firstChild"); |
| 1767 |
|
|
| 1768 |
1 |
clickBoldButton(); |
| 1769 |
|
|
| 1770 |
1 |
openLinkDialog(MENU_WEB_PAGE); |
| 1771 |
|
|
| 1772 |
1 |
waitForStepToLoad("xLinkToUrl"); |
| 1773 |
1 |
typeInInput("Web page address", "http://www.xwiki.org"); |
| 1774 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1775 |
1 |
waitForDialogToClose(); |
| 1776 |
|
|
| 1777 |
1 |
moveCaret("document.body.firstChild.firstChild.firstChild", 1); |
| 1778 |
|
|
| 1779 |
1 |
clickBoldButton(); |
| 1780 |
|
|
| 1781 |
1 |
assertEquals(3L, getRichTextArea().executeScript("return document.body.getElementsByTagName('a').length")); |
| 1782 |
|
|
| 1783 |
1 |
switchToSource(); |
| 1784 |
1 |
assertSourceText("**[[a>>url:http://www.xwiki.org]][[b>>url:http://www.xwiki.org]]**"); |
| 1785 |
|
} |
| 1786 |
|
|
| 1787 |
|
|
| 1788 |
|
@see |
| 1789 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 1790 |
1 |
@Test... |
| 1791 |
|
public void testPreviewHeadingContainingLinkWithNoLabel() |
| 1792 |
|
{ |
| 1793 |
1 |
switchToSource(); |
| 1794 |
1 |
setSourceText("= x [[y]] ="); |
| 1795 |
1 |
switchToWysiwyg(); |
| 1796 |
1 |
clickEditPreview(); |
| 1797 |
1 |
assertElementNotPresent("//div[@class = 'errormessage']"); |
| 1798 |
1 |
clickBackToEdit(); |
| 1799 |
|
} |
| 1800 |
|
|
| 1801 |
|
|
| 1802 |
|
|
| 1803 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (36) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1804 |
1 |
@Test... |
| 1805 |
|
public void testCreateLinkToRecentlyModifiedPageWithSpecialCharactersInName() |
| 1806 |
|
{ |
| 1807 |
|
|
| 1808 |
1 |
String spaceName = this.getClass().getSimpleName() + ":s.t@u?v=w&x=y#z"; |
| 1809 |
1 |
String escapedSpaceName = spaceName.replaceAll("([\\:\\.])", "\\\\$1"); |
| 1810 |
1 |
String pageName = getTestMethodName() + ":a.b@c?d=e&f=g#h"; |
| 1811 |
1 |
String escapedPageName = pageName.replace(".", "\\."); |
| 1812 |
1 |
String linkReference = String.format("%s.%s", escapedSpaceName, escapedPageName); |
| 1813 |
1 |
open("Main", "WebHome"); |
| 1814 |
1 |
createPage(spaceName, pageName, ""); |
| 1815 |
|
|
| 1816 |
|
|
| 1817 |
1 |
open(this.getClass().getSimpleName(), getTestMethodName(), "edit", "editor=wysiwyg"); |
| 1818 |
1 |
waitForEditorToLoad(); |
| 1819 |
|
|
| 1820 |
|
|
| 1821 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1822 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1823 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1824 |
1 |
String createdPageLocator = |
| 1825 |
|
"//div[contains(@class, 'xListItem')]//div[contains(@class, 'gwt-Label') and .='" |
| 1826 |
|
+ String.format(PAGE_LOCATION, spaceName, pageName) + "']"; |
| 1827 |
1 |
waitForElement(createdPageLocator); |
| 1828 |
1 |
getSelenium().click(createdPageLocator); |
| 1829 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1830 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1831 |
1 |
String label = "Label"; |
| 1832 |
1 |
typeInInput(LABEL_INPUT_TITLE, label); |
| 1833 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1834 |
1 |
waitForDialogToClose(); |
| 1835 |
|
|
| 1836 |
|
|
| 1837 |
1 |
switchToSource(); |
| 1838 |
1 |
assertSourceText(String.format("[[%s>>doc:%s]]", label, linkReference)); |
| 1839 |
1 |
switchToWysiwyg(); |
| 1840 |
|
|
| 1841 |
|
|
| 1842 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1843 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1844 |
1 |
clickTab(RECENT_PAGES_TAB); |
| 1845 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1846 |
1 |
waitForElement("//div[contains(@class, 'xListItem-selected')]//div[. = '" |
| 1847 |
|
+ String.format(PAGE_LOCATION, spaceName, pageName) + "']"); |
| 1848 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1849 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1850 |
|
|
| 1851 |
1 |
getSelenium().check("//div[contains(@class, 'xLinkConfig')]//span[contains(@class, 'gwt-CheckBox')]/input"); |
| 1852 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1853 |
1 |
waitForDialogToClose(); |
| 1854 |
|
|
| 1855 |
|
|
| 1856 |
1 |
switchToSource(); |
| 1857 |
1 |
assertSourceText(String.format("[[%s>>doc:%s||rel=\"__blank\"]]", label, linkReference)); |
| 1858 |
|
} |
| 1859 |
|
|
| 1860 |
|
|
| 1861 |
|
|
| 1862 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1863 |
1 |
@Test... |
| 1864 |
|
public void testCreateLinkToNewPageWithSpecialCharactersInName() |
| 1865 |
|
{ |
| 1866 |
1 |
String pageName = getTestMethodName() + ":a.b@c?d=e&f=g#h"; |
| 1867 |
1 |
String linkReference = pageName.replace(".", "\\."); |
| 1868 |
1 |
String label = "x"; |
| 1869 |
|
|
| 1870 |
1 |
typeText(label); |
| 1871 |
1 |
selectNode("document.body.firstChild"); |
| 1872 |
|
|
| 1873 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1874 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1875 |
1 |
waitForStepToLoad("xPagesSelector"); |
| 1876 |
1 |
waitForElement("//div[contains(@class, 'xListItem-selected')]/div[contains(@class, 'xNewPagePreview')]"); |
| 1877 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1878 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1879 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", pageName); |
| 1880 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1881 |
1 |
waitForDialogToClose(); |
| 1882 |
|
|
| 1883 |
1 |
switchToSource(); |
| 1884 |
1 |
assertSourceText(String.format("[[%s>>doc:%s]]", label, linkReference)); |
| 1885 |
|
} |
| 1886 |
|
|
| 1887 |
|
|
| 1888 |
|
|
| 1889 |
|
|
| 1890 |
|
@see |
| 1891 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1892 |
1 |
@Test... |
| 1893 |
|
public void testCreateLinkToCurrentPageThroughAllPages() |
| 1894 |
|
{ |
| 1895 |
|
|
| 1896 |
1 |
clickEditSaveAndContinue(); |
| 1897 |
|
|
| 1898 |
1 |
String linkLabel = "x"; |
| 1899 |
1 |
typeText(linkLabel); |
| 1900 |
1 |
selectNodeContents("document.body.firstChild"); |
| 1901 |
|
|
| 1902 |
1 |
openLinkDialog(MENU_WIKI_PAGE); |
| 1903 |
1 |
clickTab(ALL_PAGES_TAB); |
| 1904 |
1 |
waitForStepToLoad(STEP_EXPLORER); |
| 1905 |
|
|
| 1906 |
1 |
String currentSpaceName = this.getClass().getSimpleName(); |
| 1907 |
1 |
String currentPageName = getTestMethodName(); |
| 1908 |
|
|
| 1909 |
|
|
| 1910 |
1 |
explorer.waitForPageSelected(currentSpaceName, currentPageName); |
| 1911 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1912 |
|
|
| 1913 |
|
|
| 1914 |
1 |
waitForStepToLoad("xLinkConfig"); |
| 1915 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1916 |
1 |
waitForDialogToClose(); |
| 1917 |
|
|
| 1918 |
1 |
switchToSource(); |
| 1919 |
1 |
assertSourceText("[[" + linkLabel + ">>doc:" + currentPageName + "]]"); |
| 1920 |
|
} |
| 1921 |
|
|
| 1922 |
|
|
| 1923 |
|
@see |
| 1924 |
|
|
| 1925 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 1926 |
1 |
@Test... |
| 1927 |
|
public void testChangeLinkTargetToNewPage() |
| 1928 |
|
{ |
| 1929 |
1 |
switchToSource(); |
| 1930 |
1 |
setSourceText("[[Home>>Main.WebHome]]"); |
| 1931 |
1 |
switchToWysiwyg(); |
| 1932 |
|
|
| 1933 |
|
|
| 1934 |
1 |
selectAllContent(); |
| 1935 |
|
|
| 1936 |
1 |
openLinkDialog(MENU_LINK_EDIT); |
| 1937 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1938 |
1 |
waitForStepToLoad("xExplorerPanel"); |
| 1939 |
1 |
explorer.waitForPageSelected("Main", "WebHome"); |
| 1940 |
|
|
| 1941 |
1 |
explorer.openPage("Blog", "WebHome").selectNewPage("Blog"); |
| 1942 |
1 |
clickButtonWithText(BUTTON_SELECT); |
| 1943 |
|
|
| 1944 |
1 |
waitForStepToLoad("xLinkToNewPage"); |
| 1945 |
1 |
getSelenium().type("//div[contains(@class, 'xLinkToNewPage')]//input", getTestMethodName()); |
| 1946 |
1 |
clickButtonWithText(BUTTON_CREATE_LINK); |
| 1947 |
1 |
waitForDialogToClose(); |
| 1948 |
|
|
| 1949 |
1 |
switchToSource(); |
| 1950 |
1 |
assertSourceText("[[Home>>Blog." + getTestMethodName() + "]]"); |
| 1951 |
|
} |
| 1952 |
|
|
| 1953 |
|
|
| 1954 |
|
|
| 1955 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 1956 |
1 |
@Test... |
| 1957 |
|
public void testAttachmentSelectionLimitedToCurrentPage() |
| 1958 |
|
{ |
| 1959 |
1 |
String allPagesTabLocator = |
| 1960 |
|
"//*[contains(@class, 'xStepsTabs')]//*[@class = 'gwt-TabBarItem' and . = '" + ALL_PAGES_TAB + "']"; |
| 1961 |
1 |
String location = getSelenium().getLocation(); |
| 1962 |
|
|
| 1963 |
|
|
| 1964 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1965 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1966 |
1 |
assertElementPresent(allPagesTabLocator); |
| 1967 |
|
|
| 1968 |
|
|
| 1969 |
1 |
open("XWiki", "WysiwygEditorConfig", "edit", "editor=object"); |
| 1970 |
1 |
expandObject("XWiki.WysiwygEditorConfigClass", 0); |
| 1971 |
1 |
checkField("XWiki.WysiwygEditorConfigClass_0_attachmentSelectionLimited"); |
| 1972 |
1 |
clickEditSaveAndContinue(); |
| 1973 |
|
|
| 1974 |
1 |
try { |
| 1975 |
1 |
open(location); |
| 1976 |
1 |
waitForEditorToLoad(); |
| 1977 |
|
|
| 1978 |
|
|
| 1979 |
1 |
openLinkDialog(MENU_ATTACHMENT); |
| 1980 |
1 |
waitForStepToLoad("xSelectorAggregatorStep"); |
| 1981 |
1 |
assertElementNotPresent(allPagesTabLocator); |
| 1982 |
|
} finally { |
| 1983 |
|
|
| 1984 |
1 |
open("XWiki", "WysiwygEditorConfig", "edit", "editor=object"); |
| 1985 |
1 |
expandObject("XWiki.WysiwygEditorConfigClass", 0); |
| 1986 |
1 |
checkField("XWiki.WysiwygEditorConfigClass_0_attachmentSelectionLimited_false"); |
| 1987 |
1 |
clickEditSaveAndContinue(); |
| 1988 |
|
} |
| 1989 |
|
} |
| 1990 |
|
|
| 1991 |
|
|
| 1992 |
|
@see |
| 1993 |
|
|
| 1994 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 1995 |
1 |
@Test... |
| 1996 |
|
public void testEmptyLinkFilterWhenEditingFullScreen() throws UnsupportedEncodingException |
| 1997 |
|
{ |
| 1998 |
|
|
| 1999 |
1 |
open("Blog", "BlogIntroduction", "save", |
| 2000 |
|
"Blog.BlogPostClass_0_extract=" + URLEncoder.encode("[[XWiki>>http://www.xwiki.org]]", "UTF-8")); |
| 2001 |
|
|
| 2002 |
|
|
| 2003 |
1 |
open("Blog", "BlogIntroduction", "edit", "editor=inline"); |
| 2004 |
|
|
| 2005 |
|
|
| 2006 |
1 |
waitForEditorToLoad(); |
| 2007 |
1 |
clickEditInFullScreen(); |
| 2008 |
1 |
clickEditSaveAndView(); |
| 2009 |
|
|
| 2010 |
|
|
| 2011 |
1 |
open("/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction/objects/Blog.BlogPostClass/0/properties/extract"); |
| 2012 |
1 |
assertTrue(getDriver().getPageSource().contains("<value>[[XWiki>>http://www.xwiki.org]]</value>")); |
| 2013 |
|
} |
| 2014 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2015 |
150 |
protected void waitForStepToLoad(String name)... |
| 2016 |
|
{ |
| 2017 |
150 |
getDriver().waitUntilElementIsVisible(By.className(name)); |
| 2018 |
|
} |
| 2019 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2020 |
25 |
private void clickTab(String tabName)... |
| 2021 |
|
{ |
| 2022 |
25 |
String tabSelector = "//div[.='" + tabName + "']"; |
| 2023 |
25 |
getSelenium().click(tabSelector); |
| 2024 |
|
} |
| 2025 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 2026 |
74 |
private void openLinkDialog(String menuName)... |
| 2027 |
|
{ |
| 2028 |
74 |
clickMenu(MENU_LINK); |
| 2029 |
74 |
assertTrue(isMenuEnabled(menuName)); |
| 2030 |
74 |
clickMenu(menuName); |
| 2031 |
74 |
waitForDialogToLoad(); |
| 2032 |
|
} |
| 2033 |
|
|
| 2034 |
|
|
| 2035 |
|
@link |
| 2036 |
|
|
| 2037 |
|
|
| 2038 |
|
@param |
| 2039 |
|
@param |
| 2040 |
|
@param |
| 2041 |
|
@see@link |
| 2042 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2043 |
23 |
public void assertFieldErrorIsPresentInStep(String errorMessage, String fieldXPathLocator, String step)... |
| 2044 |
|
{ |
| 2045 |
23 |
waitForStepToLoad(step); |
| 2046 |
23 |
assertFieldErrorIsPresent(errorMessage, fieldXPathLocator); |
| 2047 |
|
} |
| 2048 |
|
|
| 2049 |
|
|
| 2050 |
|
@link |
| 2051 |
|
|
| 2052 |
|
@param |
| 2053 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2054 |
11 |
public void assertFieldErrorIsNotPresentInStep(String step)... |
| 2055 |
|
{ |
| 2056 |
11 |
waitForStepToLoad(step); |
| 2057 |
11 |
assertFieldErrorIsNotPresent(); |
| 2058 |
|
} |
| 2059 |
|
|
| 2060 |
|
|
| 2061 |
|
|
| 2062 |
|
|
| 2063 |
|
@param |
| 2064 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2065 |
11 |
private void waitForStepAggregatorAndAssertSelectedStep(String selectedStepTitle)... |
| 2066 |
|
{ |
| 2067 |
11 |
getDriver().waitUntilElementIsVisible( |
| 2068 |
|
By.xpath("//*[@class = 'xSelectorAggregatorStep']/" |
| 2069 |
|
+ "*[contains(@class, 'xStepsTabs') and not(contains(@class, 'loading'))]")); |
| 2070 |
11 |
assertTrue(getDriver().hasElementWithoutWaiting( |
| 2071 |
|
By.xpath("//*[contains(@class, 'xStepsTabs')]" |
| 2072 |
|
+ "//*[contains(@class, 'gwt-TabBarItem-selected') and . = '" + selectedStepTitle + "']"))); |
| 2073 |
|
} |
| 2074 |
|
} |