diff --git a/src/org/labkey/test/components/ui/grids/GridBar.java b/src/org/labkey/test/components/ui/grids/GridBar.java index 819149df2b..079ac01db9 100644 --- a/src/org/labkey/test/components/ui/grids/GridBar.java +++ b/src/org/labkey/test/components/ui/grids/GridBar.java @@ -7,7 +7,6 @@ import org.junit.Assert; import org.labkey.test.BootstrapLocators; import org.labkey.test.Locator; -import org.labkey.test.WebDriverWrapper; import org.labkey.test.components.Component; import org.labkey.test.components.WebDriverComponent; import org.labkey.test.components.html.BootstrapMenu; @@ -28,7 +27,6 @@ import java.util.List; import java.util.Map; -import static org.labkey.test.BaseWebDriverTest.WAIT_FOR_JAVASCRIPT; import static org.labkey.test.WebDriverWrapper.sleep; /** @@ -166,48 +164,6 @@ public QueryGrid clickPrevious() return _queryGrid; } - /** - * Click the 'Select All' button in the grid bar. - * - * @return This grid bar. - */ - public GridBar selectAllRows() - { - Locator selectBtn = Locator.xpath("//button[contains(text(), 'Select all')]"); // Select all n - Locator selectedText = Locator.xpath("//span[@class='QueryGrid-right-spacing' and normalize-space(contains(text(), 'selected'))]"); // n of n - Locator allSelected = Locator.xpath("//span[contains(text(), 'All ')]"); // All n selected - WebElement btn = selectBtn.waitForElement(_queryGrid, 5_000); - btn.click(); - - WebDriverWrapper.waitFor(() -> allSelected.findOptionalElement(this).isPresent() || - selectBtn.findOptionalElement(this).isEmpty() && - selectedText.findOptionalElement(this).isPresent() , - WAIT_FOR_JAVASCRIPT); - - return this; - } - - /** - * Click the 'Clear All' button in the grid bar. - * @return This grid bar. - */ - public GridBar clearAllSelections() - { - // Clear button can have text values of 'Clear', 'Clear both' or 'Clear all ' so just look for clear. - Locator clearBtn = Locator.xpath("//button[contains(text(), 'Clear')]"); - - if(clearBtn.findOptionalElement(this).isPresent()) - { - WebElement btn = clearBtn.waitForElement(this, 5_000); - btn.click(); - - WebDriverWrapper.waitFor(() -> clearBtn.findOptionalElement(this).isEmpty(), - WAIT_FOR_JAVASCRIPT); - } - - return this; - } - /** * Click a button on the grid bar with the given text. * @param buttonCaption Button caption. diff --git a/src/org/labkey/test/components/ui/grids/QueryGrid.java b/src/org/labkey/test/components/ui/grids/QueryGrid.java index 7b221582f9..c8a025eb03 100644 --- a/src/org/labkey/test/components/ui/grids/QueryGrid.java +++ b/src/org/labkey/test/components/ui/grids/QueryGrid.java @@ -292,26 +292,18 @@ public boolean hasSelectAllButton() */ public QueryGrid selectAllRows() { - if (isGridPanel()) + WebElement selectAllBtn = elementCache().selectAllBtnLoc.findWhenNeeded(elementCache()); + if (selectAllBtn.isDisplayed()) { - WebElement selectAllBtn = elementCache().selectAllBtnLoc.findWhenNeeded(elementCache()); - if (selectAllBtn.isDisplayed()) - { - doAndWaitForUpdate(selectAllBtn::click); - } - else - { - ReactCheckBox selectAll = selectAllBox(); - if (selectAll.isIndeterminate() || !selectAll.isChecked()) - { - doAndWaitForUpdate(() -> selectAllOnPage(true, null)); - } - } + doAndWaitForUpdate(selectAllBtn::click); } else { - doAndWaitForUpdate(() -> - getGridBar().selectAllRows()); + ReactCheckBox selectAll = selectAllBox(); + if (selectAll.isIndeterminate() || !selectAll.isChecked()) + { + doAndWaitForUpdate(() -> selectAllOnPage(true, null)); + } } return this; @@ -334,22 +326,14 @@ public QueryGrid clearAllSelections() { if(hasItemsSelected()) { - if (isGridPanel()) + WebElement clearBtn = elementCache().clearBtnLoc.findWhenNeeded(elementCache()); + if (clearBtn.isDisplayed()) { - WebElement clearBtn = elementCache().clearBtnLoc.findWhenNeeded(elementCache()); - if (clearBtn.isDisplayed()) - { - doAndWaitForUpdate(clearBtn::click); - } - else - { - doAndWaitForUpdate(() -> selectAllOnPage(false)); - } + doAndWaitForUpdate(clearBtn::click); } else { - doAndWaitForUpdate(() -> - getGridBar().clearAllSelections()); + doAndWaitForUpdate(() -> selectAllOnPage(false)); } } @@ -708,15 +692,6 @@ public void closeChart() elementCache().closeButton.click(); } - /** - * possible this is either a GridPanel, or a QueryGridPanel (QGP is to be deprecated). - * use this to test which one so we can fork behavior until QGP is gone - */ - private boolean isGridPanel() - { - return elementCache().selectionStatusContainerLoc.existsIn(elementCache()); - } - @Override protected ElementCache newElementCache() {