Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/org/labkey/test/tests/AttachmentFieldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.PortalHelper;
import org.labkey.test.util.SampleTypeHelper;
import org.labkey.test.util.TestDataGenerator;

import java.io.File;
import java.util.List;
Expand Down Expand Up @@ -96,8 +97,8 @@ public void testFileFieldInSampleType()
@Test
public void testAttachmentFieldInLists()
{
String listName = "List with attachment field";
String fieldName = "testFile";
String listName = TestDataGenerator.randomDomainName("List with attachment field");
String fieldName = TestDataGenerator.randomFieldName("Test File");
goToProjectHome();
log("Creating the list");
_listHelper.createList(getProjectName(), listName, "id");
Expand Down
17 changes: 10 additions & 7 deletions src/org/labkey/test/tests/FileAttachmentColumnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
import org.labkey.test.pages.study.CreateStudyPage;
import org.labkey.test.params.FieldDefinition;
import org.labkey.test.params.FieldDefinition.ColumnType;
import org.labkey.test.params.FieldInfo;
import org.labkey.test.params.assay.GeneralAssayDesign;
import org.labkey.test.params.experiment.SampleTypeDefinition;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.ListHelper;
import org.labkey.test.util.PortalHelper;
import org.labkey.test.util.SampleTypeHelper;
import org.labkey.test.util.StudyHelper;
import org.labkey.test.util.TestDataGenerator;
import org.labkey.test.util.core.webdav.WebDavUploadHelper;
import org.labkey.test.util.exp.SampleTypeAPIHelper;
import org.openqa.selenium.By;
Expand Down Expand Up @@ -90,6 +92,7 @@ public class FileAttachmentColumnTest extends BaseWebDriverTest
private final String RESULT_FILE_COL = "resultFile";
private final String OTHER_RESULT_FILE_COL = "otherResultFile";
private final String STUDY_DATASET_NAME = "ogreSpiteLevels";
private static final FieldInfo LIST_ATTACHMENT_FIELD = new FieldInfo(TestDataGenerator.randomFieldName("File / Attachment"), ColumnType.Attachment);

@Override
protected void doCleanup(boolean afterTest) throws TestTimeoutException
Expand Down Expand Up @@ -180,8 +183,8 @@ public void verifyFileDownloadOnClick()
for (File testFile : downloadTestFiles)
{
int rowIndex = testListRegion.getRowIndex("Name", testFile.getName());
var downloadLink = testListRegion.link(rowIndex, "File");
doAndWaitForDownload(()-> downloadLink.click());
var downloadLink = testListRegion.link(rowIndex, LIST_ATTACHMENT_FIELD.getName());
doAndWaitForDownload(downloadLink::click);
}

// verify popup/sprite for jpeg
Expand Down Expand Up @@ -428,13 +431,13 @@ private void createListWithData(String containerPath)
String LIST_KEY = "TestListId";
listHelper.createList(getProjectName() + "/" + EXPORT_FOLDER_NAME, LIST_NAME, LIST_KEY,
new FieldDefinition("Name", ColumnType.String),
new FieldDefinition("File", ColumnType.Attachment));
LIST_ATTACHMENT_FIELD.getFieldDefinition());
goToManageLists();
listHelper.click(Locator.linkContainingText(LIST_NAME));

for (File file : SAMPLE_FILES)
{
Map<String, String> fileRow = Map.of("Name", file.getName(), "File", file.getAbsolutePath());
Map<String, String> fileRow = Map.of("Name", file.getName(), LIST_ATTACHMENT_FIELD.getName(), file.getAbsolutePath());
listHelper.insertNewRow(fileRow, false);
}
}
Expand All @@ -448,7 +451,7 @@ private void importSampleDataUI(String sampleTypeName, String containerPath, Lis
for (File file : files)
{
sampleFileData.add(Map.of("Name", file.getName(), "Color", "green",
"File", file.getName()));
LIST_ATTACHMENT_FIELD.getName(), file.getName()));
}
helper.bulkImport(sampleFileData);
}
Expand Down Expand Up @@ -513,7 +516,7 @@ private void validateListData(String listName, String folderPath, List<File> exp
else
{
int rowIndex = testListRegion.getRowIndex("Name", testFile.getName());
var downloadLink = testListRegion.link(rowIndex, "File");
var downloadLink = testListRegion.link(rowIndex, LIST_ATTACHMENT_FIELD.getName());
doAndWaitForDownload(() -> downloadLink.click());
}
}
Expand All @@ -539,7 +542,7 @@ private void validateSampleData(String sampleType, String folderPath, List<File>
}
else
{
WebElement fileLinkCell = samplesRegion.findCell(rowIndex, "file");
WebElement fileLinkCell = samplesRegion.findCell(rowIndex, LIST_ATTACHMENT_FIELD.getName());
Optional<WebElement> optionalFileLink = Locator.tag("a").findOptionalElement(fileLinkCell);
checker().withScreenshot("unexpected_file_state")
.awaiting(Duration.ofSeconds(2),
Expand Down
15 changes: 8 additions & 7 deletions src/org/labkey/test/tests/InlineImagesListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.labkey.test.util.DataRegionExportHelper;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.ExcelHelper;
import org.labkey.test.util.TestDataGenerator;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;

Expand All @@ -51,16 +52,16 @@
@BaseWebDriverTest.ClassTimeout(minutes = 5)
public class InlineImagesListTest extends BaseWebDriverTest
{
protected final static String LIST_NAME = "InlineImagesList";
protected final static String LIST_KEY_NAME = "Key";
protected final static String LIST_NAME = TestDataGenerator.randomDomainName("InlineImagesList");
protected final static String LIST_KEY_NAME = TestDataGenerator.randomFieldName("Key");
protected final static ColumnType LIST_KEY_TYPE = ColumnType.Integer;

protected final static String LIST_ATTACHMENT01_NAME = "Attachment01";
protected final static String LIST_ATTACHMENT01_LABEL = "Attachment Column 01";
protected final static String LIST_ATTACHMENT01_NAME = TestDataGenerator.randomFieldName("Attachment01");
protected final static String LIST_ATTACHMENT01_LABEL = TestDataGenerator.randomFieldName("Attachment Column 01");
protected final static String LIST_ATTACHMENT01_DESC = "An 1st attachment column.";

protected final static String LIST_ATTACHMENT02_NAME = "Attachment02";
protected final static String LIST_ATTACHMENT02_LABEL = "Attachment Column 02";
protected final static String LIST_ATTACHMENT02_NAME = TestDataGenerator.randomFieldName("Attachment02");
protected final static String LIST_ATTACHMENT02_LABEL = TestDataGenerator.randomFieldName("Attachment Column 02");
protected final static String LIST_ATTACHMENT02_DESC = "An 2nd attachment column.";

protected final static ColumnType LIST_ATTACHMENT_TYPE = ColumnType.Attachment;
Expand Down Expand Up @@ -132,7 +133,7 @@ private void doInit()
}

@Test
public final void ListTest() throws Exception
public final void testList() throws Exception
{
DataRegionTable list;
DataRegionExportHelper exportHelper;
Expand Down