Class TableLayoutElement


  • public class TableLayoutElement
    extends BaseElement
    Provides the operations to interact with a Live Data when displayed with a table layout.
    Since:
    13.4RC1
    Version:
    $Id: 25b384f0a6c33bc95ca7fbc5b8dcf0a0c64de826 $
    • Field Detail

      • FILTER_COLUMN_SELECTIZE_WAIT_FOR_SUGGESTIONS

        public static final String FILTER_COLUMN_SELECTIZE_WAIT_FOR_SUGGESTIONS
        Option for filterColumn(String, String, boolean, Map) to wait for selectize fields suggestions before continuing. The default behavior being to use the typed text as the selected value without waiting.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TableLayoutElement

        public TableLayoutElement​(String liveDataId)
        Default constructor. Initializes a live data table layout page object.
        Parameters:
        liveDataId - the live data id
        Since:
        12.10.9
    • Method Detail

      • assertRow

        public void assertRow​(String columnLabel,
                              String value)
        Assert if the column contains a value. See assertRow(String, Matcher) to use another matcher on the column values.
        Parameters:
        columnLabel - a column label (for instance Title)
        value - the value to be found in the column
        Since:
        12.10.9
        See Also:
        assertRow(String, Matcher)
      • assertRow

        public void assertRow​(String columnLabel,
                              org.hamcrest.Matcher<Iterable<? super org.openqa.selenium.WebElement>> matcher)
        Calls a Matcher on the column values.
        Parameters:
        columnLabel - a column label (for instance Title)
        matcher - the matcher to apply on the values of the column
        Since:
        13.5RC1, 13.4.1, 12.10.9
        See Also:
        assertRow(String, String)
      • assertCellWithLink

        public void assertCellWithLink​(String columnName,
                                       String text,
                                       String link)
        Assert if the column contains a link with the given name and url.
        Parameters:
        columnName - the column name
        text - the text of the link to be found in the column
        link - the href value of the link to be found in the column
      • assertCellWithDeleteAction

        public void assertCellWithDeleteAction​(String columnName,
                                               org.xwiki.model.reference.EntityReference entityReference)
        Assert if the column contains a delete action.
        Parameters:
        columnName - the column name
        entityReference - the entity reference subject of the delete action
        Since:
        13.5RC1
      • assertCellWithEditAction

        public void assertCellWithEditAction​(String columnName,
                                             org.xwiki.model.reference.EntityReference entityReference)
        Assert if the column contains an edit action.
        Parameters:
        columnName - the column name
        entityReference - the entity reference subject of the edit action
        Since:
        13.5RC1
      • assertCellWithCopyAction

        public void assertCellWithCopyAction​(String columnName,
                                             org.xwiki.model.reference.EntityReference entity)
        Assert if the column contains an edit action.
        Parameters:
        columnName - the column name
        entity - the entity reference subject of the edit action
        Since:
        13.5RC1
      • assertCellWithRenameAction

        public void assertCellWithRenameAction​(String columnName,
                                               org.xwiki.model.reference.EntityReference entityReference)
        Assert if the column contains an edit action.
        Parameters:
        columnName - the column name
        entityReference - the entity reference subject of the edit action
        Since:
        13.5RC1
      • assertCellWithRightsAction

        public void assertCellWithRightsAction​(String columnName,
                                               org.xwiki.model.reference.EntityReference entityReference)
        Assert if the column contains an edit action.
        Parameters:
        columnName - the column name
        entityReference - the entity reference subject of the edit action
        Since:
        13.5RC1
      • waitUntilReady

        public void waitUntilReady()
        Waits until the table has content displayed and loaded. If you expect the Live Data to be displayed without content, see waitUntilReady(boolean).
        Since:
        12.10.9
        See Also:
        waitUntilReady(boolean)
      • waitUntilReady

        public void waitUntilReady​(boolean expectRows)
        Waits until the table is loaded. Use waitUntilReady() for the default behavior.
        Parameters:
        expectRows - when true waits for rows to be loaded, when false continue without waiting for the content
        Since:
        12.10.9
        See Also:
        waitUntilReady()
      • waitUntilRowCountGreaterThan

        public void waitUntilRowCountGreaterThan​(int minimalExpectedRowCount)
        Waits until a minimal number of rows are displayed in the live data.
        Parameters:
        minimalExpectedRowCount - the minimal number of expected rows
        See Also:
        if you want to define a custom timeout
      • waitUntilRowCountGreaterThan

        public void waitUntilRowCountGreaterThan​(int minimalExpectedRowCount,
                                                 int timeout)
        Waits until a minimal number of rows are displayed in the live data.
        Parameters:
        minimalExpectedRowCount - the minimal number of expected rows
        timeout - a custom timeout before stopping the wait and raising an error
      • waitUntilRowCountEqualsTo

        public void waitUntilRowCountEqualsTo​(int expectedRowCount)
        Waits until a the number of rows displayed in the live data matches the expected count.
        Parameters:
        expectedRowCount - the number of expected rows
        See Also:
        if you want to define a custom timeout
      • waitUntilRowCountEqualsTo

        public void waitUntilRowCountEqualsTo​(int expectedRowCount,
                                              int timeout)
        Waits until a the number of rows displayed in the live data matches the expected count.
        Parameters:
        expectedRowCount - the number of expected rows
        timeout - a custom timeout before stopping the wait and raising an error
      • filterColumn

        public void filterColumn​(String columnLabel,
                                 String content,
                                 boolean wait)
        Set the value in the filter of a column. Waits for the new filtered values to be displayed before continuing when waits is true.
        Parameters:
        columnLabel - the label of the column to filter, for instance "Creation Date"
        content - the content to set on the filter
        wait - when true waits for the filtered results to be displayed before continuing, otherwise continues without waiting (useful when updating several filters in a row).
        See Also:
        filterColumn(String, String)
      • filterColumn

        public void filterColumn​(String columnLabel,
                                 String content,
                                 boolean wait,
                                 Map<String,​Object> options)
        Set the value in the filter of a column. Waits for the new filtered values to be displayed before continuing when waits is true.
        Parameters:
        columnLabel - the label of the column to filter, for instance "Creation Date"
        content - the content to set on the filter
        wait - when true waits for the filtered results to be displayed before continuing, otherwise continues without waiting (useful when updating several filters in a row).
        options - additional options that are only relevant for specific type of fields (e.g., for selectize based fields only)
        Since:
        14.8RC1
        See Also:
        filterColumn(String, String), filterColumn(String, String, boolean)
      • getFilterValues

        public List<String> getFilterValues​(String columnLabel)
        Return the current values of the filter of a given column. We return a list of values because some filters can have several values (e.g., a selectized field).
        Parameters:
        columnLabel - the label of the column (for instance, Name)
        Returns:
        the current values of the filter
        Since:
        13.9, 13.10RC1, 13.4.4
      • countRows

        public int countRows()
        Returns:
        the number of rows currently displayed in the live data
        Since:
        12.10.9
      • getCell

        public org.openqa.selenium.WebElement getCell​(String columnLabel,
                                                      int rowNumber)
        Return the WebElement of a cell by its row and column numbers. For instance the second row of the first column is (2, 1)
        Parameters:
        columnLabel - the label of the column to get, for instance "Title"
        rowNumber - the cell row number to get, starting at 1. For instance the second column has the number 2
        Returns:
        the WebElement of the requested cell
      • getRowIndexForElement

        public int getRowIndexForElement​(org.openqa.selenium.By by)
        Get the 1-based row index of an element, relative to the number of currently displayed rows.
        Parameters:
        by - the selector of the searched element
        Returns:
        the 1-based row index where the element was found, or 0 if it doesn't exist
        Since:
        14.8RC1
      • getFilter

        public org.openqa.selenium.WebElement getFilter​(String columnLabel)
        Get the filter for the given column.
        Parameters:
        columnLabel - the label of the column to get the filter element for, for instance "Title"
        Returns:
        The WebElement for the given column filter.
        Since:
        13.10RC1
      • getPaginationSizes

        public Set<String> getPaginationSizes()
        Returns:
        the list of pagination size choices proposed by the pagination select field
        Since:
        14.7RC1
      • clickAction

        public void clickAction​(int rowNumber,
                                String actionName)
        Clicks on an action button identified by its name, on a given row.
        Parameters:
        rowNumber - the row number, for instance 3 for the third row
        actionName - the name of the action button to click on
      • editCell

        public void editCell​(String columnLabel,
                             int rowNumber,
                             String fieldName,
                             String newValue)
        Set a new value to a field in the nth cell of a column. Waits for the cell to be successfully edited before continuing.
        Parameters:
        columnLabel - the label of the column
        rowNumber - the number of the row to update (the first line is number 1)
        fieldName - the name of the field to edit, in other word the name of the corresponding XClass property
        newValue - the new value of the field
      • editAndCancel

        public void editAndCancel​(String columnLabel,
                                  int rowNumber,
                                  String fieldName,
                                  String newValue)
        Starts editing a cell, input a value, but cancel the edition (by pressing escape) instead of saving.
        Parameters:
        columnLabel - the label of the column
        rowNumber - the number of the row to update (the first line is number 1)
        fieldName - the name of the field to edit, in other word the name of the corresponding XClass property
        newValue - the new value set of the field, but never saved because we cancel the edition
        Since:
        13.5RC1, 13.4.1
      • findElementInRow

        public org.openqa.selenium.WebElement findElementInRow​(int rowNumber,
                                                               org.openqa.selenium.By by)
        Returns a single WebElement found by passing by to WebElement.findElement(By) on the WebElement of the requested row.
        Parameters:
        rowNumber - the requested row by its row number, the first row has the number 1
        by - the selector to apply on the row web element
        Returns:
        the WebElement found on the row
      • getWebElementTextMatcher

        public org.hamcrest.Matcher<org.openqa.selenium.WebElement> getWebElementTextMatcher​(String value)
        Return a hamcrest Matcher on the text of a WebElement. For instance the Matcher will match on the web element containing the following html source <p>Te<i>st</i></p> for the value "Test".
        Parameters:
        value - the expected value of the text returned by WebElement.getText()
        Returns:
        a matcher instance
        Since:
        13.5RC1, 13.4.1, 12.10.9
      • getDatePatternMatcher

        public org.hamcrest.Matcher<org.openqa.selenium.WebElement> getDatePatternMatcher()
        Return a hamcrest Matcher. This matcher assert that the text of a WebElement matches the date pattern YYYY/MM/DD HH:mm.
        Returns:
        13.5RC1
      • getWebElementCellWithLinkMatcher

        public org.hamcrest.Matcher<org.openqa.selenium.WebElement> getWebElementCellWithLinkMatcher​(String text,
                                                                                                     String link)
        Return a hamcrest Matcher on the links of a WebElement. This matcher matches when a link is found on the WebElement with the expected text and link. For instance, the Matcher will match on the web element containing the following html source <p>Links: <a href="/path">label</a>, <a href="/path2">label2</a></p> for the text "label" and the link "/path".
        Parameters:
        text - the expected text
        link - the expected link
        Returns:
        a matcher instance
        Since:
        13.5RC1, 13.4.1
      • getDropDownButton

        public org.openqa.selenium.WebElement getDropDownButton()
        Return the WebElement of the dropdown button.
        Returns:
        the WebElement of the dropdown button
        Since:
        13.10RC1, 13.4.5