Skip to content

Commit 62a2111

Browse files
committed
Selenium test for file issues
1 parent 45f1975 commit 62a2111

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.labkey.test.components.react.ReactDateTimePicker;
1616
import org.labkey.test.components.react.ToggleButton;
1717
import org.labkey.test.components.ui.files.FileAttachmentContainer;
18+
import org.labkey.test.components.ui.files.FileUploadField;
1819
import org.labkey.test.params.FieldDefinition;
1920
import org.labkey.test.params.FieldKey;
2021
import org.labkey.test.util.AuditLogHelper;
@@ -268,6 +269,11 @@ public EntityBulkUpdateDialog removeFile(CharSequence fieldIdentifier)
268269
return this;
269270
}
270271

272+
public FileUploadField getExistingFileField(String fieldKey)
273+
{
274+
return elementCache().fileField(fieldKey);
275+
}
276+
271277
/**
272278
* @param fieldIdentifier Identifier for the field; name ({@link String}) or fieldKey ({@link FieldKey})
273279
* @param checked value to set
@@ -469,6 +475,11 @@ public FileAttachmentContainer fileUploadField(CharSequence fieldIdentifier)
469475
return new FileAttachmentContainer(formRow(fieldIdentifier), getDriver());
470476
}
471477

478+
public FileUploadField fileField(String fieldKey)
479+
{
480+
return new FileUploadField(Locator.tagWithClass("div", "col-xs-12").findElementOrNull(formRow(fieldKey)), getDriver());
481+
}
482+
472483
final Locator textInputLoc = Locator.tagWithAttribute("input", "type", "text");
473484
final Locator numberInputLoc = Locator.tagWithAttribute("input", "type", "number");
474485
final Locator checkBoxLoc = Locator.tagWithAttribute("input", "type", "checkbox");

src/org/labkey/test/components/ui/files/FileAttachmentContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public String attachFileExpectingAlert(File file)
111111
/**
112112
* Returns true if there is a file with that name in the current instance
113113
*/
114-
private boolean hasFile(String fileName)
114+
public boolean hasFile(String fileName)
115115
{
116116
return new FileAttachmentEntry.FileAttachmentEntryFinder(getDriver())
117117
.withTitle(fileName).findOptional(this).isPresent();

src/org/labkey/test/components/ui/files/FileUploadField.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ public boolean hasAttachedFile()
5353
return !elementCache().fileInputLabel.isDisplayed();
5454
}
5555

56+
public String getExistingFileName()
57+
{
58+
if (hasAttachedFile())
59+
{
60+
AttachmentCard card = elementCache().getExistingAttachment().get();
61+
return card.getFileName();
62+
}
63+
return null;
64+
}
65+
5666
@Override
5767
public WebElement getComponentElement()
5868
{

0 commit comments

Comments
 (0)