From 4a50f1325a59b177c1448204c6dcf7a467c4f341 Mon Sep 17 00:00:00 2001 From: Daria Bodiakova <70635654+DariaBod@users.noreply.github.com> Date: Tue, 28 Apr 2026 09:04:31 -0700 Subject: [PATCH 1/4] fix testDragFillReadOnlyColumn() --- .../test/components/ui/grids/EditableGrid.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/EditableGrid.java b/src/org/labkey/test/components/ui/grids/EditableGrid.java index b58765eadf..8a065ec45b 100644 --- a/src/org/labkey/test/components/ui/grids/EditableGrid.java +++ b/src/org/labkey/test/components/ui/grids/EditableGrid.java @@ -1023,7 +1023,16 @@ public void dragFill(WebElement startCell, WebElement endCell) { dismissPopover(); Locator.XPathLocator selectionHandleLoc = Locator.byClass("cell-selection-handle"); - WebElement selectionHandle = selectionHandleLoc.findElement(startCell); + + WebElement selectionHandle = selectionHandleLoc.waitForElement(startCell, 2_000); + dragToCell(selectionHandle, endCell); + + // Wait and check after drag + if (WebDriverWrapper.waitFor(() -> !selectionHandleLoc.findElements(endCell).isEmpty(), 2_000)) + return; + + // Retry if failed + selectionHandle = selectionHandleLoc.waitForElement(startCell, 2_000); dragToCell(selectionHandle, endCell); selectionHandleLoc.waitForElement(endCell, 5_000); } @@ -1045,7 +1054,7 @@ private void dragToCell(WebElement elementToDrag, WebElement destinationCell) // WebDriver doesn't calculate correct location to click the cell selection handle .moveToElement(elementToDrag, 0, 7) .clickAndHold() - .pause(Duration.ofMillis(200)) + .pause(Duration.ofMillis(500)) .moveToElement(destinationCell) // Extra wiggle to get it to stick .moveByOffset(0, -size.getHeight()) From 73c70dc6f92860c527b9e3b9b403bf09efec9921 Mon Sep 17 00:00:00 2001 From: Daria Bodiakova <70635654+DariaBod@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:28:28 -0700 Subject: [PATCH 2/4] update retry --- .../components/ui/grids/EditableGrid.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/EditableGrid.java b/src/org/labkey/test/components/ui/grids/EditableGrid.java index 8a065ec45b..340aa5bbd8 100644 --- a/src/org/labkey/test/components/ui/grids/EditableGrid.java +++ b/src/org/labkey/test/components/ui/grids/EditableGrid.java @@ -1023,18 +1023,22 @@ public void dragFill(WebElement startCell, WebElement endCell) { dismissPopover(); Locator.XPathLocator selectionHandleLoc = Locator.byClass("cell-selection-handle"); - - WebElement selectionHandle = selectionHandleLoc.waitForElement(startCell, 2_000); + // Get the value from the start cell + String fillValue = getCellValue(startCell); + WebElement selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); dragToCell(selectionHandle, endCell); - // Wait and check after drag - if (WebDriverWrapper.waitFor(() -> !selectionHandleLoc.findElements(endCell).isEmpty(), 2_000)) - return; - - // Retry if failed - selectionHandle = selectionHandleLoc.waitForElement(startCell, 2_000); - dragToCell(selectionHandle, endCell); - selectionHandleLoc.waitForElement(endCell, 5_000); + // Wait until endCell actually receives the fill value. + if (!WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(endCell)), 3_000)) + { + // Fill didn't complete on the first attempt — the drag likely extended the selection + // without triggering the fill. Re-click startCell to restore selection, then retry the drag. + startCell.click(); + selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); + dragToCell(selectionHandle, endCell); + WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(endCell)), + "Drag fill did not populate end cell with value: " + fillValue, 5_000); + } } public void selectCellRange(WebElement startCell, WebElement endCell) From 0bd252632928d67c2b809fa030e081e0007d79b8 Mon Sep 17 00:00:00 2001 From: Daria Bodiakova <70635654+DariaBod@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:53:32 -0700 Subject: [PATCH 3/4] fix comment --- .../components/ui/grids/EditableGrid.java | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/EditableGrid.java b/src/org/labkey/test/components/ui/grids/EditableGrid.java index 340aa5bbd8..f5a0210e00 100644 --- a/src/org/labkey/test/components/ui/grids/EditableGrid.java +++ b/src/org/labkey/test/components/ui/grids/EditableGrid.java @@ -1019,6 +1019,38 @@ public String copyCurrentSelection() throws IOException, UnsupportedFlavorExcept return getWrapper().getClipboardContent(); } + /** + * Select a cell range and drag-fill from the end of that selection to {@code dragEnd}. + * Because this overload owns the {@link #selectCellRange} step, it can fully restore state + * and retry if the first drag extended the selection without applying the fill. + * + * @param selectStart first cell of the selection (passed to {@link #selectCellRange}) + * @param selectEnd last cell of the selection; also the source of the fill value + * @param dragEnd destination cell for the fill drag + */ + public void dragFill(WebElement selectStart, WebElement selectEnd, WebElement dragEnd) + { + Locator.XPathLocator selectionHandleLoc = Locator.byClass("cell-selection-handle"); + selectCellRange(selectStart, selectEnd); + String fillValue = getCellValue(selectEnd); + WebElement selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); + dragToCell(selectionHandle, dragEnd); + if (!WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(dragEnd)), 3_000)) + { + // Fill didn't complete — the drag likely extended the selection without triggering the fill. + selectCellRange(selectStart, selectEnd); + selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); + dragToCell(selectionHandle, dragEnd); + WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(dragEnd)), + "Drag fill did not populate end cell with value: " + fillValue, 5_000); + } + } + + /** + * Drag-fill from {@code startCell} (which must already be selected / part of the current + * selection) to {@code endCell}. Prefer {@link #dragFill(WebElement, WebElement, WebElement)} + * when the selection range is known — that overload can retry reliably. + */ public void dragFill(WebElement startCell, WebElement endCell) { dismissPopover(); @@ -1027,18 +1059,10 @@ public void dragFill(WebElement startCell, WebElement endCell) String fillValue = getCellValue(startCell); WebElement selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); dragToCell(selectionHandle, endCell); - - // Wait until endCell actually receives the fill value. - if (!WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(endCell)), 3_000)) - { - // Fill didn't complete on the first attempt — the drag likely extended the selection - // without triggering the fill. Re-click startCell to restore selection, then retry the drag. - startCell.click(); - selectionHandle = selectionHandleLoc.waitForElement(getComponentElement(), 2_000); - dragToCell(selectionHandle, endCell); - WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(endCell)), - "Drag fill did not populate end cell with value: " + fillValue, 5_000); - } + // Handle appearing in endCell alone is insufficient — the selection can expand + // (handle moves) without fill values being applied. Wait for the actual value. + WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(endCell)), + "Drag fill did not populate end cell with value: " + fillValue, 5_000); } public void selectCellRange(WebElement startCell, WebElement endCell) From 46cbed10f43ad529cfdd65545e615f91e1c008d8 Mon Sep 17 00:00:00 2001 From: Daria Bodiakova <70635654+DariaBod@users.noreply.github.com> Date: Wed, 29 Apr 2026 10:35:58 -0700 Subject: [PATCH 4/4] fix for MultiValueTextChoiceSampleTypeTest.testCrossFolderMVTCtoTCConversion --- .../labkey/test/tests/MultiValueTextChoiceSampleTypeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/labkey/test/tests/MultiValueTextChoiceSampleTypeTest.java b/src/org/labkey/test/tests/MultiValueTextChoiceSampleTypeTest.java index c09e23f64d..68e0504a6d 100644 --- a/src/org/labkey/test/tests/MultiValueTextChoiceSampleTypeTest.java +++ b/src/org/labkey/test/tests/MultiValueTextChoiceSampleTypeTest.java @@ -149,7 +149,7 @@ public void testCrossFolderMVTCtoTCConversion() throws IOException, CommandExcep updateSampleTypePage.getFieldsPanel() .getField(multiValueTextChoiceFieldName) .expand() - .setAllowMultipleSelections(false); + .setAllowMultipleSelections(false, true); updateSampleTypePage.clickSave(); // Check that impossible to choose multiple values.