35
35
import org .labkey .test .pages .study .CreateStudyPage ;
36
36
import org .labkey .test .params .FieldDefinition ;
37
37
import org .labkey .test .params .FieldDefinition .ColumnType ;
38
+ import org .labkey .test .params .FieldInfo ;
38
39
import org .labkey .test .params .assay .GeneralAssayDesign ;
39
40
import org .labkey .test .params .experiment .SampleTypeDefinition ;
40
41
import org .labkey .test .util .DataRegionTable ;
41
42
import org .labkey .test .util .ListHelper ;
42
43
import org .labkey .test .util .PortalHelper ;
43
44
import org .labkey .test .util .SampleTypeHelper ;
44
45
import org .labkey .test .util .StudyHelper ;
46
+ import org .labkey .test .util .TestDataGenerator ;
45
47
import org .labkey .test .util .core .webdav .WebDavUploadHelper ;
46
48
import org .labkey .test .util .exp .SampleTypeAPIHelper ;
47
49
import org .openqa .selenium .By ;
@@ -90,6 +92,7 @@ public class FileAttachmentColumnTest extends BaseWebDriverTest
90
92
private final String RESULT_FILE_COL = "resultFile" ;
91
93
private final String OTHER_RESULT_FILE_COL = "otherResultFile" ;
92
94
private final String STUDY_DATASET_NAME = "ogreSpiteLevels" ;
95
+ private static final FieldInfo LIST_ATTACHMENT_FIELD = new FieldInfo (TestDataGenerator .randomFieldName ("File / Attachment" ), ColumnType .Attachment );
93
96
94
97
@ Override
95
98
protected void doCleanup (boolean afterTest ) throws TestTimeoutException
@@ -180,8 +183,8 @@ public void verifyFileDownloadOnClick()
180
183
for (File testFile : downloadTestFiles )
181
184
{
182
185
int rowIndex = testListRegion .getRowIndex ("Name" , testFile .getName ());
183
- var downloadLink = testListRegion .link (rowIndex , "File" );
184
- doAndWaitForDownload (()-> downloadLink . click () );
186
+ var downloadLink = testListRegion .link (rowIndex , LIST_ATTACHMENT_FIELD . getName () );
187
+ doAndWaitForDownload (downloadLink :: click );
185
188
}
186
189
187
190
// verify popup/sprite for jpeg
@@ -428,13 +431,13 @@ private void createListWithData(String containerPath)
428
431
String LIST_KEY = "TestListId" ;
429
432
listHelper .createList (getProjectName () + "/" + EXPORT_FOLDER_NAME , LIST_NAME , LIST_KEY ,
430
433
new FieldDefinition ("Name" , ColumnType .String ),
431
- new FieldDefinition ( "File" , ColumnType . Attachment ));
434
+ LIST_ATTACHMENT_FIELD . getFieldDefinition ( ));
432
435
goToManageLists ();
433
436
listHelper .click (Locator .linkContainingText (LIST_NAME ));
434
437
435
438
for (File file : SAMPLE_FILES )
436
439
{
437
- Map <String , String > fileRow = Map .of ("Name" , file .getName (), "File" , file .getAbsolutePath ());
440
+ Map <String , String > fileRow = Map .of ("Name" , file .getName (), LIST_ATTACHMENT_FIELD . getName () , file .getAbsolutePath ());
438
441
listHelper .insertNewRow (fileRow , false );
439
442
}
440
443
}
@@ -448,7 +451,7 @@ private void importSampleDataUI(String sampleTypeName, String containerPath, Lis
448
451
for (File file : files )
449
452
{
450
453
sampleFileData .add (Map .of ("Name" , file .getName (), "Color" , "green" ,
451
- "File" , file .getName ()));
454
+ LIST_ATTACHMENT_FIELD . getName () , file .getName ()));
452
455
}
453
456
helper .bulkImport (sampleFileData );
454
457
}
@@ -513,7 +516,7 @@ private void validateListData(String listName, String folderPath, List<File> exp
513
516
else
514
517
{
515
518
int rowIndex = testListRegion .getRowIndex ("Name" , testFile .getName ());
516
- var downloadLink = testListRegion .link (rowIndex , "File" );
519
+ var downloadLink = testListRegion .link (rowIndex , LIST_ATTACHMENT_FIELD . getName () );
517
520
doAndWaitForDownload (() -> downloadLink .click ());
518
521
}
519
522
}
@@ -539,7 +542,7 @@ private void validateSampleData(String sampleType, String folderPath, List<File>
539
542
}
540
543
else
541
544
{
542
- WebElement fileLinkCell = samplesRegion .findCell (rowIndex , "file" );
545
+ WebElement fileLinkCell = samplesRegion .findCell (rowIndex , LIST_ATTACHMENT_FIELD . getName () );
543
546
Optional <WebElement > optionalFileLink = Locator .tag ("a" ).findOptionalElement (fileLinkCell );
544
547
checker ().withScreenshot ("unexpected_file_state" )
545
548
.awaiting (Duration .ofSeconds (2 ),
0 commit comments