Search in sources :

Example 1 with ObjectEditPane

use of org.xwiki.test.ui.po.editor.ObjectEditPane in project xwiki-platform by xwiki.

the class RepositoryTest method getNumberOfExtensionVersionsObjects.

private int getNumberOfExtensionVersionsObjects(String extensionName) {
    ObjectEditPage objectEditPage = goToObjectEditPage(extensionName);
    List<ObjectEditPane> versionObjects = objectEditPage.getObjectsOfClass(XWikiRepositoryModel.EXTENSIONVERSION_CLASSNAME);
    return versionObjects.size();
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage)

Example 2 with ObjectEditPane

use of org.xwiki.test.ui.po.editor.ObjectEditPane in project xwiki-platform by xwiki.

the class RepositoryTest method getNumberOfExtensionVersionsDependenciesObjects.

private int getNumberOfExtensionVersionsDependenciesObjects(String extensionName) {
    ObjectEditPage objectEditPage = goToObjectEditPage(extensionName);
    List<ObjectEditPane> dependenciesObjects = objectEditPage.getObjectsOfClass(XWikiRepositoryModel.EXTENSIONDEPENDENCY_CLASSNAME);
    return dependenciesObjects.size();
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage)

Example 3 with ObjectEditPane

use of org.xwiki.test.ui.po.editor.ObjectEditPane in project xwiki-platform by xwiki.

the class ApplicationsPanelAdministrationTest method createApplicationUIX.

private void createApplicationUIX(String applicationName) {
    getUtil().deletePage(new LocalDocumentReference(Arrays.asList("Apps", applicationName), "WebHome"));
    ViewPage page = getUtil().gotoPage("Apps", applicationName);
    ObjectEditPage editPage = page.editObjects();
    ObjectEditPane object = editPage.addObject("XWiki.UIExtensionClass");
    fillField(object, "extensionPointId", "org.xwiki.platform.panels.Applications");
    fillField(object, "name", applicationName);
    fillField(object, "parameters", String.format("label=%s\ntarget=Apps.%s\nicon=icon:home", applicationName, applicationName));
    editPage.clickSaveAndView();
}
Also used : LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage)

Example 4 with ObjectEditPane

use of org.xwiki.test.ui.po.editor.ObjectEditPane in project xwiki-platform by xwiki.

the class EditObjectsTest method testObjectAddAndRemove.

@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testObjectAddAndRemove() {
    ObjectEditPage oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
    FormElement object = oep.addObject("XWiki.XWikiUsers");
    object.setFieldValue(By.id("XWiki.XWikiUsers_0_first_name"), "John");
    // Add another object
    FormElement object2 = oep.addObject("XWiki.XWikiUsers");
    // Check that the unsaved value from the first object wasn't lost
    Assert.assertEquals("John", object.getFieldValue(By.id("XWiki.XWikiUsers_0_first_name")));
    // Check that the value from the second object is unset
    Assert.assertEquals("", object2.getFieldValue(By.id("XWiki.XWikiUsers_1_first_name")));
    // Delete the second object
    oep.deleteObject("XWiki.XWikiUsers", 1);
    // Let's save the form and check that changes were persisted.
    oep = oep.clickSaveAndView().editObjects();
    List<ObjectEditPane> xwikiUsersForms = oep.getObjectsOfClass("XWiki.XWikiUsers");
    Assert.assertEquals(1, xwikiUsersForms.size());
    Assert.assertEquals("John", xwikiUsersForms.get(0).getFieldValue(By.id("XWiki.XWikiUsers_0_first_name")));
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) FormElement(org.xwiki.test.ui.po.FormElement) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 5 with ObjectEditPane

use of org.xwiki.test.ui.po.editor.ObjectEditPane in project xwiki-platform by xwiki.

the class EditObjectsTest method testPropertyDisplayersForNewObjects.

/**
 * @see <a href="https://jira.xwiki.org/browse/XWIKI-9061">XWIKI-9061</a>: Property displayers don't work in the
 *      object editor for objects that have just been added
 */
@Test
public void testPropertyDisplayersForNewObjects() throws Exception {
    getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
    // Create a class with two properties: a date and a list of users.
    ClassEditPage classEditor = ClassEditPage.gotoPage(getTestClassName(), getTestMethodName());
    classEditor.addProperty("date", "Date");
    classEditor.addProperty("author", "Users");
    // Add an object of this class and set its properties.
    String className = getTestClassName() + "." + getTestMethodName();
    ObjectEditPage objectEditor = ObjectEditPage.gotoPage(getTestClassName(), getTestMethodName());
    ObjectEditPane object = objectEditor.addObject(className);
    object.openDatePicker("date").setDay("15");
    object.getUserPicker("author").sendKeys("ad").waitForSuggestions().select("Admin");
    // Save, edit again and check the values.
    object = objectEditor.clickSaveAndView().editObjects().getObjectsOfClass(className).get(0);
    Assert.assertEquals("15", object.openDatePicker("date").getDay());
    Assert.assertEquals("Administrator", object.getUserPicker("author").waitToLoad().getAcceptedSuggestions().get(0).getName());
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) Test(org.junit.Test)

Aggregations

ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)6 ObjectEditPane (org.xwiki.test.ui.po.editor.ObjectEditPane)6 Test (org.junit.Test)3 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)2 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)2 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)1 FormElement (org.xwiki.test.ui.po.FormElement)1 InlinePage (org.xwiki.test.ui.po.InlinePage)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1 PreviewEditPage (org.xwiki.test.ui.po.editor.PreviewEditPage)1 PreviewableEditPage (org.xwiki.test.ui.po.editor.PreviewableEditPage)1