[Testing] Refactoring Feature Matrix UITest Cases for Entry Control#34632
[Testing] Refactoring Feature Matrix UITest Cases for Entry Control#34632LogishaSelvarajSF4525 wants to merge 7 commits intodotnet:mainfrom
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34632Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34632" |
|
Hey there @@LogishaSelvarajSF4525! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR refactors the Entry Feature Matrix page and options UI to be more testable and easier to reset between scenarios, while updating platform snapshot baselines to reflect the UI/test behavior changes.
Changes:
- Add new bindable properties to the Entry feature matrix (WidthRequest, BackgroundColor, Opacity) and centralize state reset via
EntryViewModel.Reset(). - Simplify the options UI event handling (e.g., using
AutomationIdto select colors; new handlers for width/opacity/height inputs; updated font attributes handling). - Update WinUI/macOS/iOS snapshot images to match the updated UI/test baselines.
Reviewed changes
Copilot reviewed 6 out of 148 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/tests/TestCases.HostApp/FeatureMatrix/EntryControl/EntryViewModel.cs | Adds new properties (BackgroundColor/Opacity/WidthRequest) and a Reset() method to restore defaults for test runs. |
| src/Controls/tests/TestCases.HostApp/FeatureMatrix/EntryControl/EntryOptionsPage.xaml.cs | Refactors option handlers (color selection by AutomationId, numeric input handlers, font-attributes checkbox aggregation). |
| src/Controls/tests/TestCases.HostApp/FeatureMatrix/EntryControl/EntryControlPage.xaml.cs | Uses _viewModel.Reset() instead of re-instantiating the view model when navigating to options. |
| src/Controls/tests/TestCases.HostApp/FeatureMatrix/EntryControl/EntryControlPage.xaml | Binds new properties to the Entry, updates Options AutomationId, and wires CursorPositionEntry TextChanged for better interactivity. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyClearButtonVisiblityWhenTextAlignedVertically.png | Updated iOS snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyClearButtonVisiblityWhenTextAlignedHorizontally.png | Updated iOS snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ClearButtonVisiblityButton_TextPresent.png | Updated iOS snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ClearButtonVisiblityButton_TextEmpty.png | Updated iOS snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyTextWhenAlingnedVertically.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyTextWhenAlingnedHorizontally.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyClearVisiblityButtonWhenTextColorChanged.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyClearButtonVisiblityWhenTextAlignedVertically.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyClearButtonVisiblityWhenTextAlignedHorizontally.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ClearButtonVisiblityButton_TextPresent.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ClearButtonVisiblityButton_TextEmpty.png | Updated iOS 26 snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyTextWhenAlignedVertically.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyTextWhenAlignedHorizontally.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyIsPasswordWhenMaxLengthSetValue.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyClearVisibilityButtonWhenTextColorChanged.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyClearButtonVisibilityWhenTextAlignedVertically.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyClearButtonVisibilityWhenTextAlignedHorizontally.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyClearButtonVisibilityWhenIsPasswordTrueOrFalse.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ClearButtonVisibilityButton_TextPresent.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ClearButtonVisibilityButton_TextEmpty.png | Updated WinUI snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyTextWhenAlignedVertically.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyTextWhenAlignedHorizontally.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyIsPasswordWhenMaxLengthSetValue.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyClearVisibilityButtonWhenTextColorChanged.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyClearButtonVisibilityWhenTextAlignedHorizontally.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyClearButtonVisibilityWhenIsPasswordTrueOrFalse.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ClearButtonVisibilityButton_TextPresent.png | Updated macOS snapshot baseline. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ClearButtonVisibilityButton_TextEmpty.png | Updated macOS snapshot baseline. |
| private void HeightRequestEntry_TextChanged(object sender, TextChangedEventArgs e) | ||
| { | ||
| if (double.TryParse(e.NewTextValue, out double heightRequest)) | ||
| { | ||
| _viewModel.FontAttributes = FontAttributes.Italic; | ||
| _viewModel.HeightRequest = heightRequest; | ||
| } | ||
| } |
There was a problem hiding this comment.
HeightRequestEntry_TextChanged sets HeightRequest directly from user input without validating range. Given HeightRequest uses “-1 = unset, otherwise non-negative”, consider coercing values < 0 to -1 (or ignoring them) to avoid applying invalid heights via the options UI.
| <local:UITestEntry x:Name="CursorPositionEntry" | ||
| Text="{Binding CursorPosition}" | ||
| AutomationId="CursorPositionEntry" | ||
| TextChanged="CursorPositionButton_Clicked" | ||
| IsCursorVisible="False" |
There was a problem hiding this comment.
CursorPositionEntry is wired to TextChanged but the handler is named CursorPositionButton_Clicked (and takes EventArgs). Renaming the handler (and parameter type) to reflect it’s a TextChanged handler would make the intent clearer and reduce confusion when navigating the code.
| private void WidthRequestEntry_TextChanged(object sender, TextChangedEventArgs e) | ||
| { | ||
| if (sender == FontAttributesBold) | ||
| if (double.TryParse(e.NewTextValue, out double widthRequest)) | ||
| { | ||
| _viewModel.FontAttributes = FontAttributes.Bold; | ||
| _viewModel.WidthRequest = widthRequest; | ||
| } | ||
| else if (sender == FontAttributesNone) | ||
| } |
There was a problem hiding this comment.
WidthRequestEntry_TextChanged currently accepts any parsed double (including negative values other than -1). Since WidthRequest semantics are “-1 = unset, otherwise non-negative”, consider coercing values < 0 to -1 (or ignoring them) so invalid widths can’t be applied via the options UI.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
This pull request updates the
EntryControlPageand its code-behind to improve testability and maintainability of the Entry control's feature matrix. The main changes include adding new bindable properties, improving event handling, and simplifying the options navigation logic.Enhancements to Entry control testability and UI:
WidthRequest,BackgroundColor, andOpacityto the Entry control inEntryControlPage.xamlto allow more comprehensive property testing.AutomationIdof the options button from"OptionsButton"to"Options"for consistency with test automation.TextChangedevent handler (CursorPositionButton_Clicked) to theCursorPositionEntrycontrol, enabling dynamic updates to cursor position via UI interaction.Code simplification and maintainability:
NavigateToOptionsPage_Clickedwith a call to the new_viewModel.Reset()method, making the reset logic more maintainable and centralized.Issue Identified: