Skip to content

Commit 3f18250

Browse files
Issue 53306: Some LKS forms don't distinguish between fields properly (#2521)
1 parent dbcb9bf commit 3f18250

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+437
-391
lines changed

src/org/labkey/test/AssayAPITest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.labkey.remoteapi.assay.SaveProtocolCommand;
2828
import org.labkey.test.categories.Assays;
2929
import org.labkey.test.categories.Daily;
30+
import org.labkey.test.components.assay.AssayConstants;
3031
import org.labkey.test.pages.ReactAssayDesignerPage;
3132
import org.labkey.test.params.FieldDefinition;
3233
import org.labkey.test.util.APIAssayHelper;
@@ -111,7 +112,7 @@ protected void importAssayAndRun(File assayPath, int pipelineCount, String conta
111112
_uiAssayHelper.uploadXarFileAsAssayDesign(assayPath, pipelineCount, container);
112113

113114
APIAssayHelper _apiAssayHelper = new APIAssayHelper(this);
114-
_apiAssayHelper.importAssay(assayName, runPath, getProjectName(), Collections.singletonMap("ParticipantVisitResolver", "SampleInfo"));
115+
_apiAssayHelper.importAssay(assayName, runPath, getProjectName(), Collections.singletonMap(AssayConstants.PARTICIPANT_VISIT_RESOLVER_FIELD_NAME, "SampleInfo"));
115116

116117
log("verify import worked");
117118
goToProjectHome();

src/org/labkey/test/WebDriverWrapper.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,15 +2713,6 @@ public String getFormElement(WebElement el)
27132713
return el.getDomProperty("value");
27142714
}
27152715

2716-
/**
2717-
* @deprecated Use {@link org.junit.Assert#assertEquals(String, Object, Object) and {@link #getFormElement(Locator)}}
2718-
*/
2719-
@Deprecated
2720-
public void assertFormElementEquals(Locator loc, String value)
2721-
{
2722-
assertEquals(value, getFormElement(loc));
2723-
}
2724-
27252716
/**
27262717
* @deprecated Use {@link org.junit.Assert#assertEquals(String, Object, Object)} and
27272718
* {@link #getSelectedOptionText(Locator)}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.labkey.test.components.assay;
2+
3+
import org.labkey.test.Locator;
4+
5+
public class AssayConstants
6+
{
7+
public static final String PARTICIPANT_VISIT_RESOLVER_FIELD_NAME = "ParticipantVisitResolver";
8+
public static final String THAW_LIST_TYPE_FIELD_NAME = "ThawListType";
9+
public static final String TARGET_STUDY_FIELD_NAME = "TargetStudy";
10+
11+
public static final Locator ASSAY_NAME_FIELD_LOCATOR = Locator.name("Name");
12+
public static final Locator COMMENTS_FIELD_LOCATOR = Locator.name("Comments");
13+
public static final Locator TARGET_STUDY_FIELD_LOCATOR = Locator.name(TARGET_STUDY_FIELD_NAME);
14+
public static final Locator TEXT_AREA_DATA_PROVIDER_LOCATOR = Locator.xpath("//input[@value='textAreaDataProvider']");
15+
public static final Locator TEXT_AREA_DATA_COLLECTOR_LOCATOR = Locator.textarea("TextAreaDataCollector.textArea");
16+
}

src/org/labkey/test/pages/issues/BaseUpdatePage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ protected class ElementCache extends BaseIssuePage.ElementCache
110110
{
111111
protected ElementCache()
112112
{
113-
assignedTo = getSelect("assignedTo");
114-
priority = getSelect("priority");
113+
assignedTo = getSelect("AssignedTo");
114+
priority = getSelect("Priority");
115115
related = getInput("related");
116116
notifyList = getInput("notifyList");
117117
}

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/AssayExportImportTest.java

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.labkey.test.TestFileUtils;
3939
import org.labkey.test.TestTimeoutException;
4040
import org.labkey.test.categories.Daily;
41+
import org.labkey.test.components.assay.AssayConstants;
4142
import org.labkey.test.components.ext4.Checkbox;
4243
import org.labkey.test.pages.ReactAssayDesignerPage;
4344
import org.labkey.test.pages.admin.ExportFolderPage;
@@ -68,6 +69,10 @@
6869
@BaseWebDriverTest.ClassTimeout(minutes = 10)
6970
public class AssayExportImportTest extends BaseWebDriverTest
7071
{
72+
public static final String INSTRUMENT_SETTING_FIELD_NAME = "instrumentSetting";
73+
public static final String RUN_FILE_FIELD_NAME = "runFileField";
74+
public static final String OPERATOR_EMAIL_FIELD_NAME = "operatorEmail";
75+
public static final String INSTRUMENT_FIELD_NAME = "instrument";
7176
private final String ASSAY_PROJECT_FOR_EXPORT_01 = "Assay_Project_For_Export_ByFilesWebPart";
7277
private final String ASSAY_PROJECT_FOR_IMPORT_01 = "Assay_Project_For_Import_ByFilesWebPart";
7378
private final String ASSAY_PROJECT_FOR_EXPORT_02 = "Assay_Project_For_Export_ByFile";
@@ -170,16 +175,16 @@ private Integer createSimpleProjectAndAssay(String projectName, String assayName
170175
protocol.getDomains().forEach(domain -> domains.put(domain.getName(), domain));
171176

172177
Domain batchDomain = domains.get("Batch Fields");
173-
batchDomain.getFields().add(new FieldDefinition("operatorEmail", ColumnType.String));
174-
batchDomain.getFields().add(new FieldDefinition("instrument", ColumnType.String)
178+
batchDomain.getFields().add(new FieldDefinition(OPERATOR_EMAIL_FIELD_NAME, ColumnType.String));
179+
batchDomain.getFields().add(new FieldDefinition(INSTRUMENT_FIELD_NAME, ColumnType.String)
175180
.setDescription("The diagnostic test instrument."));
176181

177182
Domain runDomain = domains.get("Run Fields");
178183
List<PropertyDescriptor> runFields = runDomain.getFields();
179-
runFields.add(new FieldDefinition("instrumentSetting", ColumnType.Integer)
184+
runFields.add(new FieldDefinition(INSTRUMENT_SETTING_FIELD_NAME, ColumnType.Integer)
180185
.setDescription("The configuration setting on the instrument."));
181186
if (hasRunFileField)
182-
runFields.add(new FieldDefinition("runFileField", ColumnType.File)
187+
runFields.add(new FieldDefinition(RUN_FILE_FIELD_NAME, ColumnType.File)
183188
.setDescription("File for the run."));
184189
domains.get("Run Fields").setFields(runFields);
185190

@@ -236,7 +241,7 @@ public void populateAssay(String projectName, String assayName, boolean useFiles
236241
clickAndWait(Locator.lkButton("Import Data"));
237242
}
238243

239-
waitForElement(Locator.tagWithName("select", "targetStudy"));
244+
waitForElement(AssayConstants.TARGET_STUDY_FIELD_LOCATOR);
240245

241246
if(null != batchProperties)
242247
{
@@ -267,7 +272,7 @@ public void populateAssay(String projectName, String assayName, boolean useFiles
267272
if (fileIndex < runProperties.size())
268273
{
269274
clickAndWait(Locator.lkButton("Save and Import Another Run"));
270-
waitForElement(Locator.tagWithName("input", "instrumentSetting"));
275+
waitForElement(Locator.tagWithName("input", INSTRUMENT_SETTING_FIELD_NAME));
271276
}
272277

273278
}
@@ -276,7 +281,7 @@ public void populateAssay(String projectName, String assayName, boolean useFiles
276281
if (isElementPresent(Locator.lkButton("Save and Import Another Run")))
277282
{
278283
clickAndWait(Locator.lkButton("Save and Import Another Run"));
279-
waitForElement(Locator.tagWithName("input", "instrumentSetting"));
284+
waitForElement(Locator.tagWithName("input", INSTRUMENT_SETTING_FIELD_NAME));
280285
}
281286
}
282287

@@ -383,14 +388,14 @@ public void validateImportingFileUsingFilesWebPart() throws Exception
383388
RUN04_FILE);
384389

385390
Map<String, String> batchProperties = new HashMap<>();
386-
batchProperties.put("operatorEmail", OPERATOR_EMAIL_01);
387-
batchProperties.put("instrument", INSTRUMENT_NAME_01);
391+
batchProperties.put(OPERATOR_EMAIL_FIELD_NAME, OPERATOR_EMAIL_01);
392+
batchProperties.put(INSTRUMENT_FIELD_NAME, INSTRUMENT_NAME_01);
388393

389394
List<Map<String, String>> runProperties = new ArrayList<>();
390-
runProperties.add(Maps.of("name", RUN01_NAME, "comments", COMMENT_BASIC_01 + RUN01_NAME, "instrumentSetting", INSTRUMENT_SETTING_01));
391-
runProperties.add(Maps.of("name", RUN02_NAME, "comments", COMMENT_BASIC_01 + RUN02_NAME, "instrumentSetting", INSTRUMENT_SETTING_01));
392-
runProperties.add(Maps.of("name", RUN03_NAME, "comments", COMMENT_BASIC_01 + RUN03_NAME, "instrumentSetting", INSTRUMENT_SETTING_01));
393-
runProperties.add(Maps.of("name", RUN04_NAME, "comments", COMMENT_BASIC_01 + RUN04_NAME, "instrumentSetting", INSTRUMENT_SETTING_01));
395+
runProperties.add(Maps.of("Name", RUN01_NAME, "Comments", COMMENT_BASIC_01 + RUN01_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_01));
396+
runProperties.add(Maps.of("Name", RUN02_NAME, "Comments", COMMENT_BASIC_01 + RUN02_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_01));
397+
runProperties.add(Maps.of("Name", RUN03_NAME, "Comments", COMMENT_BASIC_01 + RUN03_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_01));
398+
runProperties.add(Maps.of("Name", RUN04_NAME, "Comments", COMMENT_BASIC_01 + RUN04_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_01));
394399

395400
log("Populate the assay '" + SIMPLE_ASSAY_FOR_EXPORT + "' by using files in the Files WebPart.");
396401
populateAssay(ASSAY_PROJECT_FOR_EXPORT_01, SIMPLE_ASSAY_FOR_EXPORT, true, runFiles, batchProperties, runProperties, SAMPLE_TXT_FILE);
@@ -478,14 +483,14 @@ public void validateImportingFileUsingRunProperties() throws Exception
478483
RUN04_FILE);
479484

480485
Map<String, String> batchProperties = new HashMap<>();
481-
batchProperties.put("operatorEmail", OPERATOR_EMAIL_02);
482-
batchProperties.put("instrument", INSTRUMENT_NAME_02);
486+
batchProperties.put(OPERATOR_EMAIL_FIELD_NAME, OPERATOR_EMAIL_02);
487+
batchProperties.put(INSTRUMENT_FIELD_NAME, INSTRUMENT_NAME_02);
483488

484489
List<Map<String, String>> runProperties = new ArrayList<>();
485-
runProperties.add(Maps.of("name", RUN01_NAME, "comments", COMMENT_BASIC_02 + RUN01_NAME, "instrumentSetting", INSTRUMENT_SETTING_02));
486-
runProperties.add(Maps.of("name", RUN02_NAME, "comments", COMMENT_BASIC_02 + RUN02_NAME, "instrumentSetting", INSTRUMENT_SETTING_02));
487-
runProperties.add(Maps.of("name", RUN03_NAME, "comments", COMMENT_BASIC_02 + RUN03_NAME, "instrumentSetting", INSTRUMENT_SETTING_02));
488-
runProperties.add(Maps.of("name", RUN04_NAME, "comments", COMMENT_BASIC_02 + RUN04_NAME, "instrumentSetting", INSTRUMENT_SETTING_02));
490+
runProperties.add(Maps.of("Name", RUN01_NAME, "Comments", COMMENT_BASIC_02 + RUN01_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_02));
491+
runProperties.add(Maps.of("Name", RUN02_NAME, "Comments", COMMENT_BASIC_02 + RUN02_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_02));
492+
runProperties.add(Maps.of("Name", RUN03_NAME, "Comments", COMMENT_BASIC_02 + RUN03_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_02));
493+
runProperties.add(Maps.of("Name", RUN04_NAME, "Comments", COMMENT_BASIC_02 + RUN04_NAME, INSTRUMENT_SETTING_FIELD_NAME, INSTRUMENT_SETTING_02));
489494

490495
log("Populate the assay '" + SIMPLE_ASSAY_FOR_EXPORT + "' by importing the file through the 'Run Properties'.");
491496
populateAssay(ASSAY_PROJECT_FOR_EXPORT_02, SIMPLE_ASSAY_FOR_EXPORT, false, runFiles, batchProperties, runProperties, null);
@@ -583,8 +588,8 @@ private void createGeneralAssayWithoutTransform(String assayName)
583588
ReactAssayDesignerPage assayDesignerPage = _assayHelper.createAssayDesign("General", assayName);
584589

585590
log("Remove the batch fields we don't care about.");
586-
assayDesignerPage.goToBatchFields().removeField("ParticipantVisitResolver")
587-
.removeField("TargetStudy");
591+
assayDesignerPage.goToBatchFields().removeField(AssayConstants.PARTICIPANT_VISIT_RESOLVER_FIELD_NAME)
592+
.removeField(AssayConstants.TARGET_STUDY_FIELD_NAME);
588593

589594
assayDesignerPage.goToResultsFields()
590595
.removeAllFields(false)
@@ -665,25 +670,25 @@ public void testExportXarToPipeline() throws Exception
665670
ImportRunCommand run1 = new ImportRunCommand(assayId, RUN01_FILE);
666671
run1.setName(RUN01_NAME);
667672
run1.setComment(commentPrefix + RUN01_NAME);
668-
run1.setProperties(Maps.of("instrumentSetting", instrumentSetting));
673+
run1.setProperties(Maps.of(INSTRUMENT_SETTING_FIELD_NAME, instrumentSetting));
669674
run1.execute(cn, exportProject);
670675

671676
ImportRunCommand run2 = new ImportRunCommand(assayId, RUN02_FILE);
672677
run2.setName(RUN02_NAME);
673678
run2.setComment(commentPrefix + RUN02_NAME);
674-
run2.setProperties(Maps.of("instrumentSetting", instrumentSetting));
679+
run2.setProperties(Maps.of(INSTRUMENT_SETTING_FIELD_NAME, instrumentSetting));
675680
run2.execute(cn, exportProject);
676681

677682
ImportRunCommand run3 = new ImportRunCommand(assayId, RUN03_FILE);
678683
run3.setName(RUN03_NAME);
679684
run3.setComment(commentPrefix + RUN03_NAME);
680-
run3.setProperties(Maps.of("instrumentSetting", instrumentSetting));
685+
run3.setProperties(Maps.of(INSTRUMENT_SETTING_FIELD_NAME, instrumentSetting));
681686
run3.execute(cn, exportProject);
682687

683688
ImportRunCommand run4 = new ImportRunCommand(assayId, RUN04_XLSX_FILE);
684689
run4.setName(RUN04_NAME);
685690
run4.setComment(commentPrefix + RUN04_NAME);
686-
run4.setProperties(Maps.of("instrumentSetting", instrumentSetting));
691+
run4.setProperties(Maps.of(INSTRUMENT_SETTING_FIELD_NAME, instrumentSetting));
687692
run4.execute(cn, exportProject);
688693

689694
List<String> runColumns = Arrays.asList("adjustedM1", "M2");

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.labkey.test.BaseWebDriverTest;
2121
import org.labkey.test.Locator;
2222
import org.labkey.test.categories.Daily;
23+
import org.labkey.test.components.assay.AssayConstants;
2324
import org.labkey.test.util.DataRegionTable;
2425

2526
import java.util.Arrays;
@@ -110,7 +111,7 @@ public void setupDataset() throws Exception
110111
DataRegionTable assayResults = new DataRegionTable(super.getDataRegionId(), this);
111112
assayResults.checkAllOnPage();
112113
clickButton("Link to Study");
113-
selectOptionByText(Locator.name("targetStudy"), "/" + getProjectName() + "/" + getFolderName() + " (" + getFolderName() + " Study)");
114+
selectOptionByText(AssayConstants.TARGET_STUDY_FIELD_LOCATOR, "/" + getProjectName() + "/" + getFolderName() + " (" + getFolderName() + " Study)");
114115
clickButton("Next");
115116
clickButton("Link to Study");
116117
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.labkey.test.WebTestHelper;
1313
import org.labkey.test.categories.Daily;
1414
import org.labkey.test.components.DomainDesignerPage;
15+
import org.labkey.test.components.assay.AssayConstants;
1516
import org.labkey.test.components.domain.DomainFormPanel;
1617
import org.labkey.test.pages.ReactAssayDesignerPage;
1718
import org.labkey.test.pages.query.UpdateQueryRowPage;
@@ -178,7 +179,7 @@ public void testNonProvisionedDomainFieldChanges()
178179
checkCheckbox(Locator.name("batchTestBoolean"));
179180
clickButton("Next");
180181

181-
setFormElement(Locator.name("name"), runName);
182+
setFormElement(AssayConstants.ASSAY_NAME_FIELD_LOCATOR, runName);
182183
setFormElement(Locator.name("runTestInteger"), "12");
183184
setFormElement(Locator.name("runTestDecimal"), "1.12");
184185
setFormElement(Locator.name("runTestDate"), "01-03-2022");

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.labkey.test.TestFileUtils;
3030
import org.labkey.test.TestTimeoutException;
3131
import org.labkey.test.categories.Daily;
32+
import org.labkey.test.components.assay.AssayConstants;
3233
import org.labkey.test.pages.admin.FolderManagementPage;
3334
import org.labkey.test.pages.assay.AssayRunsPage;
3435
import org.labkey.test.pages.files.FileContentPage;
@@ -282,7 +283,7 @@ public void testAssayFileFieldsUI() throws Exception
282283
clickButton("Next"); // batch properties
283284

284285
// run properties
285-
setFormElement(Locator.input("name"), runName);
286+
setFormElement(AssayConstants.ASSAY_NAME_FIELD_LOCATOR, runName);
286287
setFormElement(Locator.input(RUN_TXT_COL), "run text");
287288
setFormElement(Locator.input(RUN_FILE_COL), runFileFieldFile);
288289
checkRadioButton(Locator.inputById("Fileupload"));

0 commit comments

Comments
 (0)