Package org.xwiki.test.ui.po.editor

Examples of org.xwiki.test.ui.po.editor.WikiEditPage


        spaceNameInput.clear();
        spaceNameInput.sendKeys(spaceName);
        classNameInput.clear();
        classNameInput.sendKeys(className);
        createClassButton.click();
        new WikiEditPage().clickSaveAndView();
        return new ClassSheetPage();
    }
View Full Code Here


        getUtil().deletePage(space, TEMPLATE_NAME + "Provider");

        String templateFullName = space + "." + TEMPLATE_NAME;

        // Create a template
        WikiEditPage editTemplatePage = WikiEditPage.gotoPage(space, TEMPLATE_NAME);
        editTemplatePage.setTitle(templateTitle);
        editTemplatePage.setContent(templateContent);
        editTemplatePage.clickSaveAndView();

        // Create the template provider
        TemplatesAdministrationSectionPage sectionPage = TemplatesAdministrationSectionPage.gotoPage();
        TemplateProviderInlinePage templateProviderInline =
            sectionPage.createTemplateProvider(space, templateProviderName);
View Full Code Here

        int availableTemplateSize = createPagePage.getAvailableTemplateSize();
        String templateInstanceName = TEMPLATE_NAME + "Instance";
        WYSIWYGEditPage templateInstanceEditWysiwyg =
            createPagePage.createPageFromTemplate(getTestClassName(), templateInstanceName, templateProviderFullName);
        templateInstanceEditWysiwyg.waitUntilPageIsLoaded();
        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();
        CreatePagePage createUnexistingPage = new CreatePagePage();
        // Make sure we're in create mode.
        Assert.assertTrue(getUtil().isInCreateMode());
        // 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();
        unexistingPageEditWysiwyg.waitUntilPageIsLoaded();
        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 = CreatePagePage.gotoPage();
        Assert.assertTrue(createEmptyPage.getAvailableTemplateSize() > 0);
        WYSIWYGEditPage editEmptyPage = createEmptyPage.createPage(getTestClassName(), "EmptyPage");
View Full Code Here

        editNewPage.waitUntilPageIsLoaded();
        Assert.assertEquals(space, editNewPage.getMetaDataValue("space"));
        Assert.assertEquals("NewPage", editNewPage.getMetaDataValue("page"));

        // 3/ create a page from a link in another page
        WikiEditPage editNewPageWiki = editNewPage.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);
View Full Code Here

        final String space = "Main";
        final String page = "POSTTest";
        LoginPage loginPage = this.vp.login();
        loginPage.loginAsAdmin();
        // start editing a page
        WikiEditPage editPage = WikiEditPage.gotoPage(space, page);
        editPage.setTitle(test);
        editPage.setContent(test);
        // emulate expired session: delete the cookies
        getDriver().manage().deleteAllCookies();
        // try to save
        editPage.clickSaveAndView();
        // we should have been redirected to login
        String wantUrl = getUtil().getURL("XWiki", "XWikiLogin", "login");
        if (wantUrl.indexOf('?') > 0) {
            // strip parameters
            wantUrl = wantUrl.substring(0, wantUrl.indexOf('?'));
        }
        Assert.assertTrue(getDriver().getCurrentUrl().startsWith(wantUrl));
        loginPage.loginAsAdmin();
        // we should have been redirected back to view, and the page should have been saved
        Assert.assertTrue(getDriver().getCurrentUrl().startsWith(getUtil().getURL(space, page)));
        editPage = WikiEditPage.gotoPage(space, page);
        Assert.assertEquals(test, editPage.getTitle());
        Assert.assertEquals(test, editPage.getContent());
    }
View Full Code Here

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

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

    })
    public void testSectionSaveDoesNotOverwriteTheWholeContentWhenSyntax10()
    {
        ViewPage vp = createTestPages("xwiki/1.0");
        vp.editSection(3).editWiki().clickSaveAndView();
        WikiEditPage wep = vp.editWiki();
        Assert.assertEquals("1 Section1 Content1 1 Section2 Content2 1.1 Section3 Content3 1 Section4 Content4",
            wep.getContent());
    }
View Full Code Here

    })
    public void testSectionSaveDoesNotOverwriteTheWholeContentWhenSyntax20()
    {
        ViewPage vp = createTestPages("xwiki/2.0");
        vp.editSection(4).editWiki().clickSaveAndView();
        WikiEditPage wep = vp.editWiki();
        Assert.assertEquals("= Section1 = Content1 = Section2 = Content2 == Section3 == Content3 "
            + "{{include document=\"Test.SectionEditingIncluded\"/}} = Section7 = Content7", wep.getContent());
    }
View Full Code Here

            // Switch back to monolingual with French as default language.
            setLanguageSettings(false, "fr", "fr");

            // Edit and save a document section and check if the document title was overwritten.
            getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=wiki&section=1");
            Assert.assertEquals("Translated title", new WikiEditPage().clickSaveAndView().getDocumentTitle());
        } finally {
            // Restore language settings.
            setLanguageSettings(false, "en", "en");
        }
    }
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.po.editor.WikiEditPage

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.