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
4 changes: 2 additions & 2 deletions src/org/labkey/test/AssayAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ private void verifyUpdateRunFileAPI(String assayName, String runFileField, int r
"queryName: \"Runs\", " +
"success: callback," +
"failure: callback," +
"rows: [{ RowId: \""+ runRowId + "\"," +
"\"" + EscapeUtil.toJSONStr(runFileField) + "\": \"" + EscapeUtil.toJSONStr(filePath) + "\"," +
"rows: [{ \"RowId\": " + runRowId + "," +
EscapeUtil.toJSONStr(runFileField) + ": " + EscapeUtil.toJSONStr(filePath) +
"}]" +
"})";
executeAndVerifyScript(updateScript, errorMsg);
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/components/react/BaseReactSelect.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean isClearable()

public boolean isDisabled()
{
return hasClass("select-input__control--is-disabled");
return hasClass("select-input__control--is-disabled") || hasClass("select-input--is-disabled");
}

public boolean isEnabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,18 @@ public List<String> getParentAliasOptions(int index)
return elementCache().parentAliasSelect(index).getOptions();
}

public T setParentAlias(int index, @Nullable String alias, @Nullable String optionDisplayText)
public T setParentAlias(int index, @Nullable String alias, @Nullable String dataType)
{
return setParentAlias(index, alias, optionDisplayText, false);
return setParentAlias(index, alias, dataType, false);
}

public T setParentAlias(int index, @Nullable String alias, @Nullable String optionDisplayText, boolean isRequired)
public T setParentAlias(int index, @Nullable String alias, @Nullable String dataType, boolean isRequired)
{
expandPropertiesPanel();
elementCache().parentAlias(index).setValue(alias);
if (optionDisplayText != null)
if (dataType != null)
{
elementCache().parentAliasSelect(index).select(optionDisplayText);
elementCache().parentAliasSelect(index).select(dataType);
}

// The "Required" checkbox is not presented outside of the apps. Only a test running in the app could set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public T addParentAlias(String alias)
return addParentAlias(alias, null);
}

public T addParentAlias(String alias, @Nullable String optionDisplayText)
public T addParentAlias(String alias, @Nullable String dataType)
{
return addParentAlias(alias, optionDisplayText, false);
return addParentAlias(alias, dataType, false);
}

public T addParentAlias(String alias, @Nullable String optionDisplayText, boolean isRequired)
public T addParentAlias(String alias, @Nullable String dataType, boolean isRequired)
{
expandPropertiesPanel();

Expand All @@ -55,11 +55,11 @@ public T addParentAlias(String alias, @Nullable String optionDisplayText, boolea

elementCache().addParentAliasButton.click();
int initialCount = findEmptyAlias();
if (optionDisplayText == null)
if (dataType == null)
{
optionDisplayText = CURRENT_SAMPLE_TYPE;
dataType = CURRENT_SAMPLE_TYPE;
}
setParentAlias(initialCount, alias, optionDisplayText, isRequired);
setParentAlias(initialCount, alias, dataType, isRequired);
return getThis();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,20 @@ public ReactSelect getAddNewEntityTypeSelect()
*
* @return A select at this given ordinal position.
*/
private ReactSelect getEntityTypeByPosition(int index)
public ReactSelect getEntityTypeByPosition(int index)
{
return ReactSelect.finder(getDriver())
.withNamedInput(String.format("entityType%d", index))
.waitFor(elementCache());
}

public ReactSelect getDisabledEntityTypeByLabel(String typeName)
{
return ReactSelect.finder(getDriver())
.followingLabelWithSpan(typeName)
.waitFor(elementCache());
}

public ReactSelect getEntityType(String entityName)
{
Locator input = Locator.tagWithAttribute("input", "value", entityName.toLowerCase());
Expand Down Expand Up @@ -344,6 +351,10 @@ public ParentEntityEditPanel addParent(String typeName, String parentId)
return addParents(typeName, Arrays.asList(parentId));
}

public ParentEntityEditPanel addParents(String typeName, List<String> parentIds)
{
return addParents(typeName, parentIds, false);
}
/**
* Add a specific parents (samples or sources) from the given type. If the type is not currently being used for
* parent elements it will be added.
Expand All @@ -353,9 +364,9 @@ public ParentEntityEditPanel addParent(String typeName, String parentId)
* @param parentIds A list of the individuals samples or sources to add.
* @return A reference to this panel.
*/
public ParentEntityEditPanel addParents(String typeName, List<String> parentIds)
public ParentEntityEditPanel addParents(String typeName, List<String> parentIds, boolean skipAdd)
{
if (getEntityType(typeName) == null)
if (!skipAdd && getEntityType(typeName) == null)
getAddNewEntityTypeSelect().select(typeName);

var selectParent = getParentFinder(typeName).waitFor(elementCache());
Expand Down Expand Up @@ -393,6 +404,9 @@ public ParentEntityEditPanel removeEntityType(String typeName)
boolean found = false;
for (ReactSelect reactSelect : selectControls)
{
if (reactSelect.isDisabled())
continue;

if (reactSelect.getSelections().contains(typeName))
{
found = true;
Expand Down Expand Up @@ -444,6 +458,11 @@ public void clearActionComment()
elementCache().commentInput.clear();
}

public boolean hasParentInputError()
{
return Locator.tagWithClass("div", "edit-parent-danger").isDisplayed(this);
}


/**
* Simple finder for this panel.
Expand Down
13 changes: 13 additions & 0 deletions src/org/labkey/test/components/ui/grids/EditableGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ public EditableGrid removeColumn(CharSequence columnIdentifier)
return this;
}

public boolean canRemoveColumn(CharSequence columnIdentifier)
{
WebElement headerCell = elementCache().getColumnHeaderCell(columnIdentifier);
WebElement downBtn = Locator.byClass("fa-chevron-circle-down").findElementOrNull(headerCell);
if (downBtn == null)
return false;
downBtn.click();
WebElement removeBtn = Locator.tagWithText("a", "Remove Column").findElementOrNull(headerCell);
boolean canRemove = removeBtn != null && removeBtn.isDisplayed() && removeBtn.isEnabled();
downBtn.click(); // close dropdown
return canRemove;
}

private boolean hasSelectColumn()
{
return elementCache().selectColumn.isDisplayed();
Expand Down
19 changes: 18 additions & 1 deletion src/org/labkey/test/util/EscapeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -50,7 +51,23 @@ static public String toJSONStr(String str)
}
}
}
return escaped.toString();
return "\"" + escaped + "\"";
}

static public String toJSONRow(Map<String, Object> row)
{
StringBuilder sb = new StringBuilder("{");
String comma = "";
for (Map.Entry<String, Object> entry : row.entrySet())
{
sb.append(comma);
Object value = entry.getValue();
sb.append(EscapeUtil.toJSONStr(entry.getKey()))
.append(": ").append(value instanceof String ? EscapeUtil.toJSONStr((String) entry.getValue()) : value);
comma = ",";
}
sb.append("}");
return sb.toString();
}

static public String jsString(String s)
Expand Down