From 23a0657c03dfe81f1b13b373b2cdd6f7eb75bffe Mon Sep 17 00:00:00 2001 From: mikhail Date: Mon, 21 Sep 2026 11:43:39 +0300 Subject: [PATCH 1/2] docs: explain what a browserless query can and cannot find A query walks the server-side component tree, so it misses a component that a renderer creates per item and the content of a closed overlay. The page said nothing about either, and the empty result reads as a missing component rather than an unrendered one. Adds a section covering component columns, the GridTester methods that reach those components, Lit renderer columns, and overlay content, and records that Grid header, footer, and editor components are part of the tree as of Vaadin 25.3. Co-Authored-By: Claude Opus 5 (1M context) --- .../testing/browserless/component-query.adoc | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/articles/flow/testing/browserless/component-query.adoc b/articles/flow/testing/browserless/component-query.adoc index 7ad1d61b4b..91772878b6 100644 --- a/articles/flow/testing/browserless/component-query.adoc +++ b/articles/flow/testing/browserless/component-query.adoc @@ -240,4 +240,53 @@ TextField textField = findInView(VerticalLayout.class) ---- +== Components a Query Cannot Find + +A query walks the server-side component tree. A component that another component renders per item, and the content of an overlay that is closed, are not in that tree, and a query returns an empty result for them instead of an error. The failure therefore reads as though the component was never created. + + +=== Components a Renderer Creates + +A component column creates its component while rendering a row, and no row renders on its own in a browserless test: + +[source,java] +---- +grid.addComponentColumn(person -> new Checkbox(person.isSubscriber())) + .setKey("subscriber"); + +// Finds nothing: no row has rendered yet +List checkboxes = find(Checkbox.class).all(); +---- + +[classname]`GridTester` renders the cell on request: + +[source,java] +---- +Checkbox checkbox = (Checkbox) test(grid).getCellComponent(0, "subscriber"); +test(checkbox).click(); +---- + +Every call renders the cell again and attaches the new instance to the grid, so asking twice for the same cell leaves two instances behind, and a later query reports both. Keep the component the tester returns instead of asking for it again. + +A [classname]`LitRenderer` column has no server-side component at all. Read it with [methodname]`getCellText(row, column)`, [methodname]`getLitRendererPropertyValue(...)`, or [methodname]`invokeLitRendererFunction(...)`. + +[since:com.vaadin:vaadin@V25.3]#A component set as a column header, footer, or editor is part of the tree, and a query finds it.# Such a component is reported once, even when it sits in a header cell that spans several columns. + + +=== Overlay Content + +The content of an overlay, such as a context menu, is attached to the UI only while the overlay is open, so a top-level query does not see it. Query it through the overlay's own tester, or open the overlay first. See <> for both approaches. + +[source,java] +---- +// Empty while the menu is closed +find(Div.class).withText("Rename").all(); + +test(menu).open(); + +// One match +find(Div.class).withText("Rename").all(); +---- + + [discussion-id]`DDC7D136-1A56-44FC-B256-C15DB7645EDC` From 93ba5f7b0e5a8c1a436d81e0e1460b818d298cda Mon Sep 17 00:00:00 2001 From: "totally-not-ai[bot]" <290682512+totally-not-ai[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2026 07:41:12 +0000 Subject: [PATCH 2/2] docs: correct the getCellComponent semantics for 25.3 Since 25.3 the method returns the component the grid rendered, so reading a cell twice gives the same instance and a cell the grid does not render throws. Rendering a copy per call is what renderCellComponent does. --- articles/flow/testing/browserless/component-query.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/articles/flow/testing/browserless/component-query.adoc b/articles/flow/testing/browserless/component-query.adoc index 91772878b6..fca3dc2963 100644 --- a/articles/flow/testing/browserless/component-query.adoc +++ b/articles/flow/testing/browserless/component-query.adoc @@ -266,7 +266,9 @@ Checkbox checkbox = (Checkbox) test(grid).getCellComponent(0, "subscriber"); test(checkbox).click(); ---- -Every call renders the cell again and attaches the new instance to the grid, so asking twice for the same cell leaves two instances behind, and a later query reports both. Keep the component the tester returns instead of asking for it again. +[since:com.vaadin:vaadin@V25.3]#The tester hands out the component the grid actually rendered, which is the one a browser shows: reading the same cell twice gives the same instance, and that instance is replaced when the row renders anew, after [methodname]`refreshItem(...)` for example. A row the client has not asked for yet is scrolled into view first, the way a user reaches it, and a cell the grid does not render at all, such as one in a hidden column, throws.# + +[since:com.vaadin:vaadin@V25.3]#[methodname]`renderCellComponent(row, column)` renders a cell on its own instead, and attaches the copy to the grid so that it can be used. Every call renders the cell again and leaves the copy behind, so a later query reports every one of them. It is for the cells the grid does not render, and for tests written against the earlier behavior of [methodname]`getCellComponent`, which rendered a copy per call.# A [classname]`LitRenderer` column has no server-side component at all. Read it with [methodname]`getCellText(row, column)`, [methodname]`getLitRendererPropertyValue(...)`, or [methodname]`invokeLitRendererFunction(...)`.