Skip to content

Runner, reporters and types

The programmatic runner behind blop test run, the files it writes, and the types @blopai/test exports. Import from @blopai/test, never @blopai/cli or files under dist/; coverage helpers come from @blopai/test/coverage.

FunctionUse
runBlopTest(options)Run one spec file (options.specFile)
runBlopTests(options)Run several spec files (options.specFiles) in a browser, write reports and optionally upload

Both return Promise<BlopRunResult>.

import { runBlopTests } from "@blopai/test";
const result = await runBlopTests({
specFiles: ["tests/homepage.blop.ts"],
baseUrl: "http://localhost:3000",
reporter: "all",
});
if (result.status !== "passed") process.exit(1);

BlopRunOptions fields. Every field is optional; the blop.config.ts fields in Configuration use the same names and defaults.

FieldTypePurpose
specFile, specFilesstring, string[]What to run
baseUrlstringApp under test; relative agent.goto() paths resolve against it
browserContextPlaywright BrowserContextOptionsExtra context options
browser, viewport, headed, containerizedSee ConfigurationBrowser choice and display
provider, model, apiKey, reasoningEffortstring; "none" | "low" | "medium" | "high" | "max"Provider settings; the effort applies when the API supports it
cwdstringWorking directory for the agent
maxSteps, timeoutMs, retries, workersnumberStep cap, per-check time cap, retries, concurrency
reportDir, reporter, verbosestring, BlopReporter, booleanReports
progressFilestringAppend live NDJSON progress (test_start, action, frame, test_finish)
captureStepScreenshots, streamFrames, frameIntervalMsboolean, boolean, numberPer-action screenshots and live Chromium frames
coverage, coverageEndpointboolean, stringChromium JavaScript coverage and the collector that receives it
platformUrl, platformApiKeystringBlop Cloud upload; also needs BLOP_PROJECT_ID
otelEndpoint, otelHeaders, otelServiceName, otelEnvironment, otelPropagateToApp, otelPropagateAllowlistSee ConfigurationOpenTelemetry export
evidenceBlopEvidenceLaunch provenance from a trace or finding; never proof of a fix
agentStreamBlopAgentStreamRunnerReplace the model to test the runner; see Run browser checks without a provider

BlopRunResult has runId, status, startedAt, finishedAt (ISO 8601), durationMs and results: BlopTestResult[]. Its status is error if any check errored, else failed if any failed, else passed.

BlopTestResult fieldMeaning
id, name, specFileCheck identity; specFile is repo-relative or null
status, reasonOutcome and the agent’s explanation
startedAt, finishedAt, durationMsTiming
attempts, firstAttemptStatus1 plus retries used; the first attempt’s status when retried, else null
resumesAgent recoveries in the same live browser; not retries
synthetictrue for a record the runner made for a spec load error or aborted run
baseUrl, provider, modelWhat ran, or null
ciBlopCiMetadata
screenshots, screenshotArtifactsScreenshot paths and their details
criticalPointsRequirements the agent recorded with record_critical_point
browserLogsConsole messages, page errors and failed requests
actionsBlopAction: name, input, output, metadata, timestamp, durationMs for each tool call
eventsBlopAgentEvent: event_type, content, metadata, timestamp
StatusMeaning
passedThe agent called finish_test with passed
failedThe agent finished with an unmet goal; check the assertions and evidence before blaming the app
errorThe run did not finish normally: timeout, browser crash, provider failure or invalid spec

A final passed with a non-passing firstAttemptStatus is flaky.

BlopCiMetadata has provider, runId, jobId, branch, commitSha, pullRequest (raw ref such as refs/pull/42/merge), pullRequestNumber, repositoryUrl, workflowName, runAttempt, runUrl and refType (branch or tag). It is filled on GitHub Actions (provider: "github-actions") and null elsewhere.

Every run writes to reportDir (default .blop/), whether started from the CLI, watch mode or runBlopTests.

FileWritten
results.jsonAlways; the BlopRunResult
events.jsonlAlways; one BlopAgentEvent per line
report.xmlWith reporter junit or all
screenshots/When the check takes screenshots or per-action capture is on
coverage.jsonWith coverage; the Inspector shows the latest report at /inspector?view=coverage
ReporterFiles
all (default)results.json, events.jsonl, report.xml
junitSame as all
json, basicresults.json, events.jsonl
event_typeTells you
step_start, step_finishOne reasoning step
tool_resultWhat a browser tool returned
text_delta, textThe agent’s narration

report.xml is one flat <testsuite> with a <testcase> per check. Both failed and error become <failure> with the reason as its body, and time is in seconds.

Use a fresh --report-dir per run, such as .blop/reports/$GITHUB_RUN_ID, because old screenshots stay. Never delete all of .blop/: it can also hold the project’s collector store and configuration. Add .blop/ to .gitignore.

TypesReference
BlopAgent, BlopAgentTest, BlopAgentTestContext, BlopAgentTestHandler, BlopAgentStepTest DSL
BlopRunOptions, BlopRunResult, BlopTestResult, BlopTestStatus, BlopAction, BlopAgentEvent, BlopCiMetadata, BlopAgentStreamRunner, BlopAgentStreamEventThis page
BlopConfig, BlopBrowserName, BlopReporterConfiguration

Exported functions include agentTest, describe, defineAgentTest, loadAgentTests, runBlopTest, runBlopTests, runBrowserAgentStream, runNativeAgentStream and loadBlopConfig; BLOP_BROWSER_NAMES lists the browser names.