KEMBAR78
[Testing] Re-Fix for flaky UITests RotatingCollectionViewWithHTMLShouldNotHangOrCrash in CI that occasionally fails · Pull Request #30239 · dotnet/maui · GitHub
Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jun 26, 2025

Description

This pull request introduces improvements to test reliability and code clarity in the src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs file and adds a new helper method to enhance UI testing functionality in src/TestUtils/src/UITest.Appium/HelperExtensions.cs. The most significant changes include replacing Thread.Sleep with App.WaitForElement for better synchronization, adding a new helper method TapWithRetriesUntilElementReady to 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: Replaced Thread.Sleep calls with App.WaitForElement to 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 method TapWithRetriesUntilElementReady, 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:

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 26, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@anandhan-rajagopal! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 26, 2025
@ghost ghost added area-testing Unit tests, device tests testing-flakiness labels Jun 26, 2025
@ghost ghost marked this pull request as ready for review June 26, 2025 06:59
@Copilot Copilot AI review requested due to automatic review settings June 26, 2025 06:59
@ghost ghost self-requested a review as a code owner June 26, 2025 06:59
@ghost ghost requested review from jfversluis and rmarinho June 26, 2025 06:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances UI test stability by eliminating arbitrary delays in a flaky test and introducing a retry helper for tapping elements until the UI is ready. Key changes include:

  • Replaced Thread.Sleep with App.WaitForElement in Issue8870.cs to synchronize on UI readiness.
  • Introduced TapWithRetriesUntilElementReady and IsElementVisible in HelperExtensions.cs for more robust element interactions.
  • Modernized the namespace declaration style in the test file.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/TestUtils/src/UITest.Appium/HelperExtensions.cs Added TapWithRetriesUntilElementReady and IsElementVisible to handle flaky taps.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs Swapped out Thread.Sleep for App.WaitForElement and used the new retry tap helper; applied semicolon namespace syntax.
Comments suppressed due to low confidence (1)

src/TestUtils/src/UITest.Appium/HelperExtensions.cs:2569

  • Add automated tests for TapWithRetriesUntilElementReady (and IsElementVisible) in TestCases.Shared.Tests and ensure corresponding UI apps in TestCases.HostApp validate its behavior; this will guarantee the new helper is exercised and prevent regressions.
		public static bool TapWithRetriesUntilElementReady(this IApp app, string elementToTap, string elementToWaitFor,

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rmarinho
Copy link
Member

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen merged commit c3f9dd2 into dotnet:main Jun 27, 2025
78 checks passed
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Jun 27, 2025
…ldNotHangOrCrash in CI that occasionally fails (dotnet#30239)

* fixed flaky test 8870

* Update src/TestUtils/src/UITest.Appium/HelperExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-testing Unit tests, device tests community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration testing-flakiness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants