Class TreeGridElement

  • All Implemented Interfaces:
    com.vaadin.testbench.commands.CanCompareScreenshots, com.vaadin.testbench.HasCallFunction, com.vaadin.testbench.HasDriver, com.vaadin.testbench.HasElementQuery, com.vaadin.testbench.HasPropertySettersGetters, com.vaadin.testbench.HasSearchContext, com.vaadin.testbench.HasTestBenchCommandExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsElement

    public class TreeGridElement
    extends GridElement
    TestBench Element API for TreeGrid.
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeGridElement()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collapseWithClick​(int rowIndex)
      Collapses the row at the given index in the grid.
      void collapseWithClick​(int rowIndex, int hierarchyColumnIndex)
      Collapses the row at the given index in the grid with the given hierarchical column index.
      void expandWithClick​(int rowIndex)
      Expands the row at the given index in the grid.
      void expandWithClick​(int rowIndex, int hierarchyColumnIndex)
      Expands the row at the given index in the grid with the given hierarchical column index.
      GridTHTDElement getCellWaitForRow​(int rowIndex, int colIndex)
      Gets the grid cell for the given row and column index.
      GridTHTDElement getCellWaitForRow​(int rowIndex, GridColumnElement column)
      Gets the grid cell for the given row and column.
      org.openqa.selenium.WebElement getComponentRendererElement​(int rowIndex, int columnIndex)
      Gets the 'flow-component-renderer' element for the given row.
      org.openqa.selenium.WebElement getExpandToggleElement​(int rowIndex, int hierarchyColumnIndex)
      Gets the 'vaadin-grid-tree-toggle' element for the given row.
      long getNumberOfExpandedRows()
      Returns a number of expanded rows in the grid element.
      boolean hasComponentRenderer​(int rowIndex, int columnIndex, org.openqa.selenium.By searchContentBy)
      Check whether the given indices correspond to a cell that contains a visible component renderer with the optional search locator By.
      boolean hasExpandToggle​(int rowIndex, int hierarchyColumnIndex)
      Check whether the given indices correspond to a cell that contains a visible hierarchy toggle element.
      boolean hasRow​(int row)
      Returns true if given index has tr element for the row
      boolean isDetailsOpen​(int rowIndex)
      Returns true if details are open or the given row index.
      protected boolean isLoading()  
      boolean isLoadingExpandedRows()
      Returns true if grid is loading expanded rows.
      boolean isRowCollapsed​(int rowIndex, int hierarchyColumnIndex)
      Returns whether the row at the given index is collapsed or not.
      boolean isRowExpanded​(int rowIndex, int hierarchyColumnIndex)
      Returns whether the row at the given index is expanded or not.
      void scrollToRowAndWait​(int row)
      Scrolls to the row with the given index.
      • Methods inherited from class com.vaadin.testbench.TestBenchElement

        callFunction, clear, click, click, compareScreen, compareScreen, compareScreen, contextClick, dispatchEvent, dispatchEvent, doubleClick, equals, executeScript, findElement, findElements, focus, getAttribute, getCapabilities, getChildren, getClassNames, getCommandExecutor, getContext, getCssValue, getDriver, getId, getLocation, getParent, getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, hover, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isReadOnly, isSelected, scroll, scrollIntoView, scrollLeft, sendKeys, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
      • Methods inherited from interface com.vaadin.testbench.HasElementQuery

        $, $
      • Methods inherited from interface org.openqa.selenium.WebElement

        getAccessibleName, getAriaRole, getDomAttribute, getDomProperty
    • Constructor Detail

      • TreeGridElement

        public TreeGridElement()
    • Method Detail

      • scrollToRowAndWait

        public void scrollToRowAndWait​(int row)
        Scrolls to the row with the given index.
        Parameters:
        row - the row to scroll to
      • getCellWaitForRow

        public GridTHTDElement getCellWaitForRow​(int rowIndex,
                                                 int colIndex)
        Gets the grid cell for the given row and column index.

        For the column index, only visible columns are taken into account.

        Automatically scrolls the given row into view and waits for the row to load.

        Parameters:
        rowIndex - the row index
        colIndex - the column index
        Returns:
        the grid cell for the given coordinates
      • getCellWaitForRow

        public GridTHTDElement getCellWaitForRow​(int rowIndex,
                                                 GridColumnElement column)
        Gets the grid cell for the given row and column.

        Automatically scrolls the given row into view and waits for the row to load.

        Parameters:
        rowIndex - the row index
        column - the column element for the column
        Returns:
        the grid cell for the given coordinates
      • expandWithClick

        public void expandWithClick​(int rowIndex)
        Expands the row at the given index in the grid. This expects the first column to have the hierarchy data.
        Parameters:
        rowIndex - 0-based row index to expand
        See Also:
        expandWithClick(int, int)
      • expandWithClick

        public void expandWithClick​(int rowIndex,
                                    int hierarchyColumnIndex)
        Expands the row at the given index in the grid with the given hierarchical column index.
        Parameters:
        rowIndex - 0-based row index to expand
        hierarchyColumnIndex - 0-based index of the hierarchy column
      • collapseWithClick

        public void collapseWithClick​(int rowIndex)
        Collapses the row at the given index in the grid. This expects the first column to have the hierarchy data.
        Parameters:
        rowIndex - 0-based row index to collapse
        See Also:
        collapseWithClick(int, int)
      • collapseWithClick

        public void collapseWithClick​(int rowIndex,
                                      int hierarchyColumnIndex)
        Collapses the row at the given index in the grid with the given hierarchical column index.
        Parameters:
        rowIndex - 0-based row index to collapse
        hierarchyColumnIndex - 0-based index of the hierarchy column
      • isRowExpanded

        public boolean isRowExpanded​(int rowIndex,
                                     int hierarchyColumnIndex)
        Returns whether the row at the given index is expanded or not.
        Parameters:
        rowIndex - 0-based row index
        hierarchyColumnIndex - 0-based index of the hierarchy column
        Returns:
        true if expanded, false if collapsed
      • isRowCollapsed

        public boolean isRowCollapsed​(int rowIndex,
                                      int hierarchyColumnIndex)
        Returns whether the row at the given index is collapsed or not.
        Parameters:
        rowIndex - 0-based row index
        hierarchyColumnIndex - 0-based index of the hierarchy column
        Returns:
        true if collapsed, false if expanded
      • hasComponentRenderer

        public boolean hasComponentRenderer​(int rowIndex,
                                            int columnIndex,
                                            org.openqa.selenium.By searchContentBy)
        Check whether the given indices correspond to a cell that contains a visible component renderer with the optional search locator By.
        Parameters:
        rowIndex - 0-based row index
        columnIndex - 0-based index of the column
        searchContentBy - Search for specific content. May be null.
        Returns:
        true if this cell has the component renderer visible with the optional search locator
      • hasExpandToggle

        public boolean hasExpandToggle​(int rowIndex,
                                       int hierarchyColumnIndex)
        Check whether the given indices correspond to a cell that contains a visible hierarchy toggle element.
        Parameters:
        rowIndex - 0-based row index
        hierarchyColumnIndex - 0-based index of the hierarchy column
        Returns:
        true if this cell has the expand toggle visible
      • getExpandToggleElement

        public org.openqa.selenium.WebElement getExpandToggleElement​(int rowIndex,
                                                                     int hierarchyColumnIndex)
        Gets the 'vaadin-grid-tree-toggle' element for the given row.
        Parameters:
        rowIndex - 0-based row index
        hierarchyColumnIndex - 0-based index of the hierarchy column
        Returns:
        the span element that is clicked for expanding/collapsing a rows
        Throws:
        org.openqa.selenium.NoSuchElementException - if there is no expand element for this row
      • getComponentRendererElement

        public org.openqa.selenium.WebElement getComponentRendererElement​(int rowIndex,
                                                                          int columnIndex)
        Gets the 'flow-component-renderer' element for the given row.
        Parameters:
        rowIndex - 0-based row index
        columnIndex - 0-based index of the column
        Returns:
        the component renderer element
        Throws:
        org.openqa.selenium.NoSuchElementException - if there is no component renderer element for this row
      • getNumberOfExpandedRows

        public long getNumberOfExpandedRows()
        Returns a number of expanded rows in the grid element. Notice that returned number does not mean that grid has yet finished rendering all visible expanded rows.
        Returns:
        the number of expanded rows
      • isDetailsOpen

        public boolean isDetailsOpen​(int rowIndex)
        Returns true if details are open or the given row index.
        Parameters:
        rowIndex - the 0-based row index
        Returns:
        true if details are shown in the target row
      • hasRow

        public boolean hasRow​(int row)
        Returns true if given index has tr element for the row
        Parameters:
        row - the row index
        Returns:
        true if there is tr element for the row, false otherwise
      • isLoadingExpandedRows

        public boolean isLoadingExpandedRows()
        Returns true if grid is loading expanded rows.
        Returns:
        true if grid is loading expanded rows, false otherwise