Package org.xwiki.test.ui.po

Examples of org.xwiki.test.ui.po.ViewPage


    @IgnoreBrowsers( {
        @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"),
        @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177")})
    public void testUploadDownloadTwoAttachmentsInSequence()
    {
        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.waitForUploadToFinish(this.testAttachment);
        ap.clickHideProgress();
        ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment2).getPath());
        ap.waitForUploadToFinish(this.testAttachment2);

        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());
    }
View Full Code Here


    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(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"));
    }
View Full Code Here

    public void testRollbackToFirstVersion() throws Exception
    {
        getUtil().deletePage(SPACE_NAME, PAGE_NAME);

        // Create first version of the page
        ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE);

        // Adds second version
        WikiEditPage wikiEditPage = vp.editWiki();
        wikiEditPage.setContent(CONTENT2);
        wikiEditPage.clickSaveAndView();

        // 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");

        // Verify that we can rollback to the first version
        HistoryPane historyTab = vp.openHistoryDocExtraPane();
        vp = historyTab.rollbackToVersion("1.1");

        // Rollback doesn't wait...
        // Wait for the comment tab to be selected since we're currently on the history tab and rolling
        // back is going to load a new page and make the focus active on the comments tab.
        vp.waitForDocExtraPaneActive("comments");

        Assert.assertEquals("First version of Content", vp.getContent());

        historyTab = vp.openHistoryDocExtraPane();
        Assert.assertEquals("Rollback to version 1.1", historyTab.getCurrentVersionComment());
        Assert.assertEquals("Administrator", historyTab.getCurrentAuthor());
    }
View Full Code Here

    public void testDeleteLatestVersion() throws Exception
    {
        getUtil().deletePage(SPACE_NAME, PAGE_NAME);

        // Create first version of the page
        ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE);

        // Adds second version
        WikiEditPage wikiEditPage = vp.editWiki();
        wikiEditPage.setContent(CONTENT2);
        wikiEditPage.clickSaveAndView();

        // 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");

        // Verify and delete the latest version.
        HistoryPane historyTab = vp.openHistoryDocExtraPane();
        Assert.assertEquals("2.1", historyTab.getCurrentVersion());
        historyTab = historyTab.deleteVersion("2.1");

        // Verify that the current version is now the previous one.
        Assert.assertEquals("1.1", historyTab.getCurrentVersion());
View Full Code Here

        getUtil().gotoPage(getTestClassName(), getTestMethodName(), "view", "xpage=xpart&vm=commentsinline.vm");
        CommentsTab commentsTab = new CommentsTab();

        commentsTab.postComment(COMMENT_CONTENT, false);
        // This opens with ?viewer=comments, don't explicitly load the comments tab
        new ViewPage().waitUntilPageIsLoaded();
        Assert.assertEquals(COMMENT_CONTENT,
            commentsTab.getCommentContentByID(commentsTab.getCommentID(COMMENT_CONTENT)));
        Assert.assertEquals(COMMENT_AUTHOR,
            commentsTab.getCommentAuthorByID(commentsTab.getCommentID(COMMENT_CONTENT)));
    }
View Full Code Here

        // Delete page since we create it below and want to start the test clean
        getUtil().deletePage(getTestClassName(), pageName);

        // Create the page
        ViewPage vp = getUtil().createPage(getTestClassName(), pageName, "", pageName);

        // Verify that the page we're on has the correct URL, name and link in the top level menu
        String expectedURLPart = getTestClassName() + "/" + pageName.replaceAll(" ", "+");
        Assert.assertTrue(vp.getPageURL().contains(expectedURLPart));
        Assert.assertEquals(pageName, vp.getMetaDataValue("page"));
        Assert.assertTrue(vp.getPageMenuLink().endsWith(expectedURLPart));
    }
View Full Code Here

    @Test
    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
    public void testSchedulerJobDefaultEditMode()
    {
        getUtil().gotoPage("Scheduler", "WatchListDailyNotifier");
        Assert.assertTrue(new ViewPage().getEditURL().contains("/inline/"));
    }
View Full Code Here

        // Delete page that may already exist
        getUtil().deletePage(sourceSpaceName, sourcePageName);
        getUtil().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.
        CopyPage copyPage = viewPage.copy();

        // Check form content
        Assert.assertEquals(sourceSpaceName, copyPage.getSourceSpaceName());
        Assert.assertEquals(sourcePageName, copyPage.getSourcePageName());
        Assert.assertEquals(sourceSpaceName, copyPage.getTargetSpaceName());
        Assert.assertEquals(sourcePageName, copyPage.getTargetPageName());

        // Fill the target destination the page to be copied to.
        copyPage.setTargetSpaceName(targetSpaceName);
        copyPage.setTargetPageName(targetPageName);

        // Click copy button
        CopyConfirmationPage copyConfirmationPage = copyPage.clickCopyButton();

        // Check successful copy confirmation
        Assert.assertTrue(copyConfirmationPage.getInfoMessage().contains(COPY_SUCCESSFUL));
        viewPage = copyConfirmationPage.goToNewPage();

        // 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"));
    }
View Full Code Here

        // Create a new page that will be overwritten.
        getUtil().createPage(targetSpaceName, targetPageName, OVERWRITTEN_PAGE_CONTENT, targetPageName);

        // Create a new page that will be copied.
        ViewPage viewPage =
            getUtil().createPage(sourceSpaceName, sourcePageName, PAGE_CONTENT, sourcePageName);

        // Click on Copy from the Page top menu.
        CopyPage copyPage = viewPage.copy();

        // Fill the target destination the page to be copied to.
        copyPage.setTargetSpaceName(targetSpaceName);
        copyPage.setTargetPageName(targetPageName);

        // Click copy button
        CopyOverwritePromptPage copyOverwritePrompt = copyPage.clickCopyButtonExpectingOverwritePrompt();

        // Check overwrite warning
        Assert.assertEquals(OVERWRITE_PROMPT1 +  targetSpaceName + '.' + targetPageName + OVERWRITE_PROMPT2,
            copyOverwritePrompt.getWarningMessage());

        // Cancel the copy
        viewPage = copyOverwritePrompt.clickCancelButton();

        // Verify that we have been sent back to the original page
        Assert.assertEquals(sourcePageName, viewPage.getDocumentTitle());

        // Click on Copy from the Page top menu.
        copyPage = viewPage.copy();

        // Fill the target destination the page to be copied to.
        copyPage.setTargetSpaceName(targetSpaceName);
        copyPage.setTargetPageName(targetPageName);

        // Click copy button
        copyOverwritePrompt = copyPage.clickCopyButtonExpectingOverwritePrompt();

        // Click change target
        copyPage = copyOverwritePrompt.clickChangeTargetButton();

        // Check form content
        Assert.assertEquals(sourceSpaceName, copyPage.getSourceSpaceName());
        Assert.assertEquals(sourcePageName, copyPage.getSourcePageName());
        Assert.assertEquals(sourceSpaceName, copyPage.getTargetSpaceName());
        Assert.assertEquals(sourcePageName, copyPage.getTargetPageName());

        // Fill the target destination the page to be copied to.
        copyPage.setTargetSpaceName(targetSpaceName);
        copyPage.setTargetPageName(targetPageName);

        // Copy and confirm overwrite
        copyOverwritePrompt = copyPage.clickCopyButtonExpectingOverwritePrompt();
        CopyConfirmationPage copyConfirmationPage = copyOverwritePrompt.clickCopyButton();

        // Check successful copy confirmation
        Assert.assertTrue(copyConfirmationPage.getInfoMessage().contains(COPY_SUCCESSFUL));
        viewPage = copyConfirmationPage.goToNewPage();

        // 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());
    }
View Full Code Here

        String parentPageName = getTestMethodName() + "ParentPage";
        String parentPageFullName = getTestClassName() + "." + parentPageName;

        getUtil().createPage(getTestClassName(), parentPageName, null, PARENT_TITLE);
        ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), null, CHILD_TITLE, null,
            parentPageFullName);

        // Verify standard breadcrumb behavior.
        Assert.assertTrue(vp.hasBreadcrumbContent(PARENT_TITLE, false));
        Assert.assertTrue(vp.hasBreadcrumbContent(CHILD_TITLE, true));
       
        // Remove view rights on the Test.ParentPage page to everyone except Admin user so that we can verify that the
        // breadcrumb of the child page doesn't display pages for which you don't have view rights to.
        getUtil().addObject(getTestClassName(), parentPageName, "XWiki.XWikiRights",
            "levels", "view",
            "users", "XWiki.Admin",
            "allow", "1");
       
        // Log out...
        getUtil().forceGuestUser();

        // Verify breadcrumbs are only displayed for pages for which you have the view right.
        vp = getUtil().gotoPage(getTestClassName(), getTestMethodName());
        Assert.assertFalse(vp.hasBreadcrumbContent(PARENT_TITLE, false));
        Assert.assertTrue(vp.hasBreadcrumbContent(CHILD_TITLE, true));
        Assert.assertTrue(vp.hasBreadcrumbContent(parentPageFullName, false));
    }
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.po.ViewPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.