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"));
}
Aggregations