Skip to content

Commit

Permalink
Return type
Browse files Browse the repository at this point in the history
  • Loading branch information
FriggaHel committed Jul 2, 2024
1 parent c9b413e commit b6d5d6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

namespace SauceLabs.Visual.Utils
{
internal class IgnoreRegions
internal class IgnoredRegions
{
internal RegionIn[] RegionsIn;

Check warning on line 11 in visual-dotnet/SauceLabs.Visual/Utils/IgnoredRegions.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'RegionsIn' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 11 in visual-dotnet/SauceLabs.Visual/Utils/IgnoredRegions.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'RegionsIn' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
internal ElementIn[] ElementsIn;

Check warning on line 12 in visual-dotnet/SauceLabs.Visual/Utils/IgnoredRegions.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'ElementsIn' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 12 in visual-dotnet/SauceLabs.Visual/Utils/IgnoredRegions.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'ElementsIn' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

internal static void SplitIgnoredRegions(SelectiveRegion[]? regions, IgnoreRegion[]? ignoreRegions, IWebElement[]? ignoreElements, out RegionIn[] regionIns, out ElementIn[] elementIns)

internal static IgnoredRegions SplitIgnoredRegions(SelectiveRegion[]? regions, IgnoreRegion[]? ignoreRegions, IWebElement[]? ignoreElements)
{
var emptyRegions = regions?.Any(r => r.Region == null && r.Element == null);
if (emptyRegions != null && emptyRegions != false)
Expand All @@ -25,8 +28,7 @@ internal static void SplitIgnoredRegions(SelectiveRegion[]? regions, IgnoreRegio
ignoredElements.AddRange(ignoreElements?.Select(elem => new ElementIn(elem)) ?? new List<ElementIn>());
ignoredElements.AddRange(regions?.Where(r => r.Element != null).Select(r => r.ToElementIn()) ?? new List<ElementIn>());

regionIns = ignoredRegions.ToArray();
elementIns = ignoredElements.ToArray();
return new IgnoredRegions { RegionsIn = ignoredRegions.ToArray(), ElementsIn = ignoredElements.ToArray() };
}
}
}
6 changes: 3 additions & 3 deletions visual-dotnet/SauceLabs.Visual/VisualClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Task<string> VisualCheck(string name, VisualCheckOptions? options = null,

private async Task<string> VisualCheckAsync(string name, VisualCheckOptions options)
{
IgnoreRegions.SplitIgnoredRegions(options.Regions, options.IgnoreRegions, options.IgnoreElements, out var ignoredRegions, out var ignoredElements);
var ignoredRegions = IgnoredRegions.SplitIgnoredRegions(options.Regions, options.IgnoreRegions, options.IgnoreElements);

FullPageConfigIn? fullPageConfigIn = null;
if (options.FullPage == true)
Expand All @@ -154,8 +154,8 @@ private async Task<string> VisualCheckAsync(string name, VisualCheckOptions opti
name: name,
jobId: _jobId,
diffingMethod: options.DiffingMethod ?? DiffingMethod.Simple,
regions: ignoredRegions,
ignoredElements: ignoredElements,
regions: ignoredRegions.RegionsIn,
ignoredElements: ignoredRegions.ElementsIn,
sessionId: _sessionId,
sessionMetadata: _sessionMetadataBlob ?? "",
captureDom: options.CaptureDom ?? CaptureDom,
Expand Down

0 comments on commit b6d5d6f

Please sign in to comment.