Repository navigation
Add VisualTestUtils source to replace deprecated NuGet package - #32607
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the deprecated VisualTestUtils NuGet package (v0.9.46-beta, unlisted) with vendored source code to gain full control over maintenance and address security advisory CVE-2025-53015 by updating Magick.NET to v13.5.0.
Key Changes:
- Added two new projects (
VisualTestUtilsandVisualTestUtils.MagickNet) with complete visual regression testing infrastructure - Updated 4 test projects (Android, iOS, Mac, WinUI) to reference local projects instead of NuGet packages
- Added new projects to all solution files (slnx and slnf variants) for proper build integration
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj | New netstandard2.0 project for core visual testing utilities |
| src/TestUtils/src/VisualTestUtils/*.cs | Core visual testing infrastructure including regression tester, image snapshots, and interfaces |
| src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj | New project with Magick.NET v13.5.0 dependency for image comparison |
| src/TestUtils/src/VisualTestUtils.MagickNet/*.cs | ImageMagick-based implementations for visual comparison and diff generation |
| src/Controls/tests/TestCases..Tests/.csproj | Updated to reference local VisualTestUtils projects instead of deprecated NuGet packages |
| Microsoft.Maui*.slnf, Microsoft.Maui.slnx | Added new VisualTestUtils projects to solution files |
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
There was a problem hiding this comment.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
There was a problem hiding this comment.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
There was a problem hiding this comment.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| /// <param name="actualImage">Actual image screenshot.</param> | ||
| /// <param name="environmentName">Optional name for the test environment (e.g. device type, like | ||
| /// "android"). If present it's used as the parent directory for the images. It not present, all images are stored directly in the "snapshots" directory.</param> | ||
| /// <param name="testContext">Optional client provied test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> |
There was a problem hiding this comment.
Typo in parameter documentation: "provied" should be "provided".
| /// <param name="testContext">Optional client provied test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> | |
| /// <param name="testContext">Optional client provided test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> |
There was a problem hiding this comment.
Fixed in c691740. Changed "provied" to "provided".
| /// Create an image editor, to update the specified image snapshot. | ||
| /// The original image snapshot is unchanged. After making edits, | ||
| /// call IImageEditor.GetImageSnapshot to get a new image snapshot | ||
| /// width the updates. |
There was a problem hiding this comment.
Typo in documentation: "width the updates" should be "with the updates".
| /// width the updates. | |
| /// with the updates. |
There was a problem hiding this comment.
Fixed in c691740. Changed "width the updates" to "with the updates".
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
There was a problem hiding this comment.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
All review comments evaluated and addressed in c691740:
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
c691740 to
5981b46
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot please look at #32619 this reverts the move to slnx files. I think those changes are still present in this PR. Please make sure to not have an slnx files and use the existing sln and slnf files on main. You can add the paths to it that this PR introduces. After you're done, make a separate comment with just the text "/azp run MAUI-UITests-public", without quotes. |
Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Done in c82af67. Removed the slnx file and extra slnf files, and updated the existing sln/slnf files from main with the VisualTestUtils project paths. |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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!
Description of Change
Replaces deprecated VisualTestUtils NuGet package (v0.9.46-beta, unlisted) with vendored source code. Addresses Magick.NET security advisory CVE-2025-53015 by updating to v13.5.0.
Changes:
VisualTestUtilsproject (netstandard2.0) with core visual regression testing infrastructureVisualTestUtils.MagickNetproject with ImageMagick-based image comparison implementationsRationale: Full control over maintenance and security updates, eliminates external dependency on unlisted package.
Note on
UseLocalVisualTestUtilscondition: The condition in test project files is intentional. When not set (default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes.Issues Fixed
Fixes #31984
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.