Skip to content

testID prop on FontAwesomeIcon cannot be used to select the element in detox e2e test #142

@RonaldvdH

Description

@RonaldvdH

Describe the bug
I have refactored the icons in my app to use the "FontAwesomeIcon" from @fortawesome/react-native-fontawesome. The type shows an optional testID prop, but when i fill it Detox cannot find it.

Reproducible test case
Run and build the detox react-native example https://github.com/wix/Detox/tree/master/examples/demo-react-native
add one fontAwesomeIcon and try to select it with the testID

Expected behavior
I expect the testID to work with test runners like Detox with the FontAwesomeIcon

Desktop (please complete the following information):
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Max
Memory: 403.17 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.16.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /opt/homebrew/opt/openjdk@11/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.69.3 => 0.69.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Tested on iOS simulator.

Additional context
I have fixed my tests after the refactor to wrap all the icons with a View component or something that was fitting to the situation so the testID is not directly on the icon component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions