Files
Terminal.Gui/Tests/TerminalGuiFluentTesting/With.cs
Copilot 2d84ab4f01 Fixes #4322 - FluentTests: Forward configurable timeout to GuiTestContext (#4323)
* Initial plan

* Implement configurable startup timeout for GuiTestContext

- Increase default With.Timeout from 30s to 120s (CI-friendly)
- Add timeout parameter to GuiTestContext constructor
- Forward With.Timeout to GuiTestContext in both A() overloads
- Use configurable timeout for _hardStop CancellationTokenSource
- Update boot wait from fixed 10s to use configurable timeout
- Update WaitUntil to use instance timeout instead of static With.Timeout

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix code style - add missing spaces in With.cs

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Change timeout back to 30 seconds as requested

Co-authored-by: tig <585482+tig@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-10-25 11:48:43 -06:00

41 lines
1.4 KiB
C#

namespace TerminalGuiFluentTesting;
/// <summary>
/// Entry point to fluent assertions.
/// </summary>
public static class With
{
/// <summary>
/// Entrypoint to fluent assertions
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="testDriver">Which v2 testDriver to use for the test</param>
/// <param name="logWriter"></param>
/// <returns></returns>
public static GuiTestContext A<T> (int width, int height, TestDriver testDriver, TextWriter? logWriter = null) where T : Toplevel, new ()
{
return new (() => new T (), width, height, testDriver, logWriter, Timeout);
}
/// <summary>
/// Overload that takes a function to create instance <paramref name="toplevelFactory"/> after application is initialized.
/// </summary>
/// <param name="toplevelFactory"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="testDriver"></param>
/// <returns></returns>
public static GuiTestContext A (Func<Toplevel> toplevelFactory, int width, int height, TestDriver testDriver)
{
return new (toplevelFactory, width, height, testDriver, null, Timeout);
}
/// <summary>
/// The global timeout to allow for any given application to run for before shutting down.
/// </summary>
public static TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds (30);
}