Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 1, 2025

Fixing TextComponent e2e Testing Performance Issue

Problem: TextComponent tests taking over 10 minutes to complete due to TextRangeProvider's partial implementation causing hangs when accessing text range methods without proper cloning.

Root Cause:

  • CompositionTextRangeProvider::Clone method returns nullptr (no-op implementation)
  • Test automation code in RNTesterApp-Fabric.cpp calls GetText directly without cloning the text range provider first
  • This causes hangs/infinite loops during test execution

Solution:

  • Analyze codebase and identify root cause
  • Implement proper Clone method in CompositionTextRangeProvider
  • Update RNTesterApp-Fabric.cpp to clone text range provider before accessing methods
  • Apply code formatting with clang-format
  • Test changes to ensure TextComponent tests complete in reasonable time
  • Verify no regression in test functionality

Changes Made:

  1. CompositionTextRangeProvider.cpp:

    • Implemented proper Clone method that creates a new instance with same view and parent provider
    • Replaced no-op implementation that returned nullptr
    • Added proper error handling for null parameters and unavailable elements
  2. RNTesterApp-Fabric.cpp:

    • Modified DumpUIAPatternInfo to clone text range provider before calling GetText
    • Added proper error handling for clone operation
    • This prevents hangs during test automation when accessing text properties

Files Modified:

  • vnext/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp
  • packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp

Fixes #14645.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Microsoft Reviewers: Open in CodeFlow

…geProvider cloning

Co-authored-by: vineethkuttan <66076509+vineethkuttan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextComponent's e2e testing taking too long to complete

2 participants