-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
Description
The ScrollView
component does not properly map the testID
to Android's resource-id
as expected. This issue was reported here and marked as resolved but it is still reproducible in React Native v0.74.5. There are some other issues that mention a similar problem, but none of those specifically mention the ScrollView
.
This issue makes it significantly harder to create end-to-end tests while still respecting accessibility. The only "workarounds" I have found involve updating the accessibilityLabel
which is not an acceptable solution as this will impact screen reader behavior.
Similar Issues:
- [Android] TestID for Activity Indicator component is not visible #39092
- [Android] TestID assigned to TextInput control not working #32969
Steps to reproduce
- Clone the demo repository at https://github.com/Thenlie/scroll-view-test-id-demo/tree/main
- Install modules with
npm install
- Run the application on Android with
npm run android
- Start appium server with
appium
- Launch Appium Inspector with the following capabilities:
{
"platformName": "Android",
"appium:maxInstances": 1,
"appium:appPackage": "host.exp.exponent",
"appium:appActivity": "host.exp.MainActivity",
"appium:fullReset": false,
"appium:noReset": true,
"appium:newCommandTimeout": 30,
"appium:optionalIntentArguments": "--ez isAppium true",
"appium:automationName": "UIAutomator2"
}
- View the ScrollView element and View element to see the bug.
Alternatively, you can create your own project from scratch and simply create a ScrollView
with a testID
prop to see the issue.
React Native Version
0.74.5
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 13.6.7
CPU: (10) arm64 Apple M1 Pro
Memory: 93.81 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.10.0
path: ~/.asdf/installs/nodejs/20.10.0/bin/node
Yarn:
version: 1.22.21
path: ~/.asdf/installs/nodejs/20.10.0/bin/yarn
npm:
version: 10.2.3
path: ~/.asdf/plugins/nodejs/shims/npm
Watchman:
version: 2024.08.12.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/thenlie/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.14.1
path: /Users/thenlie/.asdf/shims/javac
Ruby:
version: 3.0.3
path: /Users/thenlie/.asdf/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.5
wanted: 0.74.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.75.2 is now available (your project is running on v0.74.5).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.75.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.5
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Stacktrace or Logs
N/A
Reproducer
https://github.com/Thenlie/scroll-view-test-id-demo/tree/main
Screenshots and Videos
