Package org.xwiki.test.ui.po

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


        // Create a class with a string property
        cep.addProperty("prop", "String");
        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


        // Create a class with two string properties
        getUtil().addClassProperty("Test", "EditObjectsTestClass", "prop1", "String");
        getUtil().addClassProperty("Test", "EditObjectsTestClass", "prop2", "String");

        // 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

            getUtil().recacheSecretToken();
            grasp.forceAuthenticatedView();

            // Go to a page, log out and expire session by removing cookies, log in again and verify that the user is
            // redirected to the initial page.
            ViewPage page = getUtil().gotoPage("SomeSpace", "SomePage");
            page.logout();
            // Since view is disallowed for unauthenticated users, at this point we see a log in page.
            LoginPage loginPage = new LoginPage();
            // Remove all cookie to simulate a session expiry
            getDriver().manage().deleteAllCookies();
            loginPage.loginAsAdmin();
View Full Code Here

        ResubmissionPage resubmissionPage = new ResubmissionPage();
        if (resubmissionPage.isOnResubmissionPage()) {
            resubmissionPage.resubmit();
        }
        Assert.assertTrue(getDriver().getCurrentUrl().contains("/xwiki/bin/view/Test/TestData"));
        ViewPage viewPage = new ViewPage();
        Assert.assertEquals("this should be saved instead", viewPage.getContent());
    }
View Full Code Here

    @Test
    public void testEditButtonTriggersInlineEditing()
    {
        // Go to the Admin user profile page and edit it since editing a user profile page is supposed to go in inline
        // editing by default
        ViewPage vp = getUtil().gotoPage("XWiki", "Admin");
        vp.edit();
        Assert.assertTrue(new ViewPage().isInlinePage());
    }
View Full Code Here

        // Check if the title specified on the request is properly displayed.
        Assert.assertEquals(title, inlinePage.getDocumentTitle());
        // Check if the title specified on the request is displayed in the document hierarchy.
        Assert.assertTrue(inlinePage.getBreadcrumbContent().contains(title));
        // Save the document and check again the displayed title
        ViewPage viewPage = inlinePage.clickSaveAndView();
        Assert.assertEquals(title, viewPage.getDocumentTitle());
    }
View Full Code Here

    /* See XE-168 */
    @Test
    public void testInlineEditCanChangeParent()
    {
        getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline&parent=Main.WebHome");
        ViewPage vp = new InlinePage().clickSaveAndView();
        Assert.assertTrue(vp.hasBreadcrumbContent("Wiki Home", false));
    }
View Full Code Here

    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://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());
    }
View Full Code Here

    /* See XWIKI-2389 */
    @Test
    public void testInlineEditPreservesParent()
    {
        getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "parent=Blog.WebHome");
        ViewPage vp = new ViewPage();
        Assert.assertTrue(vp.hasBreadcrumbContent("The Wiki Blog", false));
        InlinePage ip = vp.editInline();
        ViewPage vp2 = ip.clickSaveAndView();
        Assert.assertTrue(vp2.hasBreadcrumbContent("The Wiki Blog", false));
    }
View Full Code Here

    @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 testUploadDownloadTwoAttachmentsInParallel()
    {
        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.addAnotherFile();
        ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment2).getPath());
        ap.clickAttachFiles();

        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

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.