Skip to content

IBX-12632: [Behat] Waited for the dropdown items in IbexaDropdown::selectOption() - #2104

Merged
tomaszszopinski merged 1 commit into
4.6from
IBX-12632-dropdown-wait-for-items
Sep 22, 2026
Merged

tomaszszopinski merged 1 commit into
4.6from
IBX-12632-dropdown-wait-for-items

Conversation

@barbaragr

@barbaragr barbaragr commented Sep 21, 2026

Copy link
Copy Markdown
Contributor
Question Answer
JIRA issue IBX-12632
Type bug
Target version v4.6
BC breaks no
Doc needed no

Autosave.feature:29 ("Content item is not autosaved and draft is not visible in dashboard when autosave is disabled") fails intermittently on the step I disable autosave:

Ibexa\Behat\Browser\Exception\ElementNotFoundException: Could not find element named: 'Disabled'.
Collection is empty. CSS locator 'ibexaDropdownExtended'
  #0 src/lib/Behat/Component/IbexaDropdown.php(41): ElementCollection->getByCriterion()
  #1 src/lib/Behat/Page/UserSettingsPage.php(83): IbexaDropdown->selectOption()
  #2 src/lib/Behat/BrowserContext/UserPreferencesContext.php(57): UserSettingsPage->disableAutosave()

Seen in ibexa/headless run 34428511763 (branch 5.0, 2026-09-10), where Autosave.feature passed on 2 of the 3 matrix legs in the same run and failed only on MySQL 8.4 / Solr 8 / Redis.

Cause

disableAutosave() clicks the dropdown and calls selectOption() right away, and selectOption() had no wait at all — it went straight to findAll()->getByCriterion().

That is not enough, because BaseElement::internalFindAll() waits only for raw CSS matches and applies the locator criteria — including the VisibleCSSLocator visibility check — after the wait loop has ended. While the popover is already in the DOM but not yet visible, the filtered collection comes back empty and getByCriterion() throws Collection is empty immediately, without any TimeoutException.

ElementExistsCondition is the right tool here: its isMet() calls findAll(...)->any(), i.e. it checks the filtered collection, and waitUntilCondition() polls it for the full timeout.

Fix

Wait with ElementExistsCondition before findAll(), exactly the way the sibling selectOptionByValueFragment() in the same class already does. The asymmetry between those two methods looks accidental.

selectOption() is used throughout the suite for every dropdown interaction, so the fix is not limited to the autosave scenario.

For QA:

Behat only, no product code touched.

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Asked for a review (ping @ibexa/engineering).

🤖 Generated with Claude Code

…lectOption()

selectOption() called findAll() immediately after the dropdown was opened.
BaseElement::findAll() only waits for raw CSS matches and applies the
VisibleCSSLocator visibility criterion afterwards, so while the popover is in
the DOM but not yet visible the collection comes back empty - no timeout, just
"Collection is empty". Wait with ElementExistsCondition first, the way the
sibling selectOptionByValueFragment() already does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The change addresses the intermittent dropdown timing failure without altering product code.

Review effort: Lite
Findings: None

What changed in this PR

Updates Behat dropdown selection to wait for asynchronously rendered options, preventing intermittent test failures.

Changes:

  • Waits up to five seconds for visible dropdown options.
  • Preserves the existing selection behavior.
File Description
src/​lib/​Behat/​Component/​IbexaDropdown.php Adds visibility-aware waiting to selectOption().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tomaszszopinski
tomaszszopinski merged commit c51bdf5 into 4.6 Sep 22, 2026
34 of 35 checks passed
@tomaszszopinski
tomaszszopinski deleted the IBX-12632-dropdown-wait-for-items branch September 22, 2026 09:05
barbaragr added a commit that referenced this pull request Sep 22, 2026
…lectOption() (#2104)

selectOption() called findAll() immediately after the dropdown was opened.
BaseElement::findAll() only waits for raw CSS matches and applies the
VisibleCSSLocator visibility criterion afterwards, so while the popover is in
the DOM but not yet visible the collection comes back empty - no timeout, just
"Collection is empty". Wait with ElementExistsCondition first, the way the
sibling selectOptionByValueFragment() already does.

Co-authored-by: barbaragr <barbara.grajczyk@ez.no>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants