Skip to content

fix(uiautomator2-server): enumerate class regex matches with regression coverage - #52

Open
KazuCocoa wants to merge 2 commits into
mainfrom
fix/class-regex-with-regression-tests
Open

KazuCocoa wants to merge 2 commits into
mainfrom
fix/class-regex-with-regression-tests

Conversation

@KazuCocoa

Copy link
Copy Markdown
Member

findElements with UiSelector.classNameMatches enumerates parent-relative child indices, which can omit matches under different parents or return no results when the first matching child has a nonzero index. Enumerate matching instances instead, while retaining explicit instance(n) selectors.

Ports the combined change from appium/appium-uiautomator2-server#803 into packages/uiautomator2-server, including the original fix from appium/appium-uiautomator2-server#801 with its authorship preserved.

The regression tests use an activity confined to the e2eTest flavor, containing two parents with labels at index 0 and buttons at index 1. They check complete regex results across parents, results when no match has index 0, and explicit instance selection. The new test class is included in scripts/e2e.sh, so the existing API 26/29/32/36 functional CI matrix runs it.

Validation:

  • The Java and manifest changes match the previously verified combined PR exactly; the e2e script retains this repository's navigation setup.
  • In the original repository, the same tests produced two expected failures before the fix and three passes after it on API 36.
  • git diff --check and bash -n packages/uiautomator2-server/scripts/e2e.sh pass.
  • In this monorepo, all three regression tests pass on an Android 16 / API 36 ARM64 emulator with no failures or skips. lintE2eTestDebug also completes successfully.

@github-actions github-actions Bot added bug Something isn't working package:uiautomator2-server labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package:uiautomator2-server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants