use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testSwapFieldNames.
/**
* Tests that swapping field names is not allowed.
*/
@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 testSwapFieldNames() {
ClassFieldEditPane field = editor.addField("Short Text");
field.openConfigPanel();
field.setName("alice");
field = editor.addField("Number");
field.openConfigPanel();
field.setName("bob");
editor.clickSaveAndView().edit();
editor = new ApplicationClassEditPage();
field = new ClassFieldEditPane("alice");
field.openConfigPanel();
field.setName("bob");
field = new ClassFieldEditPane("bob");
field.openConfigPanel();
field.setName("alice");
// Save the page and expect the error.
editor.getSaveAndViewButton().click();
waitForPageSourceContains("The class has two fields with the same name: alice");
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testUpdateSheetAndTemplate.
/**
* Tests the options to update the class sheet and the class template.
*/
@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 testUpdateSheetAndTemplate() {
// The options panel is not displayed if the class template and sheet don't exists.
Assert.assertFalse(editor.getContent().contains("Update class template"));
// Add a class field.
editor.addField("Number");
// Save and edit again.
editor.clickSaveAndView().edit();
editor = new ApplicationClassEditPage();
// Set default value for the previously added field.
new ClassFieldEditPane("number1").setDefaultValue("9");
// Add a new field
editor.addField("Database List");
// The options panel should be displayed now.
editor.setUpdateClassSheet(false);
// Save and edit the template.
editor.clickSaveAndView();
new ClassSheetPage().clickTemplateLink().edit();
// The sheet should display only the first field.
EntryEditPage inlineEditor = new EntryEditPage();
List<String> fieldNames = inlineEditor.getFieldNames();
Assert.assertEquals(1, fieldNames.size());
Assert.assertEquals("number1", fieldNames.get(0));
// Assert the value of the first field. The class template should have been updated.
Assert.assertEquals("9", inlineEditor.getValue("number1"));
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testRenameField.
/**
* Tests that class fields can be renamed.
*/
@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 testRenameField() {
// Add a class field.
editor.addField("Number").setDefaultValue("13");
// Save and edit the class template.
editor.clickSaveAndView();
new ClassSheetPage().clickTemplateLink().edit();
// Change the field value.
EntryEditPage inlineEditor = new EntryEditPage();
Assert.assertEquals("13", inlineEditor.getValue("number1"));
inlineEditor.setValue("number1", "27");
// Save and edit again the class.
inlineEditor.clickSaveAndView();
getUtil().gotoPage(getTestClassName(), getTestMethodName());
new ViewPage().edit();
// Rename the class field.
ClassFieldEditPane field = new ClassFieldEditPane("number1");
field.openConfigPanel();
field.setName("age");
// Save and edit again the class template.
new ApplicationClassEditPage().clickSaveAndView();
new ClassSheetPage().clickTemplateLink().edit();
Assert.assertEquals("27", new EntryEditPage().getValue("age"));
}
Aggregations