Grid UI Unit Test: click checkbox inserted via LitRenderer

I am writing a UI unit test for a view in Vaadin 24.6.2
This view contains a grid.
In this grid there is a column which contains, beside other content, a native checkbox

<input type=‘checkbox’ id=‘XYZ’>

inserted via LitRenderer.

How can I now perform a click in this checkbox programmatically in the UI UnitTest ?
Though I can get the current value via

Boolean checked = grid.getLitRendererPropertyValue(0,2, ‘checked’, Boolean.class);

but I don’t see a method to execute a click.
It’s such API still missing or overlook I something ?

Kind regards
Dominik

There is no such API

You really cannot execute real browser code in UI Unit Tests. The Testers of UI Unit Tests can to some extend convey simulated built-in functionalities of our components. But if you add LitRenderer, JavaScript execution, etc. those parts you need to verify with regular Browser based TestBench tests.

Hey guys,

thanks for your fast response.

From the point of view of tatu’s comments, it makes sense to do without such an api.
In my case, I was able to switch from LitRenderer to component column for testing purposes. From a performance point of view, however, I have found it better to favour LitRenderer, as there can be thousands of rows in the grid with 2-4 checkboxes in each row. Does the advice to use LitRenderer instead of component columns for better performance still apply?

Yes… I personally would refactor your view a little bit that - instead of testing the click - you test the method that is invoked by your click listener on server side… e.g.

// view.grid.click(2) remove

// view.clickInGrid(ObjectThatNormallyPassedFromTheGridsRow)

The difference between ComponentColumn and LitRenderer is not necessarily major. Actually the count of the rows is not a big factor here as Grid does lazy loading / virtual scrolling, so not all the rows are attached to DOM (unless you have used setAllRowsVisible(true)). LitRenderer starts to pay of when the content of the cell becomes very complex. If you are just rendering one simple component to a cell, there should not be noticeable difference.

Ok, thanks for clarification.