Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding testcase and execution id support #175

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}
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 @@ -77,7 +77,7 @@
this.debugUrl = debugUrl;
}

public virtual JObject Screenshot(String name, ScreenshotOptions options, String platformVersion = null)

Check warning on line 80 in Percy/providers/GenericProvider.cs

View workflow job for this annotation

GitHub Actions / Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 80 in Percy/providers/GenericProvider.cs

View workflow job for this annotation

GitHub Actions / Test

Cannot convert null literal to non-nullable reference type.
{
this.metadata = MetadataHelper.Resolve(
percyAppiumDriver,
Expand Down Expand Up @@ -109,7 +109,7 @@
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
Loading