Search in sources :

Example 21 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser 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 22 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class EditInlineTest method testInlineEditPreservesTitle.

/* See XWIKI-2389 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testInlineEditPreservesTitle() {
    String title = RandomStringUtils.randomAlphanumeric(4);
    getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "title=" + title);
    ViewPage vp = new ViewPage();
    Assert.assertEquals(title, vp.getDocumentTitle());
    InlinePage ip = vp.editInline();
    ViewPage vp2 = ip.clickSaveAndView();
    Assert.assertEquals(title, vp2.getDocumentTitle());
}
Also used : InlinePage(org.xwiki.test.ui.po.InlinePage) ViewPage(org.xwiki.test.ui.po.ViewPage) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Aggregations

Test (org.junit.Test)22 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)22 AbstractTest (org.xwiki.test.ui.AbstractTest)12 ViewPage (org.xwiki.test.ui.po.ViewPage)10 AddTagsPane (org.xwiki.tag.test.po.AddTagsPane)5 FormElement (org.xwiki.test.ui.po.FormElement)5 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)5 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)5 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)4 MimeMessage (javax.mail.internet.MimeMessage)3 CopyPage (org.xwiki.index.test.po.CopyPage)2 InvitationSenderPage (org.xwiki.invitation.test.po.InvitationSenderPage)2 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)2 TaggablePage (org.xwiki.tag.test.po.TaggablePage)2 TestUtils (org.xwiki.test.ui.TestUtils)2 CopyOrRenameStatusPage (org.xwiki.test.ui.po.CopyOrRenameStatusPage)2 DocumentPicker (org.xwiki.test.ui.po.DocumentPicker)2 TableElement (org.xwiki.test.ui.po.TableElement)2 StaticListClassEditElement (org.xwiki.test.ui.po.editor.StaticListClassEditElement)2 AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)1