E2EFixture
Namespace: E2E
public abstract class E2EFixtureThe 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
Properties
Section titled “Properties”ActionTimeout
Section titled “ActionTimeout”protected virtual TimeSpan ActionTimeout { get; }Value: TimeSpan
protected Agent Agent { get; }Value: Agent
AgentContext
Section titled “AgentContext”protected virtual string? AgentContext { get; }agents.default.context: project context told to every model call.
Value: string
AgentExecutor
Section titled “AgentExecutor”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
AgentSystem
Section titled “AgentSystem”protected virtual string? AgentSystem { get; }agents.default.system: text appended to the act rules.
Value: string
AgentTools
Section titled “AgentTools”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>
AiTrace
Section titled “AiTrace”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
protected App App { get; }Value: App
AssertionTimeout
Section titled “AssertionTimeout”protected virtual TimeSpan AssertionTimeout { get; }Value: TimeSpan
BaseUrl
Section titled “BaseUrl”protected virtual string? BaseUrl { get; }targets[0].app.url.
Value: string
Browser
Section titled “Browser”protected Browser Browser { get; }Value: Browser
CacheDirectory
Section titled “CacheDirectory”protected virtual string CacheDirectory { get; }cache.dir, resolved against the config directory.
Value: string
CacheMode
Section titled “CacheMode”protected virtual CacheMode CacheMode { get; }cache.mode. Unset, it is read-write locally and read-only in CI.
Value: CacheMode
CacheStrict
Section titled “CacheStrict”protected virtual bool CacheStrict { get; }cache.strict.
Value: bool
CleanupTimeout
Section titled “CleanupTimeout”protected virtual TimeSpan CleanupTimeout { get; }Value: TimeSpan
Config
Section titled “Config”protected virtual E2EConfig Config { get; }The discovered e2e.config.json, or the defaults when there is none. Loaded once per test run.
Value: E2EConfig
Context
Section titled “Context”protected TestContext Context { get; }Value: TestContext
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
JudgmentTimeout
Section titled “JudgmentTimeout”protected virtual TimeSpan JudgmentTimeout { get; }agents.default.judgmentTimeout.
Value: TimeSpan
LaunchTimeout
Section titled “LaunchTimeout”protected virtual TimeSpan LaunchTimeout { get; }Value: TimeSpan
MaxModelCalls
Section titled “MaxModelCalls”protected virtual int MaxModelCalls { get; }agents.default.maxModelCalls.
Value: int
MaxSteps
Section titled “MaxSteps”protected virtual int MaxSteps { get; }agents.default.maxSteps: actions one ActAsync may take. ActOptions.MaxSteps can only lower it.
Value: int
ProjectRoot
Section titled “ProjectRoot”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
ProviderOptions
Section titled “ProviderOptions”protected virtual IReadOnlyDictionary<string, JsonElement>? ProviderOptions { get; }agents.default.providerOptions.
Value: IReadOnlyDictionary<string, JsonElement>
ReplayTimeout
Section titled “ReplayTimeout”protected virtual TimeSpan ReplayTimeout { get; }How long a replay waits for each recorded target and for the recorded end state.
Value: TimeSpan
ResultsDirectory
Section titled “ResultsDirectory”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
RunAgent
Section titled “RunAgent”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
Screen
Section titled “Screen”protected Screen Screen { get; }Value: Screen
Secrets
Section titled “Secrets”protected Secrets Secrets { get; }Secrets declared in the config, with E2E_SECRET_{NAME} overrides.
Value: Secrets
StepTimeout
Section titled “StepTimeout”protected virtual TimeSpan StepTimeout { get; }How long one ActAsync may run unless its options say otherwise. A .NET-only setting.
Value: TimeSpan
TargetName
Section titled “TargetName”protected virtual string TargetName { get; }targets[0].name: the target part of a stored screenshot’s file name.
Value: string
TestTimeout
Section titled “TestTimeout”protected virtual TimeSpan TestTimeout { get; }Value: TimeSpan
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
UpdateSnapshots
Section titled “UpdateSnapshots”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
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
Methods
Section titled “Methods”CaptureFailureEvidenceAsync(Exception)
Section titled “CaptureFailureEvidenceAsync(Exception)”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
CreateAgents()
Section titled “CreateAgents()”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>
CreateEngine()
Section titled “CreateEngine()”protected virtual IEngine CreateEngine()Browser engine. Override to supply a DocumentEngine or a custom engine.
Returns: IEngine
CreateJudge()
Section titled “CreateJudge()”protected virtual IAgentModel? CreateJudge()The judge for agents.default: agents.default.judge, or null to judge with CreateModel().
Returns: IAgentModel
CreateModel()
Section titled “CreateModel()”protected virtual IAgentModel? CreateModel()The model for agents.default, or null when the config sets no model.
Returns: IAgentModel
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
TakeSession()
Section titled “TakeSession()”protected E2ESession? TakeSession()Hands the running session to the adapter to complete and dispose, or null when setup never started one.
Returns: E2ESession