Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/org/labkey/test/tests/GpatAssayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.labkey.test.util.EscapeUtil;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.LoggedParam;
import org.labkey.test.util.RReportHelper;
import org.labkey.test.util.TestDataGenerator;
import org.labkey.test.util.core.webdav.WebDavUploadHelper;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -72,11 +73,13 @@ public class GpatAssayTest extends BaseWebDriverTest
private static final String ASSAY_NAME_FNA = "FASTA Assay";
private static final String ASSAY_NAME_FNA_MULTIPLE = "FASTA Assay - Multiple file upload";
private static final String ASSAY_NAME_FNA_MULTIPLE_SINGLE_INPUT = "FASTA Assay - Multiple file single input upload";
private static final File RTRANSFORM_SCRIPT_FILE_NOOP = TestFileUtils.getSampleData("qc/noopTransform.R");

@BeforeClass
public static void doSetup()
{
GpatAssayTest init = getCurrentTest();
new RReportHelper(init).ensureRConfig();
init._containerHelper.createProject(init.getProjectName(), "Assay");
init.goToProjectHome();
}
Expand Down Expand Up @@ -256,6 +259,14 @@ private void importFastaGpatAssay(File fnaFile, String assayName)
clickButton("Save and Finish", defaultWaitForPage);
}

// GitHub Issue #875: Optionally add transform scripts in GPAT assay design to test code path with and without transform script
private void randomlyAddTransformScript(ReactAssayDesignerPage assayDesignerPage)
{
boolean shouldAddTransformScript = TestDataGenerator.randomBoolean("whether to add transform script in assay design");
if (shouldAddTransformScript)
assayDesignerPage.addTransformScript(RTRANSFORM_SCRIPT_FILE_NOOP);
}

@LogMethod
private ReactAssayDesignerPage startCreateGpatAssay(File dataFile, @LoggedParam String assayName)
{
Expand All @@ -265,9 +276,9 @@ private ReactAssayDesignerPage startCreateGpatAssay(File dataFile, @LoggedParam
_fileBrowserHelper.importFile(dataFile.getName(), "Create New Standard Assay Design");

ReactAssayDesignerPage assayDesignerPage = new ReactAssayDesignerPage(getDriver());

if (assayName != null)
assayDesignerPage.setName(assayName);
randomlyAddTransformScript(assayDesignerPage);
return assayDesignerPage;
}

Expand Down
10 changes: 9 additions & 1 deletion src/org/labkey/test/util/TestDataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,15 @@ public String randomDateString(String dateFormat, Date min, Date max)

public static boolean randomBoolean()
{
return ThreadLocalRandom.current().nextBoolean();
return randomBoolean(null);
}

public static boolean randomBoolean(@Nullable String message)
{
boolean value = ThreadLocalRandom.current().nextBoolean();
if (message != null)
TestLogger.log("Generated random boolean value for %s: %s".formatted(message, value));
return value;
}

private @NotNull List<String> getFieldsForFile()
Expand Down