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

LMBQ-373: Fix visual verification tests instead of using Firefox and skipping them #392

Merged
merged 11 commits into from
Jul 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ public static void WaitScrollToNotChange(

lastScrollPosition = currentScrollPosition;

context.TriggerHtmlReload();

return ready;
},
timeout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static void SetBrowserSize(this UITestContext context, Size size)
context.Configuration.TestOutputHelper.WriteLineTimestampedAndDebug(
"Set window size to {0}x{1}.", size.Width, size.Height);
context.Driver.Manage().Window.Size = new System.Drawing.Size(size.Width, size.Height);
context.TriggerHtmlReload();
}

/// <summary>
Expand Down
16 changes: 14 additions & 2 deletions Lombiq.Tests.UI/Extensions/ScrollingUITestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,20 @@ public static void ScrollTo(this UITestContext context, Point position) =>
/// <summary>
/// Scrolls to a particular set of coordinates in the document.
/// </summary>
public static void ScrollTo(this UITestContext context, int x, int y) =>
context.ExecuteScript("window.scrollTo(arguments[0], arguments[1], \"instant\");", x, y);
public static void ScrollTo(this UITestContext context, int x, int y)
{
context.ExecuteScript("window.scrollTo(arguments[0], arguments[1], 'instant');", x, y);
context.TriggerHtmlReload();
}

/// <summary>
/// Sometimes elements don't render properly after scrolling. So we have to set the scale to re-render them.
/// </summary>
public static void TriggerHtmlReload(this UITestContext context)
{
context.ExecuteScript("document.body.style.transform = 'scale(1)';");
context.ExecuteScript("document.body.style.transform = '';");
}

/// <summary>
/// Scrolls the document vertically to the given <paramref name="position"/>.
Expand Down