Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/org/labkey/test/components/ui/grids/EditableGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -1049,17 +1049,33 @@ public void dragFill(WebElement startCell, WebElement endCell)

/**
* Select {@code selectStart} through {@code dragEnd} and fill down from {@code selectEnd}'s row using Ctrl/Cmd+D.
* The drag that establishes the selection is occasionally treated as a click, leaving the key combination
* nothing to fill, so the whole sequence is retried once.
* @param selectStart top-left cell of the range to select
* @param selectEnd cell whose value will be filled down (must be in {@code selectStart}'s row)
* @param dragEnd bottom-right cell of the range to select and fill down to
*/
public void fillDown(WebElement selectStart, WebElement selectEnd, WebElement dragEnd)
{
selectCellRange(selectStart, dragEnd);
String fillValue = getCellValue(selectEnd);

selectAndFillDown(selectStart, dragEnd);
if (!WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(dragEnd)), 3_000))
{
selectAndFillDown(selectStart, dragEnd);
WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(dragEnd)),
"Fill-down did not populate end cell with value: " + fillValue, 5_000);
}
}

/**
* Drag-select {@code selectStart} through {@code dragEnd} and send the fill-down key combination.
*/
private void selectAndFillDown(WebElement selectStart, WebElement dragEnd)
{
dragToCell(selectStart, dragEnd);
WebDriverWrapper.waitFor(() -> isInSelection(selectStart) && isInSelection(dragEnd), 2_000);
new Actions(getDriver()).keyDown(MODIFIER_KEY).sendKeys("d").keyUp(MODIFIER_KEY).build().perform();
WebDriverWrapper.waitFor(() -> fillValue.equals(getCellValue(dragEnd)),
"Fill-down did not populate end cell with value: " + fillValue, 3_000);
}

public void selectCellRange(WebElement startCell, WebElement endCell)
Expand Down