diff --git a/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java b/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java index 7c9309caba..c4fc7ed4e5 100644 --- a/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java +++ b/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java @@ -16,6 +16,7 @@ import org.labkey.test.components.react.FilteringReactSelect; import org.labkey.test.components.react.ReactDateTimePicker; import org.labkey.test.components.react.ToggleButton; +import org.labkey.test.components.ui.files.AttachmentCard; import org.labkey.test.components.ui.files.FileAttachmentContainer; import org.labkey.test.components.ui.files.FileUploadField; import org.labkey.test.params.FieldDefinition; @@ -294,6 +295,24 @@ public EntityBulkUpdateDialog removeFile(CharSequence fieldIdentifier) return this; } + /** + * Removes an existing attachment displayed as an {@link AttachmentCard} in the bulk update dialog. + * This is used when the rows being edited already have an attachment — the existing file is shown + * as an AttachmentCard with a dropdown menu containing "Remove attachment". + * + * @param fieldIdentifier Identifier for the field; name ({@link String}) or fieldKey ({@link FieldKey}) + * @return this component + */ + public EntityBulkUpdateDialog removeExistingAttachment(CharSequence fieldIdentifier) + { + var row = getFileField(fieldIdentifier); + // setEditableState(fieldIdentifier, true); + // WebElement row = elementCache().formRow(fieldIdentifier); + AttachmentCard card = new AttachmentCard.FileAttachmentCardFinder(getDriver()).waitFor(row); + card.clickRemove(); + return this; + } + public FileUploadField getExistingFileCard(CharSequence fieldIdentifier) { FieldKey identifier = FileAttachmentContainer.fileUploadFieldKey(fieldIdentifier);