Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
145f646
new FieldInfo(TestDataGenerator.randomFieldName() -> FieldInfo.random()
cnathe Jul 10, 2025
4e407bb
TestDataGenerator randomString support for REPEAT_PLACEHOLDER to add …
cnathe Jul 10, 2025
81af952
TestDataGenerator randomString support for ALL_CHARS_PLACEHOLDER to a…
cnathe Jul 10, 2025
3c29c4f
DataClassAPIHelper.dataClassTestFields update to use FieldInfo.random()
cnathe Jul 10, 2025
958367d
Merge branch 'develop' into fb_testDataGen258
cnathe Jul 15, 2025
a33701e
CrossFolderListTest to use FieldInfo.random()
cnathe Jul 15, 2025
e267d72
SampleTypeTest to use FieldInfo.random()
cnathe Jul 15, 2025
8ae1657
Merge branch 'develop' into fb_testDataGen258
cnathe Jul 15, 2025
298ce40
Merge branch 'develop' into fb_testDataGen258
cnathe Jul 16, 2025
d8c9e43
PropertyController.ValidateDomainFieldsAction and usage in TestDataGe…
cnathe Jul 16, 2025
c5865f2
TestDataGenerator.randomFieldName to take DomainKind (defaults to Sam…
cnathe Jul 16, 2025
5a534c3
Merge branch 'develop' into fb_testDataGen258
cnathe Jul 17, 2025
d6bda85
Update PropertyController.ValidateDomainAndFieldNamesAction to also v…
cnathe Jul 17, 2025
6fa8287
Update usages of randomDomainName to pass DomainKind
cnathe Jul 17, 2025
db34bee
TestDataGenerator randomFieldName and randomDomainName to use getNumC…
cnathe Jul 17, 2025
330cf04
Set DomainKind in usages of TestDataGenerator.randomDomainName()
cnathe Jul 17, 2025
4cbc2fb
CustomizeView to scroll into view the tree expand icon before clicking
cnathe Jul 17, 2025
e395e6e
text update for change to sample type duplicate name error message
cnathe Jul 17, 2025
afb22ba
SampleTypeHelper.convertMapToTsv to use TestDataUtils.tsvStringFromRo…
cnathe Jul 17, 2025
72852c8
BiologicsReportTest fix for which non-ASCII chars are replaced with #…
cnathe Jul 18, 2025
9b0ad44
FieldDefinition.labelFromName multiple spaces in the UI are collapsed…
cnathe Jul 18, 2025
5186bcf
reset the min/max randomInt values for domain and field name generato…
cnathe Jul 18, 2025
7f24adc
missed from last commit
cnathe Jul 18, 2025
3aa5baf
Merge branch 'develop' into fb_testDataGen258
cnathe Jul 18, 2025
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
4 changes: 3 additions & 1 deletion src/org/labkey/test/components/CustomizeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ private WebElement expandPivots(CharSequence fieldKey)
_driver.scrollIntoView(fieldRow, false);
if (!StringUtils.trimToEmpty(fieldRow.getAttribute("class")).contains("expanded"))
{
Locator.css(".x4-tree-expander").findElement(fieldRow).click();
WebElement expander = Locator.css(".x4-tree-expander").findElement(fieldRow);
_driver.scrollIntoView(expander, true);
expander.click();
}
Locator.tag("tr").withClass("x4-grid-tree-node-expanded").withAttribute("data-recordid", dataRecordId).waitForElement(getComponentElement(), 10000);
WebDriverWrapper.waitFor(() -> Locator.css("tr[data-recordid] + tr:not(.x4-grid-row)").findElements(getComponentElement()).isEmpty(), 2000); // Spacer row appears during expansion animation
Expand Down
3 changes: 2 additions & 1 deletion src/org/labkey/test/params/FieldDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ else if (Character.isUpperCase(c) && Character.isLowerCase(chars[i - 1]))
}
}

return buf.toString();
// Multiple spaces in the UI are collapsed into a single space
return buf.toString().replaceAll("\\s+", " ");
}

public String getEffectiveLabel()
Expand Down
13 changes: 11 additions & 2 deletions src/org/labkey/test/params/FieldInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.labkey.test.params.FieldDefinition.ColumnType;
import org.labkey.test.util.DomainUtils;
import org.labkey.test.util.EscapeUtil;
import org.labkey.test.util.TestDataGenerator;

Expand Down Expand Up @@ -53,13 +54,21 @@ public FieldInfo(String name)
/**
* Creates a FieldInfo with a semi-random name
*/
public static FieldInfo random(String namePart, ColumnType columnType)
public static FieldInfo random(String namePart, ColumnType columnType, DomainUtils.DomainKind domainKind)
{
FieldInfo field = new FieldInfo(TestDataGenerator.randomFieldName(namePart), columnType);
FieldInfo field = new FieldInfo(TestDataGenerator.randomFieldName(namePart, null, domainKind), columnType);
field.setNamePart(namePart);
return field;
}

/**
* Creates a FieldInfo with a semi-random name
*/
public static FieldInfo random(String namePart, ColumnType columnType)
{
return random(namePart, columnType, null);
}

/**
* Creates a String field with a semi-random name
*/
Expand Down
10 changes: 10 additions & 0 deletions src/org/labkey/test/params/experiment/DataClassDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,14 @@ public TestDataGenerator getTestDataGenerator(String containerPath)
{
return super.getTestDataGenerator(containerPath).withColumns(List.of(new FieldDefinition("Name", FieldDefinition.ColumnType.String)));
}

public FieldDefinition getFieldByNamePart(String namePart)
{
for (FieldDefinition field : getFields())
{
if (field.isNamePartMatch(namePart))
return field;
}
throw new IllegalArgumentException("No field found with name part: " + namePart);
}
}
29 changes: 14 additions & 15 deletions src/org/labkey/test/params/list/ListDefinition.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package org.labkey.test.params.list;

import org.jetbrains.annotations.NotNull;
import org.labkey.remoteapi.CommandException;
import org.labkey.remoteapi.Connection;
import org.labkey.remoteapi.domain.Domain;
import org.labkey.remoteapi.domain.InferDomainCommand;
import org.labkey.remoteapi.domain.PropertyDescriptor;
import org.labkey.test.params.FieldDefinition;
import org.labkey.test.params.property.DomainProps;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -19,7 +15,7 @@ public abstract class ListDefinition extends DomainProps
{
private String _name;
private String _description;
private List<PropertyDescriptor> _fields = new ArrayList<>();
private List<FieldDefinition> _fields = new ArrayList<>();
private String _keyName;
// API Options
private String _titleColumn;
Expand Down Expand Up @@ -67,7 +63,7 @@ public List<PropertyDescriptor> getFields()
return new ArrayList<>(_fields); // return a copy
}

public ListDefinition setFields(List<? extends PropertyDescriptor> fields)
public ListDefinition setFields(List<FieldDefinition> fields)
{
if (!fields.isEmpty() && getKeyName() == null)
{
Expand All @@ -78,14 +74,7 @@ public ListDefinition setFields(List<? extends PropertyDescriptor> fields)
return this;
}

public ListDefinition inferFields(File dataFile, Connection connection) throws IOException, CommandException
{
return setFields(new InferDomainCommand(dataFile, getKind())
.execute(connection, "/")
.getFields());
}

public ListDefinition addField(@NotNull PropertyDescriptor field)
public ListDefinition addField(@NotNull FieldDefinition field)
{
if (getKeyName() == null)
{
Expand Down Expand Up @@ -157,4 +146,14 @@ protected Map<String, Object> getOptions()
}

protected abstract String getKeyType();

public FieldDefinition getFieldByNamePart(String namePart)
{
for (FieldDefinition field : _fields)
{
if (field.isNamePartMatch(namePart))
return field;
}
throw new IllegalArgumentException("No field found with name part: " + namePart);
}
}
16 changes: 10 additions & 6 deletions src/org/labkey/test/tests/DataClassFolderExportImportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,18 @@ public void testExportImportSimpleDataClass() throws Exception
_containerHelper.createSubfolder(getProjectName(), subfolder);

DataClassDefinition testType = new DataClassDefinition(testDataClass).setFields(DataClassAPIHelper.dataClassTestFields());
String intColumnName = testType.getFieldByNamePart("intColumn").getName();
String decimalColumnName = testType.getFieldByNamePart("decimalColumn").getName();
String stringColumnName = testType.getFieldByNamePart("stringColumn").getName();
String attachmentColumnName = testType.getFieldByNamePart("attachmentColumn").getName();

TestDataGenerator testDgen = DataClassAPIHelper.createEmptyDataClass(subfolderPath, testType);

testDgen.addCustomRow(Map.of("Name", "class1", "intColumn", 7771, "decimalColumn", 1.1, "stringColumn", "one"));
testDgen.addCustomRow(Map.of("Name", "class2", "intColumn", 7772, "decimalColumn", 2.2, "stringColumn", "two"));
testDgen.addCustomRow(Map.of("Name", "class3", "intColumn", 7773, "decimalColumn", 3.3, "stringColumn", "three"));
testDgen.addCustomRow(Map.of("Name", "class4", "intColumn", 7774, "decimalColumn", 4.4, "stringColumn", "four"));
testDgen.addCustomRow(Map.of("Name", "class5", "intColumn", 7775, "decimalColumn", 5.5, "stringColumn", "five"));
testDgen.addCustomRow(Map.of("Name", "class1", intColumnName, 7771, decimalColumnName, 1.1, stringColumnName, "one"));
testDgen.addCustomRow(Map.of("Name", "class2", intColumnName, 7772, decimalColumnName, 2.2, stringColumnName, "two"));
testDgen.addCustomRow(Map.of("Name", "class3", intColumnName, 7773, decimalColumnName, 3.3, stringColumnName, "three"));
testDgen.addCustomRow(Map.of("Name", "class4", intColumnName, 7774, decimalColumnName, 4.4, stringColumnName, "four"));
testDgen.addCustomRow(Map.of("Name", "class5", intColumnName, 7775, decimalColumnName, 5.5, stringColumnName, "five"));
testDgen.insertRows();

PortalHelper portalHelper = new PortalHelper(this);
Expand All @@ -125,7 +129,7 @@ public void testExportImportSimpleDataClass() throws Exception
// issue https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=42191 tracks this
// until it is fixed we will have to add attachments via the UI, like this
sourceTable.clickEditRow(i);
setFormElement(Locator.input("quf_attachmentColumn"), _attachments.get(i));
setFormElement(Locator.input("quf_" + attachmentColumnName), _attachments.get(i));
clickButton("Submit");
}
List<Map<String, String>> sourceRowData = sourceTable.getTableData();
Expand Down
13 changes: 7 additions & 6 deletions src/org/labkey/test/tests/DomainFieldTypeChangeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.labkey.test.params.FieldInfo;
import org.labkey.test.util.APIAssayHelper;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.DomainUtils;
import org.labkey.test.util.PortalHelper;
import org.labkey.test.util.TestDataGenerator;

Expand Down Expand Up @@ -63,19 +64,19 @@ public void testProvisionedDomainFieldChanges() throws IOException, CommandExcep
{
log("Creating list with variety of data fields");
String listName = TestDataGenerator.randomDomainName("SampleListWithAllDataTypes");
FieldInfo stringField = new FieldInfo(TestDataGenerator.randomFieldName("name"), FieldDefinition.ColumnType.String);
FieldInfo integerField = new FieldInfo(TestDataGenerator.randomFieldName("Test/Integer"), FieldDefinition.ColumnType.Integer);
FieldInfo decimalField = new FieldInfo(TestDataGenerator.randomFieldName("Test/Decimal"), FieldDefinition.ColumnType.Decimal);
FieldInfo dateField = new FieldInfo(TestDataGenerator.randomFieldName("Test/Date"), FieldDefinition.ColumnType.DateAndTime);
FieldInfo booleanField = new FieldInfo(TestDataGenerator.randomFieldName("Test'/\"Boolean"), FieldDefinition.ColumnType.Boolean); // GH Issue #755
FieldInfo stringField = FieldInfo.random("name", FieldDefinition.ColumnType.String, DomainUtils.DomainKind.IntList);
FieldInfo integerField = FieldInfo.random("Test/Integer", FieldDefinition.ColumnType.Integer, DomainUtils.DomainKind.IntList);
FieldInfo decimalField = FieldInfo.random("Test/Decimal", FieldDefinition.ColumnType.Decimal, DomainUtils.DomainKind.IntList);
FieldInfo dateField = FieldInfo.random("Test/Date", FieldDefinition.ColumnType.DateAndTime, DomainUtils.DomainKind.IntList);
FieldInfo booleanField = FieldInfo.random("Test'/\"Boolean", FieldDefinition.ColumnType.Boolean, DomainUtils.DomainKind.IntList); // GH Issue #755
TestDataGenerator dgen = new TestDataGenerator("lists", listName, getProjectName())
.withColumns(List.of(
stringField.getFieldDefinition(),
integerField.getFieldDefinition(),
decimalField.getFieldDefinition(),
dateField.getFieldDefinition(),
booleanField.getFieldDefinition()));
dgen.createDomain(createDefaultConnection(), "IntList", Map.of("keyName", "id"));
dgen.createDomain(createDefaultConnection(), DomainUtils.DomainKind.IntList.name(), Map.of("keyName", "id"));

log("Inserting sample rows in the list");
dgen.addCustomRow(Map.of(
Expand Down
4 changes: 2 additions & 2 deletions src/org/labkey/test/tests/ExportOptionsMetadataOnlyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public void testDataClassExportOptions() throws IOException, CommandException

DataClassDefinition testType = new DataClassDefinition(dataClassName).setFields(DataClassAPIHelper.dataClassTestFields());
TestDataGenerator testDgen = DataClassAPIHelper.createEmptyDataClass(getProjectName(), testType);
testDgen.addCustomRow(Map.of("Name", "class1", "intColumn", 1, "decimalColumn", 1.1, "stringColumn", "one"));
testDgen.addCustomRow(Map.of("Name", "class2", "intColumn", 2, "decimalColumn", 2.2, "stringColumn", "two"));
testDgen.addCustomRow(Map.of("Name", "class1"));
testDgen.addCustomRow(Map.of("Name", "class2"));
Comment on lines +70 to +71
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just cleaning up data that adds no value to the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, these other columns like "intColumn" are now randomly generated names so when I went to update them in the data rows I noticed that the values aren't checked anywhere so it seemed cleaner to just remove the related data row values.

testDgen.insertRows();

log("Export data class design only");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ public void testExportImportDerivedSamples() throws Exception
.addParentAlias("SelfParent"); // to derive from samles in the current type

TestDataGenerator dataClassDgen = DataClassAPIHelper.createEmptyDataClass(subfolderPath, dataClassType);
dataClassDgen.addCustomRow(Map.of("Name", "data1", "intColumn", 1, "stringColumn", "one"));
dataClassDgen.addCustomRow(Map.of("Name", "data2", "intColumn", 2, "stringColumn", "two"));
dataClassDgen.addCustomRow(Map.of("Name", "data3", "intColumn", 3, "stringColumn", "three"));
dataClassDgen.addCustomRow(Map.of("Name", "data1"));
dataClassDgen.addCustomRow(Map.of("Name", "data2"));
dataClassDgen.addCustomRow(Map.of("Name", "data3"));
dataClassDgen.insertRows();

TestDataGenerator parentDgen = SampleTypeAPIHelper.createEmptySampleType(subfolderPath, parentType);
Expand Down
Loading