Skip to content

Commit 062901c

Browse files
Issue 53306: Some LKS forms don't distinguish between fields differing only by special chars
1 parent 7f9b317 commit 062901c

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

src/org/labkey/test/params/FieldDefinition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public FieldDefinition withNewName(String newName)
8383
* Define a String field
8484
* @param name field name
8585
*/
86-
public FieldDefinition(String name)
86+
public FieldDefinition(@NotNull String name)
8787
{
8888
this(name, ColumnType.String);
8989
}

src/org/labkey/test/tests/SampleTypeLineageTest.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.junit.Assert.assertNull;
4141
import static org.junit.Assert.assertTrue;
4242
import static org.junit.Assert.fail;
43+
import static org.labkey.test.params.FieldDefinition.DOMAIN_TRICKY_CHARACTERS;
4344
import static org.labkey.test.util.exp.SampleTypeAPIHelper.SAMPLE_TYPE_DOMAIN_KIND;
4445

4546
@Category({Daily.class})
@@ -1116,31 +1117,37 @@ public void testDeleteSampleSources() throws CommandException, IOException
11161117
@Test
11171118
public void testDeleteSamplesSomeWithDerivedSamples()
11181119
{
1119-
final String SAMPLE_TYPE_NAME = "DeleteSamplesWithParents";
1120+
final String SAMPLE_TYPE_NAME = "DeleteSamplesWithParents" + DOMAIN_TRICKY_CHARACTERS;
11201121
List<String> parentSampleNames = Arrays.asList("P-1", "P-2", "P-3");
11211122
List<Map<String, String>> sampleData = new ArrayList<>();
1122-
parentSampleNames.forEach(name -> {
1123-
sampleData.add(Map.of("Name", name));
1124-
});
1123+
parentSampleNames.forEach(name -> sampleData.add(Map.of("Name", name)));
11251124

11261125
clickProject(PROJECT_NAME);
11271126
SampleTypeHelper sampleHelper = new SampleTypeHelper(this);
11281127
log("Create a sample type with some potential parents");
1129-
sampleHelper.createSampleType(new SampleTypeDefinition(SAMPLE_TYPE_NAME), sampleData);
1128+
sampleHelper.createSampleType(new SampleTypeDefinition(SAMPLE_TYPE_NAME).
1129+
addField(new FieldDefinition("Blood+")).
1130+
addField(new FieldDefinition("Blood-")),
1131+
sampleData);
11301132
DataRegionTable drtSamples = sampleHelper.getSamplesDataRegionTable();
11311133
log("Derive one sample from another");
11321134
drtSamples.checkCheckbox(drtSamples.getIndexWhereDataAppears(parentSampleNames.get(0), "Name"));
11331135
clickButton("Derive Samples");
11341136
waitAndClickAndWait(Locator.lkButton("Next"));
11351137
String childName = parentSampleNames.get(0) + ".1";
1136-
setFormElement(Locator.name("outputSample1_Name"), childName);
1138+
String nameFieldInputFieldName = "Output Sample 1_Name";
1139+
String bloodPlusFieldInputFieldName = "Output Sample 1_Blood+";
1140+
String bloodMinusFieldInputFieldName = "Output Sample 1_Blood-";
1141+
setFormElement(Locator.name(nameFieldInputFieldName), childName);
1142+
setFormElement(Locator.name(bloodPlusFieldInputFieldName), "blood plus");
1143+
setFormElement(Locator.name(bloodMinusFieldInputFieldName), "blood minus");
11371144
clickButton("Submit");
11381145

11391146
log("Derive a sample from the one just created");
11401147
clickAndWait(Locator.linkContainingText("derive samples from this sample"));
11411148
clickButton("Next");
11421149
String grandchildName = childName + ".1";
1143-
setFormElement(Locator.name("outputSample1_Name"), grandchildName);
1150+
setFormElement(Locator.name(nameFieldInputFieldName), grandchildName);
11441151
clickButton("Submit");
11451152

11461153
log("Derive a sample with two parents");
@@ -1150,11 +1157,16 @@ public void testDeleteSamplesSomeWithDerivedSamples()
11501157
clickButton("Derive Samples");
11511158
waitAndClickAndWait(Locator.lkButton("Next"));
11521159
String twoParentChildName = parentSampleNames.get(1) + "+" + childName + ".1";
1153-
setFormElement(Locator.name("outputSample1_Name"), twoParentChildName);
1160+
setFormElement(Locator.name(nameFieldInputFieldName), twoParentChildName);
11541161
clickButton("Submit");
11551162

11561163
clickAndWait(Locator.linkContainingText(SAMPLE_TYPE_NAME));
11571164

1165+
// Issue 53306 - ensure that names differing only by special characters were captured correctly and are being
1166+
// shown in the grid
1167+
assertTextPresent("blood plus", "blood minus");
1168+
1169+
11581170
log("Try to delete parent sample");
11591171
drtSamples.checkCheckbox(drtSamples.getIndexWhereDataAppears(parentSampleNames.get(0), "Name"));
11601172
drtSamples.clickHeaderButton("Delete");

0 commit comments

Comments
 (0)