Skip to content

Make FilteringReactSelect prefer exact matches#2771

Merged
labkey-tchad merged 2 commits intodevelopfrom
fb_filteringReactSelectPrecision
Oct 31, 2025
Merged

Make FilteringReactSelect prefer exact matches#2771
labkey-tchad merged 2 commits intodevelopfrom
fb_filteringReactSelectPrecision

Conversation

@labkey-tchad
Copy link
Member

Rationale

FilteringReactSelect. filterSelect picks the first option that contains the provided filter text. This can easily pick the wrong option.
For example, this failures where the test was trying to select NS-5 but selected m.sNS-50907jqB instead.

org.openqa.selenium.NoSuchElementException: Expected condition failed: waiting for xpath=//div[contains(concat(' ',normalize-space(@class),' '), ' detail-component ')][.//div[contains(concat(' ',normalize-space(@class),' '), ' component-detail--child--title ')]//h4[normalize-space()='NS-5']] (tried for 2 second(s) with 100 milliseconds interval)
  at app//org.labkey.test.Locator.waitForElement(Locator.java:570)
  at app//org.labkey.test.Locator.waitForElement(Locator.java:546)
  at app//org.labkey.test.Locator.waitForElement(Locator.java:539)
  at app//org.labkey.test.pages.biologics.registry.molecule.AppRegisterMoleculePage$SelectComponentsStep.selectNucleotide(AppRegisterMoleculePage.java:318)
  at app//org.labkey.test.tests.biologics.BiologicsTest.testMoleculesWithTrickyNames(BiologicsTest.java:573)
  at app//org.labkey.test.tests.biologics.BiologicsTest.testRegisterMoleculeWithTrickyName(BiologicsTest.java:550)

We can have it prefer to find the option that matches exactly but leave the existing, more lax behavior:

WebElement elemToClick = Locator.waitForAnyElement(getWrapper().shortWait(),
    Locators.option.withDescendant(Locator.tagWithText("strong", value)), // Exact match
    Locators.option.containing(value));

Related Pull Requests

  • N/A

Changes

  • Make FilteringReactSelect prefer exact matches
  • Remove invalid retry from FilteringReactSelect. filterSelect
  • Remove redundant locators from BaseReactSelect.Locators

@labkey-tchad labkey-tchad merged commit 2555ba9 into develop Oct 31, 2025
8 checks passed
@labkey-tchad labkey-tchad deleted the fb_filteringReactSelectPrecision branch October 31, 2025 17:10
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.

2 participants