Skip to content

select: Let UI tests find the search field and combobox input by id - #1433

Open
madcodelife wants to merge 1 commit into
mainfrom
select-search-test-id
Open

madcodelife wants to merge 1 commit into
mainfrom
select-search-test-id

Conversation

@madcodelife

Copy link
Copy Markdown
Member

Summary

UI tests could not reach the search field of a searchable Select or the
input of a Combobox by id: the select makes its search field inside the
popup and the combobox makes its input inside its root, and testID names
only the component's own view. Tests had to find these fields by their
placeholder or screen reader label, which changes with the app's wording
and language.

This adds a test id for each of these parts, named after the part as its
other props are (searchClass / searchAccessibilityLabel,
inputClass / inputStyle):

  • Select: searchTestID (Rust .search_test_id(..)) sets the search
    field's test id.
  • Combobox: inputTestID (Rust .input_test_id(..)) sets the input's
    test id. The combobox has no separate search field; its input is the
    search.

Public API

  • Select.searchTestID?: string / SelectProps::search_test_id: Prop<Option<SharedString>>
    (builder .search_test_id(..)): the id UI tests find the search field by.
  • Combobox.inputTestID?: string / ComboboxProps::input_test_id: Prop<Option<SharedString>>
    (builder .input_test_id(..)): the id UI tests find the input by.

Validation

  • nsh-base tests: new select::ui_tests_find_the_search_field_by_its_test_id
    and combobox::ui_tests_find_the_input_by_its_test_id find the field by
    id: and type into it; the select and combobox suites pass.
  • Compat cases base-select and base-combobox set the new props and their
    script reaches the fields by id:.
  • Docs: the Select and Combobox pages (English and zh-CN) and
    docs/dev/api-naming.md.
  • cargo +nightly fmt --all, cargo clippy -p nsh-base --all-targets.

🤖 Generated with Claude Code

A searchable Select makes its search field inside the popup and a
Combobox makes its input inside its root, so the component's testID
never reaches them: tests had to find these fields by placeholder or
screen reader label, which follow the app's wording and language.

Select's searchTestID and Combobox's inputTestID give those parts the
app's test id, named after the part as their other props are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant