[Testing] Re-Fix for flaky UITests RotatingCollectionViewWithHTMLShouldNotHangOrCrash in CI that occasionally fails #30239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces improvements to test reliability and code clarity in the
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.csfile and adds a new helper method to enhance UI testing functionality insrc/TestUtils/src/UITest.Appium/HelperExtensions.cs. The most significant changes include replacingThread.SleepwithApp.WaitForElementfor better synchronization, adding a new helper methodTapWithRetriesUntilElementReadyto handle UI interactions more robustly, and adopting a modern namespace declaration style.Improvements to test reliability:
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs: ReplacedThread.Sleepcalls withApp.WaitForElementto ensure synchronization with the UI state during orientation changes. This improves test reliability by waiting for elements to be ready instead of relying on arbitrary delays.src/TestUtils/src/UITest.Appium/HelperExtensions.cs: Added a new helper methodTapWithRetriesUntilElementReady, which retries tapping an element until a target element becomes interactable or the retry limit is reached. This addresses cases where elements may appear but are not immediately ready for interaction.Code clarity improvements:
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs: Adopted a modern namespace declaration style by removing braces and switching to thenamespacesemicolon syntax. This simplifies the code structure and aligns with current C# conventions.