Examples of ViewPage


Examples of org.xwiki.test.ui.framework.elements.ViewPage

        this.sectionPage.selectPackage(PACKAGE_WITH_HISTORY);

        this.sectionPage.selectReplaceHistoryOption();
        this.sectionPage.importPackage();

        ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");

        // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
        // will race for completion. Let's wait for comments first.
        importedPage.openCommentsDocExtraPane();
        HistoryTab history = importedPage.openHistoryDocExtraPane();

        Assert.assertEquals("4.1", history.getCurrentVersion());
        Assert.assertEquals("Imported from XAR", history.getCurrentVersionComment());
        Assert.assertTrue(history.hasVersionWithSummary("A new version of the document"));
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        this.sectionPage.attachPackage(fileUrl);
        this.sectionPage.selectPackage(PACKAGE_WITHOUT_HISTORY);

        this.sectionPage.importPackage();

        ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");

        // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
        // will race for completion. Let's wait for comments first.
        importedPage.openCommentsDocExtraPane();
        HistoryTab history = importedPage.openHistoryDocExtraPane();

        Assert.assertEquals("1.1", history.getCurrentVersion());
        Assert.assertEquals("Imported from XAR", history.getCurrentVersionComment());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        WebElement importAsBackup = getDriver().findElement(By.name("importAsBackup"));
        Assert.assertTrue(importAsBackup.isSelected());

        this.sectionPage.importPackage();

        ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");

        // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
        // will race for completion. Let's wait for comments first.
        importedPage.openCommentsDocExtraPane();
        HistoryTab history = importedPage.openHistoryDocExtraPane();

        Assert.assertEquals("JohnDoe", history.getCurrentAuthor());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        importAsBackup.click();
        Assert.assertFalse(importAsBackup.isSelected());

        this.sectionPage.importPackage();

        ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");

        // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
        // will race for completion. Let's wait for comments first.
        importedPage.openCommentsDocExtraPane();
        HistoryTab history = importedPage.openHistoryDocExtraPane();

        Assert.assertEquals("Administrator", history.getCurrentAuthor());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

                "section test in " + syntaxId, syntaxId);
        } else {
            throw new RuntimeException("Unhandled syntax [" + syntaxId + "]");
        }

        return new ViewPage();
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

     * See XWIKI-174: Sectional editing.
     */
    @Test
    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
        Assert.assertEquals("1.1 Section3 Content3",
            vp.editSection(3).editWiki().getContent());
        wikiEditPage.clickCancel();

        // Edit the fourth section in the wiki editor
        Assert.assertEquals("1 Section4 Content4",
            vp.editSection(4).editWiki().getContent());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        testSectionEditInWikiEditorWhenSyntax2x("xwiki/2.1");
    }

    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
        wikiEditPage = vp.editSection(3).editWiki();
        Assert.assertEquals("== Section3 == Content3 {{include document=\"Test.SectionEditingIncluded\"/}}",
            wikiEditPage.getContent());
        vp = wikiEditPage.clickCancel();

        // Edit the fourth section in the wiki editor
        // Note: we prove that included documents don't generate editable sections by checking that the fourth section
        // is "Section7".
        wikiEditPage = vp.editSection(4).editWiki();
        Assert.assertEquals("= Section7 = Content7", wikiEditPage.getContent());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        // create a template
        String templateProviderName = TEMPLATE_NAME + "Provider";
        String templateContent = "Templates are fun";
        String templateTitle = "Funny templates";
        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
        Assert.assertEquals(space, newPage.getMetaDataValue("space"));
        Assert.assertEquals(newPageName, newPage.getMetaDataValue("page"));
        // and now test the title is the name of the page and the content is the one from the template
        Assert.assertEquals(newPageName, newPage.getDocumentTitle());
        Assert.assertEquals(templateContent, newPage.getContent());
        // and the parent, it should be the template provider, since that's where we created it from
        Assert.assertTrue(newPage.hasBreadcrumbContent(templateProviderName, false));
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

        // Create a class with a string property
        cep.addProperty("prop", "com.xpn.xwiki.objects.classes.StringClass");
        cep.clickSaveAndView();

        // Create object page
        ViewPage vp = getUtil().createPage("Test", "EditObjectsTestObject",
            "this is the content: {{velocity}}$doc.display('prop'){{/velocity}}", getTestMethodName());

        // Add an object of the class created
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "testing value");
        vp = oep.clickSaveAndView();

        Assert.assertEquals("this is the content: testing value", vp.getContent());
    }
View Full Code Here

Examples of org.xwiki.test.ui.framework.elements.ViewPage

            "prop1", "com.xpn.xwiki.objects.classes.StringClass");
        getUtil().addClassProperty("Test", "EditObjectsTestClass",
            "prop2", "com.xpn.xwiki.objects.classes.StringClass");

        // Create object page
        ViewPage vp = getUtil().createPage("Test", "EditObjectsTestObject",
            "this is the content: {{velocity}}$doc.display('prop1')/$doc.display('prop2')/" +
            "$!doc.getObject('Test.EditObjectsTestClass').getProperty('prop1').value{{/velocity}}",
            getTestMethodName());

        // Add an object of the class created
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop1"), "testing value 1");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop2"), "testing value 2");
        vp = oep.clickSaveAndView();

        Assert.assertEquals("this is the content: testing value 1/testing value 2/testing value 1", vp.getContent());

        // Delete the first property from the class
        ClassEditPage cep = getUtil().editClass("Test", "EditObjectsTestClass");
        cep.deleteProperty("prop1");
        cep.clickSaveAndView();

        vp = getUtil().gotoPage("Test", "EditObjectsTestObject");
        Assert.assertEquals("this is the content: /testing value 2/testing value 1", vp.getContent());

        oep = vp.editObjects();
        Assert.assertNotNull(getDriver().findElement(By.className("deprecatedProperties")));
        Assert.assertNotNull(getDriver().findElement(By.cssSelector(".deprecatedProperties label")));
        Assert.assertEquals("prop1:", getDriver().findElement(By.cssSelector(".deprecatedProperties label")).getText());

        // Remove deprecated properties
        oep.removeAllDeprecatedProperties();
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: /testing value 2/", vp.getContent());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.