Skip to content

[Android] TestID for Activity Indicator component is not visible #39092

@elizabethberger

Description

@elizabethberger

Description

After adding testID, the resource-id attribute does not appear on the Android platform, thanks to which I could use this element in my e2e tests. On the iOS platform, this testID is visible as a name attribute.
For example, in the Button component, after adding testID, the resource-id attribute appears on the Android platform and for iOS, testID is visible as the name attribute.

A screenshot from the Appium inspector tool, where all the attributes of the Default Activity Indicator element are visible (missing resource-id):
android_activity_indicator

Here I added the testID to the Default Activity Indicator component:

exports.examples = [
  {
    title: 'Default (small, white)',
    render(): Node {
      return (
        <ActivityIndicator
          style={[styles.centering, styles.gray]}
          color="white"
          testID="default_activity_indicator"
          accessibilityLabel="Wait for content to load!"
        />
      );
    },
  },

React Native Version

0.72.4

Output of npx react-native info

System:
OS: macOS 13.0.1
CPU: (8) arm64 Apple M1 Pro
Memory: 223.94 MB / 32.00 GB
Shell:
version: 5.8.1
path: /bin/zsh
Binaries:
Node:
version: 18.17.0
path: ~/.nvm/versions/node/v18.17.0/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 9.6.7
path: ~/.nvm/versions/node/v18.17.0/bin/npm
Watchman:
version: 2023.07.24.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/elzbietaszulc/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.1
- iOS 16.1
- macOS 13.0
- tvOS 16.1
- watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode:
version: 14.1/14B47b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.8
path: /usr/bin/javac
Ruby:
version: 2.7.6
path: /Users/elzbietaszulc/.rvm/rubies/ruby-2.7.6/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: false
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

  1. Add testID="default_activity_indicator" to the Default Activity Indicator element
  2. Reload RNtester app
  3. Run the Appium Inspector tool
  4. Check if resource-id attribute has been added for the Android platform

Snack, screenshot, or link to a repository

A link to the Activity Indicator component that I defined:

https://github.com/elzszulc/react-native/blob/new-rntester-e2e-tests/packages/rn-tester-e2e/tests/screens/components/activityIndicatorComponent.screen.js

A link to ActivityIndicatorExample.js where I added testID:

https://github.com/elzszulc/react-native/blob/new-rntester-e2e-tests/packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions