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

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


     */
    @Test
    public void testChangeMultiselectProperty()
    {
        // Create a class with a database list property set to return all documents
        ClassEditPage cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.addProperty("prop", "com.xpn.xwiki.objects.classes.DBListClass");
        cep.getDatabaseListClassEditElement("prop").setHibernateQuery(
            "select doc.fullName from XWikiDocument doc where doc.space = 'Test'");
        cep.clickSaveAndView();

        // Create a second page to hold the Object and set its content
        WikiEditPage wep = new WikiEditPage();
        wep.switchToEdit("Test", "EditObjectsTestObject");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

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

        // Set multiselect to true
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getDatabaseListClassEditElement("prop").setMultiSelect(true);
        cep.clickSaveAndView();

        // Select a second document in the DB list select field.
        oep = new ObjectEditPage();
        oep.switchToEdit("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
View Full Code Here


        wep.switchToEdit("Test", "EditObjectsTestClass");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add class
        ClassEditPage cep = vp.editClass();
        cep.addProperty("prop", "com.xpn.xwiki.objects.classes.NumberClass");
        cep.getNumberClassEditElement("prop").setNumberType("integer");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Create object page
        wep = new WikiEditPage();
        wep.switchToEdit("Test", "EditObjectsTestObject");
        wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
        vp = wep.clickSaveAndView();

        // Add object
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "3");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: 3", vp.getContent());

        // Change number to double type
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getNumberClassEditElement("prop").setNumberType("double");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep = new ObjectEditPage();
        oep.switchToEdit("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
            By.id("Test.EditObjectsTestClass_0_prop"), "2.5");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: 2.5", vp.getContent());

        // Change number to long type
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getNumberClassEditElement("prop").setNumberType("long");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep = new ObjectEditPage();
        oep.switchToEdit("Test", "EditObjectsTestObject");
View Full Code Here

        wep.switchToEdit("Test", "EditObjectsTestClass");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add class
        ClassEditPage cep = vp.editClass();
        cep.addProperty("prop", "com.xpn.xwiki.objects.classes.StaticListClass");
        StaticListClassEditElement slcee = cep.getStaticListClassEditElement("prop");
        slcee.setMultiSelect(false);
        slcee.setValues("choice 1|choice 2|choice 3|choice 4|choice 5");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Create object page
        wep = new WikiEditPage();
        wep.switchToEdit("Test", "EditObjectsTestObject");
        wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
        vp = wep.clickSaveAndView();

        // Add object
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: choice 3", vp.getContent());

        // Change list to a multiple select.
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getStaticListClassEditElement("prop").setMultiSelect(true);
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep.switchToEdit("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
View Full Code Here

        wep.switchToEdit("Test", "EditObjectsTestClass");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add class
        ClassEditPage cep = vp.editClass();
        cep.addProperty("prop", "com.xpn.xwiki.objects.classes.StaticListClass");
        StaticListClassEditElement slcee = cep.getStaticListClassEditElement("prop");
        slcee.setMultiSelect(true);
        slcee.setDisplayType(StaticListClassEditElement.DisplayType.INPUT);
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Create object page
        wep = new WikiEditPage();
        wep.switchToEdit("Test", "EditObjectsTestObject");
        wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
        vp = wep.clickSaveAndView();

        // Add object
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
        objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "this|that|other");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: this that other", vp.getContent());

        // Change list to relational storage.
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getStaticListClassEditElement("prop").setRelationalStorage(true);
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Make sure we can still edit the object.
        oep.switchToEdit("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
            By.id("Test.EditObjectsTestClass_0_prop"), "this|other");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: this other", vp.getContent());

        // Change list to non-relational storage.
        cep = new ClassEditPage();
        cep.switchToEdit("Test", "EditObjectsTestClass");
        cep.getStaticListClassEditElement("prop").setRelationalStorage(false);
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Make sure we can still edit the object.
        oep.switchToEdit("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
View Full Code Here

    @Test
    public void testAddProperty()
    {
        // We verify that we can click on Edit Class from View Page (we need to test this at
        // least once to ensure the UI works).
        ClassEditPage cep = getUtil().gotoPage("Test", "EditObjectsTestClass").editClass();

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

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

    }

    @Test
    public void addInvalidProperty()
    {
        ClassEditPage cep = getUtil().editClass("Test", "EditObjectsTestClass");
        cep.addPropertyWithoutWaiting("a<b c", "com.xpn.xwiki.objects.classes.StringClass");
        cep.waitForNotificationErrorMessage("Failed: Property names must follow these naming rules:");
    }
View Full Code Here

     * Performs a click on the "edit class" entry of the content menu.
     */
    public ClassEditPage editClass()
    {
        clickContentMenuEditSubMenuEntry("tmEditClass");
        return new ClassEditPage();
    }
View Full Code Here

TOP

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

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.