Package org.xwiki.livedata.test.po
Class TableLayoutElement
- java.lang.Object
-
- org.xwiki.test.ui.po.BaseElement
-
- org.xwiki.livedata.test.po.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 Summary
Fields Modifier and Type Field Description static StringFILTER_COLUMN_SELECTIZE_WAIT_FOR_SUGGESTIONSOption forfilterColumn(String, String, boolean, Map)to wait for selectize fields suggestions before continuing.
-
Constructor Summary
Constructors Constructor Description TableLayoutElement(String liveDataId)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertCellWithCopyAction(String columnName, org.xwiki.model.reference.EntityReference entity)Assert if the column contains an edit action.voidassertCellWithDeleteAction(String columnName, org.xwiki.model.reference.EntityReference entityReference)Assert if the column contains a delete action.voidassertCellWithEditAction(String columnName, org.xwiki.model.reference.EntityReference entityReference)Assert if the column contains an edit action.voidassertCellWithLink(String columnName, String text, String link)Assert if the column contains a link with the given name and url.voidassertCellWithRenameAction(String columnName, org.xwiki.model.reference.EntityReference entityReference)Assert if the column contains an edit action.voidassertCellWithRightsAction(String columnName, org.xwiki.model.reference.EntityReference entityReference)Assert if the column contains an edit action.voidassertRow(String columnLabel, String value)Assert if the column contains a value.voidassertRow(String columnLabel, org.hamcrest.Matcher<Iterable<? super org.openqa.selenium.WebElement>> matcher)Calls aMatcheron the column values.voidclickAction(int rowNumber, String actionName)Clicks on an action button identified by its name, on a given row.intcountRows()voideditAndCancel(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.voideditCell(String columnLabel, int rowNumber, String fieldName, String newValue)Set a new value to a field in the nth cell of a column.voidfilterColumn(String columnLabel, String content)Set the value in the filter of a column and wait for the filtered results to be displayed.voidfilterColumn(String columnLabel, String content, boolean wait)Set the value in the filter of a column.voidfilterColumn(String columnLabel, String content, boolean wait, Map<String,Object> options)Set the value in the filter of a column.org.openqa.selenium.WebElementfindElementInRow(int rowNumber, org.openqa.selenium.By by)Returns a singleWebElementfound by passingbytoWebElement.findElement(By)on theWebElementof the requested row.org.openqa.selenium.WebElementgetCell(String columnLabel, int rowNumber)Return theWebElementof a cell by its row and column numbers.org.hamcrest.Matcher<org.openqa.selenium.WebElement>getDatePatternMatcher()Return a hamcrestMatcher.org.openqa.selenium.WebElementgetDropDownButton()Return theWebElementof the dropdown button.org.openqa.selenium.WebElementgetFilter(String columnLabel)Get the filter for the given column.List<String>getFilterValues(String columnLabel)Return the current values of the filter of a given column.Set<String>getPaginationSizes()intgetRowIndexForElement(org.openqa.selenium.By by)Get the 1-based row index of an element, relative to the number of currently displayed rows.org.hamcrest.Matcher<org.openqa.selenium.WebElement>getWebElementCellWithLinkMatcher(String text, String link)Return a hamcrestMatcheron the links of aWebElement.org.hamcrest.Matcher<org.openqa.selenium.WebElement>getWebElementTextMatcher(String value)Return a hamcrestMatcheron the text of aWebElement.voidwaitUntilReady()Waits until the table has content displayed and loaded.voidwaitUntilReady(boolean expectRows)Waits until the table is loaded.voidwaitUntilRowCountEqualsTo(int expectedRowCount)Waits until a the number of rows displayed in the live data matches the expected count.voidwaitUntilRowCountEqualsTo(int expectedRowCount, int timeout)Waits until a the number of rows displayed in the live data matches the expected count.voidwaitUntilRowCountGreaterThan(int minimalExpectedRowCount)Waits until a minimal number of rows are displayed in the live data.voidwaitUntilRowCountGreaterThan(int minimalExpectedRowCount, int timeout)Waits until a minimal number of rows are displayed in the live data.-
Methods inherited from class org.xwiki.test.ui.po.BaseElement
getDriver, getUtil, isElementVisible, setContext, waitForNotificationErrorMessage, waitForNotificationInProgressMessage, waitForNotificationSuccessMessage, waitForNotificationWarningMessage, waitUntilPageIsReady
-
-
-
-
Field Detail
-
FILTER_COLUMN_SELECTIZE_WAIT_FOR_SUGGESTIONS
public static final String FILTER_COLUMN_SELECTIZE_WAIT_FOR_SUGGESTIONS
Option forfilterColumn(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. SeeassertRow(String, Matcher)to use another matcher on the column values.- Parameters:
columnLabel- a column label (for instanceTitle)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 aMatcheron the column values.- Parameters:
columnLabel- a column label (for instanceTitle)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 nametext- the text of the link to be found in the columnlink- 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 nameentityReference- 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 nameentityReference- 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 nameentity- 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 nameentityReference- 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 nameentityReference- 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, seewaitUntilReady(boolean).- Since:
- 12.10.9
- See Also:
waitUntilReady(boolean)
-
waitUntilReady
public void waitUntilReady(boolean expectRows)
Waits until the table is loaded. UsewaitUntilReady()for the default behavior.- Parameters:
expectRows- whentruewaits for rows to be loaded, whenfalsecontinue 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 rowstimeout- 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 rowstimeout- a custom timeout before stopping the wait and raising an error
-
filterColumn
public void filterColumn(String columnLabel, String content)
Set the value in the filter of a column and wait for the filtered results to be displayed. SeefilterColumn(String, String, boolean)to filter without waiting.- Parameters:
columnLabel- the label of the column to filter, for instance"Title"content- the content to set on the filter- See Also:
filterColumn(String, String, boolean)
-
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 whenwaitsistrue.- Parameters:
columnLabel- the label of the column to filter, for instance"Creation Date"content- the content to set on the filterwait- whentruewaits 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 whenwaitsistrue.- Parameters:
columnLabel- the label of the column to filter, for instance"Creation Date"content- the content to set on the filterwait- whentruewaits 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 theWebElementof 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
WebElementof 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
WebElementfor 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 rowactionName- 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 columnrowNumber- 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 propertynewValue- 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 columnrowNumber- 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 propertynewValue- 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 singleWebElementfound by passingbytoWebElement.findElement(By)on theWebElementof the requested row.- Parameters:
rowNumber- the requested row by its row number, the first row has the number1by- the selector to apply on the row web element- Returns:
- the
WebElementfound on the row
-
getWebElementTextMatcher
public org.hamcrest.Matcher<org.openqa.selenium.WebElement> getWebElementTextMatcher(String value)
Return a hamcrestMatcheron the text of aWebElement. For instance theMatcherwill 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 byWebElement.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 hamcrestMatcher. This matcher assert that the text of aWebElementmatches the date patternYYYY/MM/DD HH:mm.- Returns:
- 13.5RC1
-
getWebElementCellWithLinkMatcher
public org.hamcrest.Matcher<org.openqa.selenium.WebElement> getWebElementCellWithLinkMatcher(String text, String link)
Return a hamcrestMatcheron the links of aWebElement. This matcher matches when a link is found on theWebElementwith the expected text and link. For instance, theMatcherwill 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 textlink- the expected link- Returns:
- a matcher instance
- Since:
- 13.5RC1, 13.4.1
-
getDropDownButton
public org.openqa.selenium.WebElement getDropDownButton()
Return theWebElementof the dropdown button.- Returns:
- the
WebElementof the dropdown button - Since:
- 13.10RC1, 13.4.5
-
-