diff --git a/src/Atata/Atata.csproj b/src/Atata/Atata.csproj index 1f928a4d..6672c1f3 100644 --- a/src/Atata/Atata.csproj +++ b/src/Atata/Atata.csproj @@ -33,7 +33,7 @@ Features: - + diff --git a/src/Atata/Context/ScreenshotConsumerAtataContextBuilderExtensions.cs b/src/Atata/Context/ScreenshotConsumerAtataContextBuilderExtensions.cs index 29faf5be..4cde8711 100644 --- a/src/Atata/Context/ScreenshotConsumerAtataContextBuilderExtensions.cs +++ b/src/Atata/Context/ScreenshotConsumerAtataContextBuilderExtensions.cs @@ -9,6 +9,7 @@ public static class ScreenshotConsumerAtataContextBuilderExtensions /// The builder. /// The image format. /// The same builder instance. + [Obsolete("Don't use this method as it will be removed. Atata will only support the PNG format, as will Selenium.WebDriver.")] // Obsolete since v2.11.0. public static ScreenshotConsumerAtataContextBuilder With( this ScreenshotConsumerAtataContextBuilder builder, ScreenshotImageFormat imageFormat) diff --git a/src/Atata/Extensions/ScreenshotImageFormatExtensions.cs b/src/Atata/Extensions/ScreenshotImageFormatExtensions.cs index d050371c..5ac34f72 100644 --- a/src/Atata/Extensions/ScreenshotImageFormatExtensions.cs +++ b/src/Atata/Extensions/ScreenshotImageFormatExtensions.cs @@ -1,7 +1,9 @@ namespace Atata; +// TODO: Atata v3. Remove class. public static class ScreenshotImageFormatExtensions { + [Obsolete("Don't use this method as it will be removed.")] // Obsolete since v2.11.0. public static string GetExtension(this ScreenshotImageFormat format) => format == ScreenshotImageFormat.Jpeg ? ".jpg" diff --git a/src/Atata/Logging/FileScreenshotConsumerBase.cs b/src/Atata/Logging/FileScreenshotConsumerBase.cs index ca5f61da..0347025f 100644 --- a/src/Atata/Logging/FileScreenshotConsumerBase.cs +++ b/src/Atata/Logging/FileScreenshotConsumerBase.cs @@ -6,6 +6,7 @@ public abstract class FileScreenshotConsumerBase : IScreenshotConsumer /// Gets or sets the image format. /// The default format is . /// + [Obsolete("Don't use this property as it will be removed. Atata will only support the PNG format, as will Selenium.WebDriver.")] // Obsolete since v2.11.0. public ScreenshotImageFormat ImageFormat { get; set; } = ScreenshotImageFormat.Png; /// @@ -16,7 +17,9 @@ public void Take(ScreenshotInfo screenshotInfo) { string filePath = BuildFilePath(screenshotInfo); filePath = filePath.SanitizeForPath(); +#pragma warning disable CS0618 // Type or member is obsolete filePath += ImageFormat.GetExtension(); +#pragma warning restore CS0618 // Type or member is obsolete if (!Path.IsPathRooted(filePath)) filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filePath); @@ -51,9 +54,11 @@ public void Take(ScreenshotInfo screenshotInfo) private void SaveImage(ScreenshotInfo screenshotInfo, string filePath) { +#pragma warning disable CS0618 // Type or member is obsolete if (ImageFormat == ScreenshotImageFormat.Png) screenshotInfo.ScreenshotContent.Save(filePath); else screenshotInfo.Screenshot.SaveAsFile(filePath, ImageFormat); +#pragma warning restore CS0618 // Type or member is obsolete } }