Search in sources :

Example 21 with ObjectEditPage

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

the class ClassEditorTest method testDeleteField.

/**
 * Tests that class fields can be deleted and that documents having objects of that class are updated.
 */
@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 testDeleteField() {
    // Add two fields.
    editor.addField("Boolean").setPrettyName("Available");
    editor.addField("Date").setPrettyName("Day");
    // Save and assert they are present.
    ViewPage classView = editor.clickSaveAndView();
    Assert.assertTrue(classView.getContent().contains("Available (boolean1: Boolean)"));
    Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));
    // Edit again and delete one of the fields.
    classView.edit();
    new ClassFieldEditPane("boolean1").delete().clickYes();
    // Save and check if the field was removed.
    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"));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) ClassSheetPage(org.xwiki.xclass.test.po.ClassSheetPage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Aggregations

ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)21 Test (org.junit.Test)15 ViewPage (org.xwiki.test.ui.po.ViewPage)11 FormElement (org.xwiki.test.ui.po.FormElement)9 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)9 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)8 ObjectEditPane (org.xwiki.test.ui.po.editor.ObjectEditPane)6 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)5 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)4 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)3 HashMap (java.util.HashMap)2 AbstractTest (org.xwiki.test.ui.AbstractTest)2 StaticListClassEditElement (org.xwiki.test.ui.po.editor.StaticListClassEditElement)2 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 MimeMessage (javax.mail.internet.MimeMessage)1 Before (org.junit.Before)1 TimeoutException (org.openqa.selenium.TimeoutException)1 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)1 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)1 LongTextClassFieldEditPane (org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane)1