AgGrid

public class AgGrid

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.

Fields

AgBody

public static final Path AgBody

AgGridRoot

public static final Path AgGridRoot

AgList

public static final Path AgList

AgListOption

public static final Path AgListOption

CELL

public static final Path CELL

CHECKBOX

public static final Path CHECKBOX

COL_ID

public static final String COL_ID

HEADER_CELL

public static final Path HEADER_CELL

HEADER_MENU

public static final Path HEADER_MENU

HEADER_TXT

public static final Path HEADER_TXT

ROW

public static final Path ROW

Methods

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.

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

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

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

findTableInBrowser

public void findTableInBrowser()

getBuilder

public static AgGridBuilder getBuilder()

getRowIndex

public 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

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

hasIndex

static ElementProperty hasIndex(int ind)

isVirtualized

public boolean isVirtualized()

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

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

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

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

rowOfGrid

public static Path rowOfGrid(Path gridContainer)

setFinalTimeout

public void setFinalTimeout()

setScrollStep

public void setScrollStep(int size)

Override the default step size of scrolling when moving through a grid

Parameters:
  • size – step size in pixels

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.

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.

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

sortBy

public void sortBy(String headerText, SortDirection direction)

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:
  • OperationFailedException – operation failed - typically the configuration of the grid does not allow to sort as wanted.

toString

public String toString()