Skip to content

Commit 3a26c69

Browse files
Merge 26.3 to 26.7
2 parents 6699ff6 + d83a30d commit 3a26c69

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

‎src/org/labkey/test/tests/filecontent/FileContentUploadTest.java‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import java.time.Duration;
5959
import java.util.ArrayList;
6060
import java.util.Arrays;
61-
import java.util.Collections;
6261
import java.util.HashMap;
6362
import java.util.HashSet;
6463
import java.util.List;
@@ -75,8 +74,6 @@
7574
@BaseWebDriverTest.ClassTimeout(minutes = 6)
7675
public class FileContentUploadTest extends BaseWebDriverTest
7776
{
78-
private static final String FILE_DESCRIPTION = "FileContentTestFile";
79-
private static final String CUSTOM_PROPERTY_VALUE = "ExtendedProperty";
8077
private static final String CUSTOM_PROPERTY = "customProperty";
8178
protected static final String TEST_USER = "user_filecontent@filecontentupload.test";
8279
private static final String TEST_GROUP = "FileContentTestGroup";
@@ -140,6 +137,10 @@ protected SearchHelper getSearchHelper()
140137
@Test
141138
public void testFileBrowser()
142139
{
140+
String fileDescription = "FileContentTestFile";
141+
String fileReplacedDescription = "FileContentReplacedTestFile";
142+
String customPropertyValue = "ExtendedProperty";
143+
143144
sendFileDigest();
144145

145146
SearchHelper _searchHelper = getSearchHelper();
@@ -152,20 +153,20 @@ public void testFileBrowser()
152153
final File testFile = TestFileUtils.getSampleData("security/InlineFile.html");
153154
final String filename = testFile.getName();
154155
List<FileBrowserExtendedProperty> fileProperties = new ArrayList<>();
155-
fileProperties.add(new FileBrowserExtendedProperty(CUSTOM_PROPERTY, CUSTOM_PROPERTY_VALUE, false));
156+
fileProperties.add(new FileBrowserExtendedProperty(CUSTOM_PROPERTY, customPropertyValue, false));
156157
fileProperties.add(new FileBrowserExtendedProperty("LookupColumn:", LOOKUP_VALUE_2, true));
157158

158-
_fileBrowserHelper.uploadFile(testFile, FILE_DESCRIPTION, fileProperties, false);
159+
_fileBrowserHelper.uploadFile(testFile, fileDescription, fileProperties, false);
159160
assertElementPresent(Locator.linkWithText(LOOKUP_VALUE_2));
160-
assertElementPresent(Locator.linkWithText(CUSTOM_PROPERTY_VALUE));
161-
assertAttributeEquals(Locator.linkWithText(CUSTOM_PROPERTY_VALUE), "href", "http://labkey.test/?a=" + CUSTOM_PROPERTY_VALUE + "&b=" + LOOKUP_VALUE_2);
161+
assertElementPresent(Locator.linkWithText(customPropertyValue));
162+
assertAttributeEquals(Locator.linkWithText(customPropertyValue), "href", "http://labkey.test/?a=" + customPropertyValue + "&b=" + LOOKUP_VALUE_2);
162163

163164
log("replace file");
164165
refresh();
165166
fileProperties = new ArrayList<>();
166-
fileProperties.add(new FileBrowserExtendedProperty(CUSTOM_PROPERTY, CUSTOM_PROPERTY_VALUE, false));
167+
fileProperties.add(new FileBrowserExtendedProperty(CUSTOM_PROPERTY, customPropertyValue, false));
167168
fileProperties.add(new FileBrowserExtendedProperty("LookupColumn:", LOOKUP_VALUE_1, true));
168-
_fileBrowserHelper.uploadFile(testFile, FILE_DESCRIPTION, fileProperties, true);
169+
_fileBrowserHelper.uploadFile(testFile, fileReplacedDescription, fileProperties, true);
169170

170171
log("move file");
171172
final String folderName = "Test folder";
@@ -184,8 +185,12 @@ public void testFileBrowser()
184185

185186
_searchHelper.enqueueSearchItem(filename); // No results for old file name
186187
_searchHelper.enqueueSearchItem(newFileName, folderName, Locator.linkContainingText(newFileName));
187-
_searchHelper.enqueueSearchItem(FILE_DESCRIPTION, folderName, Locator.linkContainingText(newFileName));
188-
_searchHelper.enqueueSearchItem(CUSTOM_PROPERTY_VALUE, folderName, Locator.linkContainingText(newFileName));
188+
_searchHelper.addUnwantedResult(newFileName, Locator.linkContainingText(filename));
189+
_searchHelper.enqueueSearchItem(fileDescription); // No results for old description
190+
_searchHelper.enqueueSearchItem(fileReplacedDescription, folderName, Locator.linkContainingText(newFileName));
191+
_searchHelper.addUnwantedResult(fileReplacedDescription, Locator.linkContainingText(filename));
192+
_searchHelper.enqueueSearchItem(customPropertyValue, folderName, Locator.linkContainingText(newFileName));
193+
_searchHelper.addUnwantedResult(customPropertyValue, Locator.linkContainingText(filename));
189194

190195
_searchHelper.verifySearchResults(getProjectName(), "searchAfterRename");
191196

@@ -194,16 +199,16 @@ public void testFileBrowser()
194199
_fileBrowserHelper.deleteFile(folderName + "/" + newFileName);
195200
waitForElementToDisappear(Locator.css(".labkey-filecontent-grid div.x4-grid-cell-inner").withText(newFileName));
196201
_searchHelper.enqueueSearchItem(newFileName);
197-
_searchHelper.enqueueSearchItem(FILE_DESCRIPTION);
198-
_searchHelper.enqueueSearchItem(CUSTOM_PROPERTY_VALUE);
202+
_searchHelper.enqueueSearchItem(fileReplacedDescription);
203+
_searchHelper.enqueueSearchItem(customPropertyValue);
199204

200205
_searchHelper.verifySearchResults(getProjectName(), "searchAfterDelete");
201206

202207
clickProject(getProjectName());
203208
_fileBrowserHelper.clickFileBrowserButton(BrowserAction.AUDIT_HISTORY);
204209
assertTextPresent(
205210
"File uploaded to project: /" + getProjectName(),
206-
"annotations updated: " + CUSTOM_PROPERTY + "=" + CUSTOM_PROPERTY_VALUE,
211+
"annotations updated: " + CUSTOM_PROPERTY + "=" + customPropertyValue,
207212
"File deleted from project: /" + getProjectName());
208213

209214
sendFileDigest();
@@ -240,7 +245,7 @@ public void testAbsoluteFilePath() throws Exception
240245
navigateToFolder(getProjectName(), subfolderName);
241246
final File testFile = TestFileUtils.getSampleData("security/InlineFile2.html");
242247
final String filename = testFile.getName();
243-
_fileBrowserHelper.uploadFile(testFile, FILE_DESCRIPTION, Collections.emptyList(), false);
248+
_fileBrowserHelper.uploadFile(testFile);
244249

245250
_fileBrowserHelper.goToAdminMenu();
246251
_fileBrowserHelper.goToConfigureButtonsTab();

0 commit comments

Comments
 (0)