use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class AbstractClassEditorTest method setUp.
@Before
public void setUp() throws Exception {
getUtil().deleteSpace(getTestClassName());
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", "editor=inline&template=AppWithinMinutes.ClassTemplate&title=" + getTestMethodName() + " Class");
editor = new ApplicationClassEditPage();
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class AppsLiveTableTest method testEditApplication.
/**
* Creates an application and edits it using the Actions column from the applications live table.
*/
@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 testEditApplication() {
// Create the application.
String appName = RandomStringUtils.randomAlphabetic(6);
createApplication(appName);
// Edit the application.
ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable();
appsLiveTable.waitUntilReady();
ApplicationClassEditPage classEditor = appsLiveTable.clickEditApplication(appName);
// Edit the existing class field.
ClassFieldEditPane fieldEditPane = new ClassFieldEditPane("shortText1");
fieldEditPane.setPrettyName("City Name");
fieldEditPane.openConfigPanel();
fieldEditPane.setName("cityName");
// Move to the next step.
ApplicationHomeEditPage homeEditPage = classEditor.clickNextStep().clickNextStep();
homeEditPage.setDescription("demo");
// Finish editing.
ApplicationHomePage homePage = homeEditPage.clickFinish();
Assert.assertTrue(homePage.getContent().contains("demo"));
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage 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"));
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testInvalidFieldName.
/**
* Tests that invalid field names are 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 testInvalidFieldName() {
String invalidFieldNameErrorMessage = "Property names must follow these naming rules:";
ClassFieldEditPane field = editor.addField("Static List");
field.openConfigPanel();
field.setName("3times");
// Save the page and expect the error.
editor.getSaveAndViewButton().click();
waitForPageSourceContains(invalidFieldNameErrorMessage);
getDriver().navigate().back();
editor = new ApplicationClassEditPage();
field = editor.addField("User");
field.openConfigPanel();
// Unfortunately we don't allow Unicode letters because they are not fully supported in tag names.
// See XWIKI-7306: The class editor doesn't validate properly the field names
field.setName("\u021Bar\u0103");
// Save the page and expect the error.
editor.getSaveAndViewButton().click();
waitForPageSourceContains(invalidFieldNameErrorMessage);
getDriver().navigate().back();
editor = new ApplicationClassEditPage();
field = editor.addField("Group");
field.openConfigPanel();
field.setName("alice>bob");
// Save the page and expect the error.
editor.getSaveAndViewButton().click();
waitForPageSourceContains(invalidFieldNameErrorMessage);
}
use of org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testSaveAndContinue.
/**
* Tests the Save & Continue button.
*/
@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 testSaveAndContinue() {
editor.addField("Date");
editor.clickSaveAndContinue();
// Check if the field was added.
ViewPage viewer = editor.clickCancel();
Assert.assertTrue(viewer.getContent().contains("Date (date1: Date)"));
// Edit again. This time check the error message.
viewer.edit();
editor = new ApplicationClassEditPage();
// Try to set the field name to an invalid value.
ClassFieldEditPane field = new ClassFieldEditPane("date1");
field.openConfigPanel();
field.setName("-delta");
editor.clickSaveAndContinue(false);
editor.waitForNotificationErrorMessage("Failed to save the page.");
// Double check that the field wasn't renamed.
Assert.assertTrue(editor.clickCancel().getContent().contains("Date (date1: Date)"));
}
Aggregations