Skip to content

Commit 84eda0a

Browse files
authored
Adding testcase and execution id support (#175)
* adding testcase and execution id * test fux
1 parent ec5be52 commit 84eda0a

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Percy.Tests/lib/ScreenshotOptionsTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public void TestGetAndSet()
3737
Assert.Equal(screenshotOptions.ConsiderRegionXpaths.Count, 0);
3838
Assert.Equal(screenshotOptions.CustomConsiderRegions.Count, 0);
3939
Assert.Equal(screenshotOptions.Sync, null);
40+
Assert.Equal(screenshotOptions.TestCase, null);
41+
Assert.Equal(screenshotOptions.ThTestCaseExecutionId, null);
4042
}
4143
}
4244
}

Percy/lib/CliWrapper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private static dynamic Request(string endpoint, JObject? payload = null)
8888
}
8989
};
9090

91-
internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync)
91+
internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync, String? testCase, String? thTestCaseExecutionId)
9292
{
9393
try
9494
{
@@ -102,7 +102,9 @@ internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tile
102102
name = name,
103103
ignoredElementsData = ignoredElementsData,
104104
consideredElementsData = consideredElementsData,
105-
sync = sync
105+
sync = sync,
106+
testCase = testCase,
107+
thTestCaseExecutionId = thTestCaseExecutionId
106108
};
107109
dynamic res = Request("/percy/comparison", JObject.FromObject(screenshotOptions));
108110
dynamic data = DeserializeJson<dynamic>(res.content);

Percy/lib/ScreenshotOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class ScreenshotOptions
1717
public bool FullPage { get; set; } = false;
1818
public int? ScreenLengths { get; set; }
1919
public Boolean? Sync { get; set; }
20+
public String? TestCase { get; set; }
21+
public String? ThTestCaseExecutionId { get; set; }
2022
public List<String> IgnoreRegionXpaths { get; set; } = new List<string>();
2123
public List<String> IgnoreRegionAccessibilityIds { get; set; } = new List<string>();
2224
public List<Object> IgnoreRegionAppiumElements { get; set; } = new List<Object>();

Percy/providers/GenericProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public virtual JObject Screenshot(String name, ScreenshotOptions options, String
109109
considerElementsData = consideredRegions
110110
});
111111
var tiles = CaptureTiles(options);
112-
return CliWrapper.PostScreenshot(name, tag, tiles, debugUrl, ignoredElementsData, consideredElementsData, options.Sync);
112+
return CliWrapper.PostScreenshot(name, tag, tiles, debugUrl, ignoredElementsData, consideredElementsData, options.Sync, options.TestCase, options.ThTestCaseExecutionId);
113113
}
114114

115115
public JArray FindRegions(List<String> Xpaths, List<String> AccessibilityIds, List<Object> Elements, List<Region> Locations)

0 commit comments

Comments
 (0)