mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-12 05:35:31 +00:00
allow tests to use timeformat with and without seconds for
html5DateTimeBox, added placeholders for older browsers
This commit is contained in:
1 parent
ee8cccd2e2
commit
ce2e8bd7c6
6 files changed
+17
-9
No files matched your search
+2
-1
@@ -36,14 +36,15 @@ public class DateTimeBoxFallbackStrategie extends Composite implements DateTimeB
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
// parser for low level, RFC compatible format
|
||||
dateFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
datebox.setFormat(new DefaultFormat(dateFormat));
|
||||
datebox.getElement().setAttribute("placeholder", dateFormat.getPattern());
|
||||
|
||||
datebox.ensureDebugId("datebox");
|
||||
UIObject.ensureDebugId(timebox, "timebox");
|
||||
|
||||
if (format != Format.YEAR_TO_DAY) {
|
||||
timeFormat = DateTimeFormat.getFormat(format == Format.YEAR_TO_MINUTE ? "HH:mm" : "HH:mm:ss");
|
||||
timebox.setAttribute("placeholder", timeFormat.getPattern());
|
||||
if (format == Format.YEAR_TO_SECOND) {
|
||||
timebox.setAttribute("step", "1");
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class PageObject {
|
||||
/**
|
||||
* </p>The default timeout of 15 seconds for the lookup of other elements.</p>
|
||||
*/
|
||||
protected static final int DEFAULT_LOOKUP_TIMEOUT = 15;
|
||||
protected static final int DEFAULT_LOOKUP_TIMEOUT = 60;
|
||||
|
||||
/**
|
||||
* <p>The web driver to use.</p>
|
||||
|
||||
+2
-2
@@ -50,8 +50,8 @@ public class EventCreateDialogPO extends DataEntryDialogPO {
|
||||
TextBoxPO.create(driver, nameTextBox).appendText(name);
|
||||
TextAreaPO.create(driver, descriptionTextArea).appendText(description);
|
||||
TextBoxPO.create(driver, venueTextBox).appendText(venue);
|
||||
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(start);
|
||||
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(end);
|
||||
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(start, false);
|
||||
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(end, false);
|
||||
CheckBoxPO.create(driver, isPublicCheckBox).setSelected(isPublic);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public class SetStartTimeDialogPO extends DataEntryDialogPO {
|
||||
}
|
||||
|
||||
public void setStartTimeValue(Date startTime) {
|
||||
BetterDateTimeBoxPO.create(driver, startTimeTimeBox, true).setDate(startTime);
|
||||
BetterDateTimeBoxPO.create(driver, startTimeTimeBox, true).setDate(startTime,true);
|
||||
}
|
||||
|
||||
public void pressSetStartTime() {
|
||||
|
||||
+2
-2
@@ -56,8 +56,8 @@ public class RegattaCreateDialogPO extends DataEntryDialogPO {
|
||||
public void setValues(String name, String boatClass, Date startDate, Date endDate) {
|
||||
this.setRegattaName(name);
|
||||
this.setBoatClass(boatClass);
|
||||
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(startDate);
|
||||
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(endDate);
|
||||
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(startDate, false);
|
||||
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(endDate, false);
|
||||
}
|
||||
|
||||
// TODO: Scoring System, Event and Course Area
|
||||
|
||||
+9
-2
@@ -19,6 +19,7 @@ public class BetterDateTimeBoxPO extends PageArea {
|
||||
|
||||
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private static final DateFormat timeFormat = new SimpleDateFormat("hh:mm");
|
||||
private static final DateFormat timeFormatSeconds = new SimpleDateFormat("hh:mm:ss");
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "datebox")
|
||||
private WebElement datebox;
|
||||
@@ -39,17 +40,23 @@ public class BetterDateTimeBoxPO extends PageArea {
|
||||
*
|
||||
* @param date
|
||||
* the {@link Date} object to set
|
||||
* @param withSeconds true, if the used TimeBox requires also seconds and not only hours and minutes
|
||||
*
|
||||
* @see DateFormat#format(Date)
|
||||
* @see #setText(String)
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
public void setDate(Date date, boolean withSeconds) {
|
||||
String datein = dateFormat.format(date);
|
||||
datebox.clear();
|
||||
datebox.sendKeys(datein);
|
||||
// ensure popups are closed!
|
||||
datebox.sendKeys("\t");
|
||||
String timein = timeFormat.format(date);
|
||||
final String timein;
|
||||
if(withSeconds){
|
||||
timein = timeFormatSeconds.format(date);
|
||||
}else{
|
||||
timein = timeFormat.format(date);
|
||||
}
|
||||
timebox.clear();
|
||||
timebox.sendKeys(timein);
|
||||
// ensure popups are closed!
|
||||
|
||||
Reference in new issue
Block a user