Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] ScrollView does not properly handle testID property #46180

Closed
Thenlie opened this issue Aug 22, 2024 · 1 comment
Closed

[Android] ScrollView does not properly handle testID property #46180

Thenlie opened this issue Aug 22, 2024 · 1 comment
Labels
Component: ScrollView Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@Thenlie
Copy link

Thenlie commented Aug 22, 2024

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:

Steps to reproduce

  1. Clone the demo repository at https://github.com/Thenlie/scroll-view-test-id-demo/tree/main
  2. Install modules with npm install
  3. Run the application on Android with npm run android
  4. Start appium server with appium
  5. 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"
}
  1. 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

Xnip2024-08-22_16-55-50
@mateoguzmana
Copy link
Contributor

I did some debugging here with the reproduction steps and this only happens when the horizontal prop is set as true. When we use a vertical scroll view it works as expected.

Might be fixed in #48254

@cortinico cortinico added the Resolution: Fixed A PR that fixes this issue has been merged. label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ScrollView Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants