Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void setInsertFieldValues(List<FieldDefinition> fields, Map<String, Objec
else if (field.getType() == FieldDefinition.ColumnType.Integer || field.getType() == FieldDefinition.ColumnType.Decimal || field.getType() == FieldDefinition.ColumnType.Double)
setNumericField(fieldKey, String.valueOf(value));
else if (field.getType() == FieldDefinition.ColumnType.Date || field.getType() == FieldDefinition.ColumnType.DateAndTime || field.getType() == FieldDefinition.ColumnType.Time)
setDateTimeField(field.getName(), value, fieldKey);
setDateTimeField(fieldKey, value);
else if (field.getType() == FieldDefinition.ColumnType.TextChoice)
setSelectionField(field.getLabel(), (List<String>) value);
else
Expand All @@ -246,24 +246,20 @@ else if (field.getType() == FieldDefinition.ColumnType.TextChoice)
* object to use the picker to set the field. If a text value is passed in it is used as a literal and jut typed
* into the textbox.
*
* @param fieldName Field to update.
* @param fieldKey Field to update.
* @param dateTime A LocalDateTime, LocalDate, LocalTime or String.
* @return A reference to this page.
*/
public EntityBulkInsertDialog setDateTimeField(String fieldName, Object dateTime)
public EntityBulkInsertDialog setDateTimeField(String fieldKey, Object dateTime)
{
return setDateTimeField(fieldName, dateTime, null);
}
public EntityBulkInsertDialog setDateTimeField(String fieldName, Object dateTime, @Nullable String fieldKey)
{
ReactDateTimePicker dateTimePicker = elementCache().dateInput(fieldName, fieldKey);
ReactDateTimePicker dateTimePicker = elementCache().dateInput(fieldKey);
dateTimePicker.select(dateTime);
return this;
}

public String getDateTimeField(String fieldName, @Nullable String fieldKey)
public String getDateTimeField(String fieldKey)
{
return elementCache().dateInput(fieldName, fieldKey).get();
return elementCache().dateInput(fieldKey).get();
}

public EntityBulkInsertDialog setBooleanField(String fieldKey, boolean checked)
Expand Down Expand Up @@ -410,13 +406,10 @@ public Input numericInput(String fieldKey)
return new Input(inputEl, getDriver());
}

public ReactDateTimePicker dateInput(String fieldName, @Nullable String fieldKey)
public ReactDateTimePicker dateInput(String fieldKey)
{
if (fieldKey == null)
fieldKey = fieldName;

return new ReactDateTimePicker.ReactDateTimeInputFinder(getDriver())
.withInputId(fieldKey).find(formRow(fieldName));
.withInputId(fieldKey).find(formRow(fieldKey));
}

public List<WebElement> fieldLabels()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void setValue(FieldDefinition field, Object newValue)
else if (field.getType() == FieldDefinition.ColumnType.Integer || field.getType() == FieldDefinition.ColumnType.Decimal || field.getType() == FieldDefinition.ColumnType.Double)
setNumericField(EscapeUtil.fieldKeyEncodePart(field.getName()), String.valueOf(newValue));
else if (field.getType() == FieldDefinition.ColumnType.Date || field.getType() == FieldDefinition.ColumnType.DateAndTime || field.getType() == FieldDefinition.ColumnType.Time)
setDateField(field.getLabel() == null ? field.getName() : field.getLabel(), (String) newValue);
setDateField(EscapeUtil.fieldKeyEncodePart(field.getName()), (String) newValue);
else if (field.getType() == FieldDefinition.ColumnType.Boolean)
setBooleanField(EscapeUtil.fieldKeyEncodePart(field.getName()), (Boolean) newValue);
else if (field.getType() == FieldDefinition.ColumnType.MultiLine)
Expand Down Expand Up @@ -151,9 +151,9 @@ public String getNumericField(String fieldKey)
return elementCache().numericInput(fieldKey).get();
}

public EntityBulkUpdateDialog setDateField(String fieldLabel, String dateString)
public EntityBulkUpdateDialog setDateField(String fieldKey, String dateString)
{
enableAndWait(fieldLabel, elementCache().dateInput(fieldLabel)).set(dateString);
enableAndWait(fieldKey, elementCache().dateInput(fieldKey)).set(dateString);
return this;
}

Expand Down Expand Up @@ -360,10 +360,10 @@ public Input numericInput(String fieldKey)
return new Input(inputEl, getDriver());
}

public ReactDateTimePicker dateInput(String fieldLabel)
public ReactDateTimePicker dateInput(String fieldKey)
{
return new ReactDateTimePicker.ReactDateTimeInputFinder(getDriver())
.withInputId(EscapeUtil.fieldKeyEncodePart(fieldLabel)).waitFor(formRow(fieldLabel));
.withInputId(fieldKey).waitFor(formRow(fieldKey));
}

public FileAttachmentContainer fileUploadField(String fieldKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public WebElement valueCellWithLabel(String label)

public WebElement valueCellWithName(String fieldName)
{
return Locator.tagWithAttribute("td", "data-fieldkey", EscapeUtil.fieldKeyEncodePart(fieldName).toLowerCase()).findElement(editPanel);
return Locator.tagWithAttribute("td", "data-fieldkey", EscapeUtil.fieldKeyEncodePart(fieldName)).findElement(editPanel);
}

public FileUploadField fileField(String label)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public String getActiveSelectedFieldLabel()

if(active.isDisplayed())
{
return getTextContent(Locator.tagWithClass("div", "field-name").findElement(active));
return getTextContent(Locator.tagWithClass("div", "field-caption").findElement(active));
}
else
{
Expand Down Expand Up @@ -601,7 +601,7 @@ protected class ElementCache extends ModalDialog.ElementCache
protected WebElement selectedFieldsPanel = contentPanelLocator.index(1).findWhenNeeded(this);

// This is present to items in both panels.
protected final Locator listItemName = Locator.tagWithClass("div", "field-name");
protected final Locator listItemName = Locator.tagWithClass("div", "field-caption");

protected final WebElement undoEditsButton = Locator.tagWithText("span", "Undo edits")
.refindWhenNeeded(this);
Expand All @@ -624,15 +624,15 @@ protected class ElementCache extends ModalDialog.ElementCache
protected List<WebElement> getListItemElements(WebElement panel, String fieldLabel)
{
return Locator.tagWithClass("div", "list-group-item")
.withDescendant(Locator.tagWithClass("div", "field-name").withText(fieldLabel))
.withDescendant(Locator.tagWithClass("div", "field-caption").withText(fieldLabel))
.findElements(panel);
}

// Will get the first list item that matches the fieldLabel.
protected WebElement getListItemElement(WebElement panel, String fieldLabel)
{
return Locator.tagWithClass("div", "list-group-item")
.withDescendant(Locator.tagWithClass("div", "field-name").withText(fieldLabel))
.withDescendant(Locator.tagWithClass("div", "field-caption").withText(fieldLabel))
.findElement(panel);
}

Expand Down