feat: add GridElement methods to read cell contents in bulk - #8513
Open
Artur- wants to merge 5 commits into
Open
feat: add GridElement methods to read cell contents in bulk#8513Artur- wants to merge 5 commits into
Artur- wants to merge 5 commits into
Conversation
Artur-
force-pushed
the
grid-dump-cells
branch
from
January 22, 2026 08:54
f7d3db7 to
5749ad2
Compare
|
Contributor
|
@Artur- , would you like to proceed with the change and mark it ready for review or there is anything you would like to adjust in the PR or have a discussion about? |
Add three new methods to GridElement for efficient grid cell extraction: - dumpVisibleCells(): dumps currently visible cells in one browser round-trip - dumpAllCells(): dumps all grid cells by scrolling through pages - dumpCells(fromRow, toRow): dumps cells for a specific row range This addresses the performance issue when testing grid content, reducing browser round-trips from N×M (one per cell) to 1-50 requests depending on grid size, resulting in 20-500x performance improvement. Only visible columns are included in the output. Hidden columns are filtered out automatically. Fixes #1876
Rename dump* to get*CellContents to match GridElement naming. Fix row ordering in the visible-rows dump, match GridTHTDElement.getText() text extraction exactly, deduplicate the extraction JS into one shared snippet, and drop the flaky timing assertion.
Member
Author
|
Updated to make more sense and work better |
Artur-
marked this pull request as ready for review
July 7, 2026 09:24
getCellContents(0, 0) on an empty grid threw with a broken "0..-1" bound. Detect the empty grid first and throw with a clear message. getAllCellContents keeps returning an empty list.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Reading grid data in a TestBench test today means calling
getCell(row, col).getText()for every cell, and each call is a separate browser round-trip. For anything larger
than a handful of rows this is very slow, and there is no built-in way to grab the
data the grid is showing as a plain 2D structure to compare against expected values.
This adds three methods to
GridElementthat read cell text in bulk:getVisibleCellContents()— the rows currently in the viewport, in one round-trip.getCellContents(fromRow, toRow)— a specific row range, scrolling as needed toload the rows.
getAllCellContents()— every row, by scrolling through all pages.All three return
List<List<String>>(rows of visible-column text). The text of eachcell matches
GridTHTDElement.getText(), so existing expected-value comparisons keepworking. Hidden columns are excluded, and rows are always returned in row-index order
(the grid recycles row elements, so DOM order does not match visual order).
The extraction runs in the browser as a single
executeScriptper rendered windowinstead of one request per cell, which is the whole point: for a grid with N rows and
M columns this replaces N×M round-trips with 1 (viewport) or roughly one per page
(range/all).
The extraction reads the rendered DOM rather than the server-side data provider, so
the result reflects what the grid actually shows, including what renderers produced.
Tests cover small/medium/large and callback-backed grids, hidden columns, invalid
ranges, parity with
getCell().getText(), and that the viewport dump returns exactlythe visible rows in order.
Fixes vaadin/testbench#1876