From ccecb723e3788534b7ce3e1a510ab7eff15a541b Mon Sep 17 00:00:00 2001 From: prklm10 Date: Fri, 25 Oct 2024 14:31:38 +0530 Subject: [PATCH] adding support for label --- Percy.Tests/lib/ScreenshotOptionsTest.cs | 1 + Percy/lib/CliWrapper.cs | 3 ++- Percy/lib/ScreenshotOptions.cs | 1 + Percy/providers/GenericProvider.cs | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Percy.Tests/lib/ScreenshotOptionsTest.cs b/Percy.Tests/lib/ScreenshotOptionsTest.cs index b5294b4..1b0bd9e 100644 --- a/Percy.Tests/lib/ScreenshotOptionsTest.cs +++ b/Percy.Tests/lib/ScreenshotOptionsTest.cs @@ -38,6 +38,7 @@ public void TestGetAndSet() Assert.Equal(screenshotOptions.CustomConsiderRegions.Count, 0); Assert.Equal(screenshotOptions.Sync, null); Assert.Equal(screenshotOptions.TestCase, null); + Assert.Equal(screenshotOptions.Labels, null); Assert.Equal(screenshotOptions.ThTestCaseExecutionId, null); } } diff --git a/Percy/lib/CliWrapper.cs b/Percy/lib/CliWrapper.cs index 59b11cc..62095e6 100644 --- a/Percy/lib/CliWrapper.cs +++ b/Percy/lib/CliWrapper.cs @@ -88,7 +88,7 @@ private static dynamic Request(string endpoint, JObject? payload = null) } }; - internal static JObject PostScreenshot(string name, JObject tag, List tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync, String? testCase, String? thTestCaseExecutionId) + internal static JObject PostScreenshot(string name, JObject tag, List tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync, String? testCase, String? labels, String? thTestCaseExecutionId) { try { @@ -104,6 +104,7 @@ internal static JObject PostScreenshot(string name, JObject tag, List tile consideredElementsData = consideredElementsData, sync = sync, testCase = testCase, + labels = labels, thTestCaseExecutionId = thTestCaseExecutionId }; dynamic res = Request("/percy/comparison", JObject.FromObject(screenshotOptions)); diff --git a/Percy/lib/ScreenshotOptions.cs b/Percy/lib/ScreenshotOptions.cs index 920abe7..588bfa2 100644 --- a/Percy/lib/ScreenshotOptions.cs +++ b/Percy/lib/ScreenshotOptions.cs @@ -18,6 +18,7 @@ public class ScreenshotOptions public int? ScreenLengths { get; set; } public Boolean? Sync { get; set; } public String? TestCase { get; set; } + public String? Labels { get; set; } public String? ThTestCaseExecutionId { get; set; } public List IgnoreRegionXpaths { get; set; } = new List(); public List IgnoreRegionAccessibilityIds { get; set; } = new List(); diff --git a/Percy/providers/GenericProvider.cs b/Percy/providers/GenericProvider.cs index 7246723..d4fc7b0 100644 --- a/Percy/providers/GenericProvider.cs +++ b/Percy/providers/GenericProvider.cs @@ -109,7 +109,7 @@ public virtual JObject Screenshot(String name, ScreenshotOptions options, String considerElementsData = consideredRegions }); var tiles = CaptureTiles(options); - return CliWrapper.PostScreenshot(name, tag, tiles, debugUrl, ignoredElementsData, consideredElementsData, options.Sync, options.TestCase, options.ThTestCaseExecutionId); + return CliWrapper.PostScreenshot(name, tag, tiles, debugUrl, ignoredElementsData, consideredElementsData, options.Sync, options.TestCase, options.Labels, options.ThTestCaseExecutionId); } public JArray FindRegions(List Xpaths, List AccessibilityIds, List Elements, List Locations)