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

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


        WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add an XWikiGroups object
        ObjectEditPage oep = vp.editObjects();
        oep.addObject("XWiki.XWikiGroups");
        vp = oep.clickSaveAndView();

        oep = vp.editObjects();
        Assert.assertEquals(1, oep.getObjectsOfClass("XWiki.XWikiGroups").size());
    }
View Full Code Here


        WikiEditPage wep = WikiEditPage.gotoPage("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 = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
        cep.getDatabaseListClassEditElement("prop").setMultiSelect(true);
        cep.clickSaveAndView();

        // Select a second document in the DB list select field.
        oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
            By.id("Test.EditObjectsTestClass_0_prop"), "Test.EditObjectsTestObject");
        vp = oep.clickSaveAndView();

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

        wep = WikiEditPage.gotoPage("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 = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
        cep.getNumberClassEditElement("prop").setNumberType("double");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep = ObjectEditPage.gotoPage("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 = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
        cep.getNumberClassEditElement("prop").setNumberType("long");
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: 2", vp.getContent());
    }
View Full Code Here

        wep = WikiEditPage.gotoPage("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 = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
        cep.getStaticListClassEditElement("prop").setMultiSelect(true);
        vp = cep.clickSaveAndView();
        Assert.assertEquals("this is the content", vp.getContent());

        // Verify conversion
        oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
            By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
        oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(
            By.id("Test.EditObjectsTestClass_0_prop"), "choice 4");
        vp = oep.clickSaveAndView();
        Assert.assertEquals("this is the content: choice 3 choice 4", vp.getContent());
    }
View Full Code Here

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

            "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

        wikiEditPage.setMinorEdit(true);
        wikiEditPage.setEditComment("Fix typo in title.");
        wikiEditPage.clickSaveAndContinue();

        // Add objects.
        ObjectEditPage objectEditPage = wikiEditPage.editObjects();
        FormElement form = objectEditPage.addObject("XWiki.JavaScriptExtension");
        Map<String, String> assignment = new HashMap<String, String>();
        assignment.put("XWiki.JavaScriptExtension_0_name", "JavaScript code");
        assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = bob;\nbob = tmp;");
        assignment.put("XWiki.JavaScriptExtension_0_use", "onDemand");
        form.fillFieldsByName(assignment);
        objectEditPage.clickSaveAndContinue();
        assignment.put("XWiki.JavaScriptExtension_0_name", "Code snippet");
        assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = 2 * bob;\nbob = tmp;");
        form.fillFieldsByName(assignment);
        objectEditPage.clickSaveAndContinue();

        // Create class.
        ClassEditPage classEditPage = objectEditPage.editClass();
        classEditPage.addProperty("age", "Number");
        classEditPage.addProperty("color", "String");
        classEditPage.getNumberClassEditElement("age").setNumberType("integer");
        classEditPage.clickSaveAndContinue();
        classEditPage.deleteProperty("color");
View Full Code Here

        WikiEditPage wep = WikiEditPage.gotoPage("Test", "SkinxTest");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add an XWikiGroups object
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("XWiki.JavaScriptExtension");
        objectForm.setFieldValue(By.id("XWiki.JavaScriptExtension_0_code"), SCRIPT);
        objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("always");
        oep.clickSaveAndView();
        waitForScriptResult();
        HomePage.gotoPage();
        waitForScriptResult();

        oep = ObjectEditPage.gotoPage("Test", "SkinxTest");
        objectForm = oep.getObjectsOfClass("XWiki.JavaScriptExtension").get(0);
        objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("currentPage");
        oep.clickSaveAndView();
        waitForScriptResult();
        HomePage.gotoPage();
        try {
            waitForScriptResult();
            Assert.fail("The JSX should be active only on the current page.");
        } catch (TimeoutException e) {
        }

        oep = ObjectEditPage.gotoPage("Test", "SkinxTest");
        objectForm = oep.getObjectsOfClass("XWiki.JavaScriptExtension").get(0);
        objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("onDemand");
        oep.clickSaveAndView();
        try {
            waitForScriptResult();
            Assert.fail("The JSX should be active only on demand.");
        } catch (TimeoutException e) {
        }
View Full Code Here

        classView = new ApplicationClassEditPage().clickSaveAndView();
        Assert.assertFalse(classView.getContent().contains("Available (boolean1: Boolean)"));
        Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));

        // Edit the class template and see if the deleted field is now deprecated.
        ObjectEditPage objectEditor = new ClassSheetPage().clickTemplateLink().editObjects();
        String className = String.format("%s.%s", getTestClassName(), getTestMethodName());
        Assert.assertTrue(objectEditor.isPropertyDeprecated(className, "boolean1"));
        Assert.assertFalse(objectEditor.isPropertyDeprecated(className, "date1"));
    }
View Full Code Here

    public void testAcceptInvitationToClosedWiki() throws Exception
    {
        TestUtils.Session admin = getUtil().getSession();
        try {
            // First we ban anon from registering.
            ObjectEditPage oep = ObjectEditPage.gotoPage("XWiki", "XWikiPreferences");

            oep.getObjectsOfClass("XWiki.XWikiGlobalRights").get(2)
                .getSelectElement(By.name("XWiki.XWikiGlobalRights_2_levels")).unSelect("register");

            oep.clickSaveAndContinue();
            // now prove anon cannot register
            getUtil().forceGuestUser();
            RegistrationPage.gotoPage();
            getUtil().assertOnPage(getUtil().getURL("XWiki", "XWikiLogin", "login"));

            // Now we try sending and accepting an invitation.
            getUtil().setSession(admin);
            setSenderPage(InvitationSenderPage.gotoPage());
            getSenderPage().fillInDefaultValues();

            startGreenMail();
            getSenderPage().send();
            getGreenMail().waitForIncomingEmail(10000, 1);
            MimeMessage[] messages = getGreenMail().getReceivedMessages();
            String htmlMessage = getMessageContent(messages[0]).get("htmlPart");
            Assert.assertTrue("New invitation is not listed as pending in the footer.",
                getSenderPage().getFooter().myPendingInvitations() == 1);
            // Now switch to guest.
            getUtil().forceGuestUser();

            InvitationGuestActionsPage guestPage =
                InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.ACCEPT);
            Assert.assertTrue("There was an error message when accepting the invitation message:\n"
                + guestPage.getMessage(),
                guestPage.getMessage().equals(""));
            // Register a new user.
            RegistrationPage rp = new RegistrationPage();
            rp.fillRegisterForm(null, null, "AnotherInvitedMember", "WeakPassword", "WeakPassword", null);
            rp.clickRegister();
            Assert.assertTrue("There were failure messages when registering.",
                rp.getValidationFailureMessages().isEmpty());
            getDriver().get(getUtil().getURLToLoginAs("AnotherInvitedMember", "WeakPassword"));

            Assert.assertTrue("Failed to log user in after registering from invitation.", rp.isAuthenticated());
        } finally {
            stopGreenMail();
            getUtil().setSession(admin);

            // Better open the wiki back up again.
            ObjectEditPage oep = ObjectEditPage.gotoPage("XWiki", "XWikiPreferences");

            oep.getObjectsOfClass("XWiki.XWikiGlobalRights").get(2)
                .getSelectElement(By.name("XWiki.XWikiGlobalRights_2_levels")).select("register");

            oep.clickSaveAndContinue();
        }
    }
View Full Code Here

TOP

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

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.