Skip to content

E2EFixture

Namespace: E2E

public abstract class E2EFixture

The part of a test base class that every test framework shares. It holds the settings and starts one E2ESession per test. A framework adapter, such as E2E.NUnit.E2ETest, calls MethodBase) before the test body and commits the session from the framework’s result after it.

<p> Settings come from Config, the nearest e2e.config.json above the test assembly or the working directory. Override a property to change one value for a fixture. </p>

Inheritance: object

Derived: E2ETest, E2ETest

View source

protected virtual TimeSpan ActionTimeout { get; }

Value: TimeSpan

View source

protected Agent Agent { get; }

Value: Agent

View source

protected virtual string? AgentContext { get; }

agents.default.context: project context told to every model call.

Value: string

View source

protected virtual IStepExecutor? AgentExecutor { get; }

The custom brain of agents.default, upstream’s executor. None by default: an executor is code, so the config file cannot name one. With one, AgentSystem and AgentTools must be unset.

Value: IStepExecutor

View source

protected virtual string? AgentSystem { get; }

agents.default.system: text appended to the act rules.

Value: string

View source

protected virtual IReadOnlyDictionary<string, AgentTool>? AgentTools { get; }

The project tools of agents.default, offered to the model beside the agent’s own. None by default; a device test passes MobileTools.Create(engine).

Value: IReadOnlyDictionary<string, AgentTool>

View source

protected virtual bool AiTrace { get; }

E2E_AI_TRACE: when set to 1 or true, the port’s counterpart of --ai-trace. Each test records every model call in the AI SDK devtools shape. The process writes them to ai-trace-<process id>.json next to the results directory (.e2e by default); read it with npx unbox-ai. Override to turn it on in code.

Value: bool

View source

protected App App { get; }

Value: App

View source

protected virtual TimeSpan AssertionTimeout { get; }

Value: TimeSpan

View source

protected virtual string? BaseUrl { get; }

targets[0].app.url.

Value: string

View source

protected Browser Browser { get; }

Value: Browser

View source

protected virtual string CacheDirectory { get; }

cache.dir, resolved against the config directory.

Value: string

View source

protected virtual CacheMode CacheMode { get; }

cache.mode. Unset, it is read-write locally and read-only in CI.

Value: CacheMode

View source

protected virtual bool CacheStrict { get; }

cache.strict.

Value: bool

View source

protected virtual TimeSpan CleanupTimeout { get; }

Value: TimeSpan

View source

protected virtual E2EConfig Config { get; }

The discovered e2e.config.json, or the defaults when there is none. Loaded once per test run.

Value: E2EConfig

View source

protected TestContext Context { get; }

Value: TestContext

View source

protected virtual bool Debug { get; }

E2E_DEBUG: when set to 1 or true, the port’s counterpart of --debug. Each test prints its phase timings to stderr and keeps the transcript of every agent step. Override to turn it on in code.

Value: bool

View source

protected virtual TimeSpan JudgmentTimeout { get; }

agents.default.judgmentTimeout.

Value: TimeSpan

View source

protected virtual TimeSpan LaunchTimeout { get; }

Value: TimeSpan

View source

protected virtual int MaxModelCalls { get; }

agents.default.maxModelCalls.

Value: int

View source

protected virtual int MaxSteps { get; }

agents.default.maxSteps: actions one ActAsync may take. ActOptions.MaxSteps can only lower it.

Value: int

View source

protected virtual string ProjectRoot { get; }

Anchors the files a test names, such as a route’s fulfill path. Defaults to the config’s directory.

Value: string

View source

protected virtual IReadOnlyDictionary<string, JsonElement>? ProviderOptions { get; }

agents.default.providerOptions.

Value: IReadOnlyDictionary<string, JsonElement>

View source

protected virtual TimeSpan ReplayTimeout { get; }

How long a replay waits for each recorded target and for the recorded end state.

Value: TimeSpan

View source

protected virtual string? ResultsDirectory { get; }

Where a failed screenshot comparison puts its diff, actual, and expected images. Defaults to .e2e/results under ProjectRoot.

Value: string

View source

protected virtual string? RunAgent { get; }

E2E_AGENT: the agent that calls use when neither the call nor the test (AgentAttribute) names one, the port’s counterpart of --agent. Unset, it is default. Override to set it in code.

Value: string

View source

protected Screen Screen { get; }

Value: Screen

View source

protected Secrets Secrets { get; }

Secrets declared in the config, with E2E_SECRET_{NAME} overrides.

Value: Secrets

View source

protected virtual TimeSpan StepTimeout { get; }

How long one ActAsync may run unless its options say otherwise. A .NET-only setting.

Value: TimeSpan

View source

protected virtual string TargetName { get; }

targets[0].name: the target part of a stored screenshot’s file name.

Value: string

View source

protected virtual TimeSpan TestTimeout { get; }

Value: TimeSpan

View source

protected virtual ResolvedRecording Trace { get; }

trace for the target: E2E_TRACE, else targets[0].trace, else the config’s trace, else retain-on-failure. Override to set it for one fixture.

Value: ResolvedRecording

View source

protected virtual bool UpdateSnapshots { get; }

E2E_UPDATE_SNAPSHOTS: when set to 1, ToHaveScreenshotAsync writes each stored screenshot it finds missing or different, and passes. Override to turn it on in code.

Value: bool

View source

protected virtual ResolvedRecording Video { get; }

video for the target: E2E_VIDEO, else targets[0].video, else the config’s video, else off. Override to set it for one fixture.

Value: ResolvedRecording

View source

protected Task CaptureFailureEvidenceAsync(Exception error)

Looks at the app now, for an adapter to call when the test body has failed and before the test’s own teardown runs, so a teardown that navigates away cannot replace the evidence. See CaptureFailureEvidenceAsync(Exception). Does nothing when setup never started a session.

Parameters

Name Type Description
error Exception

Returns: Task

View source

protected virtual IReadOnlyDictionary<string, AgentOptions> CreateAgents()

The named agents besides default, picked per call with the Agent option. Defaults to every other agents.<name> entry in the config.

Returns: IReadOnlyDictionary<string, AgentOptions>

View source

protected virtual IEngine CreateEngine()

Browser engine. Override to supply a DocumentEngine or a custom engine.

Returns: IEngine

View source

protected virtual IAgentModel? CreateJudge()

The judge for agents.default: agents.default.judge, or null to judge with CreateModel().

Returns: IAgentModel

View source

protected virtual IAgentModel? CreateModel()

The model for agents.default, or null when the config sets no model.

Returns: IAgentModel

View source

StartSessionAsync(string, int, Action<TestException>?, Func<bool>, CancellationToken, MethodBase?)

Section titled “StartSessionAsync(string, int, Action<TestException>?, Func<bool>, CancellationToken, MethodBase?)”
protected Task StartSessionAsync(string title, int attempt, Action<TestException>? onSoftFailure, Func<bool> testFailed, CancellationToken cancellationToken, MethodBase? testMethod = null)

Starts the session for one test. <code class=“paramref”>title</code> is the cache identity, <code class=“paramref”>attempt</code> is 1 for a first attempt, <code class=“paramref”>onSoftFailure</code> reports an Expect.Soft failure to the framework (null keeps them on the session), and <code class=“paramref”>testFailed</code> says whether the framework already failed the test. <code class=“paramref”>testMethod</code> is the test’s method, which carries its AgentAttribute and AgentContextAttribute.

Parameters

Name Type Description
title string
attempt int
onSoftFailure Action<TestException>
testFailed Func<bool>
cancellationToken CancellationToken
testMethod MethodBase

Returns: Task

View source

protected E2ESession? TakeSession()

Hands the running session to the adapter to complete and dispose, or null when setup never started one.

Returns: E2ESession

View source