Skip to content

LKSM: Multivalue text choice automation: Type Conversion#2960

Open
DariaBod wants to merge 11 commits intodevelopfrom
fb_typeConversionMVTC
Open

LKSM: Multivalue text choice automation: Type Conversion#2960
DariaBod wants to merge 11 commits intodevelopfrom
fb_typeConversionMVTC

Conversation

@DariaBod
Copy link
Copy Markdown
Contributor

Rationale

Added tests for type conversion MVTC->TC, TC->MVTC, MVTC->Text for for saved custom grid views with all array type filters.
Also added test to verify MVTC cannot convert to TC if any row has >1 values, cross folder scenario, if rows with multi value is in child/sibling folder only.

Related Pull Requests

Changes

Copy link
Copy Markdown
Member

@labkey-tchad labkey-tchad left a comment

Choose a reason for hiding this comment

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

Several suggestions. (Claude /review-pr was useful)

// it is in the product).

public void setAllowMultipleSelections(Boolean allowMultipleSelections)
public DomainFieldRow setAllowMultipleSelections(Boolean allowMultipleSelections)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a parameter to explicitly determine whether a confirmation dialog is expected. This is consistent with the setType method.

Suggested change
public DomainFieldRow setAllowMultipleSelections(Boolean allowMultipleSelections)
public DomainFieldRow setAllowMultipleSelections(Boolean allowMultipleSelections, boolean confirmDialogExpected)

Without this change, the component might fail to dismiss a dialog that appears a little too slowly.


log("Validate that the order of the fields in the 'Shown in Grid' column are as expected.");
expectedFields = List.of(COL_NAME, COL_STRING1, COL_STRING2, COL_INT, COL_BOOL);
expectedFields = List.of(COL_NAME, COL_STRING1, COL_STRING2, COL_INT, COL_BOOL, COL_MULTITEXTCHOICE);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The list of expected fields should be conditional

Suggested change
expectedFields = List.of(COL_NAME, COL_STRING1, COL_STRING2, COL_INT, COL_BOOL, COL_MULTITEXTCHOICE);
expectedFields = MULTI_CHOICE_ENABLED
? List.of(COL_NAME, COL_STRING1, COL_STRING2, COL_INT, COL_BOOL, COL_MULTITEXTCHOICE)
: List.of(COL_NAME, COL_STRING1, COL_STRING2, COL_INT, COL_BOOL);

* @param columns The columns to show in the default view. Will be added in the order of the list.
*/
private void resetDefaultView(String sampleTypeName, List<String> columns) throws Exception
private void resetDefaultView(String projectPath, String sampleTypeName, List<String> columns) throws Exception
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why add this path parameter? It is never anything but getProjectName().

Comment on lines +114 to +118
private record GridConversionResult(boolean isDropped, @Nullable String expectedFilterText)
{
static GridConversionResult kept(String filterText) { return new GridConversionResult(false, filterText); }
static GridConversionResult dropped() { return new GridConversionResult(true, null); }
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add more documentation. Claude is great at this.

Suggested change
private record GridConversionResult(boolean isDropped, @Nullable String expectedFilterText)
{
static GridConversionResult kept(String filterText) { return new GridConversionResult(false, filterText); }
static GridConversionResult dropped() { return new GridConversionResult(true, null); }
}
/**
* Describes the expected state of a saved grid view's filter pill after a field type conversion.
*
* @param isDropped {@code true} if the filter is expected to be silently dropped by the conversion
* (i.e., no filter pill should be visible); {@code false} if the filter should survive.
* @param expectedFilterText the substring expected to appear in the filter pill after conversion;
* {@code null} when {@code isDropped} is {@code true}.
*/
private record GridConversionResult(boolean isDropped, @Nullable String expectedFilterText)
{
/** The filter survives conversion and its pill should contain {@code filterText}. */
static GridConversionResult kept(String filterText) { return new GridConversionResult(false, filterText); }
/** The filter is silently dropped by the conversion; no filter pill should be visible. */
static GridConversionResult dropped() { return new GridConversionResult(true, null); }
}

Comment on lines +120 to +126
private record GridMVTCCase(String viewName, Filter.Operator op, String[] filterVals,
GridConversionResult conversionResult,
Map<String, String> expectedSampleMap) {}

private record GridTCCase(String viewName, Filter.Operator op, String[] filterVals,
String expectedAfterConversionText,
Map<String, String> expectedSampleMap) {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add documentation to these as well

Comment on lines +1702 to +1711
private void changeMVTCFieldToText()
{
UpdateSampleTypePage updatePage = beginAtSampleTypesList(this, getProjectName())
.goToEditSampleType(DEFAULT_VIEW_SAMPLE_TYPE);
updatePage.getFieldsPanel()
.getField(COL_MULTITEXTCHOICE)
.expand()
.setType(FieldDefinition.ColumnType.String, true);
updatePage.clickSave();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If any of these new tests fails while the column type has been changed, it could cause all of the subsequent MVTC tests to fail because the type is not as expected.

Consider having these type changer methods not depend on a certain initial type and alter their behavior based on the current type. Then each of the conversion tests could switch the column to MVTC at the start instead of having each of them switch back to MVTC at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants