Skip to content

Commit 5bb98d8

Browse files
authored
GitHub Issue 875: Standard Assay Multi-File Transform Import Skips First Data Row (#2896)
- GpatAssayTest to randomlyAddTransformScript for testing GitHub Issue 875
1 parent a522ef9 commit 5bb98d8

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.labkey.test.util.EscapeUtil;
4242
import org.labkey.test.util.LogMethod;
4343
import org.labkey.test.util.LoggedParam;
44+
import org.labkey.test.util.RReportHelper;
4445
import org.labkey.test.util.TestDataGenerator;
4546
import org.labkey.test.util.core.webdav.WebDavUploadHelper;
4647
import org.openqa.selenium.WebElement;
@@ -72,11 +73,13 @@ public class GpatAssayTest extends BaseWebDriverTest
7273
private static final String ASSAY_NAME_FNA = "FASTA Assay";
7374
private static final String ASSAY_NAME_FNA_MULTIPLE = "FASTA Assay - Multiple file upload";
7475
private static final String ASSAY_NAME_FNA_MULTIPLE_SINGLE_INPUT = "FASTA Assay - Multiple file single input upload";
76+
private static final File RTRANSFORM_SCRIPT_FILE_NOOP = TestFileUtils.getSampleData("qc/noopTransform.R");
7577

7678
@BeforeClass
7779
public static void doSetup()
7880
{
7981
GpatAssayTest init = getCurrentTest();
82+
new RReportHelper(init).ensureRConfig();
8083
init._containerHelper.createProject(init.getProjectName(), "Assay");
8184
init.goToProjectHome();
8285
}
@@ -256,6 +259,14 @@ private void importFastaGpatAssay(File fnaFile, String assayName)
256259
clickButton("Save and Finish", defaultWaitForPage);
257260
}
258261

262+
// GitHub Issue #875: Optionally add transform scripts in GPAT assay design to test code path with and without transform script
263+
private void randomlyAddTransformScript(ReactAssayDesignerPage assayDesignerPage)
264+
{
265+
boolean shouldAddTransformScript = TestDataGenerator.randomBoolean("whether to add transform script in assay design");
266+
if (shouldAddTransformScript)
267+
assayDesignerPage.addTransformScript(RTRANSFORM_SCRIPT_FILE_NOOP);
268+
}
269+
259270
@LogMethod
260271
private ReactAssayDesignerPage startCreateGpatAssay(File dataFile, @LoggedParam String assayName)
261272
{
@@ -265,9 +276,9 @@ private ReactAssayDesignerPage startCreateGpatAssay(File dataFile, @LoggedParam
265276
_fileBrowserHelper.importFile(dataFile.getName(), "Create New Standard Assay Design");
266277

267278
ReactAssayDesignerPage assayDesignerPage = new ReactAssayDesignerPage(getDriver());
268-
269279
if (assayName != null)
270280
assayDesignerPage.setName(assayName);
281+
randomlyAddTransformScript(assayDesignerPage);
271282
return assayDesignerPage;
272283
}
273284

src/org/labkey/test/util/TestDataGenerator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,15 @@ public String randomDateString(String dateFormat, Date min, Date max)
799799

800800
public static boolean randomBoolean()
801801
{
802-
return ThreadLocalRandom.current().nextBoolean();
802+
return randomBoolean(null);
803+
}
804+
805+
public static boolean randomBoolean(@Nullable String message)
806+
{
807+
boolean value = ThreadLocalRandom.current().nextBoolean();
808+
if (message != null)
809+
TestLogger.log("Generated random boolean value for %s: %s".formatted(message, value));
810+
return value;
803811
}
804812

805813
private @NotNull List<String> getFieldsForFile()

0 commit comments

Comments
 (0)