Skip to content

feat: add waitForLoadingFinished to ComboBoxElement - #10189

Merged
web-padawan merged 1 commit into
mainfrom
feat/combo-box-testbench-loading
Sep 23, 2026
Merged

web-padawan merged 1 commit into
mainfrom
feat/combo-box-testbench-loading

Conversation

@web-padawan

@web-padawan web-padawan commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Description

Related to #10141

The new method does not change getOptions(). TestBench calls waitForVaadin() before its element commands, so the request that loads the first page has already finished when filteredItems is read. A combo box whose data provider sleeps 500 ms returns its labels with and without an explicit wait, so the method does not need one. The wait is useful where a test drives the combo box itself, which is why it becomes part of the element API.

  • Added waitForLoadingFinished() to ComboBoxElement, matching the method MultiSelectComboBoxElement already provides
  • Changed setFilter() to call the new method instead of waiting on the loading property inline
  • Updated AbstractComboBoxIT and ComboBoxListDataViewIT to call the new method instead of polling the loading property

Type of change

  • Feature

Note

The getOptions() Javadoc correction moved to #10190, so this branch no longer touches that method.

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — left 2 comments.

Finding
📝 getOptions() still returns empty labels for placeholder items once the data set exceeds one page, so the new doc line promises more than it delivers
🧪 Nothing would fail if the new wait in getOptions() were removed again


/**
* Gets a list of all available options.
* Gets a list of all available options. Opens the popup and waits until the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 getOptions() still returns empty labels for placeholder items once the data set exceeds one page, so the new doc line promises more than it delivers

loading only reflects pending page requests. For a lazy combo box, filteredItems is sized to size and the indexes outside the loaded pages hold ComboBoxPlaceholder, whose label resolves to ''. With the 250-item combo box in ComboBoxListDataViewPage, getOptions() returns 250 entries of which 200 are empty strings, and the new wait changes nothing about that.

"Gets a list of all available options ... waits until the items have finished loading" reads as a completeness guarantee. MultiSelectComboBoxElement.getOptions() words the same behavior accurately ("gets the labels of the items that are currently loaded in the popup") — worth aligning with it.

ComboBoxElement.java:131 · documentation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated JavaDoc to mention the limitation and be more aligned with MultiSelectComboBoxElement.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to #10190

@SuppressWarnings("unchecked")
public List<String> getOptions() {
openPopup();
waitForLoadingFinished();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Nothing would fail if the new wait in getOptions() were removed again

All ComboBoxElement.getOptions() callers in the IT module either wrap the call in their own waitUntil (DataProviderIT, RefreshDataProviderIT.emptyComboBox_addItemsAndRefreshAll_addedItemsIncluded) or depend on timing (RefreshDataProviderIT.refreshItem_onlyOneItemUpdated, which would only flake, not fail). The one behavior this PR adds to getOptions() — open a data-provider combo box and read real labels without an outer wait — has no test that pins it.

ComboBoxElement.java:139 · tests

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this line and reverted IT change to keep this PR about new API only, without behavior change.

Tests that wait for a lazy combo box repeated the same polling on the
loading property. The method makes that wait part of the element API,
like the one MultiSelectComboBoxElement already provides.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@web-padawan
web-padawan force-pushed the feat/combo-box-testbench-loading branch from 10a9917 to 302005e Compare September 23, 2026 08:02
@sonarqubecloud

Copy link
Copy Markdown

@sissbruecker sissbruecker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we can use this in getOptions, I would dismiss the review bot comment.

@web-padawan

Copy link
Copy Markdown
Member Author

IMO we can use this in getOptions, I would dismiss the review bot comment.

Sounds good to me, but let me create a separate PR for that.

@web-padawan
web-padawan removed the request for review from vursen September 23, 2026 09:10
@web-padawan
web-padawan added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit 3c03628 Sep 23, 2026
19 checks passed
@web-padawan
web-padawan deleted the feat/combo-box-testbench-loading branch September 23, 2026 09:26
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.4.0-alpha1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants