Package org.xwiki.test.ui.framework.elements.editor

Examples of org.xwiki.test.ui.framework.elements.editor.WYSIWYGEditPage


    public void testSectionEditInEditorWhenSyntax10()
    {
        ViewPage vp = createTestPages("xwiki/1.0");

        // Edit the second section in the wysiwyg editor
        WYSIWYGEditPage wysiwygEditPage = vp.editSection(2);
        Assert.assertEquals("Section2\nContent2\nSection3\nContent3", wysiwygEditPage.getContent());

        // Edit the second section in the wiki editor
        WikiEditPage wikiEditPage = wysiwygEditPage.editWiki();
        Assert.assertEquals("1 Section2 Content2 1.1 Section3 Content3",
            wikiEditPage.getContent());
        wikiEditPage.clickCancel();

        // Edit the third section in the wiki editor
View Full Code Here


    private void testSectionEditInWikiEditorWhenSyntax2x(String syntaxId)
    {
        ViewPage vp = createTestPages(syntaxId);

        // Edit the second section in the wysiwyg editor
        WYSIWYGEditPage wysiwygEditPage = vp.editSection(2);
        wysiwygEditPage.getContentEditor().waitToLoad();
        Assert.assertEquals("Section2\nContent2\nSection3\nContent3\nSection4\nContent4\nSection5\nContent5\n"
            + "Section6\nContent6", wysiwygEditPage.getContent());

        // Edit the second section in the wiki editor
        WikiEditPage wikiEditPage = wysiwygEditPage.editWiki();
        Assert.assertEquals("= Section2 = Content2 == Section3 == Content3 "
            + "{{include document=\"Test.SectionEditingIncluded\"/}}", wikiEditPage.getContent());
        vp = wikiEditPage.clickCancel();

        // Edit the third section in the wiki editor
View Full Code Here

    @Override
    public void setUp()
    {
        super.setUp();

        editPage = new WYSIWYGEditPage();
        editPage.switchToEdit(getTestClassName(), getTestMethodName());
        editPage.getContentEditor().waitToLoad();
    }
View Full Code Here

        // Create the new document from template
        CreatePagePage createPagePage = templateProviderView.createPage();
        // Save the number of available templates so that we can make some checks later on.
        int availableTemplateSize = createPagePage.getAvailableTemplateSize();
        String templateInstanceName = TEMPLATE_NAME + "Instance";
        WYSIWYGEditPage templateInstanceEditWysiwyg =
            createPagePage.createPageFromTemplate(getTestClassName(), templateInstanceName, templateProviderFullName);
        WikiEditPage templateInstanceEdit = templateInstanceEditWysiwyg.clickSaveAndView().editWiki();

        // Verify template instance content
        Assert.assertEquals(templateInstanceName, templateInstanceEdit.getTitle());
        Assert.assertEquals(templateContent, templateInstanceEdit.getContent());
        // check the parent of the template instance
        Assert.assertEquals(templateProviderFullName, templateInstanceEdit.getParent());

        // Put a wanted link in the template instance
        templateInstanceEdit.setContent("[[NewPage]]");
        ViewPage vp = templateInstanceEdit.clickSaveAndView();

        // Verify that clicking on the wanted link pops up a box to choose the template.
        vp.clickWantedLink(getTestClassName(), "NewPage", true);
        List<WebElement> templates = getDriver().findElements(By.name("templateprovider"));
        // Note: We need to remove 1 to exclude the "Empty Page" template entry
        Assert.assertEquals(availableTemplateSize, templates.size() - 1);
        Assert.assertTrue(createPagePage.getAvailableTemplates().contains(templateProviderFullName));

        // Create a new page from template by going to a non-existing page
        // And make sure we're on a non-existing page
        Assert.assertFalse(getUtil().gotoPage(getTestClassName(), TEMPLATE_NAME + "UnexistingInstance").exists());
        DocumentDoesNotExistPage unexistingPage = new DocumentDoesNotExistPage();
        unexistingPage.clickEditThisPageToCreate();
        // make sure we're in create mode
        Assert.assertTrue(getUtil().isInCreateMode());
        CreatePagePage createUnexistingPage = new CreatePagePage();
        // count the available templates, make sure they're as many as before and that our template is among them
        templates = getDriver().findElements(By.name("templateprovider"));
        // Note: We need to remove 1 to exclude the "Empty Page" template entry
        Assert.assertEquals(availableTemplateSize, templates.size() - 1);
        Assert.assertTrue(createPagePage.getAvailableTemplates().contains(templateProviderFullName));
        // select it
        createUnexistingPage.setTemplate(templateProviderFullName);
        // and create
        createUnexistingPage.clickCreate();
        WYSIWYGEditPage unexistingPageEditWysiwyg = new WYSIWYGEditPage();
        WikiEditPage unexistingPageEdit = unexistingPageEditWysiwyg.clickSaveAndView().editWiki();

        // Verify template instance content
        Assert.assertEquals(TEMPLATE_NAME + "UnexistingInstance", unexistingPageEdit.getTitle());
        Assert.assertEquals(templateContent, unexistingPageEdit.getContent());
        // test that this page has no parent
        Assert.assertEquals("", unexistingPageEdit.getParent());

        // create an empty page when there is a template available, make sure it's empty
        CreatePagePage createEmptyPage = new CreatePagePage();
        createEmptyPage.gotoPage();
        Assert.assertTrue(createEmptyPage.getAvailableTemplateSize() > 0);
        WYSIWYGEditPage editEmptyPage = createEmptyPage.createPage(getTestClassName(), "EmptyPage");
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        // wait to load editor to make sure that what we're saving is the content that is supposed to be in this
        // document
        editEmptyPage.getContentEditor().waitToLoad();
        ViewPage emptyPage = editEmptyPage.clickSaveAndView();
        // make sure it's empty
        Assert.assertEquals("", emptyPage.getContent());
        // make sure parent is the right one
        Assert.assertTrue(emptyPage.hasBreadcrumbContent("Wiki Home", false));
        // mare sure title is the right one
View Full Code Here

        // start creating a space
        HomePage homePage = new HomePage();
        homePage.gotoPage();
        CreateSpacePage createSpace = homePage.createSpace();

        WYSIWYGEditPage editSpaceWebhomePage = createSpace.createSpace(space);
        // expect wysiwyg edit mode for the webhome of the space
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        Assert.assertEquals(space, editSpaceWebhomePage.getMetaDataValue("space"));
        Assert.assertEquals("WebHome", editSpaceWebhomePage.getMetaDataValue("page"));
        // and no parent
        Assert.assertEquals("", editSpaceWebhomePage.getParent());
        // and the title the name of the space
        Assert.assertEquals(space, editSpaceWebhomePage.getDocumentTitle());
    }
View Full Code Here

        // make sure we're not in create mode anymore
        Assert.assertFalse(getUtil().isInCreateMode());
        // make sure we're directly in edit mode
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        // TODO: check that we're indeed in the edit mode of space.NewUnexitingPage
        WYSIWYGEditPage editNewUnexistingPage = new WYSIWYGEditPage();
        Assert.assertEquals(space, editNewUnexistingPage.getMetaDataValue("space"));
        Assert.assertEquals("NewUnexistingPage", editNewUnexistingPage.getMetaDataValue("page"));

        // 2/ create a page from the create menu on an existing page, by filling in space and name
        ViewPage spaceHomePage = getUtil().gotoPage(space, "WebHome");
        CreatePagePage createNewPage = spaceHomePage.createPage();
        // we expect no templates available
        Assert.assertEquals(0, createNewPage.getAvailableTemplateSize());
        // fill in data and create the page
        createNewPage.setSpace(space);
        createNewPage.setPage("NewPage");
        createNewPage.clickCreate();
        // we expect to go to the edit mode of the new page
        Assert.assertFalse(getUtil().isInCreateMode());
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        WYSIWYGEditPage editNewPage = new WYSIWYGEditPage();
        Assert.assertEquals(space, editNewPage.getMetaDataValue("space"));
        Assert.assertEquals("NewPage", editNewPage.getMetaDataValue("page"));

        // 3/ create a page from a link in another page
        // we're in edit mode of the newly created page from template
        WYSIWYGEditPage editNewPageWysiwyg = new WYSIWYGEditPage();
        // sometimes this fails to find the edit button, for a reason for which I don't understand...
        WikiEditPage editNewPageWiki = editNewPageWysiwyg.clickSaveAndView().editWiki();
        // put a link to the new page to create
        editNewPageWiki.setContent("[[NewLinkedPage]]");
        ViewPage newPage = editNewPageWiki.clickSaveAndView();
        // no templates are available, so we don't expect a panel with a list of templates, we just expect it goes
        // directly to edit mode of the new page
        // it would be nice to be able to test here that the create page panel is not displayed, ever. However, we can't
        // since we need to wait for that time, and we don't know how much is never.
        newPage.clickWantedLink(space, "NewLinkedPage", false);
        WYSIWYGEditPage editNewLinkedPage = new WYSIWYGEditPage();
        // since the edit mode loads as a result of a redirect that comes from a async call made by the click, we need
        // to wait for the page to load
        editNewLinkedPage.waitUntilElementIsVisible(By
            .xpath("//div[@id='tmCurrentEditor']//a/strong[contains(text(), 'WYSIWYG')]"));
        // make sure we're in edit mode (of the new page)
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        Assert.assertEquals(space, editNewLinkedPage.getMetaDataValue("space"));
        Assert.assertEquals("NewLinkedPage", editNewLinkedPage.getMetaDataValue("page"));
    }
View Full Code Here

        String templateProviderFullName = space + "." + templateProviderName;
        ViewPage templatePage = createTemplate(templateProviderName, templateContent, templateTitle, true);

        // create the page
        CreatePagePage createPage = templatePage.createPage();
        WYSIWYGEditPage editCreatedPage =
            createPage.createPageFromTemplate(space, newPageName, templateProviderFullName);
        // ensure that we're indeed in edit mode
        Assert.assertTrue(getUtil().isInWYSIWYGEditMode());
        // wait for editor to load (so that content is loaded)
        editCreatedPage.getContentEditor().waitToLoad();
        // and now cancel it
        ViewPage newPage = editCreatedPage.clickCancel();
        // make sure we're not in unexisting page
        Assert.assertTrue(newPage.exists());
        // we should be in view mode (useless check since the impl of isNonExisting page calls it anyway)
        Assert.assertTrue(getUtil().isInViewMode());
        // make sure it's the page we want
View Full Code Here

    public void testCreatePageFromPanel()
    {
        NewPagePanel newPagePanel = new NewPagePanel();
        newPagePanel.gotoPage();

        WYSIWYGEditPage editPage = newPagePanel.createPage(getTestClassName(), getTestMethodName());

        Assert.assertEquals(getTestMethodName(), editPage.getDocumentTitle());
        Assert.assertEquals(getTestMethodName(), editPage.getMetaDataValue("page"));
        Assert.assertEquals(getTestClassName(), editPage.getMetaDataValue("space"));
    }
View Full Code Here

        spaceNameTextField.clear();
        spaceNameTextField.sendKeys(spaceName);
        pageNameTextField.clear();
        pageNameTextField.sendKeys(pageName);
        pageNameTextField.submit();
        return new WYSIWYGEditPage();
    }
View Full Code Here

     * Performs a click on the "edit wysiwyg" entry of the content menu.
     */
    public WYSIWYGEditPage editWYSIWYG()
    {
        clickContentMenuEditSubMenuEntry("tmEditWysiwyg");
        return new WYSIWYGEditPage();
    }
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.framework.elements.editor.WYSIWYGEditPage

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.