Skip to content

Add Functional Tests for TouchableOpacity Component in E2E Test App (Fabric) #14769

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 11, 2025

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_touchable which 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 underlayColor is 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:

@microsoft-github-policy-service microsoft-github-policy-service bot added Area: Fabric Support Facebook Fabric Area: Tests New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric labels Jun 11, 2025
@Copilot Copilot AI changed the title [WIP] Add Functional Tests for TouchableOpacity Component Add Functional Tests for TouchableOpacity Component in E2E Test App (Fabric) Jun 11, 2025
@Copilot Copilot AI requested a review from anupriya13 June 11, 2025 09:25
Copilot finished work on behalf of anupriya13 June 11, 2025 09:25
@anupriya13
Copy link
Contributor

@copilot run yarn change and then commit.
After commit comment here "/azp run" to start the pipelines

Copy link
Author

Copilot AI commented Jun 11, 2025

@copilot run yarn change and 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

Copilot finished work on behalf of anupriya13 June 11, 2025 09:38
@anupriya13
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@@ -952,41 +952,6 @@ NativeAnimatedTurboModuleCxxSpecJSI::NativeAnimatedTurboModuleCxxSpecJSI(std::sh
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleCxxSpecJSI_removeListeners};
methodMap_["queueAndExecuteBatchedOperations"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleCxxSpecJSI_queueAndExecuteBatchedOperations};
}
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_getColorScheme(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please undo the changes to this file. This file should not be changed as a part of this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the changes to vnext/codegen/rnwcoreJSI-generated.cpp and vnext/codegen/rnwcoreJSI.h as requested. These files are now back to their original state and should not be part of this PR anymore. Commit: cab7db8

@@ -1871,87 +1871,6 @@ class JSI_EXPORT NativeAnimatedTurboModuleCxxSpec : public TurboModule {
};


class JSI_EXPORT NativeAppearanceCxxSpecJSI : public TurboModule {
Copy link
Contributor

@chiaramooney chiaramooney Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please undo the changes to this file. This file should not be changed for this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the changes to vnext/codegen/rnwcoreJSI.h and vnext/codegen/rnwcoreJSI-generated.cpp as requested. These files are now back to their original state and are no longer part of this PR. Commit: a4180c7

Copilot finished work on behalf of chiaramooney June 12, 2025 19:03
Copilot finished work on behalf of chiaramooney June 12, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Fabric Support Facebook Fabric Area: Tests New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Functional Tests for TouchableOpacity Component
3 participants