Search in sources :

Example 11 with ClassFieldEditPane

use of org.xwiki.appwithinminutes.test.po.ClassFieldEditPane 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"));
}
Also used : EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) 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)

Example 12 with ClassFieldEditPane

use of org.xwiki.appwithinminutes.test.po.ClassFieldEditPane in project xwiki-platform by xwiki.

the class ClassEditorTest method testRenameWithSaveAndContinue.

/**
 * Test that Save And Continue supports field renames.
 */
@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 testRenameWithSaveAndContinue() {
    ClassFieldEditPane field = editor.addField("Short Text");
    editor.clickSaveAndContinue();
    // Rename the field.
    field.openConfigPanel();
    field.setName("title");
    editor.clickSaveAndContinue();
    // Rename the field for a second time.
    // NOTE: The IDs have been changed so we must recreate the class field edit pane.
    new ClassFieldEditPane("title").setName("city");
    // Save and assert the field was added with the right name.
    Assert.assertTrue(editor.clickSaveAndView().getContent().contains("Short Text (city: String)"));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 13 with ClassFieldEditPane

use of org.xwiki.appwithinminutes.test.po.ClassFieldEditPane 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"));
}
Also used : EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ClassSheetPage(org.xwiki.xclass.test.po.ClassSheetPage) ViewPage(org.xwiki.test.ui.po.ViewPage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)13 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)13 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)12 LongTextClassFieldEditPane (org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane)10 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)9 ViewPage (org.xwiki.test.ui.po.ViewPage)5 EntryEditPage (org.xwiki.appwithinminutes.test.po.EntryEditPage)4 ApplicationHomeEditPage (org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage)3 ApplicationHomePage (org.xwiki.appwithinminutes.test.po.ApplicationHomePage)3 AbstractTest (org.xwiki.test.ui.AbstractTest)3 ClassSheetPage (org.xwiki.xclass.test.po.ClassSheetPage)3 ApplicationsLiveTableElement (org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement)2 EntryNamePane (org.xwiki.appwithinminutes.test.po.EntryNamePane)2 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)2 AppWithinMinutesHomePage (org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage)1 ApplicationCreatePage (org.xwiki.appwithinminutes.test.po.ApplicationCreatePage)1 ApplicationTemplateProviderEditPage (org.xwiki.appwithinminutes.test.po.ApplicationTemplateProviderEditPage)1 DocumentPickerModal (org.xwiki.index.tree.test.po.DocumentPickerModal)1 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)1 PagesLiveTableElement (org.xwiki.test.ui.po.PagesLiveTableElement)1