-
Notifications
You must be signed in to change notification settings - Fork 9
Tests for multi choice value #2872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
333c490
fabe096
349d08d
0ab67be
fd9d700
bf42d09
1745585
f349d82
92000dd
c3c8266
e5ec9db
33683e0
9a5773a
41e1c78
36a970a
bac1f69
c44cbd6
c60c514
fe04f1f
0435138
b4d52e0
fd83f85
6648cf1
d1751b3
187e9b4
7c72826
e9aab1d
87c688b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
| { | ||
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update this comment to describe this method (looks leftover from the This could also take a |
||
|
|
||
| /** | ||
| * Check single facet value by label to see if it is checked or not. | ||
| * @param value desired value | ||
|
|
@@ -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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a separate
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trey is correct that we should use different |
||
|
|
||
| public ExpSchema.DerivationDataScopeType getAliquotOption() | ||
| { | ||
| return _aliquotOption; | ||
|
|
@@ -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); | ||
| /** | ||
|
|
@@ -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 | ||
|
|
||
There was a problem hiding this comment.
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?