Search in sources :

Example 86 with ViewPage

use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.

the class AttachmentTest method testUploadDownloadTwoAttachmentsInParallel.

@Test
@Ignore("WebDriver doesn't support uploading multiple files in one input, see http://code.google.com/p/selenium/issues/detail?id=2239")
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testUploadDownloadTwoAttachmentsInParallel() {
    ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), null, getTestClassName() + "#" + getTestMethodName());
    // TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
    // view mode) is fixed.
    vp.waitForDocExtraPaneActive("comments");
    AttachmentsPane ap = vp.openAttachmentsDocExtraPane();
    ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment).getPath());
    ap.addAnotherFile();
    ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment2).getPath());
    ap.clickAttachFiles();
    Assert.assertEquals("1.1", ap.getLatestVersionOfAttachment(this.testAttachment));
    Assert.assertEquals("1.1", ap.getLatestVersionOfAttachment(this.testAttachment2));
    // Verify attachment contents
    ap.getAttachmentLink(this.testAttachment).click();
    Assert.assertEquals("This is a small attachment.", getDriver().findElement(By.tagName("html")).getText());
    getDriver().navigate().back();
    vp.waitForDocExtraPaneActive("attachments");
    ap.getAttachmentLink(this.testAttachment2).click();
    Assert.assertEquals("This is another small attachment.", getDriver().findElement(By.tagName("html")).getText());
}
Also used : AttachmentsPane(org.xwiki.test.ui.po.AttachmentsPane) ViewPage(org.xwiki.test.ui.po.ViewPage) Ignore(org.junit.Ignore) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 87 with ViewPage

use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.

the class AttachmentTest method testAttachAndViewGifImage.

/**
 * See XWIKI-5896: The image handling in the WYSIWYG-editor with GIF images is buggy.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testAttachAndViewGifImage() {
    // Prepare the page to display the GIF image. We explicitly set the width to a value greater than the actual
    // image width because we want the code that resizes the image on the server side to be executed (even if the
    // image is not actually resized).
    ViewPage viewPage = getUtil().createPage(getClass().getSimpleName(), getTestMethodName(), String.format("[[image:image.gif||width=%s]]", (20 + RandomUtils.nextInt(0, 200))), getTestClassName());
    // TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
    // view mode) is fixed.
    viewPage.waitForDocExtraPaneActive("comments");
    // Attach the GIF image.
    AttachmentsPane attachmentsPane = viewPage.openAttachmentsDocExtraPane();
    attachmentsPane.setFileToUpload(getClass().getResource("/image.gif").getPath());
    attachmentsPane.waitForUploadToFinish("image.gif");
    Assert.assertTrue(attachmentsPane.attachmentExistsByFileName("image.gif"));
}
Also used : AttachmentsPane(org.xwiki.test.ui.po.AttachmentsPane) ViewPage(org.xwiki.test.ui.po.ViewPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 88 with ViewPage

use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.

the class CopyPageTest method testCopyPage.

@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testCopyPage() throws Exception {
    String sourceSpaceName = getTestClassName();
    String sourcePageName = getTestMethodName();
    String targetSpaceName = getTestClassName() + "Copy";
    String targetPageName = getTestMethodName() + "Copy";
    // Delete page that may already exist
    getUtil().rest().deletePage(sourceSpaceName, sourcePageName);
    getUtil().rest().deletePage(targetSpaceName, targetPageName);
    // Create a new page that will be copied.
    ViewPage viewPage = getUtil().createPage(sourceSpaceName, sourcePageName, PAGE_CONTENT, sourcePageName);
    // Add an attachment to verify that it's version is not incremented in the target document (XWIKI-8157).
    // FIXME: Remove the following wait when XWIKI-6688 is fixed.
    viewPage.waitForDocExtraPaneActive("comments");
    AttachmentsPane attachmentsPane = viewPage.openAttachmentsDocExtraPane();
    attachmentsPane.setFileToUpload(getClass().getResource("/image.gif").getPath());
    attachmentsPane.waitForUploadToFinish("image.gif");
    Assert.assertEquals("1.1", attachmentsPane.getLatestVersionOfAttachment("image.gif"));
    // Click on Copy from the Page top menu.
    viewPage.copy();
    CopyPage copyPage = new CopyPage();
    // Check the source document
    Assert.assertEquals(Arrays.asList("", sourceSpaceName, sourcePageName), copyPage.getSourceLocation().getPath());
    Assert.assertEquals(sourceSpaceName, copyPage.getSourceSpaceName());
    Assert.assertEquals(sourcePageName, copyPage.getSourcePageName());
    // Check the default target document.
    DocumentPicker documentPicker = copyPage.getDocumentPicker();
    Assert.assertEquals(sourcePageName, documentPicker.getTitle());
    Assert.assertEquals(Arrays.asList("", sourceSpaceName, sourcePageName), documentPicker.getLocation().getPath());
    Assert.assertEquals(sourceSpaceName, copyPage.getTargetSpaceName());
    Assert.assertEquals(sourcePageName, copyPage.getTargetPageName());
    // Fill the target destination the page to be copied to.
    documentPicker.setTitle(targetPageName);
    // The target page name is updated based on the entered title.
    Assert.assertEquals(targetPageName, copyPage.getTargetPageName());
    documentPicker.waitForLocation(Arrays.asList("", sourceSpaceName, targetPageName));
    // Select a new parent document.
    documentPicker.toggleLocationAdvancedEdit().setParent(targetSpaceName);
    documentPicker.waitForLocation(Arrays.asList("", targetSpaceName, targetPageName));
    // Click copy button
    CopyOrRenameStatusPage copyStatusPage = copyPage.clickCopyButton().waitUntilFinished();
    // Check successful copy confirmation
    Assert.assertEquals(COPY_SUCCESSFUL, copyStatusPage.getInfoMessage());
    viewPage = copyStatusPage.gotoNewPage();
    Assert.assertEquals(Arrays.asList("", targetSpaceName, targetPageName), viewPage.getBreadcrumb().getPath());
    // Verify that the copied title is modified to be the new page name since it was set to be the page name
    // originally.
    Assert.assertEquals(targetPageName, viewPage.getDocumentTitle());
    Assert.assertEquals(PAGE_CONTENT, viewPage.getContent());
    // Verify the attachment version is the same (XWIKI-8157).
    // FIXME: Remove the following wait when XWIKI-6688 is fixed.
    viewPage.waitForDocExtraPaneActive("comments");
    attachmentsPane = viewPage.openAttachmentsDocExtraPane();
    Assert.assertEquals("1.1", attachmentsPane.getLatestVersionOfAttachment("image.gif"));
}
Also used : CopyOrRenameStatusPage(org.xwiki.test.ui.po.CopyOrRenameStatusPage) CopyPage(org.xwiki.index.test.po.CopyPage) AttachmentsPane(org.xwiki.test.ui.po.AttachmentsPane) ViewPage(org.xwiki.test.ui.po.ViewPage) DocumentPicker(org.xwiki.test.ui.po.DocumentPicker) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 89 with ViewPage

use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.

the class EditInlineTest method testInlineEditCanChangeTitle.

/* See XE-168 and XWIKI-6992 */
@Test
public void testInlineEditCanChangeTitle() {
    String title = RandomStringUtils.randomAlphanumeric(4);
    getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline&title=" + title);
    InlinePage inlinePage = new InlinePage();
    // Check if the title specified on the request is properly displayed.
    Assert.assertEquals(title, inlinePage.getDocumentTitle());
    // Check if the title specified on the request is displayed in the document hierarchy.
    Assert.assertTrue(inlinePage.getBreadcrumbContent().contains(title));
    // Save the document and check again the displayed title
    ViewPage viewPage = inlinePage.clickSaveAndView();
    Assert.assertEquals(title, viewPage.getDocumentTitle());
}
Also used : InlinePage(org.xwiki.test.ui.po.InlinePage) ViewPage(org.xwiki.test.ui.po.ViewPage) Test(org.junit.Test)

Example 90 with ViewPage

use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.

the class EditInlineTest method testEditButtonTriggersInlineEditing.

// Note: We're not testing basic inline editing since this is already covered by the User Profile tests
@Test
public void testEditButtonTriggersInlineEditing() {
    // Go to the Admin user profile page and edit it since editing a user profile page is supposed to go in inline
    // editing by default
    ViewPage vp = getUtil().gotoPage("XWiki", "Admin");
    vp.edit();
    Assert.assertTrue(new ViewPage().isInlinePage());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) Test(org.junit.Test)

Aggregations

ViewPage (org.xwiki.test.ui.po.ViewPage)93 Test (org.junit.Test)75 AbstractTest (org.xwiki.test.ui.AbstractTest)41 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)26 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)18 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)11 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)10 DocumentReference (org.xwiki.model.reference.DocumentReference)8 CreatePagePage (org.xwiki.test.ui.po.CreatePagePage)8 FormElement (org.xwiki.test.ui.po.FormElement)7 HistoryPane (org.xwiki.test.ui.po.HistoryPane)7 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)7 WebElement (org.openqa.selenium.WebElement)6 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)6 AttachmentsPane (org.xwiki.test.ui.po.AttachmentsPane)6 URL (java.net.URL)5 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)5 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)5 ExtensionId (org.xwiki.extension.ExtensionId)5 ExtensionAdministrationPage (org.xwiki.extension.test.po.ExtensionAdministrationPage)5