Skip to content

Add semantic selectors for iced tests#3324

Open
caniko wants to merge 1 commit into
iced-rs:masterfrom
caniko:semantic-test-selectors
Open

Add semantic selectors for iced tests#3324
caniko wants to merge 1 commit into
iced-rs:masterfrom
caniko:semantic-test-selectors

Conversation

@caniko
Copy link
Copy Markdown

@caniko caniko commented May 2, 2026

Summary

Adds semantic metadata to widget operations so iced_selector and iced_test can target widgets by role, label, and stable test id. This is intended to make headless E2E tests less dependent on visible text or implementation-only widget ids.

Changes

  • Add iced_core::widget::metadata::{Metadata, Role}.
  • Add a non-breaking Operation::metadata hook.
  • Extend iced_selector candidates and targets with metadata.
  • Add semantic selectors: by_role, by_label, by_role_and_label, and by_test_id.
  • Add widget::Semantics / widget::semantics(...) for explicit metadata.
  • Emit metadata from button, checkbox, text_input, scrollable, and text.
  • Extend .ice instructions to accept semantic targets like test_id="profile-name" and role=button label="Create".

Validation

nix shell nixpkgs#cargo nixpkgs#rustfmt -c cargo fmt --check
nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#rustfmt nixpkgs#stdenv.cc -c cargo test -p iced_selector
nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#rustfmt nixpkgs#stdenv.cc -c cargo test -p iced_widget
nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#rustfmt nixpkgs#stdenv.cc -c cargo test -p iced_test
nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#rustfmt nixpkgs#clippy nixpkgs#stdenv.cc nixpkgs#pkg-config nixpkgs#openssl.dev -c bash -lc 'export PKG_CONFIG_PATH=$(nix eval --raw nixpkgs#openssl.dev.outPath)/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}; cargo lint'

@caniko caniko marked this pull request as ready for review May 2, 2026 11:11
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