Skip to content

Commit

Permalink
adding testcase and execution id
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 committed Mar 27, 2024
1 parent ec5be52 commit 4c01e42
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Percy.Tests/lib/ScreenshotOptionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public void TestGetAndSet()
Assert.Equal(screenshotOptions.ConsiderRegionXpaths.Count, 0);
Assert.Equal(screenshotOptions.CustomConsiderRegions.Count, 0);
Assert.Equal(screenshotOptions.Sync, null);
Assert.Equal(screenshotOptions.TestCase, null);
Assert.Equal(screenshotOptions.ThTestCaseExecutionId, null);
}
}
}
2 changes: 1 addition & 1 deletion Percy.Tests/providers/AppAutomateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void TestScreenshot_WhenPercyScreenshotBeginReturnsNull()
// Act
var actual = appAutomate.Screenshot("temp", options);
// Assert
Assert.Equal(true, actual["success"]);
Assert.Equal(null, actual);
Environment.SetEnvironmentVariable("PERCY_DISABLE_REMOTE_UPLOADS", "false");
}

Expand Down
6 changes: 4 additions & 2 deletions Percy/lib/CliWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static dynamic Request(string endpoint, JObject? payload = null)
}
};

internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync)
internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tiles, String externalDebugUrl, JObject ignoredElementsData, JObject consideredElementsData, Boolean? sync, String? testCase, String? thTestCaseExecutionId)
{
try
{
Expand All @@ -102,7 +102,9 @@ internal static JObject PostScreenshot(string name, JObject tag, List<Tile> tile
name = name,
ignoredElementsData = ignoredElementsData,
consideredElementsData = consideredElementsData,
sync = sync
sync = sync,
testCase = testCase,
thTestCaseExecutionId = thTestCaseExecutionId
};
dynamic res = Request("/percy/comparison", JObject.FromObject(screenshotOptions));
dynamic data = DeserializeJson<dynamic>(res.content);
Expand Down
2 changes: 2 additions & 0 deletions Percy/lib/ScreenshotOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class ScreenshotOptions
public bool FullPage { get; set; } = false;
public int? ScreenLengths { get; set; }
public Boolean? Sync { get; set; }
public String? TestCase { get; set; }
public String? ThTestCaseExecutionId { get; set; }
public List<String> IgnoreRegionXpaths { get; set; } = new List<string>();
public List<String> IgnoreRegionAccessibilityIds { get; set; } = new List<string>();
public List<Object> IgnoreRegionAppiumElements { get; set; } = new List<Object>();
Expand Down
2 changes: 1 addition & 1 deletion Percy/providers/GenericProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
return CliWrapper.PostScreenshot(name, tag, tiles, debugUrl, ignoredElementsData, consideredElementsData, options.Sync, options.TestCase, options.ThTestCaseExecutionId);
}

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

0 comments on commit 4c01e42

Please sign in to comment.