Skip to content

The e2e check

tester-army/e2e, the npm package e2e (Apache-2.0), is an end-to-end testing tool whose agent uses a model to drive Chromium. Axocoatl can run it as a required check of a loadout: inside the Session container, on the exact final files, with its test results in the run’s Outcome and JUnit file.

Axocoatl pins e2e@0.18.0, which needs Node 22.22.3 or a later 22.x, or Node 24.8 or later; the recipe image has Node 24.21.0.

  1. Build the e2e image:

    Terminal window
    axocoatl recipe build e2e

    The image holds Node, Playwright’s Chromium headless shell and e2e@0.18.0 on the PATH, installed from an exact lockfile that pins every package by version and integrity. Combine it with an external agent when the loadout has one, as in axocoatl recipe build claude-code e2e. See Build the image.

  2. Store the key for e2e’s model, piped in on standard input:

    Terminal window
    printenv OPENROUTER_API_KEY | axocoatl secret set e2e-openrouter
  3. Add the check, the route its model calls go through, and the recipe to the loadout:

    checks:
    - name: e2e
    run:
    e2e:
    args: [run]
    model_route: openrouter.ai
    model: { param: e2e_model }
    timeout: 15m
    routes:
    - host: openrouter.ai
    credential: e2e-openrouter
    inject: { header: Authorization, format: "Bearer {}" }
    rules:
    - { methods: [POST], path: "/api/v1/chat/completions" }
    params:
    e2e_model: { kind: text, required: true, description: a model with tool calls and image input }
    environment:
    recipes: [e2e]

model_route names a host under the loadout’s routes, and that route needs a credential and inject, so the key never enters the container. model is a model id of letters, digits and ._:/@+-, at most 200 bytes; a parameter for it is a text parameter. args are the arguments after e2e: the first is run or explore ([run] when left out), at most 64 in all, and --reporter, --headed, --help and --version are refused, because the check writes its own report and runs headless. timeout is at most 30 minutes.

The check runs e2e <command> --reporter json <rest of args> through a small wrapper, as sh -c, inside the Session container. The wrapper:

  • forces E2E_TELEMETRY_DISABLED=1, whatever the repository sets;
  • sets e2e’s model and its base URL and key variables for the route; the key variable holds a placeholder, and the daemon adds the real key on your computer to each request the route’s rules allow, so the key never enters the container;
  • writes e2e’s JSON report to /tmp/axocoatl-check-reports/<check name>/report.json, outside the Workspace, and its diagnostics to e2e.log beside it;
  • prints the last 16 KiB of that log, then AXOCOATL-CHECK-REPORT sha256=<hex>, the SHA-256 of the report, as its last line of output, and exits with e2e’s own status.

The repository’s .e2e/cache is mounted read-only for a loadout with an e2e check, so a run cannot change the cache your other e2e runs use; the rest of the Workspace stays writable. Every model call e2e makes is a request on the route and is in the Session’s network record.

A route to a model API host (openrouter.ai, api.openai.com, api.anthropic.com, generativelanguage.googleapis.com, api.mistral.ai, api.x.ai, ai-gateway.vercel.sh) also reads each request body and refuses one that asks the provider to fetch a URL, search the web or run a tool itself (Requests to model APIs). It reads the Chat Completions, Responses, Messages and Gemini formats. The AI SDK’s own protocol to the Vercel AI Gateway, which e2e init configures by default, is not one of them: see The Vercel AI Gateway.

Under network: egress a required check normally has no network: the proxy refuses every connection it makes. An e2e check is the exception. Its process gets an egress credential of its own for as long as it runs, as a writer’s shell does, so it reaches the loadout’s routes and allowlist and nothing else, with every connection recorded. Other required checks of the same loadout still get none.

  • The model choice. e2e has no environment variable for the model: the project’s e2e.config.ts picks it. The wrapper exports AXOCOATL_E2E_MODEL, AXOCOATL_E2E_BASE_URL and AXOCOATL_E2E_API_KEY (the placeholder), and for well-known hosts it also sets the provider’s own key variable to the placeholder. A config that ignores AXOCOATL_E2E_MODEL runs its own model; the check’s result then says which model the report shows, and the capability check above covers only the model the loadout declares.
  • Ignored output. e2e always writes its output directory into the Workspace (.e2e/report.json and .e2e/artifacts/ by default). The repository must ignore those paths, as e2e init does in .gitignore; otherwise the files change between the captures around the check and readiness fails with changed files.
  • Its own dependencies. The project’s node_modules must provide e2e@0.18.0, @e2e-dev/web@0.13.0 (Playwright 1.63.0, which matches the Chromium in the recipe image), ai and the provider package. They come from the loadout’s setup command, which needs the registry under egress.allow. Another @e2e-dev/web version looks for another Chromium build, which it cannot download under egress.
  • CI mode. The check runs e2e with CI=1: one worker, one retry of a failing test and a read-only replay cache. A retried failing agent step can spend its model calls twice.

e2e’s agent needs a model that calls tools and reads images. For a check whose model_route is openrouter.ai, admission reads OpenRouter’s public model catalog and refuses the run (exit code 3) when the model is not listed with tool calls and image input. That catalog request goes from your computer, without a credential, when the run is admitted, and is not in the Session’s network record; when the catalog cannot be read, the run does not start (exit code 5). For other routes Axocoatl cannot check, and the run warns (e2e_model_capability_unverified) that the capability is not verified. A model_route of ai-gateway.vercel.sh that checks bodies also gets e2e_ai_sdk_gateway_refused (The Vercel AI Gateway).

e2e init sets e2e’s model to gateway('openai/gpt-6-luna-fast') from ai unless you choose another gateway. That client sends the AI SDK’s own protocol to the gateway (POST /v4/ai/language-model with ai 7.0.139). Vercel documents the gateway’s Chat Completions, Responses and Anthropic Messages APIs, and this protocol only through the AI SDK, not as an HTTP API, so the route cannot tell what such a request asks the gateway, or the provider behind it, to do. A route to ai-gateway.vercel.sh that checks bodies, the default, refuses it with 403 ai_sdk_gateway_refused and a hint that names the fix, and records it with that reason, which Session network explains with the same fix. Admission warns about it (e2e_ai_sdk_gateway_refused) for every e2e check whose model_route is that host and checks bodies. The run still starts: admission cannot see which client your e2e.config.ts builds.

Build e2e’s model with the gateway’s OpenAI-compatible API instead, which the route checks like any Chat Completions request:

e2e.config.ts
import type { E2EConfig } from 'e2e';
import { web } from '@e2e-dev/web';
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
// In Axocoatl's e2e check, AXOCOATL_E2E_BASE_URL is https://ai-gateway.vercel.sh/v1,
// AXOCOATL_E2E_API_KEY is the placeholder the route replaces with your key, and
// AXOCOATL_E2E_MODEL is the check's model.
const aiGateway = createOpenAICompatible({
name: 'ai-gateway',
baseURL: process.env.AXOCOATL_E2E_BASE_URL ?? 'https://ai-gateway.vercel.sh/v1',
apiKey: process.env.AXOCOATL_E2E_API_KEY ?? process.env.AI_GATEWAY_API_KEY,
supportsStructuredOutputs: true,
});
export default {
agents: {
default: {
model: aiGateway.chatModel(process.env.AXOCOATL_E2E_MODEL ?? 'openai/gpt-6-luna-fast'),
},
},
targets: [{ engine: web(), app: { url: process.env.APP_URL ?? 'http://localhost:3000' } }],
} satisfies E2EConfig;

Add @ai-sdk/openai-compatible 3.x, the version e2e 0.18.0 accepts, to the project’s dependencies, and allow the endpoint on the loadout’s route:

routes:
- host: ai-gateway.vercel.sh
credential: e2e-gateway
inject: { header: Authorization, format: "Bearer {}" }
rules:
- { methods: [POST], path: "/v1/chat/completions" }
  • The fallbacks after ?? keep the config working outside Axocoatl, with your AI_GATEWAY_API_KEY.
  • Name the provider something other than openai: under that name @ai-sdk/openai-compatible would also copy into each request the OpenAI options e2e adds for openai/ models.
  • supportsStructuredOutputs sends e2e’s JSON schemas as response_format of type json_schema, which the gateway’s Chat Completions API supports; without it the client asks only for a JSON object.

With e2e 0.18.0’s model adapter, ai 7.0.139 and @ai-sdk/openai-compatible 3.0.68 in the e2e recipe image, and the variables the check exports, this config sends e2e’s judgments (a JSON schema and the screenshot as a data: URL) and its tool calls to /v1/chat/completions. Axocoatl’s tests send those captured requests through a loadout’s route to ai-gateway.vercel.sh: they pass the check and reach the gateway byte for byte with the key, and the gateway() request is refused unsent.

provider_fetch: allow on the loadout’s route lets gateway() work as it did before 1.3.2, with AI_GATEWAY_API_KEY, which the check sets to the placeholder for this host. The route then sends every body to the gateway unread, so a request could ask the gateway or the provider behind it to fetch URLs, search the web, connect to MCP servers or run tools itself, and the record would not show what it asked.

After the run’s last turn, Axocoatl reads each check’s report from the Session container (at most 4 MiB) and accepts it only when its SHA-256 matches the marker that check printed in its final recorded run, so a report left over from an earlier run, or written by something else, is not used. The report is parsed into the check’s result in the Outcome: its format, its digest, each test case with its suite, name, status, message and duration, and the counts passed, failed, skipped and errors.

The check passes or fails on e2e’s exit status, as any check does. A missing report, or one whose digest does not match, leaves the check without a report and says why. In the JUnit file, each report adds a suite check:<name> with its test cases.