})
public void testDatePicker()
{
// First select a date using the picker and assert the value of the date input.
DateClassFieldEditPane dateField = new DateClassFieldEditPane(editor.addField("Date").getName());
DatePicker datePicker = dateField.openDatePicker();
datePicker.setYear("2011");
datePicker.setMonth("October");
datePicker.setDay("13");
datePicker.setHour("8 AM");
datePicker.setMinute("15");
String selectedDate = dateField.getDefaultValue();
// Ignore the number of seconds.
Assert.assertTrue(selectedDate.startsWith("13/10/2011 08:15:"));
// Set the value of the date input and assert the date selected by the picker.
dateField.setDefaultValue("17/03/2020 19:43:34");
// Currently the date picker doesn't know how to parse a date with a specified format. The workaround is to pass
// the date time stamp when generating the date input, but for this the page needs to be saved and reloaded.
editor.clickSaveAndView().edit();
datePicker = new DateClassFieldEditPane("date1").openDatePicker();
Assert.assertEquals("2020", datePicker.getYear());
Assert.assertEquals("March", datePicker.getMonth());
Assert.assertEquals("17", datePicker.getDay());
Assert.assertEquals("7 PM", datePicker.getHour());
Assert.assertEquals("40", datePicker.getMinute());
}