Grid ItemDetailsRenderer not triggered (itemConsumer of ComponentRenderer not called)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the issue in testGrid_withOneEntity_shouldOpenDetailsOnClick(), focusing on GridTester.clickRow(0), ComponentTester.click(), and the ItemDetailsRenderer item setter. Compare the Browserless Test behavior with the manual click path and verify completion by confirming that setItem is called and Grid.isDetailsVisible(...) becomes true after the simulated click.
Written by the indexing model from the issue text.
Description
Problem
I want to test my Grid component with Browserless Tests. I configured an ItemDetailsRenderer that should open on click. Manually clicking a row opens the details, but when I click the row (or a column) in a Browserless Test the details do not open.
More context I already posted in the Vaadin forum: https://vaadin.com/forum/t/browserless-test-grid-itemdetailsrenderer/179401
Setup
In the Grid I use:
grid.setItemDetailsRenderer(
new ComponentRenderer<>(() -> new MyItemDetailsComponent(someService, someOtherService),
MyItemDetailsComponent::setItem));
grid.setDetailsVisibleOnClick(true);
This opens the details for the selected row when I click the row manually.
Goal
I want to verify with a Browserless Test that the details open when a user clicks a row.
@Test
void testGrid_withOneEntity_shouldOpenDetailsOnClick() {
final GridView gridView = navigate(GridView.class);
Grid<Item> grid = $(Grid.class, gridView).single(); // grid is private in the view
GridTester<Grid<Item>, Item> gridTest = test(grid);
assertThat(gridTest.size()).isEqualTo(1); // one entry present
assertThat(grid.isDetailsVisibleOnClick()).isTrue(); // setting is present
gridTest.clickRow(0); // does not open details
// try clicking a column
Grid.Column<Item> column = grid.getColumns().get(0); // any column
ComponentTester<Grid.Column<Item>> columnTester = test(column);
columnTester.click(); // does not open details
assertThat(grid.isDetailsVisible(gridTest.getRow(0))).isTrue(); // always false
grid.setDetailsVisible(entity, true);//then it would be true, but I had to do it myself
}
Test environment
Test class extends SpringBrowserlessTest.
Annotated with @DataJpaTest and some test properties.
Vaadin 25.1, Spring Boot starter parent 4.0.4.
I import the item details component and nested dependencies in the test class using:
@Import(MyItemDetailsComponent.class, OtherNestedClass.class)
The MyItemDetailsComponent constructor is invoked in the test and its fields are set correctly, but MyItemDetailsComponent::setItem is never called and the logic executed when details open is not triggered.
Observed behavior
MyItemDetailsComponent constructor runs in the test.
setItem (the renderer’s item setter) is never called.
Grid.isDetailsVisible(...) remains false after clicks. (it returns only true when I explicitly set it to true using `grid.setDetailsVisible(entity, true);`
Question
Why does the ItemDetailsRenderer not get invoked in the Browserless Test (itemConsumer of ComponentRenderer not called), and how can I reliably open and assert the details panel in a Browserless Test? I might test if a grid.addItemClickListener() works if I do the details in there - but I would call this a workaround then
- Dominant language
- Java
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vaadin/browserless-test
-
Rename MultiSelectComboBoxTester.selectItem(String...) to selectItems(String...)Possibly taken @totally-not-ai claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
vaadin/browserless-test#291 · 3 comments ·
Maintainers usually reply within 1 day
-
(MultiSelect)ComboBoxTester add support for selectItemContaining(String)Possibly taken @totally-not-ai claimed this 27 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
vaadin/browserless-test#270 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vaadin/browserless-test#266 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vaadin/browserless-test#123 ·
Maintainers usually reply within 1 day
-
withLabel() doesn't find a field labelled by its FormLayout form itemPossibly taken @totally-not-ai claimed this 2 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 60/100
vaadin/browserless-test#308 · 1 comment ·
Maintainers usually reply within 1 day
All issues in vaadin/browserless-test
Similar issues
-
[Bug] 资源包列表 与 模组/数据包/世界 列表排列顺序不一致Possibly taken @fishdry1000 claimed this 4 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AtlasOfLivingAustralia/species-lists#882 ·
Maintainers usually reply within 1 day
-
Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ballerina-platform/ballerina-library#9458 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
winder/Universal-G-Code-Sender#3242 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PCL-Community/PCL-CE#3767 ·
Maintainers usually reply within 1 day