Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into issue/OSOE-628
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Jun 11, 2023
2 parents c68608f + d8997d5 commit 39886d3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Lombiq.Tests.UI.Samples/UITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Lombiq.Tests.UI.Samples;

// This will be the base class for our UI test classes. Here we'll set up some common configuration. Inheriting test
// classes is not mandatory but the approach is simple and effective.
public class UITestBase : OrchardCoreUITestBase<Program>
public abstract class UITestBase : OrchardCoreUITestBase<Program>
{
protected UITestBase(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public static class VisualVerificationUITestContextExtensions
/// Returns the selector for the given screen size. This may return the same selector all the time, or a different
/// selector, e.g. if mobile and desktop views have different DOMs.
/// </param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
/// <remarks>
/// <para>
/// The parameter <c>beforeAssertAsync</c> was removed, because it sometimes polluted the stack trace, which was
Expand All @@ -49,7 +51,9 @@ public static class VisualVerificationUITestContextExtensions
public static void AssertVisualVerificationOnAllResolutions(
this UITestContext context,
IEnumerable<Size> sizes,
Func<Size, By> getSelector)
Func<Size, By> getSelector,
double pixelErrorPercentageThreshold = 0,
Action<VisualVerificationMatchApprovedConfiguration> configurator = null)
{
context.HideScrollbar();

Expand All @@ -62,9 +66,12 @@ public static void AssertVisualVerificationOnAllResolutions(
{
context.AssertVisualVerificationApproved(
getSelector(size),
pixelErrorPercentageThreshold: 0,
configurator: configuration => configuration
.WithFileNameSuffix(StringHelper.CreateInvariant($"{size.Width}x{size.Height}")));
pixelErrorPercentageThreshold: pixelErrorPercentageThreshold,
configurator: configuration =>
{
configuration.WithFileNameSuffix(StringHelper.CreateInvariant($"{size.Width}x{size.Height}"));
configurator?.Invoke(configuration);
});
}
catch (Exception exception)
{
Expand Down Expand Up @@ -92,8 +99,8 @@ public static void AssertVisualVerificationOnAllResolutions(
/// </summary>
/// <param name="context">The <see cref="UITestContext"/> in which the extension is executed on.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
/// <exception cref="VisualVerificationBaselineImageNotFoundException">
/// If no baseline image found under project path.
/// </exception>
Expand All @@ -118,8 +125,8 @@ public static void AssertVisualVerificationApproved(
/// <param name="context">The <see cref="UITestContext"/> in which the extension is executed on.</param>
/// <param name="elementSelector">Selector for the target element.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
/// <exception cref="VisualVerificationBaselineImageNotFoundException">
/// If no baseline image found under project path.
/// </exception>
Expand Down Expand Up @@ -167,8 +174,8 @@ public static void AssertVisualVerificationApproved(
/// <param name="context">The <see cref="UITestContext"/> in which the extension is executed on.</param>
/// <param name="element">Target element.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
/// <exception cref="VisualVerificationBaselineImageNotFoundException">
/// If no baseline image found under project path.
/// </exception>
Expand Down Expand Up @@ -199,8 +206,8 @@ public static void AssertVisualVerificationApproved(
/// <param name="context">The <see cref="UITestContext"/> in which the extension is executed on.</param>
/// <param name="baseline">The baseline image.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
public static void AssertVisualVerification(
this UITestContext context,
Image baseline,
Expand All @@ -222,8 +229,8 @@ public static void AssertVisualVerification(
/// <param name="elementSelector">Selector for the target element.</param>
/// <param name="baseline">The baseline image.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
public static void AssertVisualVerification(
this UITestContext context,
By elementSelector,
Expand Down Expand Up @@ -270,8 +277,8 @@ public static void AssertVisualVerification(
/// <param name="element">The target element.</param>
/// <param name="baseline">The baseline image.</param>
/// <param name="pixelErrorPercentageThreshold">Maximum acceptable pixel error in percentage.</param>
/// <param name="regionOfInterest">Region of interest. Can be null.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be null.</param>
/// <param name="regionOfInterest">Region of interest. Can be <see langword="null"/>.</param>
/// <param name="configurator">Action callback to configure the behavior. Can be <see langword="null"/>.</param>
public static void AssertVisualVerification(
this UITestContext context,
IWebElement element,
Expand Down

0 comments on commit 39886d3

Please sign in to comment.