KEMBAR78
[Testing] Feature Matrix UITest Cases for Switch Control by TamilarasanSF4853 · Pull Request #29950 · dotnet/maui · GitHub
Skip to content

Conversation

TamilarasanSF4853
Copy link
Contributor

This PR includes a comprehensive set of UI test cases for the Switch control. The tests validate the Switch control, including properties such as IsToggled, OnColor, ThumbColor, IsEnabled, IsVisible, FlowDirection, and Shadow.

Switch Control Implementation:

  • Added SwitchControlMainPage to host the Switch control, with bindings for properties like IsToggled, OnColor, ThumbColor, IsEnabled, IsVisible, FlowDirection, and Shadow, and event handlers for the Toggled event.

  • Created SwitchOptionsPage to allow users to configure Switch properties interactively, including IsToggled, OnColor, ThumbColor, IsEnabled, IsVisible, FlowDirection, and Shadow.

  • Added event handlers for property changes in SwitchOptionsPage.xaml.cs to update the Switch control dynamically through a ViewModel pattern.

  • Implemented a suite of UI tests in SwitchFeatureTests to validate property updates, event handling (Toggled), disabled and visibility states, color configurations (OnColor, ThumbColor), flow direction, and shadow behavior. Used VerifyScreenshot() for visual verification across property configurations and platforms.

Screen.Recording.2025-06-12.at.11.31.26.AM.mov

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

Hey there @@TamilarasanSF4853! 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 12, 2025
@ghost ghost added area-testing Unit tests, device tests area-controls-switch Switch labels Jun 12, 2025
@TamilarasanSF4853 TamilarasanSF4853 marked this pull request as ready for review June 12, 2025 10:23
@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 10:23
@TamilarasanSF4853 TamilarasanSF4853 requested a review from a team as a code owner June 12, 2025 10:23
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 introduces a comprehensive set of UI test cases and supporting UI pages for validating the Switch control’s behavior and appearance. Key changes include:

  • New UI tests in SwitchFeatureTests to verify various Switch states (toggled, colors, enabled, visible, shadow, and flow direction).
  • Addition of SwitchViewModel implementing property notifications for Switch behavior.
  • Implementation of SwitchOptionsPage and SwitchControlMainPage for an interactive configuration of Switch properties.

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TestCases.Shared.Tests/Tests/FeatureMatrix/SwitchFeatureTests.cs Introduces UI tests for multiple Switch scenarios
TestCases.HostApp/FeatureMatrix/Switch/SwitchViewModel.cs Implements the view model with property change notifications for the Switch control
TestCases.HostApp/FeatureMatrix/Switch/SwitchOptionsPage.xaml(.cs) Provides an options page for adjusting Switch properties interactively
TestCases.HostApp/FeatureMatrix/Switch/SwitchControlPage.xaml(.cs) Hosts the Switch control and integrates with the options page for state reinitialization
TestCases.HostApp/CoreViews/CorePageView.cs Adds a new gallery entry for accessing the Switch control pages
Comments suppressed due to low confidence (2)

src/Controls/tests/TestCases.HostApp/FeatureMatrix/Switch/SwitchOptionsPage.xaml.cs:37

  • The AutomationId 'IsEnabledFalseCheckBox' paired with inverted logic in this event handler could be confusing. Consider renaming the checkbox (and similarly for the visible checkbox) to better reflect that checking it disables the control (e.g., 'DisableSwitchCheckBox').
if (e.Value)

src/Controls/tests/TestCases.HostApp/FeatureMatrix/Switch/SwitchControlPage.xaml.cs:26

  • Reinitializing the view model in the NavigateToOptionsPage_Clicked event resets the current state; please confirm this behavior is intended for the interactive configuration flow.
BindingContext = _viewModel = new SwitchViewModel();

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
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.

Pending snapshots for Mac and Windows.
image

Could you commit the images?

@TamilarasanSF4853
Copy link
Contributor Author

Pending snapshots for Mac and Windows. image

Could you commit the images?

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

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there's a bug here based on the snapshot. The shadow appears to reflect the off state and doesn't update when the Switch state changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you verify? If is a bug, could you create a new bug and add the link to it in the test with a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz I have added the failing condition to the test case, created a bug issue, and included the bug link in the test case as a comment.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current June 26, 2025 17:35
@PureWeen PureWeen merged commit 58bda54 into dotnet:inflight/current Jun 26, 2025
79 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 26, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
PureWeen pushed a commit that referenced this pull request Jun 27, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
PureWeen pushed a commit that referenced this pull request Jun 28, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 1, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
github-actions bot pushed a commit that referenced this pull request Jul 9, 2025
* added test cases

* added new test cases

* added new test cases

* added android and iOS snapshots

* modified test case and added snapshots

* added failing condition
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-switch Switch 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.

3 participants