Skip to content

[Testing] Feature Matrix UITest Cases for RefreshView Control#30614

Merged
PureWeen merged 12 commits into
inflight/currentfrom
unknown repository
Sep 11, 2025
Merged

[Testing] Feature Matrix UITest Cases for RefreshView Control#30614
PureWeen merged 12 commits into
inflight/currentfrom
unknown repository

Conversation

@TamilarasanSF4853

Copy link
Copy Markdown
Contributor

This PR includes a comprehensive set of UI test cases for the RefreshView control. The tests validate the RefreshView control functionality, including properties such as Command, CommandParameter, FlowDirection, IsEnabled, IsVisible, IsRefreshing, RefreshColor, and Shadow, along with pull-to-refresh interactions with different content types (ScrollView and CollectionView).

RefreshView Control Implementation:

  • Added RefreshViewControlMainPage to host the RefreshView control, with bindings for properties like Command, CommandParameter, FlowDirection, IsEnabled, IsVisible, IsRefreshing, RefreshColor, and Shadow. The control dynamically switches between ScrollView and CollectionView content to demonstrate refresh functionality with different scrollable containers.

  • Created RefreshViewOptionsPage to allow users to configure RefreshView properties interactively, including command parameter selection, state control, layout direction, refresh color selection, and visual effects configuration.

  • Added event handlers for property changes in RefreshViewOptionsPage.xaml.cs to update the RefreshView control dynamically through a ViewModel pattern, enabling real-time property modifications and validation.

  • Implemented RefreshViewViewModel with comprehensive property binding and Command execution that handles refresh operations, parameter-based content changes, and status tracking.

  • Implemented a suite of UI tests in RefreshViewFeatureTests to validate default state verification, pull-to-refresh functionality with different content types, command parameter handling, state management (IsEnabled, IsVisible, IsRefreshing), refresh color styling, flow direction support, shadow effects, and visual verification of property configurations using VerifyScreenshot() across platforms with platform-specific conditional compilation for Catalyst and Windows limitations.

Issues Identified

Screen.Recording.2025-07-14.at.6.37.11.PM.mov

@dotnet-policy-service dotnet-policy-service Bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jul 14, 2025
@ghost ghost added the area-testing Unit tests, device tests label Jul 14, 2025
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz jsuarezruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pending snapshots:
image
Already available in the latest build. Could you commit the images?

@TamilarasanSF4853

Copy link
Copy Markdown
Contributor Author

Pending snapshots: image Already available in the latest build. Could you commit the images?

@jsuarezruiz I have added the pending snapshots in the latest commit.

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@TamilarasanSF4853 TamilarasanSF4853 marked this pull request as ready for review July 17, 2025 14:41
@TamilarasanSF4853 TamilarasanSF4853 requested a review from a team as a code owner July 17, 2025 14:41

@jsuarezruiz jsuarezruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pending snapshot for RefreshView_SetShadowWithCollectionView_VerifyShadowApplied in Mac.
image

@TamilarasanSF4853

Copy link
Copy Markdown
Contributor Author

Pending snapshot for RefreshView_SetShadowWithCollectionView_VerifyShadowApplied in Mac. image

@jsuarezruiz I have added the pending snapshots in the latest commit.

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz jsuarezruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Previously included, but the test ProgressSpinnerNotDisabledOnStartup that is a RefreshView test, is failing on Android.

  Failed ProgressSpinnerNotDisabledOnStartup [11 s]
  Error Message:
   VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: Issue28343_ProgressSpinnerDisabled.png (2.70% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

Could you review it in this PR?

Copilot AI review requested due to automatic review settings July 29, 2025 12:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds comprehensive UI test cases for the RefreshView control to validate its functionality across different platforms. The implementation includes a feature matrix test page that tests properties like Command, CommandParameter, FlowDirection, IsEnabled, IsVisible, IsRefreshing, RefreshColor, and Shadow with different content types.

Key changes include:

  • Addition of RefreshView feature matrix UI test infrastructure with XAML pages and ViewModel
  • Comprehensive test suite covering RefreshView properties and pull-to-refresh interactions
  • Platform-specific conditional compilation for Catalyst and Windows limitations

Reviewed Changes

Copilot reviewed 9 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
RefreshViewFeatureTests.cs New comprehensive test suite with 13 test methods validating RefreshView functionality
RefreshViewControlPage.xaml/.cs Main UI page for testing RefreshView with dynamic content switching between ScrollView and CollectionView
RefreshViewOptionsPage.xaml/.cs Configuration page allowing interactive property modifications for RefreshView testing
RefreshViewViewModel.cs ViewModel implementing property binding and command execution for RefreshView operations
Issue28343.cs Updated existing issue test with additional UI elements and scroll functionality
CorePageView.cs Registration of new RefreshView Feature Matrix in the gallery navigation

App.WaitForElement("RefreshNotTriggered");
App.WaitForElement("ListItem0");
App.ScrollUp("CollectionView");
Thread.Sleep(1000);

Copilot AI Jul 29, 2025

Copy link

Choose a reason for hiding this comment

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

Using Thread.Sleep in UI tests is unreliable and can cause flaky tests. Consider using App.WaitForElement with a timeout or App.WaitForNoElement instead of Thread.Sleep for better test stability.

Suggested change
Thread.Sleep(1000);
App.WaitForElement("RefreshNotTriggered", "Waiting for RefreshNotTriggered to appear after scrolling", TimeSpan.FromSeconds(10));

Copilot uses AI. Check for mistakes.
private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
SetScrollViewContent();
BindingContext = _viewModel = new RefreshViewViewModel();

Copilot AI Jul 29, 2025

Copy link

Choose a reason for hiding this comment

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

Creating a new ViewModel instance and reassigning the field in the NavigateToOptionsPage_Clicked method will lose the current state. This could cause unexpected behavior when returning from the options page. Consider preserving the existing ViewModel state or clearly documenting this reset behavior.

Suggested change
BindingContext = _viewModel = new RefreshViewViewModel();

Copilot uses AI. Check for mistakes.
_viewModel.RefreshColor = Colors.Orange;
break;
default:
_viewModel.RefreshColor = null;

Copilot AI Jul 29, 2025

Copy link

Choose a reason for hiding this comment

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

Setting RefreshColor to null in the default case may not be the intended behavior. Consider using a default color value or removing this case if no default handling is needed.

Suggested change
_viewModel.RefreshColor = null;
_viewModel.RefreshColor = Colors.Gray; // Assign a default color

Copilot uses AI. Check for mistakes.
@TamilarasanSF4853

Copy link
Copy Markdown
Contributor Author

Previously included, but the test ProgressSpinnerNotDisabledOnStartup that is a RefreshView test, is failing on Android.

  Failed ProgressSpinnerNotDisabledOnStartup [11 s]
  Error Message:
   VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: Issue28343_ProgressSpinnerDisabled.png (2.70% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

Could you review it in this PR?

@jsuarezruiz I have updated the ProgressSpinnerNotDisabledOnStartup test case to address the snapshot mismatch on Android

@mattleibow

Copy link
Copy Markdown
Member

I have been working on this PR: #30692

This should make it more consistent. Also, I found that if you use the "scroll up" gesture on appium, it does pull to refresh.

@mattleibow

Copy link
Copy Markdown
Member

There is also a src/Controls/tests/TestCases.HostApp/Issues/RefreshViewPage.cs that seems to be unused. Not sure if it has anything useful in there or should we delete?

@TamilarasanSF4853

Copy link
Copy Markdown
Contributor Author

I have been working on this PR: #30692

This should make it more consistent. Also, I found that if you use the "scroll up" gesture on appium, it does pull to refresh.

@mattleibow I have replaced DragCoordinates with the ScrollUp method in the test cases.

@TamilarasanSF4853

TamilarasanSF4853 commented Aug 6, 2025

Copy link
Copy Markdown
Contributor Author

There is also a src/Controls/tests/TestCases.HostApp/Issues/RefreshViewPage.cs that seems to be unused. Not sure if it has anything useful in there or should we delete?

@mattleibow I have checked the RefreshViewPage.cs hostapp sample its not been unused. It verifies the test (src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/RefreshViewTests.cs) whether the Refreshing event and the RefreshView command set IsRefreshing to true and false.

@bronteq

bronteq commented Aug 29, 2025

Copy link
Copy Markdown

I don't know if you also cover this case, but i suggest to test also the case when Command is null; in this case RefreshView should not show any activity animation. Here there is an open issue for Windows about this #12977

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current September 11, 2025 15:05
@PureWeen PureWeen merged commit 0bd7773 into dotnet:inflight/current Sep 11, 2025
78 checks passed
PureWeen pushed a commit that referenced this pull request Sep 18, 2025
* added test cases

* updated test cases

* updated ui

* added test cases

* added failing condition

* added Android and iOS snapshots

* added snapshots

* removed VerifyScreenshot

* added additional test case

* added mac snapshot

* modified ProgressSpinnerNotDisabledOnStartup test case

* Replaced DragCoordinates with the ScrollUp method
PureWeen pushed a commit that referenced this pull request Sep 18, 2025
* added test cases

* updated test cases

* updated ui

* added test cases

* added failing condition

* added Android and iOS snapshots

* added snapshots

* removed VerifyScreenshot

* added additional test case

* added mac snapshot

* modified ProgressSpinnerNotDisabledOnStartup test case

* Replaced DragCoordinates with the ScrollUp method
github-actions Bot pushed a commit that referenced this pull request Sep 18, 2025
* added test cases

* updated test cases

* updated ui

* added test cases

* added failing condition

* added Android and iOS snapshots

* added snapshots

* removed VerifyScreenshot

* added additional test case

* added mac snapshot

* modified ProgressSpinnerNotDisabledOnStartup test case

* Replaced DragCoordinates with the ScrollUp method
github-actions Bot pushed a commit that referenced this pull request Sep 23, 2025
* added test cases

* updated test cases

* updated ui

* added test cases

* added failing condition

* added Android and iOS snapshots

* added snapshots

* removed VerifyScreenshot

* added additional test case

* added mac snapshot

* modified ProgressSpinnerNotDisabledOnStartup test case

* Replaced DragCoordinates with the ScrollUp method
github-actions Bot pushed a commit that referenced this pull request Sep 23, 2025
* added test cases

* updated test cases

* updated ui

* added test cases

* added failing condition

* added Android and iOS snapshots

* added snapshots

* removed VerifyScreenshot

* added additional test case

* added mac snapshot

* modified ProgressSpinnerNotDisabledOnStartup test case

* Replaced DragCoordinates with the ScrollUp method
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants