Class GridTester<T>
java.lang.Object
com.vaadin.testbench.uiunittest.testers.Tester<com.vaadin.ui.Grid<T>>
com.vaadin.testbench.uiunittest.testers.GridTester<T>
- Direct Known Subclasses:
TreeGridTester
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Simulates clicking cancel button of the editor.cell(int column, int row) Return the content of the cell.voidclick(int column, int row) Simulate click in given cell.voidclickToSelect(int row) Simulate clicking of the multiselect checkbox column of the Grid as a user on a given item.voidclickToSelect(T item) Simulate clicking of the multiselect checkbox column of the Grid as a user on a given item.description(int row) Return the description (aka tooltip) for the row.description(int column, int row) Return the description (aka tooltip) for the cell.protected voidprotected voidvoidedit(int row) Simulate user opening the editor if Grid and Editor are interactable.booleanReturns the open state of the Editor.protected com.vaadin.ui.Grid<T> item(int row) Return data item of the row.voidsave()Simulates clicking save button of the editor.protected voidprotected voidintsize()Return the total amount of rows as reported by DataProvider.styleName(int row) Return the style name (aka CSS class name) for the row.voidtoggleColumnSorting(int columnIndex) Simulate toggling of the sorting direction of the column.voidtoggleColumnVisibility(int columnIndex) Toggles the visibility of the given column by index.voidtoggleColumnVisibility(String caption) Toggles the visibility of the given column by caption value.Methods inherited from class com.vaadin.testbench.uiunittest.testers.Tester
errorMessage, fireSimulatedEvent, focus, isFocused, isInteractable, isInvalid, shortcut, shortcut
-
Constructor Details
-
GridTester
-
-
Method Details
-
cell
Return the content of the cell. If ComponentRenderer was used it is the Component produced by the renderer otherwise it is the value. Asserts that column is visible.- Parameters:
column- Column index including hidden columnsrow- The row index- Returns:
- Cell content
-
description
Return the description (aka tooltip) for the row.- Parameters:
row- The row index, base 0- Returns:
- Description String
-
description
Return the description (aka tooltip) for the cell.- Parameters:
column- Column index including hidden columnsrow- The row index, base 0- Returns:
- Description String
-
styleName
Return the style name (aka CSS class name) for the row.- Parameters:
row- The row index, base 0- Returns:
- Style name String
-
item
Return data item of the row.- Parameters:
row- Row index- Returns:
- The item
-
size
public int size()Return the total amount of rows as reported by DataProvider.- Returns:
- int value
-
click
public void click(int column, int row) Simulate click in given cell. Will trigger ItemClick event as a user. If selection mode is Single, selection is updated accordingly. Asserts that column is visible.- Parameters:
column- Column index including hidden columnsrow- Row index
-
clickToSelect
public void clickToSelect(int row) Simulate clicking of the multiselect checkbox column of the Grid as a user on a given item.- Parameters:
row- The row index
-
clickToSelect
Simulate clicking of the multiselect checkbox column of the Grid as a user on a given item.- Parameters:
item- Item
-
edit
public void edit(int row) Simulate user opening the editor if Grid and Editor are interactable. This will fire EditorOpenEvent and populate the editor with the item.Note: There is a limitation. Programmatic opening of the editor from application logic will require client round trip, which is not possible in Unit testing. E.g. if you have ItemClickListener that opens the editor, clicking the item will do nothing.
- Parameters:
row- Row index to start the editor- See Also:
-
editorOpen
public boolean editorOpen()Returns the open state of the Editor.- Returns:
- boolean value
- See Also:
-
save
public void save()Simulates clicking save button of the editor. If Editor is in buffered mode, bean is written if is valid. Validation errors will prevent editor saving and closing. If save is success, Editor is closed and EditorSaveEvent will be fired.Note: There is a limitation. Programmatic saving of the editor from application logic will require client round trip, which is not possible in Unit testing. E.g. if you have logic that force saves the editor, it will do nothing.
- See Also:
-
cancel
public void cancel()Simulates clicking cancel button of the editor. If Editor is in buffered mode, bean is not written and Grid is not updated. Editor is closed.- See Also:
-
toggleColumnVisibility
public void toggleColumnVisibility(int columnIndex) Toggles the visibility of the given column by index. The ColumnVisibilityChangeEvent fired will have userOriginated = true.- Parameters:
columnIndex- int
-
toggleColumnVisibility
Toggles the visibility of the given column by caption value. The ColumnVisibilityChangeEvent fired will have userOriginated = true.- Parameters:
caption- The caption as string
-
toggleColumnSorting
public void toggleColumnSorting(int columnIndex) Simulate toggling of the sorting direction of the column. Asserts that column is visible. SortEvent fired will have userOriginated = true.- Parameters:
columnIndex- Index of the column including hidden columns.
-
select
-
deselect
-
select
-
deselect
-
getComponent
- Overrides:
getComponentin classTester<com.vaadin.ui.Grid<T>>
-