Skip to content

Commit 1758e68

Browse files
Merge branch 'develop' into fb_smFolderArchives
2 parents 7911108 + f0fcd7c commit 1758e68

33 files changed

Lines changed: 1026 additions & 214 deletions

modules/simpletest/resources/scripts/validationTest/simpleQueryTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var testFunctions = [
3737

3838
function() //testResults[1]
3939
{
40-
testResults[testResults.length] = LABKEY.Query.selectRows({schemaName:schemaName, queryName:queryName, sort: "-Date", filterArray: filters});
40+
testResults[testResults.length] = LABKEY.Query.selectRows({schemaName:schemaName, queryName:queryName, sort: "-Created", filterArray: filters});
4141
executeNext();
4242
},
4343

@@ -49,7 +49,7 @@ var testFunctions = [
4949

5050
function() //testResults[3]
5151
{
52-
testResults[testResults.length] = LABKEY.Query.executeSql({schemaName: schemaName, sort: "Date", sql: "select Date from UserAuditEvent"});
52+
testResults[testResults.length] = LABKEY.Query.executeSql({schemaName: schemaName, sort: "Created", sql: "select Created from UserAuditEvent"});
5353
executeNext();
5454
},
5555

src/org/labkey/test/AssayAPITest.java

Lines changed: 128 additions & 23 deletions
Large diffs are not rendered by default.

src/org/labkey/test/BaseWebDriverTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import org.labkey.test.pages.query.NewQueryPage;
6565
import org.labkey.test.pages.query.SourceQueryPage;
6666
import org.labkey.test.pages.search.SearchResultsPage;
67+
import org.labkey.test.params.ContainerInfo;
6768
import org.labkey.test.params.FieldDefinition;
6869
import org.labkey.test.params.FieldKey;
6970
import org.labkey.test.teamcity.TeamCityUtils;
@@ -224,7 +225,7 @@ public abstract class BaseWebDriverTest extends LabKeySiteWrapper implements Cle
224225

225226
public static final String TRICKY_CHARACTERS = "><&/%\\' \"1\u00E4\u00F6\u00FC\u00C5";
226227
public static final String TRICKY_CHARACTERS_NO_QUOTES = "></% 1\u00E4\u00F6\u00FC\u00C5";
227-
public static final String TRICKY_CHARACTERS_FOR_PROJECT_NAMES = "\u2603~!@$&()_+{}-=[],.#\u00E4\u00F6\u00FC\u00C5"; // No slash or space
228+
public static final String TRICKY_CHARACTERS_FOR_PROJECT_NAMES = ContainerInfo.TRICKY_CHARACTERS;
228229
public static final String LONG_NON_ASCII_STRING = StringUtils.repeat(FieldDefinition.SNOWMAN, 22); // "☃" See Issue 52714
229230
public static final String INJECT_CHARS_1 = Crawler.injectScriptBlock;
230231
public static final String INJECT_CHARS_2 = Crawler.injectAttributeScript;
@@ -1904,7 +1905,7 @@ public void setPipelineRoot(String rootPath, boolean inherit)
19041905
{
19051906
_setPipelineRoot(rootPath, inherit);
19061907

1907-
waitForElement(Locators.labkeyMessage.withText("The pipeline root was set to '" + Paths.get(rootPath).normalize() + "'"));
1908+
waitForElement(Locators.labkeyMessage.withTextIgnoreCase("The pipeline root was set to '" + Paths.get(rootPath).normalize() + "'"));
19081909

19091910
getArtifactCollector().addArtifactLocation(new File(rootPath));
19101911

src/org/labkey/test/Locator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,11 @@ public XPathLocator withText(String text)
12471247
return this.withPredicate("normalize-space()="+xq(ns(text)));
12481248
}
12491249

1250+
public XPathLocator withTextIgnoreCase(String text)
1251+
{
1252+
return this.withPredicate(toLowerCase("normalize-space()", text) + "= "+xq(ns(text.toLowerCase())));
1253+
}
1254+
12501255
public XPathLocator withText()
12511256
{
12521257
return this.withPredicate("string-length() > 0");

src/org/labkey/test/components/Component.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.labkey.test.components;
1717

1818
import org.apache.commons.lang3.NotImplementedException;
19+
import org.jetbrains.annotations.NotNull;
1920
import org.labkey.test.Locator;
2021
import org.labkey.test.selenium.RefindingWebElement;
2122
import org.labkey.test.util.TestLogger;
@@ -27,6 +28,7 @@
2728

2829
import java.util.ArrayList;
2930
import java.util.List;
31+
import java.util.Objects;
3032
import java.util.Optional;
3133
import java.util.function.Function;
3234

@@ -43,13 +45,13 @@ public String toString()
4345
}
4446

4547
@Override
46-
public WebElement findElement(By by)
48+
public @NotNull WebElement findElement(@NotNull By by)
4749
{
4850
return getComponentElement().findElement(by);
4951
}
5052

5153
@Override
52-
public List<WebElement> findElements(By by)
54+
public @NotNull List<WebElement> findElements(@NotNull By by)
5355
{
5456
return getComponentElement().findElements(by);
5557
}
@@ -69,8 +71,9 @@ protected EC elementCache()
6971
// Pass if element doesn't exist. Might be checking if component is visible.
7072
}
7173

72-
_elementCache = newElementCache();
74+
_elementCache = Objects.requireNonNull(newElementCache());
7375
waitForReady();
76+
Objects.requireNonNull(_elementCache, "waitForReady() cleared the element cache");
7477
}
7578
return _elementCache;
7679
}
@@ -103,13 +106,13 @@ protected ElementCache()
103106
}
104107

105108
@Override
106-
public List<WebElement> findElements(By by)
109+
public @NotNull List<WebElement> findElements(@NotNull By by)
107110
{
108111
return getComponentElement().findElements(by);
109112
}
110113

111114
@Override
112-
public WebElement findElement(By by)
115+
public @NotNull WebElement findElement(@NotNull By by)
113116
{
114117
return getComponentElement().findElement(by);
115118
}

src/org/labkey/test/components/ui/grids/EditableGrid.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.labkey.test.components.ui.grids;
22

3+
import org.apache.commons.csv.CSVFormat;
34
import org.apache.commons.lang3.StringUtils;
45
import org.apache.commons.lang3.mutable.Mutable;
56
import org.apache.commons.lang3.mutable.MutableObject;
@@ -97,6 +98,17 @@ public void waitForReady()
9798
Locators.spinner.waitForElementToDisappear(this, 30000);
9899
}
99100

101+
/**
102+
* Quote values to be pasted into lookup columns. Prevents a value containing a comma from being interpreted as
103+
* multiple values.
104+
* @param values the raw values
105+
* @return The values, quoted if necessary for pasting into a single lookup cell
106+
*/
107+
public static String quoteForPaste(String... values)
108+
{
109+
return Arrays.stream(values).map(CSVFormat.DEFAULT::format).collect(Collectors.joining(","));
110+
}
111+
100112
public void clickDelete()
101113
{
102114
doAndWaitForRowCountUpdate(() -> elementCache().deleteRowsBtn.click());
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package org.labkey.test.params;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.labkey.test.TestProperties;
5+
import org.labkey.test.util.AbstractContainerHelper;
6+
import org.labkey.test.util.TestDataGenerator;
7+
8+
import java.util.Collections;
9+
import java.util.List;
10+
import java.util.Objects;
11+
12+
import static org.labkey.test.util.TestDataGenerator.ALL_CHARS_PLACEHOLDER;
13+
import static org.labkey.test.util.TestDataGenerator.WIDE_PLACEHOLDER;
14+
import static org.labkey.test.util.TextUtils.containerPath;
15+
16+
public class ContainerInfo
17+
{
18+
public static final String TRICKY_CHARACTERS = "\u2603~!@$&()_+{}-=[],.#\u00E4\u00F6\u00FC\u00C5" + WIDE_PLACEHOLDER + ALL_CHARS_PLACEHOLDER; // No slash or space
19+
20+
private final @NotNull String _name;
21+
private final String _parentContainerPath;
22+
private final @NotNull String _containerPath;
23+
private final String _folderType;
24+
private final @NotNull List<String> _enableModules;
25+
26+
protected ContainerInfo(String name, ContainerInfo parentContainer, String folderType, List<String> enableModules)
27+
{
28+
_parentContainerPath = parentContainer == null ? null : parentContainer.getContainerPath();
29+
_name = Objects.requireNonNull(containerPath(name));
30+
_containerPath = containerPath(_parentContainerPath, name);
31+
_folderType = folderType;
32+
_enableModules = enableModules == null || enableModules.isEmpty() ? Collections.emptyList() : List.copyOf(enableModules);
33+
}
34+
35+
private static @NotNull String getRandomName(String folderName)
36+
{
37+
if (TestProperties.isTestRunningOnTeamCity())
38+
return TestDataGenerator.randomName(folderName, TestDataGenerator.randomInt(0, 5), 5, TRICKY_CHARACTERS, null);
39+
else
40+
return folderName + TRICKY_CHARACTERS;
41+
}
42+
43+
public static ContainerInfo folder(String folderName, ContainerInfo parentContainer, String folderType, List<String> enableModules)
44+
{
45+
return new ContainerInfo(getRandomName(folderName), parentContainer, folderType, enableModules);
46+
}
47+
48+
public static ContainerInfo folder(String folderName, ContainerInfo parentContainer, String folderType)
49+
{
50+
return folder(folderName, parentContainer, folderType, null);
51+
}
52+
53+
public static ContainerInfo folder(String folderName, ContainerInfo parentContainer)
54+
{
55+
return folder(folderName, parentContainer, null, null);
56+
}
57+
58+
public static ContainerInfo project(String projectName, String folderType, List<String> enableModules)
59+
{
60+
return folder(projectName, null, folderType, enableModules);
61+
}
62+
63+
public static ContainerInfo project(String projectName, String folderType)
64+
{
65+
return project(projectName, folderType, null);
66+
}
67+
68+
public static ContainerInfo project(String projectName)
69+
{
70+
return project(projectName, null, null);
71+
}
72+
73+
public void create(AbstractContainerHelper containerHelper)
74+
{
75+
create(containerHelper, _folderType);
76+
}
77+
78+
public void create(AbstractContainerHelper containerHelper, String folderType)
79+
{
80+
if (isProject())
81+
containerHelper.createProject(_name, folderType);
82+
else
83+
containerHelper.createSubfolder(_parentContainerPath, _name, folderType);
84+
if (!_enableModules.isEmpty())
85+
{
86+
containerHelper.enableModules(_containerPath, _enableModules);
87+
}
88+
}
89+
90+
public @NotNull String getName()
91+
{
92+
return _name;
93+
}
94+
95+
public @NotNull String getContainerPath()
96+
{
97+
return _containerPath;
98+
}
99+
100+
public boolean isProject()
101+
{
102+
return _parentContainerPath == null;
103+
}
104+
105+
}

src/org/labkey/test/params/experiment/DataClassDefinition.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.labkey.remoteapi.domain.PropertyDescriptor;
66
import org.labkey.test.params.FieldDefinition;
77
import org.labkey.test.params.property.DomainProps;
8+
import org.labkey.test.util.DomainUtils.DomainKind;
89
import org.labkey.test.util.TestDataGenerator;
910

1011
import java.util.ArrayList;
@@ -123,7 +124,7 @@ protected Domain getDomainDesign()
123124
@Override
124125
protected String getKind()
125126
{
126-
return "DataClass";
127+
return DomainKind.DataClass.name();
127128
}
128129

129130
@NotNull

src/org/labkey/test/params/experiment/SampleTypeDefinition.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.labkey.test.components.ui.domainproperties.samples.SampleTypeDesigner;
77
import org.labkey.test.params.FieldDefinition;
88
import org.labkey.test.params.property.DomainProps;
9+
import org.labkey.test.util.DomainUtils.DomainKind;
910

1011
import java.util.ArrayList;
1112
import java.util.HashMap;
@@ -14,8 +15,6 @@
1415
import java.util.Map;
1516
import java.util.Set;
1617

17-
import static org.labkey.test.util.exp.SampleTypeAPIHelper.SAMPLE_TYPE_DOMAIN_KIND;
18-
1918
/**
2019
* Defines a Sample Type. Suitable for use with UI and API helpers.
2120
* 'exp.materials'
@@ -217,7 +216,7 @@ protected Domain getDomainDesign()
217216
@Override
218217
protected String getKind()
219218
{
220-
return SAMPLE_TYPE_DOMAIN_KIND;
219+
return DomainKind.SampleSet.name();
221220
}
222221

223222
@NotNull

src/org/labkey/test/params/list/IntListDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.jetbrains.annotations.NotNull;
44
import org.labkey.remoteapi.domain.PropertyDescriptor;
55
import org.labkey.test.params.FieldDefinition;
6+
import org.labkey.test.util.DomainUtils.DomainKind;
67
import org.labkey.test.util.TestDataGenerator;
78

89
import java.util.List;
@@ -11,7 +12,6 @@
1112

1213
public class IntListDefinition extends ListDefinition
1314
{
14-
private static final String DOMAIN_KIND = "IntList";
1515

1616
private final boolean isAutoIncrementKey;
1717

@@ -43,7 +43,7 @@ public List<PropertyDescriptor> getFields()
4343
@Override
4444
protected String getKind()
4545
{
46-
return DOMAIN_KIND;
46+
return DomainKind.IntList.name();
4747
}
4848

4949
@Override

0 commit comments

Comments
 (0)