diff --git a/Lombiq.Tests.UI/Extensions/FailureDumpUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/FailureDumpUITestContextExtensions.cs
index 2718acb0b..fdeca8613 100644
--- a/Lombiq.Tests.UI/Extensions/FailureDumpUITestContextExtensions.cs
+++ b/Lombiq.Tests.UI/Extensions/FailureDumpUITestContextExtensions.cs
@@ -17,6 +17,7 @@ public static class FailureDumpUITestContextExtensions
/// instance.
/// The name of the file.
/// Gets called in failure dump collection.
+ /// A message to display in case the desired file already exists in the dump.
public static void AppendFailureDump(
this UITestContext context,
string fileName,
@@ -33,6 +34,7 @@ public static void AppendFailureDump(
/// instance.
/// The name of the file.
/// File content.
+ /// A message to display in case the desired file already exists in the dump.
public static void AppendFailureDump(
this UITestContext context,
string fileName,
@@ -54,6 +56,7 @@ public static void AppendFailureDump(
/// File content.
/// Function to get a new from content.
/// Action to dispose the content, if required. Can be null.
+ /// A message to display in case the desired file already exists in the dump.
public static void AppendFailureDump(
this UITestContext context,
string fileName,
@@ -71,9 +74,8 @@ public static void AppendFailureDump(
///
/// instance.
/// The name of the file.
- ///
- /// File content. The will be disposed at the end.
- ///
+ /// File content. The will be disposed at the end.
+ /// A message to display in case the desired file already exists in the dump.
public static void AppendFailureDump(
this UITestContext context,
string fileName,
diff --git a/Lombiq.Tests.UI/Extensions/VisualVerificationUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/VisualVerificationUITestContextExtensions.cs
index d15dcbbf8..4d43d3b03 100644
--- a/Lombiq.Tests.UI/Extensions/VisualVerificationUITestContextExtensions.cs
+++ b/Lombiq.Tests.UI/Extensions/VisualVerificationUITestContextExtensions.cs
@@ -400,13 +400,7 @@ private static void AssertVisualVerification(
using var elementImageOriginal = context.TakeElementScreenshot(element).ShouldNotBeNull();
var originalElementScreenshotFileName =
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.ElementImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-");
+ configuration.WrapFileName(VisualVerificationMatchNames.ElementImageFileName);
// Checking the dimensions of captured image. This needs to happen before any other comparisons, because that
// can only be done on images with the same dimensions.
@@ -446,7 +440,7 @@ private static void AssertVisualVerification(
.ShouldNotBeNull();
// Now we are one step away from the end. Here we create a statistical summary of the differences between the
- // captured and the baseline image. In the end, the lower values are better. You can read more about how these
+ // captured and the baseline image. In the end, lower values are better. You can read more about how these
// statistical calculations are created here:
// https://github.com/Codeuctivity/ImageSharp.Compare/blob/2.0.46/ImageSharpCompare/ImageSharpCompare.cs#L218.
var diff = baselineImageCropped.CompareTo(elementImageCropped);
@@ -458,75 +452,21 @@ private static void AssertVisualVerification(
catch
{
// Here we append all the relevant items to the failure dump to help the investigation.
- // The full-page screenshot
- context.AddImageToFailureDump(
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.FullScreenImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-"),
- fullScreenImage);
-
- // The original element screenshot
- context.AddImageToFailureDump(originalElementScreenshotFileName, elementImageOriginal);
+ void AddImageToFailureDumpLocal(string fileName, Image image, bool dontWrap = false) =>
+ context.AddImageToFailureDump(dontWrap ? fileName : configuration.WrapFileName(fileName), image);
+
+ AddImageToFailureDumpLocal(VisualVerificationMatchNames.FullScreenImageFileName, fullScreenImage);
+ AddImageToFailureDumpLocal(originalElementScreenshotFileName, elementImageOriginal, dontWrap: true);
+ AddImageToFailureDumpLocal(VisualVerificationMatchNames.BaselineImageFileName, baselineImageOriginal);
+ AddImageToFailureDumpLocal(VisualVerificationMatchNames.CroppedBaselineImageFileName, baselineImageCropped);
+ AddImageToFailureDumpLocal(VisualVerificationMatchNames.CroppedElementImageFileName, elementImageCropped);
+ AddImageToFailureDumpLocal(VisualVerificationMatchNames.DiffImageFileName, diffImage);
- // The original baseline image
- context.AddImageToFailureDump(
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.BaselineImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-"),
- baselineImageOriginal);
-
- // The cropped baseline image
- context.AddImageToFailureDump(
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.CroppedBaselineImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-"),
- baselineImageCropped);
-
- // The cropped element image
- context.AddImageToFailureDump(
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.CroppedElementImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-"),
- elementImageCropped);
-
- // The diff image
- context.AddImageToFailureDump(
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.DiffImageFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-"),
- diffImage);
-
- // The diff stats
+ // The diff stats.
context.AppendFailureDump(
Path.Combine(
VisualVerificationMatchNames.DumpFolderName,
- new[]
- {
- configuration.FileNamePrefix,
- VisualVerificationMatchNames.DiffLogFileName,
- configuration.FileNameSuffix,
- }
- .JoinNotNullOrEmpty("-")),
+ configuration.WrapFileName(VisualVerificationMatchNames.DiffLogFileName)),
content: string.Format(
CultureInfo.InvariantCulture,
@"
diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj
index 7be0a170d..f488f340d 100644
--- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj
+++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj
@@ -91,7 +91,7 @@
-
+