[Testing] Feature matrix UITest Cases for Map Control#30954
[Testing] Feature matrix UITest Cases for Map Control#30954HarishKumarSF4517 wants to merge 14 commits intomainfrom unknown repository
Conversation
|
Hey there @@HarishKumarSF4517! 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-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
This pull request adds comprehensive UI testing infrastructure for Map controls in the .NET MAUI framework. The implementation provides a feature matrix testing approach to validate various map functionalities including user interaction, visual elements, and map behavior configurations.
- Introduces a complete testing framework for Map controls with over 30 test scenarios covering visibility, user location, map types, elements, and templating
- Creates a sophisticated options page with controls for managing map properties, pins, elements, and templating features
- Implements a ViewModel-based architecture for managing map state and synchronizing between UI components
Reviewed Changes
Copilot reviewed 7 out of 36 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| MapFeatureTests.cs | Comprehensive test suite with 30+ test cases covering map visibility, user location, element types, zoom/scroll functionality, and templating scenarios |
| MapViewModel.cs | ViewModel implementing map state management with properties for user location, map type, pins, elements, and data templating |
| MapOptionsPage.xaml.cs | Code-behind implementing complex map configuration logic including pin management, element creation, and template setup |
| MapOptionsPage.xaml | XAML defining the options UI with checkboxes, radio buttons, and control buttons for map configuration |
| MapControlPage.xaml.cs | Main map page implementation handling map events, pin synchronization, and navigation between pages |
| MapControlPage.xaml | XAML defining the main map display with event labels and property bindings |
| CorePageView.cs | Registration of the new Map Feature Matrix page in the main gallery navigation |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX(), rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
| Thread.Sleep(2000); | |
| App.WaitFor(() => App.WaitForElement("VisibleRegionLatitudeDegrees").GetText() != value, timeout: TimeSpan.FromSeconds(5)); |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX() - 100, rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
| Thread.Sleep(2000); | |
| // Wait up to 5 seconds for the value to change after dragging | |
| bool valueChanged = UITestUtils.WaitForValueToChange(() => App.WaitForElement("VisibleRegionLatitudeDegrees").GetText(), value, timeoutMs: 5000, pollIntervalMs: 250); | |
| Assert.That(valueChanged, Is.True, "VisibleRegionLatitudeDegrees did not change after drag."); |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX(), rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
| Thread.Sleep(2000); | |
| WaitForVisibleRegionLatitudeDegreesToChange(value, timeoutInSeconds: 5); |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX(), rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
| Thread.Sleep(2000); | |
| App.WaitFor(() => App.WaitForElement("VisibleRegionLatitudeDegrees").GetText() != value, timeout: TimeSpan.FromSeconds(5)); |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX(), rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
| Thread.Sleep(2000); | |
| App.WaitFor(() => App.WaitForElement("VisibleRegionLatitudeDegrees").GetText() != value, timeout: TimeSpan.FromSeconds(5)); |
| var rect =App.WaitForElement("MapView").GetRect(); | ||
| App.DragCoordinates(rect.CenterX() - 100, rect.CenterY(), rect.CenterX(), rect.CenterY() - 100); | ||
|
|
||
| Thread.Sleep(2000); |
There was a problem hiding this comment.
Using Thread.Sleep in UI tests is a code smell that can lead to flaky tests. Consider using App.WaitForElement with a timeout or a more deterministic wait condition instead of an arbitrary 2-second delay.
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/MapFeatureTests.cs
Outdated
Show resolved
Hide resolved
…MapFeatureTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |




This pull request adds a new feature to test map controls in the app. It includes UI components to test user interaction, map behavior, and customization. Key changes include a Map Feature Matrix page, a main Map Control page, and a Map Options page for configuration.
Note: Tests are added only for iOS and macOS, as Maps aren't supported on Windows and require an API key on Android.
New Map Feature Matrix Page
MapControlPagein theCorePageViewto include it in the feature matrix navigation.MapControlPage.xamlto define the UI for displaying a map and its interactive elements, including labels for map and marker click events, and bindings for various map properties.MapControlPage.xaml.csto handle map interactions, synchronize map state with the ViewModel, and manage events like map clicks, pin additions, and property changes.MapOptionsPage.xamlto provide a UI for configuring map behavior and properties, such as visibility, zoom, traffic, and user location. It also includes options to manage pins and map elements.MapFeatureMatrix.mov