Add Functional Tests for TouchableOpacity Component in E2E Test App (Fabric)
This PR adds comprehensive functional tests for the TouchableOpacity component to the E2E test app (Fabric) to validate various functionality scenarios as requested in the issue.
Changes Made
Added a new TouchableOpacity Tests describe block to TouchableComponentTest.test.ts with the following test cases:
✅ Implemented Tests
-
TouchableOpacity should fire action upon press - Tests onPress event handling using
touchable_feedback_events_button - TouchableOpacity should fire action upon onPressIn - Tests onPressIn event handling
- TouchableOpacity should fire action upon onPressOut - Tests onPressOut event handling
- TouchableOpacity should fire action upon onLongPress - Tests onLongPress event handling
-
TouchableOpacity should register press in clicked within hitSlop range - Tests hitSlop functionality using
touchable_hit_slop_button -
TouchableOpacity should not be interactable when disabled - Tests disabled state behavior using
disabled_touchable -
TouchableOpacity should update style upon fast refresh - Tests dynamic style updates using
disabled_touchablewhich changes backgroundColor via setState
Test Components Used
All tests leverage existing TouchableOpacity examples from the RNTester:
-
touchable_feedback_events_button- TouchableOpacity with comprehensive event handlers -
touchable_hit_slop_button- TouchableOpacity with hitSlop configuration -
disabled_touchable- TouchableOpacity with dynamic style updates (backgroundColor changes from transparent to blue)
Technical Approach
- Follows established E2E testing patterns using snapshot testing with
dumpVisualTree() - Uses minimal changes approach by leveraging existing test components rather than creating new ones
- Tests cover both static configurations and dynamic property updates ("fast refresh" scenarios)
Notes on Remaining Requirements
- TouchableOpacity activeOpacity fast refresh testing: Would require creating a new test component with dynamic activeOpacity property changes, which is not available in existing examples
-
TouchableOpacity underlayColor fast refresh testing: This requirement appears to be incorrect as
underlayColoris not a valid TouchableOpacity property (it's exclusive to TouchableHighlight)
The implementation provides comprehensive coverage of TouchableOpacity functionality while maintaining the principle of minimal changes by reusing existing test infrastructure.
Fixes #12466.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
googlechromelabs.github.io
- Triggering command:
/usr/local/bin/node install.mjs(dns block)https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.116/linux64/chrome-headless-shell-linux64.zip
- Triggering command:
/usr/local/bin/node install.mjs(http block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to my firewall allow list
@copilot run yarn change and then commit.
After commit comment here "/azp run" to start the pipelines
@copilot run
yarn changeand then commit. After commit comment here "/azp run" to start the pipelines
Done! I've run yarn change (created the change file manually due to dependency issues) and committed the change file. Commit: 9f25408
/azp run
/azp run
Azure Pipelines successfully started running 2 pipeline(s).