Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
333c490
initial commit for multichoice value
DariaBod Jan 23, 2026
fabe096
some changes
DariaBod Jan 26, 2026
349d08d
add tests for:
DariaBod Jan 28, 2026
0ab67be
Merge branch 'develop' into fb_mvtc_test
DariaBod Jan 28, 2026
fd9d700
new changes for test
DariaBod Jan 29, 2026
bf42d09
Merge branch 'develop' into fb_mvtc_test
DariaBod Jan 29, 2026
1745585
Merge branch 'develop' into fb_mvtc_test
DariaBod Jan 30, 2026
f349d82
add test testMultiChoiceUpdateFromFile(), testMultiChoiceEditInGridDr…
DariaBod Feb 3, 2026
92000dd
Merge branch 'develop' into fb_mvtc_test
DariaBod Feb 3, 2026
c3c8266
Merge branch 'develop' into fb_mvtc_test
DariaBod Feb 4, 2026
e5ec9db
-delete unused imports
DariaBod Feb 5, 2026
33683e0
-delete unexpected symbol
DariaBod Feb 5, 2026
9a5773a
-some code style fixes
DariaBod Feb 5, 2026
41e1c78
Apply suggestion from @labkey-tchad
DariaBod Feb 11, 2026
36a970a
Provide warnings for unknown fields for cross sample type import (#2862)
cnathe Feb 5, 2026
bac1f69
Dismiss popover for responsive grid (#2874)
DariaBod Feb 7, 2026
c44cbd6
Misc fixes for error message single quote change (#2876)
cnathe Feb 9, 2026
c60c514
Fix expected error messages in tests (#2875)
DariaBod Feb 9, 2026
fe04f1f
Fix build: remove import in ListDateAndTimeTest (#2879)
labkey-nicka Feb 9, 2026
0435138
Updating SampleFinder Test Component (#2877)
labkey-danield Feb 10, 2026
b4d52e0
fix comments about selectFilter javadoc and initFilterColumn method
DariaBod Feb 11, 2026
fd83f85
Merge branch 'develop' into fb_mvtc_test
labkey-danield Feb 11, 2026
6648cf1
Apply suggestions from code review
DariaBod Feb 13, 2026
d1751b3
Apply suggestions from code review
DariaBod Feb 13, 2026
187e9b4
Move getExpectedAuditDataChange method to AuditLogHelper. (#2880)
labkey-susanh Feb 10, 2026
7c72826
Make CSP error logging validation more robust (#2868)
labkey-jeckels Feb 4, 2026
e9aab1d
Merge branch 'refs/heads/develop' into fb_mvtc_test
DariaBod Feb 13, 2026
87c688b
fix all pr comments
DariaBod Feb 14, 2026
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
9 changes: 9 additions & 0 deletions src/org/labkey/test/components/domain/DomainFieldRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,11 @@ public DomainFieldRow clickRemoveOntologyConcept()
// behind the scenes. Because of that the validator aspect of the TextChoice field is hidden from the user (just like
// it is in the product).

public void setAllowMultipleSelections(Boolean allowMultipleSelections)
{
elementCache().allowMultipleSelectionsCheckbox.set(allowMultipleSelections);
}

/**
* Set the list of allowed values for a TextChoice field.
*
Expand Down Expand Up @@ -1702,6 +1707,10 @@ protected class ElementCache extends WebDriverComponent.ElementCache
public final WebElement domainWarningIcon = Locator.tagWithClass("span", "domain-warning-icon")
.findWhenNeeded(this);

// text choice field option
public final Checkbox allowMultipleSelectionsCheckbox = new Checkbox(Locator.tagWithClass("input", "domain-text-choice-multi")
.refindWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));

// lookup field options
public final Select lookupContainerSelect = SelectWrapper.Select(Locator.name("domainpropertiesrow-lookupContainer"))
.findWhenNeeded(this);
Expand Down
11 changes: 11 additions & 0 deletions src/org/labkey/test/components/domain/DomainFormPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ else if (validator instanceof FieldDefinition.TextChoiceValidator textChoiceVali
throw new IllegalArgumentException("TextChoice fields cannot have additional validators.");
}
fieldRow.setTextChoiceValues(textChoiceValidator.getValues());
fieldRow.setAllowMultipleSelections(false);
}
else if (validator instanceof FieldDefinition.MultiValueTextChoiceValidator multiValueTextChoiceValidator)
{
// MultiValueTextChoice is a field type; implemented using a special validator. TextChoice field cannot have other validators.
if (validators.size() > 1)
{
throw new IllegalArgumentException("TextChoice fields cannot have additional validators.");
}
fieldRow.setTextChoiceValues(multiValueTextChoiceValidator.getValues());
fieldRow.setAllowMultipleSelections(true);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ public EntityBulkUpdateDialog setSelectionField(CharSequence fieldIdentifier, Li
return this;
}

/**
* Clear the field (fieldIdentifier).
*
* @param fieldIdentifier Identifier for the field; name ({@link String}) or fieldKey ({@link FieldKey})
* @return this component
*/
public EntityBulkUpdateDialog clearSelection(CharSequence fieldIdentifier)
{
FilteringReactSelect reactSelect = enableSelectionField(fieldIdentifier);
reactSelect.clearSelection();
return this;
}

/**
* @param fieldIdentifier Identifier for the field; name ({@link String}) or fieldKey ({@link FieldKey})
* @param selectValue value to select
Expand Down
3 changes: 3 additions & 0 deletions src/org/labkey/test/components/ui/grids/EditableGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,14 @@ public WebElement setCellValue(int row, CharSequence columnIdentifier, Object va

if (value instanceof List)
{

// If this is a list assume that it will need a lookup.
List<String> values = (List) value;

ReactSelect lookupSelect = elementCache().lookupSelect(gridCell);

lookupSelect.clearSelection();

Comment on lines +516 to +517
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work if a test is trying to add to an existing selections?

lookupSelect.open();

for (String _value : values)
Expand Down
35 changes: 29 additions & 6 deletions src/org/labkey/test/components/ui/grids/ResponsiveGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.labkey.test.components.react.ReactCheckBox;
import org.labkey.test.components.ui.grids.FieldReferenceManager.FieldReference;
import org.labkey.test.components.ui.search.FilterExpressionPanel;
import org.labkey.test.components.ui.search.FilterFacetedPanel;
import org.labkey.test.params.FieldKey;
import org.labkey.test.util.selenium.WebElementUtils;
import org.openqa.selenium.Keys;
Expand All @@ -40,6 +41,14 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.labkey.remoteapi.query.Filter.Operator.CONTAINS_ALL;
import static org.labkey.remoteapi.query.Filter.Operator.CONTAINS_ANY;
import static org.labkey.remoteapi.query.Filter.Operator.CONTAINS_EXACTLY;
import static org.labkey.remoteapi.query.Filter.Operator.CONTAINS_NONE;
import static org.labkey.remoteapi.query.Filter.Operator.DOES_NOT_CONTAIN_EXACTLY;
import static org.labkey.remoteapi.query.Filter.Operator.IN;
import static org.labkey.remoteapi.query.Filter.Operator.IS_EMPTY;
import static org.labkey.remoteapi.query.Filter.Operator.IS_NOT_EMPTY;
import static org.labkey.test.WebDriverWrapper.waitFor;

public class ResponsiveGrid<T extends ResponsiveGrid<?>> extends WebDriverComponent<ResponsiveGrid<T>.ElementCache> implements UpdatingComponent
Expand Down Expand Up @@ -234,18 +243,31 @@ public String filterColumnExpectingError(CharSequence columnIdentifier, Filter.O

private GridFilterModal initFilterColumn(CharSequence columnIdentifier, Filter.Operator operator, Object value)
{
List<Filter.Operator> listOperators = List.of(IN, CONTAINS_ALL, CONTAINS_ANY, CONTAINS_EXACTLY, CONTAINS_NONE,
DOES_NOT_CONTAIN_EXACTLY);
clickColumnMenuItem(columnIdentifier, "Filter...", false);
GridFilterModal filterModal = new GridFilterModal(getDriver(), this);
if (operator != null)
{
if (operator.equals(Filter.Operator.IN) && value instanceof List<?>)
if (listOperators.contains(operator) && value instanceof List<?>)
{
List<String> values = (List<String>) value;
filterModal.selectFacetTab().selectValue(values.get(0));
filterModal.selectFacetTab().checkValues(values.toArray(String[]::new));
FilterFacetedPanel filterPanel = filterModal.selectFacetTab();
filterPanel.selectValue(values.get(0));
filterPanel.checkValues(values.toArray(String[]::new));
if (filterPanel.isFiltersPresented())
{
filterPanel.selectFilter(operator);
}
}
else if (value == null)
{
filterModal.selectFacetTab().selectFilter(operator);
}
else
{
filterModal.selectExpressionTab().setFilter(new FilterExpressionPanel.Expression(operator, value));
}
}
return filterModal;
}
Expand Down Expand Up @@ -385,15 +407,16 @@ public T selectRow(int index, boolean checked)

/**
* Finds the first row with the specified texts in the specified columns, and sets its checkbox
* @param partialMap key-column (fieldKey, name, or label), value-text in that column
* @param checked the desired checkbox state
*
* @param partialMap key-column (fieldKey, name, or label), value-text in that column
* @param checked the desired checkbox state
* @return this grid
*/
public T selectRow(Map<String, String> partialMap, boolean checked)
{
GridRow row = getRow(partialMap);
selectRowAndVerifyCheckedCounts(row, checked);
getWrapper().log("Row described by map ["+partialMap+"] selection state set to + ["+row.isSelected()+"]");
getWrapper().log("Row described by map [" + partialMap + "] selection state set to + [" + row.isSelected() + "]");

return getThis();
}
Expand Down
23 changes: 23 additions & 0 deletions src/org/labkey/test/components/ui/search/FilterFacetedPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
import org.labkey.test.components.WebDriverComponent;
import org.labkey.test.components.html.Checkbox;
import org.labkey.test.components.html.Input;
import org.labkey.test.components.react.ReactSelect;
import org.labkey.test.components.ui.FilterStatusValue;
import org.labkey.remoteapi.query.Filter;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

import java.util.List;
import java.util.stream.Collectors;

import static org.labkey.test.WebDriverWrapper.waitFor;
import static org.labkey.test.components.html.Input.Input;
import static org.labkey.test.util.samplemanagement.SMTestUtils.isVisible;

public class FilterFacetedPanel extends WebDriverComponent<FilterFacetedPanel.ElementCache>
{
Expand Down Expand Up @@ -48,6 +52,23 @@ public void selectValue(String value)
elementCache().findCheckboxLabel(value).click();
}

/**
* Check that filter choosing option exists on the page.
*/
public boolean isFiltersPresented()
{
return waitFor(() -> isVisible(elementCache().filterTypeSelects), 1000);
}

/**
* Select a filer by clicking its label. Right now this method relevant only for multi-value text choice.
* @param operator desired filter value
*/
public void selectFilter(Filter.Operator operator)
{
elementCache().filterTypeSelects.select(operator.getDisplayValue());
}
Comment on lines 55 to 70
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this comment to describe this method (looks leftover from the selectValue). The comment should also mention that this is only relevant to multi-value text choice fields.

This could also take a Filter.Operator instead of a String for some extra type-safety.


/**
* Check single facet value by label to see if it is checked or not.
* @param value desired value
Expand Down Expand Up @@ -123,6 +144,8 @@ protected class ElementCache extends Component<?>.ElementCache
{
protected final Input filterInput =
Input(Locator.id("filter-faceted__typeahead-input"), getDriver()).findWhenNeeded(this);
protected final ReactSelect filterTypeSelects =
new ReactSelect.ReactSelectFinder(getDriver()).index(0).findWhenNeeded(this);
protected final WebElement checkboxSection =
Locator.byClass("labkey-wizard-pills").index(0).refindWhenNeeded(this);
protected final Locator.XPathLocator checkboxLabelLoc
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/pages/DatasetInsertPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void tryInsert(Map<String, String> values)
{
for (Map.Entry<String, String> entry : values.entrySet())
{
WebElement fieldInput = Locator.name(EscapeUtil.getFormFieldName(entry.getKey())).findElement(getDriver());
WebElement fieldInput = Locator.tag("*").attributeEndsWith("name", EscapeUtil.getFormFieldName(entry.getKey())).findElement(getDriver());
String type = fieldInput.getAttribute("type");
switch (type)
{
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/pages/query/UpdateQueryRowPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public UpdateQueryRowPage setField(String fieldName, String value)
WebElement field = elementCache().findField(fieldName);
if (field.getTagName().equals("select"))
{
setField(fieldName, OptionSelect.SelectOption.textOption(value));
selectOptionByText(field, value);
}
else
{
Expand Down
51 changes: 51 additions & 0 deletions src/org/labkey/test/params/FieldDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ public FieldDefinition setTextChoiceValues(List<String> values)
return this;
}

public FieldDefinition setMultiChoiceValues(List<String> values)
{
Assert.assertEquals("Invalid field type for text choice values.", ColumnType.MultiValueTextChoice, getType());
setValidators(List.of(new FieldDefinition.MultiValueTextChoiceValidator(values)));
return this;
}
Comment on lines 478 to 483
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a separate ColumnType for Multi Choice. That would make our API helpers able to deal with Multi-choice columns and it more closely matches the product design. It would also make setMultiChoiceValues redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trey is correct that we should use different ColumnType for multi choice. Though not obvious on UI, MVTC and TC are very different fields with distinct field definition. It uses rangeUri:
ColumnType MultiValueTextChoice = new ColumnTypeImpl("Text Choice (Multi-Value)", "http://cpas.fhcrc.org/exp/xml#multiChoice");


public ExpSchema.DerivationDataScopeType getAliquotOption()
{
return _aliquotOption;
Expand Down Expand Up @@ -611,6 +618,7 @@ public boolean isMeasureByDefault()
ColumnType Sample = new ColumnTypeImpl("Sample", "int", "http://www.labkey.org/exp/xml#sample", new IntLookup( "exp", "Materials"));
ColumnType Barcode = new ColumnTypeImpl("Unique ID", "string", "http://www.labkey.org/types#storageUniqueId", null);
ColumnType TextChoice = new ColumnTypeImpl("Text Choice", "string", "http://www.labkey.org/types#textChoice", null);
ColumnType MultiValueTextChoice = new ColumnTypeImpl("Text Choice", "string", "http://cpas.fhcrc.org/exp/xml#multiChoice", null);
ColumnType SMILES = new ColumnTypeImpl("SMILES", "string", "http://www.labkey.org/exp/xml#smiles", null);
ColumnType Calculation = new ColumnTypeImpl("Calculation", null, "http://www.labkey.org/exp/xml#calculated", null);
/**
Expand Down Expand Up @@ -1145,6 +1153,49 @@ public List<String> getValues()

}

/**
* TextChoice is implemented using a validator, however it is more 'limited' in scope. The user does not name a TextChoice
* validator or add a description or error message. A TextChoice is a lot like a look-up field, but it is not linked
* to an external data source. The user only provides the list of (string) values that the field will display in the dropdown.
* Another difference is that there can only be one TextChoice on a field, whereas you can have multiple validators on a field.
*/
public static class MultiValueTextChoiceValidator extends FieldValidator<MultiValueTextChoiceValidator>
{
private final List<String> _values;

public MultiValueTextChoiceValidator(List<String> values)
{
// The TextChoice validator only has a name and no description or message.
// And the name is generated (not user defined).
super("Text Choice Validator", "", "");
_values = Collections.unmodifiableList(values);
}

@Override
protected MultiValueTextChoiceValidator getThis()
{
return this;
}

@Override
protected String getType()
{
return "TextChoice";
}

@Override
protected String getExpression()
{
return EscapeUtil.getTextChoiceValidatorExpression(_values);
}

public List<String> getValues()
{
return _values;
}

}

}

class ColumnTypeImpl implements FieldDefinition.ColumnType
Expand Down
36 changes: 36 additions & 0 deletions src/org/labkey/test/tests/list/ListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -1688,6 +1689,41 @@ public void testAutoIncrementKeyEncoded()
_listHelper.deleteList();
}

@Test
public void testMultiChoiceValues()
{
Assume.assumeTrue("Multi-choice text fields are only supported on PostgreSQL", WebTestHelper.getDatabaseType() == WebTestHelper.DatabaseType.PostgreSQL);
// setup a list with an auto-increment key and multi text choice field
String encodedListName = TestDataGenerator.randomDomainName("multiChoiceList", DomainUtils.DomainKind.IntList);
String keyName = TestDataGenerator.randomFieldName("'><script>alert(\":(\")</script>'");
String columnName = TestDataGenerator.randomFieldName("MultiChoiceField");
List<String> tcValues = List.of("~`!@#$%^&*()_+=[]{}\\|';:\"<>?,./", "1", "2");
_listHelper.createList(PROJECT_VERIFY, encodedListName, keyName, col(columnName, ColumnType.MultiValueTextChoice)
.setMultiChoiceValues(tcValues));
_listHelper.goToList(encodedListName);

DataRegionTable table = new DataRegionTable("query", getDriver());
UpdateQueryRowPage insertNewRow = table.clickInsertNewRow();
List<String> valuesToChoose = tcValues.subList(1, 3);
valuesToChoose.forEach(value->{
insertNewRow.setField(columnName, value);
});
insertNewRow.submit();
checker().withScreenshot().verifyEquals("Multi choice value not as expected", String.join(" ", valuesToChoose), table.getDataAsText(0, columnName));

UpdateQueryRowPage editRow = table.clickEditRow(0);
valuesToChoose = tcValues.subList(1, 3);
valuesToChoose.forEach(value->{
editRow.setField(columnName, value);
});
editRow.submit();

// verify the multi choice value is persisted
checker().withScreenshot().verifyEquals("Multi choice value not as expected", String.join(" ", valuesToChoose), table.getDataAsText(0, columnName));

_listHelper.deleteList();
}

private List<String> getQueryFormFieldNames()
{
return Locator.tag("input").attributeStartsWith("name", "quf_")
Expand Down
7 changes: 7 additions & 0 deletions src/org/labkey/test/util/TestDataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Function;
Expand Down Expand Up @@ -956,6 +957,12 @@ public ImportDataResponse importRows(Connection cn, List<Map<String, Object>> ro
return getQueryHelper(cn).importData(TestDataUtils.stringFromRows(TestDataUtils.rowListsFromMaps(rows)), lookupByAlternateKey);
}

public static <T> List<T> shuffleSelect(List<T> allFields)
{
int randomSize = new Random().nextInt(allFields.size()) + 1;
return shuffleSelect(allFields, randomSize);
}

public static <T> List<T> shuffleSelect(List<T> allFields, int selectCount)
{
List<T> shuffled = new ArrayList<>(allFields);
Expand Down
15 changes: 15 additions & 0 deletions src/org/labkey/test/util/data/TestDataUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
Expand Down Expand Up @@ -577,6 +578,20 @@ public static List<List<String>> readRowsFromFile(File file, CSVFormat format) t
}
}

public static List<String> parseMultiValueText(String multiValueString) throws IOException
{
CSVFormat format = CSVFormat.RFC4180.builder()
.setIgnoreSurroundingSpaces(true).get();
try (CSVParser parser = format.parse(new StringReader(multiValueString)))
{
List<CSVRecord> records = parser.getRecords();
List<List<String>> list = records.stream().map(CSVRecord::toList).toList();
if (list.size() != 1)
throw new IllegalArgumentException("Invalid multi-value text string: " + multiValueString);
return list.getFirst();
}
}

public static <T> String stringFromRows(List<List<T>> rows, CSVFormat format)
{
StringWriter stringWriter = new StringWriter();
Expand Down