Skip to content

feat: add semantic selectors and session management#15

Open
tosh7 wants to merge 4 commits intomainfrom
feature/semantic-selector-session
Open

feat: add semantic selectors and session management#15
tosh7 wants to merge 4 commits intomainfrom
feature/semantic-selector-session

Conversation

@tosh7
Copy link
Copy Markdown
Owner

@tosh7 tosh7 commented Mar 24, 2026

Summary

  • Semantic selectors: --text and --type/--index options for tap and fill commands, enabling label-based and type-based element targeting without coordinates or ref numbers
  • Session management: era session connect/list/disconnect with persistent device sessions (~/.era/sessions.json), --session option on all device commands, and cached scale factor auto-detection

Changes

Phase 3a: Semantic Selectors

  • snapshot.rs: find_by_text() (case-insensitive partial match, prefers enabled elements), find_by_type_index() (type + 0-based index)
  • cli/mod.rs: resolve_live_element() — live UI tree search via idb describe-all
  • 4-way exclusive targeting: --ref / --text / --type / -x -y (enforced by clap constraints)
  • 21 tests added

Phase 3b: Session Management

  • New session.rs (447 lines): SessionStore with file-backed CRUD, resolve_device() priority chain (--session > --device > default session)
  • --session added to: Snapshot, Tap, Fill, TapRegion, Swipe
  • --device changed to Optional (falls back to session or default)
  • resolve_scale() supports session cached scale
  • 13 tests added

Housekeeping

  • Removed firebase-debug.log from tracking, added to .gitignore

Usage Examples

# Semantic selectors
era tap -d <device> --text "カートに入れる"
era tap -d <device> --type Button --index 2
era fill -d <device> --target "メールアドレス" "test@example.com"

# Session management
era session connect --name main -d "iPhone 16 Pro"
era tap --session main --text "ログイン"
era tap --text "ログイン"  # uses default session
era session list
era session disconnect --name main

Test plan

  • All 193 tests pass (90 lib + 18 coordinate + 56 regression + 12 retry + 17 scale)
  • Semantic selector 4-way exclusivity verified via clap constraint tests
  • Session file I/O round-trip tests with parallel-safe temp directories
  • Merge conflict resolution verified (handle_tap/handle_fill parameter integration)

tosh7 added 4 commits March 24, 2026 17:53
- Add --text option: find element by AXLabel/AXValue (case-insensitive
  partial match) via live UI tree query
- Add --type/--index options: find element by type with optional 0-based
  index among matches
- Both tap and fill now support 4 target modes: -x/-y, --ref, --text,
  --type (mutually exclusive via clap conflicts)
- Fill --target for text-based element search, --type/--index for type
- Add find_by_text() and find_by_type_index() to snapshot module
- resolve_live_element() helper queries idb describe-all on the fly
Add era session connect/list/disconnect/disconnect-all commands.
Sessions store UDID, device name, and auto-detected scale factor
in ~/.era/sessions.json. Existing commands (tap, snapshot, fill,
swipe, tap-region) gain --session option as alternative to --device.
When neither is specified, the default session is used.
…tor-session

# Conflicts:
#	src/cli/mod.rs
#	tests/regression.rs
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