From 5c78862b5dc324af06e30157e0ca4f3f56af24ef Mon Sep 17 00:00:00 2001 From: XingY Date: Sun, 5 Apr 2026 20:58:39 -0700 Subject: [PATCH 1/2] Selenium test for GitHub Issue 915: Bulk edit doesn't completely remove attachments for sources --- .../ui/entities/EntityBulkUpdateDialog.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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); From 2b17a2f67e7380cc5c56dcb0c8063d216c9d2f42 Mon Sep 17 00:00:00 2001 From: XingY Date: Tue, 7 Apr 2026 18:12:53 -0700 Subject: [PATCH 2/2] clean --- .../test/components/ui/entities/EntityBulkUpdateDialog.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java b/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java index c4fc7ed4e5..c358b7d65c 100644 --- a/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java +++ b/src/org/labkey/test/components/ui/entities/EntityBulkUpdateDialog.java @@ -306,8 +306,6 @@ public EntityBulkUpdateDialog removeFile(CharSequence fieldIdentifier) 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;