Skip to content

Commit

Permalink
IRIS-849-fps
Browse files Browse the repository at this point in the history
  • Loading branch information
paweltomaszewskisaucelabs committed Apr 2, 2024
1 parent bc3fb8b commit 9c49a79
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
19 changes: 19 additions & 0 deletions visual-dotnet/SauceLabs.Visual/FullPageConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using SauceLabs.Visual.GraphQL;

namespace SauceLabs.Visual
{
public class FullPageConfig
{
public int? DelayAfterScrollMs { get; set; }
public string[]? HideAfterFirstScroll { get; set; }

internal FullPageConfigIn ToFullPageConfigIn()
{
return new FullPageConfigIn()
{
DelayAfterScrollMs = DelayAfterScrollMs,
HideAfterFirstScroll = HideAfterFirstScroll
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ internal class CreateSnapshotFromWebDriverIn

[JsonProperty("clipSelector")]
public string? ClipSelector { get; set; }
[JsonProperty("fullPageConfig")]
public FullPageConfigIn? FullPageConfig { get; set; }

public CreateSnapshotFromWebDriverIn(
string buildUuid,
Expand All @@ -40,7 +42,8 @@ public CreateSnapshotFromWebDriverIn(
bool captureDom,
string? clipSelector,
string? suiteName,
string? testName
string? testName,
FullPageConfigIn? fullPageConfig
)
{
BuildUuid = buildUuid;
Expand All @@ -54,6 +57,7 @@ public CreateSnapshotFromWebDriverIn(
ClipSelector = clipSelector;
SuiteName = suiteName;
TestName = testName;
FullPageConfig = fullPageConfig;
}
}
}
12 changes: 12 additions & 0 deletions visual-dotnet/SauceLabs.Visual/GraphQL/FullPageConfigIn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace SauceLabs.Visual.GraphQL
{
internal class FullPageConfigIn
{
[JsonProperty("delayAfterScrollMs")]
public int? DelayAfterScrollMs { get; set; }
[JsonProperty("hideAfterFirstScroll")]
public string[]? HideAfterFirstScroll { get; set; }
}
}
13 changes: 13 additions & 0 deletions visual-dotnet/SauceLabs.Visual/VisualCheckOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ namespace SauceLabs.Visual
/// </summary>
public class VisualCheckOptions
{
private FullPageConfig? _fullPageConfig;
public DiffingMethod? DiffingMethod { get; set; }
public IgnoreRegion[]? IgnoreRegions { get; set; }
public IWebElement[]? IgnoreElements { get; set; }
public bool? CaptureDom { get; set; }
public bool? FullPage { get; set; }
public FullPageConfig? FullPageConfig
{
get
{
return _fullPageConfig ?? (FullPage == true ? new FullPageConfig() : null);
}
set
{
_fullPageConfig = value;
}
}
public string? ClipSelector { get; set; }

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion visual-dotnet/SauceLabs.Visual/VisualClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ private async Task<string> VisualCheckAsync(string name, VisualCheckOptions opti
captureDom: options.CaptureDom ?? CaptureDom,
clipSelector: options.ClipSelector,
suiteName: options.SuiteName,
testName: options.TestName
testName: options.TestName,
fullPageConfig: options.FullPageConfig?.ToFullPageConfigIn()
))).EnsureValidResponse();
result.Result.Diffs.Nodes.ToList().ForEach(d => _screenshotIds.Add(d.Id));
return result.Result.Id;
Expand Down

0 comments on commit 9c49a79

Please sign in to comment.