Class AgGrid


  • public class AgGrid
    extends Object
    Custom class to validate the presence of an AgGrid, and interact with it, since it can be tricky. It supports virtualized and non-virtualized tables. It should be used like other custom matchers in the package.
    • Field Detail

      • HEADER_CELL

        public static final Path HEADER_CELL
      • HEADER_TXT

        public static final Path HEADER_TXT
      • ROW

        public static final Path ROW
      • CELL

        public static final Path CELL
      • HEADER_MENU

        public static final Path HEADER_MENU
      • CHECKBOX

        public static final Path CHECKBOX
      • AgGridRoot

        public static final Path AgGridRoot
      • AgBody

        public static final Path AgBody
      • AgList

        public static final Path AgList
      • AgListOption

        public static final Path AgListOption
    • Method Detail

      • rowOfGrid

        public static Path rowOfGrid​(Path gridContainer)
      • row

        public Path row()
      • isVirtualized

        public boolean isVirtualized()
      • setScrollStep

        public void setScrollStep​(int size)
        Override the default step size of scrolling when moving through a grid
        Parameters:
        size - step size in pixels
      • overrideTimeoutDuringOperation

        public void overrideTimeoutDuringOperation​(int millisecs)
        Override the default timeout threshold for finding elements while scrolling the table. The default is 5 milliseconds
        Parameters:
        millisecs - - the timeout in milliseconds
      • overrideTimeoutWhenDone

        public void overrideTimeoutWhenDone​(int millisecs)
        Override the default timeout threshold it reverts to when table operations are done. The default is 5000 milliseconds
        Parameters:
        millisecs - - the timeout in milliseconds
      • clickMenuOfHeader

        public void clickMenuOfHeader​(String headerText)
        Click on the menu of a the column with the given header
        Parameters:
        headerText - - the header text, or the column ID. A string wrapped with curly braces is interpreted as the column ID.
      • clickOnSort

        public void clickOnSort​(String headerText)
        Click on the 'sort' column with the given header
        Parameters:
        headerText - - the header text, or the column ID. A string wrapped with curly braces is interpreted as the column ID.
      • sortBy

        public void sortBy​(String headerText,
                           AgGrid.SortDirection direction)
                    throws Operations.OperationFailedException
        Click on 'sort' so that the given column is sorted in the direction provided.
        Parameters:
        headerText - - the header text, or the column ID. A string wrapped with curly braces is interpreted as the column ID.
        direction - - wanted direction. either descending or ascending.
        Throws:
        Operations.OperationFailedException - operation failed - typically the configuration of the grid does not allow to sort as wanted.
      • showAllColumnsUsingMenuOfColumn

        public void showAllColumnsUsingMenuOfColumn​(String headerText)
        Show all columns by using the popup menu of the given header.
        Parameters:
        headerText - - the header text, or the column ID, to open the popup menu from. A string wrapped with curly braces is interpreted as the column ID.
      • openColumnMenuTabAndGetMenu

        public Path openColumnMenuTabAndGetMenu​(String headerText)
        open the popup menu for the column
        Parameters:
        headerText - - the header text, or the column ID, to open the popup menu from. A string wrapped with curly braces is interpreted as the column ID.
        Returns:
        the Path to the popup menu
      • openColumnFilterTabAndGetMenu

        public Path openColumnFilterTabAndGetMenu​(String headerText)
        open the popup filter for the column
        Parameters:
        headerText - - the header text, or the column ID, to open the popup menu from. A string wrapped with curly braces is interpreted as the column ID.
        Returns:
        the Path to the popup menu
      • openColumnsSelectionMenuAndGetMenu

        public Path openColumnsSelectionMenuAndGetMenu​(String headerText)
        open the popup columns show/hide selection by using a popup of the given column
        Parameters:
        headerText - - the header text, or the column ID, to open the popup menu from. A string wrapped with curly braces is interpreted as the column ID.
        Returns:
        the Path to the popup menu
      • openColumnsSelectionMenuAndGetMenu

        public Path openColumnsSelectionMenuAndGetMenu()
        open the popup columns show/hide selection by using a popup of the first column (assumes it is active)
        Returns:
        the Path to the popup menu
      • showSpecificColumnsUsingMenuOfColumn

        public void showSpecificColumnsUsingMenuOfColumn​(String headerText,
                                                         List<String> columns)
        Show only specific columns, by opening the popup menu of the given column
        Parameters:
        headerText - - the header text, or the column ID, to open the popup menu from. A string wrapped with curly braces is interpreted as the column ID.
        columns - - the columns to show
      • showSpecificColumnsUsingMenuOfColumn

        public void showSpecificColumnsUsingMenuOfColumn​(List<String> columns)
        Show only specific columns, by opening the popup menu of the first column. Assumes that the first column has the popup menu.
        Parameters:
        columns - - the columns to show
      • showAllColumnsUsingFirstColumn

        public void showAllColumnsUsingFirstColumn()
        Show all columns, by opening the popup menu of the first column. Assumes that the first column has the popup menu.
      • getVisibleHeaderPath

        public Path getVisibleHeaderPath​(String headerText)
        Make sure the given column header is visible, and returns a Path element to access it. This is useful to perform direct operations on that element or access other DOM elements contained in the header.
        Parameters:
        headerText - - the header text, or the column ID. A string wrapped with curly braces is interpreted as the column ID.
        Returns:
        the Path element to access the column header
      • setFinalTimeout

        public void setFinalTimeout()
      • ensureVisibilityOfRowWithIndex

        public Path ensureVisibilityOfRowWithIndex​(int n)
        Scroll until the row with the given index is visible, and return a Path element that matches it. Useful for performing operations or accessing fields in the wanted row.
        Parameters:
        n - the number of row in the table, as visible to the user
        Returns:
        a Path element that allows to access the row
      • ensureVisibilityOfRowWithIndexAndColumn

        public Path ensureVisibilityOfRowWithIndexAndColumn​(int index,
                                                            String columnTitle)
        Scroll until the row with the given index, as well as the given column, is visible. It return a Path element that matches the wanted cell in row. Useful for performing operations or accessing fields in the wanted cell (for example: edit it)
        Parameters:
        index - the number of row in the table, as visible to the user
        columnTitle - the header title of the wanted cell in the row
        Returns:
        the Path element to access the wanted cell in the wanted row
      • getRowIndex

        public static int getRowIndex​(Path row)
        assuming the row is already present in the DOM, get its internal index in the table.
        Parameters:
        row - the row we are interested in. Should be the value returned from findRowInBrowser() or ensureVisibilityOfRowWithIndex()
        Returns:
        the internal index of the row in the table
      • getRowIndexOfCell

        public int getRowIndexOfCell​(Path cell)
        assuming the row is already present in the DOM, get its internal index in the table.
        Parameters:
        cell - - the cell in the row we are interested in. Should be the return value of ensureVisibilityOfRowWithIndexAndColumn()
        Returns:
        the internal index of the row in the table
      • findRowIndex

        public int findRowIndex​(Map<String,​ElementProperty> row)
        Find internal index of row within table. This method typically will make sure the row is also visible if it exists, in case the user needs to interact with it, but in some cases ensureVisiblityOfRow will be required.
        Parameters:
        row - - the definition of the row content
        Returns:
        the internal index of the row, if it was found
      • ensureVisibilityOfCellInColumn

        public Path ensureVisibilityOfCellInColumn​(String columnTitle,
                                                   ElementProperty cellContent)
        Find a specific cell under a column, without knowing the row, ensure it is displayed, and return its Path
        Parameters:
        columnTitle - the title of the column to look under
        cellContent - a property that describes the content of the expect cell
        Returns:
        the Path of the found cell. allows to interact with it
      • scrollToLeftSide

        public void scrollToLeftSide()
      • scrollToTop

        public void scrollToTop()
      • ensureVisibilityOfCellInColumnInVisibleRow

        public Path ensureVisibilityOfCellInColumnInVisibleRow​(Path row,
                                                               String columnTitle)
        Find a specific cell under a column, when row is already known and displayed, ensure it is displayed, and return its Path
        Parameters:
        row - the row, which is assumed to be already displayed
        columnTitle - the title of the column to look under
        Returns:
        the Path of the found cell. allows to interact with it
      • ensureVisibilityOfCellInColumnInVisibleRowById

        public Path ensureVisibilityOfCellInColumnInVisibleRowById​(Path row,
                                                                   String columnId)
        Find a specific cell under a column, when row is already known and displayed, ensure it is displayed, and return its Path
        Parameters:
        row - the row, which is assumed to be already displayed
        columnId - the Id the column to look under
        Returns:
        the Path of the found cell. allows to interact with it
      • findTableInBrowser

        public void findTableInBrowser()