fix(mobile): read XCUIElementType class names as their XCTest types

Merged
AM
11d ago
+49-7

What and why

On iOS, agent-device's WebDriver runtime reports XCUITest class names such as XCUIElementTypeButton and XCUIElementTypeStaticText, where the native runner reports Button and StaticText. Every hosted Appium cloud goes through that runtime: TestMu AI, BrowserStack and AWS Device Farm. The mobile engine read those as unknown types, so getByRole('button', …) matched nothing, and observe listed nodes as xcuielement-type-button.

normalizeKind now drops the XCUIElementType prefix before mapping the type. A button is then a button, a tab bar's buttons are tabs, and the navigation bar titles the screen.

This was split out of #772 as requested in its review.

Verified

Ran it locally: yes

  • pnpm check passes.
  • @e2e-dev/mobile tests pass (251), including a new case in which a snapshot with every type XCUIElementType-prefixed projects the same roles and screen title as the native one.
  • Seen live on a TestMu AI iOS simulator and a real iPhone: getByRole('button', …) matched only with this change.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change. n/a
  • Docs updated. n/a (no behaviour documented)
  • Contract change. n/a
  • Engine contract change. n/a

🤖 Generated with Claude Code