diff --git a/src/org/labkey/test/components/ui/Pager.java b/src/org/labkey/test/components/ui/Pager.java index dd0740a53b..f364bed03a 100644 --- a/src/org/labkey/test/components/ui/Pager.java +++ b/src/org/labkey/test/components/ui/Pager.java @@ -63,28 +63,41 @@ public int getCurrentPage() // only works on GridPanel public Pager selectPageSize(String pageSize) // only works on GridPanel { - int currentPageSize = getPageSize(); - if(currentPageSize != Integer.parseInt(pageSize)) - { - _pagedComponent.doAndWaitForUpdate(() -> elementCache().jumpToDropdown.clickSubMenu(false, pageSize)); - } + pageSize(pageSize); return this; } public int getPageSize() // only works on GridPanel { - // Changing the jumpToDropdown button from the deprecated DropdownButtonGroup class to a MultiMenu type has changed - // the way that various text from the control is gathered. Getting the current page size now requires that the dropdown + return pageSize(null); + } + + /** + * Sets the page size if required (pageSize is specified and doesn't match the current page size) + * @return returns the initial page size + */ + private int pageSize(String pageSize) // only works on GridPanel + { + // Getting the current page size requires that the dropdown // be expanded and the selected page size found in the list. elementCache().jumpToDropdown.expand(); // Find the selected li element in the page size list WebElement activeLi = Locator.byClass("active").findElement(elementCache().jumpToDropdown); - int size = Integer.parseInt(activeLi.getText()); - elementCache().jumpToDropdown.collapse(); + int initialSize = Integer.parseInt(activeLi.getText()); + + if (pageSize != null && initialSize != Integer.parseInt(pageSize)) + { + _pagedComponent.doAndWaitForUpdate(() -> elementCache().jumpToDropdown.clickSubMenu(false, pageSize)); + } + else + { + // Tooltip sometimes blocks button. Click active option to dismiss menu. + activeLi.click(); + } - return size; + return initialSize; } /** diff --git a/src/org/labkey/test/components/ui/grids/EditableGrid.java b/src/org/labkey/test/components/ui/grids/EditableGrid.java index 5f8dea57da..db6ce743cf 100644 --- a/src/org/labkey/test/components/ui/grids/EditableGrid.java +++ b/src/org/labkey/test/components/ui/grids/EditableGrid.java @@ -192,8 +192,9 @@ public EditableGrid shiftSelectRange(int start, int end) var checkBoxes = Locator.tag("tr").child("td") .child(Locator.tagWithAttribute("input", "type", "checkbox")) .findElements(elementCache().table); + getWrapper().scrollIntoView(checkBoxes.get(start)); // Make sure the header isn't in the way checkBoxes.get(start).click(); - getWrapper().scrollIntoView(checkBoxes.get(end), true); // Actions.click() doesn't scroll + getWrapper().scrollIntoView(checkBoxes.get(end)); // Actions.click() doesn't scroll new Actions(getDriver()) .keyDown(Keys.SHIFT) .click(checkBoxes.get(end))