Skip to content

[Testing] Feature matrix UITest Cases for SwipeView Control#30968

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

[Testing] Feature matrix UITest Cases for SwipeView Control#30968
PureWeen merged 11 commits into
inflight/currentfrom
unknown repository

Conversation

@LogishaSelvarajSF4525
Copy link
Copy Markdown
Contributor

This PR includes a comprehensive set of UI test cases for the SwipeView control. The tests validate the SwipeView control’s behavior across a wide range of properties and interaction scenarios. This includes verifying SwipeItems for all supported directions—LeftItems, RightItems, TopItems, and BottomItems—to ensure they are correctly displayed and invoked. Event validation covers key swipe lifecycle events such as SwipeStarted, SwipeChanging, SwipeEnded, and SwipeItem.Invoked, confirming their correct firing during user interactions. The tests also assess various SwipeView properties like IsEnabled, IsVisible, BackgroundColor, HeightRequest, and WidthRequest, ensuring they update the control as expected. Additionally, support for programmatic control using OpenRequested and CloseRequested is validated. Finally, the tests confirm consistent swipe gesture handling across all platforms.

SwipeView Control Feature Matrix

Gallery Page Addition

  • Integrated a new GalleryPageFactory entry for SwipeViewControlPage into CorePageView.cs.
  • Enables easy navigation to the feature matrix page showcasing SwipeView control functionality within the test app.

Options Page Implementation

  • Created SwipeViewOptionsPage.xaml to provide a UI for dynamic interaction with SwipeView properties.
  • The options page includes:
    • Configuration for SwipeItem directions and content types (Label, Image, CollectionView).
    • Toggle support for visual properties like background, border, visibility, and enabled state.
    • Binding support for SwipeItems and swipe events.

Main Page Implementation

  • Added SwipeViewControlPage.xaml.cs, which includes:
    • Initialization of SwipeViewViewModel for dynamic property and event binding.
    • Methods to generate content and SwipeItems dynamically based on user selections.
    • Handlers for programmatically opening and closing SwipeView via command buttons.
    • Wiring up of swipe gesture event tracking for testing behavior during swipes.

Issues Identified

Screen.Recording.2025-07-02.at.3.50.54.PM.mov

@dotnet-policy-service dotnet-policy-service Bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Aug 1, 2025
@ghost ghost added area-testing Unit tests, device tests area-controls-swipeview SwipeView labels Aug 1, 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).

@LogishaSelvarajSF4525 LogishaSelvarajSF4525 marked this pull request as ready for review August 5, 2025 09:59
Copilot AI review requested due to automatic review settings August 5, 2025 09:59
@LogishaSelvarajSF4525 LogishaSelvarajSF4525 requested a review from a team as a code owner August 5, 2025 09:59
Copy link
Copy Markdown
Contributor

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 introduces comprehensive UI test cases for the SwipeView control to validate its behavior across different properties and interaction scenarios. The implementation includes a full feature matrix testing framework that covers SwipeItems for all directions, event validation, property testing, and programmatic control support.

  • Adds extensive UI test coverage for SwipeView control functionality across platforms
  • Implements a comprehensive feature matrix page with options to test various SwipeView configurations
  • Creates test infrastructure to validate SwipeItems, events, properties, and programmatic actions

Reviewed Changes

Copilot reviewed 6 out of 77 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SwipeViewFeatureTests.cs Comprehensive test suite with 40+ test cases covering SwipeView functionality
SwipeViewViewModel.cs ViewModel implementing property binding and command handling for SwipeView testing
SwipeViewOptionsPage.xaml.cs Code-behind for options page providing UI configuration controls
SwipeViewOptionsPage.xaml XAML layout for test configuration options with radio buttons and controls
SwipeViewControlPage.cs Main test page implementation with dynamic content generation and event handling
CorePageView.cs Gallery integration to make SwipeView feature matrix accessible in test app
Comments suppressed due to low confidence (1)

src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/SwipeViewFeatureTests.cs:254

  • The test methods are duplicating the navigation to Options page and configuration steps repeatedly. Consider extracting common setup logic into helper methods to reduce code duplication and improve maintainability.
		App.WaitForElement("Options");

Comment on lines +317 to +342
_viewModel.RequestOpen += dir =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Open(dir));
};

_viewModel.RequestClose += () =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Close());
};
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

The event handlers for RequestOpen and RequestClose are being added every time WireUpOpenCloseHandlers is called, which could lead to memory leaks and multiple event subscriptions. Consider unsubscribing from previous handlers before adding new ones.

Suggested change
_viewModel.RequestOpen += dir =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Open(dir));
};
_viewModel.RequestClose += () =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Close());
};
// Unsubscribe previous handlers if they exist
if (_requestOpenHandler != null)
_viewModel.RequestOpen -= _requestOpenHandler;
if (_requestCloseHandler != null)
_viewModel.RequestClose -= _requestCloseHandler;
// Create new handlers
_requestOpenHandler = dir =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Open(dir));
};
_requestCloseHandler = () =>
{
Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => swipeView.Close());
};
// Subscribe new handlers
_viewModel.RequestOpen += _requestOpenHandler;
_viewModel.RequestClose += _requestCloseHandler;

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made the changes based on your valid suggestion and committed the latest updates.

Comment on lines +141 to +148
var swipeItems = CreateSwipeItems(swipeItemType);
var swipeView = new SwipeView
{
Content = itemLabel,
LeftItems = swipeItems,
RightItems = swipeItems,
TopItems = swipeItems,
BottomItems = swipeItems,
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

The same swipeItems collection is being assigned to LeftItems, RightItems, TopItems, and BottomItems. This could cause issues since collections should not be shared between multiple properties. Consider creating separate SwipeItems instances for each direction.

Suggested change
var swipeItems = CreateSwipeItems(swipeItemType);
var swipeView = new SwipeView
{
Content = itemLabel,
LeftItems = swipeItems,
RightItems = swipeItems,
TopItems = swipeItems,
BottomItems = swipeItems,
var leftSwipeItems = CreateSwipeItems(swipeItemType);
var rightSwipeItems = CreateSwipeItems(swipeItemType);
var topSwipeItems = CreateSwipeItems(swipeItemType);
var bottomSwipeItems = CreateSwipeItems(swipeItemType);
var swipeView = new SwipeView
{
Content = itemLabel,
LeftItems = leftSwipeItems,
RightItems = rightSwipeItems,
TopItems = topSwipeItems,
BottomItems = bottomSwipeItems,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made the changes based on your valid suggestion and committed the latest updates.

Comment on lines +231 to +239
var swipeItems = CreateSwipeItems(swipeItemType);

var swipeView = new SwipeView
{
Content = contentView,
LeftItems = swipeItems,
RightItems = swipeItems,
TopItems = swipeItems,
BottomItems = swipeItems,
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

Same issue as in the CollectionView template - the same swipeItems collection is being reused for all directions. Each SwipeView direction should have its own SwipeItems instance to prevent potential binding and state conflicts.

Suggested change
var swipeItems = CreateSwipeItems(swipeItemType);
var swipeView = new SwipeView
{
Content = contentView,
LeftItems = swipeItems,
RightItems = swipeItems,
TopItems = swipeItems,
BottomItems = swipeItems,
var leftItems = CreateSwipeItems(swipeItemType);
var rightItems = CreateSwipeItems(swipeItemType);
var topItems = CreateSwipeItems(swipeItemType);
var bottomItems = CreateSwipeItems(swipeItemType);
var swipeView = new SwipeView
{
Content = contentView,
LeftItems = leftItems,
RightItems = rightItems,
TopItems = topItems,
BottomItems = bottomItems,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made the changes based on your valid suggestion and committed the latest updates.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/rebase

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The test VerifyImageWithSwipeRevealAndSwipeBehaviorOnInvokedAuto is failing on Mac:

   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2530
   at UITest.Appium.HelperExtensions.WaitForNone(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2554
   at UITest.Appium.HelperExtensions.WaitForNoElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 816
   at Microsoft.Maui.TestCases.Tests.SwipeViewFeatureTests.VerifyImageWithSwipeRevealAndSwipeBehaviorOnInvokedAuto() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/SwipeViewFeatureTests.cs:line 503
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@LogishaSelvarajSF4525
Copy link
Copy Markdown
Contributor Author

The test VerifyImageWithSwipeRevealAndSwipeBehaviorOnInvokedAuto is failing on Mac:

   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2530
   at UITest.Appium.HelperExtensions.WaitForNone(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2554
   at UITest.Appium.HelperExtensions.WaitForNoElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 816
   at Microsoft.Maui.TestCases.Tests.SwipeViewFeatureTests.VerifyImageWithSwipeRevealAndSwipeBehaviorOnInvokedAuto() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/SwipeViewFeatureTests.cs:line 503
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@jsuarezruiz Modified the test to ensure it runs on Mac and committed the code changes.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current September 11, 2025 15:47
@PureWeen PureWeen merged commit 38aad66 into dotnet:inflight/current Sep 11, 2025
PureWeen added a commit that referenced this pull request Sep 18, 2025
* added the sample and test class files

* added snapshot for iOS and android

* added FailsOn attributes

* updated

* test case modified

* changes updated

* revert this changes

* added snapshot from CI

* update copilot suggestion

* update test case

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
PureWeen added a commit that referenced this pull request Sep 18, 2025
* added the sample and test class files

* added snapshot for iOS and android

* added FailsOn attributes

* updated

* test case modified

* changes updated

* revert this changes

* added snapshot from CI

* update copilot suggestion

* update test case

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
github-actions Bot pushed a commit that referenced this pull request Sep 18, 2025
* added the sample and test class files

* added snapshot for iOS and android

* added FailsOn attributes

* updated

* test case modified

* changes updated

* revert this changes

* added snapshot from CI

* update copilot suggestion

* update test case

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
github-actions Bot pushed a commit that referenced this pull request Sep 23, 2025
* added the sample and test class files

* added snapshot for iOS and android

* added FailsOn attributes

* updated

* test case modified

* changes updated

* revert this changes

* added snapshot from CI

* update copilot suggestion

* update test case

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
github-actions Bot pushed a commit that referenced this pull request Sep 23, 2025
* added the sample and test class files

* added snapshot for iOS and android

* added FailsOn attributes

* updated

* test case modified

* changes updated

* revert this changes

* added snapshot from CI

* update copilot suggestion

* update test case

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
@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-controls-swipeview SwipeView 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.

5 participants