docs: document e2e helpers

This commit is contained in:
Peter Steinberger
2026-06-05 00:04:03 -04:00
parent bafe17e60b
commit cb5bb9b936
76 changed files with 76 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
// Walks the kitchen-sink gateway RPC scenario for E2E smoke coverage.
import childProcess from "node:child_process";
import fs from "node:fs";
import os from "node:os";

View File

@@ -1,3 +1,4 @@
// Helpers for extracting agent turn output from E2E protocol events.
import fs from "node:fs";
import { readTextFileTail, tailText } from "./text-file-utils.mjs";

View File

@@ -1,3 +1,4 @@
// Bounded response body reader used by E2E HTTP fixture clients.
function bodyTooLargeError(label, byteLimit) {
return Object.assign(new Error(`${label} response body exceeded ${byteLimit} bytes`), {
code: "ETOOBIG",

View File

@@ -1,3 +1,4 @@
// Assertions for browser CDP snapshot E2E fixtures.
import fs from "node:fs";
const snapshotPath = process.argv[2] ?? "/tmp/browser-cdp-snapshot.txt";

View File

@@ -1,3 +1,4 @@
// Fixture HTTP server for browser CDP snapshot E2E scenarios.
import http from "node:http";
import { readPositiveIntEnv } from "../env-limits.mjs";

View File

@@ -1,3 +1,4 @@
// Assertions for Bun global install E2E validation.
import { spawn } from "node:child_process";
const DEFAULT_TIMEOUT_KILL_GRACE_MS = 30_000;

View File

@@ -1,3 +1,4 @@
// Probe script for bundled plugin install/uninstall E2E scenarios.
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import os from "node:os";

View File

@@ -1,3 +1,4 @@
// Runtime smoke script for bundled plugin install/uninstall E2E validation.
import childProcess from "node:child_process";
import fs from "node:fs";
import os from "node:os";

View File

@@ -1,3 +1,4 @@
// CommonJS fixture server for ClawHub package/install E2E scenarios.
const crypto = require("node:crypto");
const fs = require("node:fs");
const http = require("node:http");

View File

@@ -1,3 +1,4 @@
// Shared Codex plugin install helpers for E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { readJson } from "./fixtures/common.mjs";

View File

@@ -1,3 +1,4 @@
// Client helpers for Codex media-path E2E fixtures.
import { createHash, randomBytes, randomUUID } from "node:crypto";
import { setTimeout as delay } from "node:timers/promises";
import { PROTOCOL_VERSION } from "../../../../dist/gateway/protocol/index.js";

View File

@@ -1,3 +1,4 @@
// Fake Codex app server used by media-path E2E scenarios.
import fs from "node:fs";
import readline from "node:readline";

View File

@@ -1,3 +1,4 @@
// Tails JSONL request logs for Codex media-path E2E assertions.
import {
createIncrementalLineReader,
resolvePositiveInteger,

View File

@@ -1,3 +1,4 @@
// Limits shared by Codex media-path E2E fixtures.
export function readPositiveIntEnv(name, fallback, env = process.env) {
const text = String(env[name] ?? fallback).trim();
if (!/^\d+$/u.test(text)) {

View File

@@ -1,3 +1,4 @@
// Writes config fixtures for Codex media-path E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { readPositiveIntEnv } from "./limits.mjs";

View File

@@ -1,3 +1,4 @@
// Assertions for Codex npm plugin live E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import {

View File

@@ -1,3 +1,4 @@
// Assertions for Codex on-demand plugin E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { DatabaseSync } from "node:sqlite";

View File

@@ -1,3 +1,4 @@
// Log assertions for config reload E2E scenarios.
import { readPositiveIntEnv } from "../env-limits.mjs";
import { createConfigReloadLogScanner } from "./log-scanner.mjs";

View File

@@ -1,3 +1,4 @@
// Streaming log scanner for config reload E2E scenarios.
import {
createIncrementalLineReader,
resolvePositiveInteger,

View File

@@ -1,3 +1,4 @@
// Mutates plugin metadata fixtures for config reload E2E scenarios.
import fs from "node:fs";
const configPath = process.env.OPENCLAW_CONFIG_PATH;

View File

@@ -1,3 +1,4 @@
// Resource ceiling assertions for Docker E2E stats output.
import fs from "node:fs";
import { createInterface } from "node:readline";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Writes wrapper scripts for doctor install-switch E2E scenarios.
import fs from "node:fs";
const [wrapperPath, npmBin, logPath = `${process.env.HOME}/openclaw-wrapper-argv.log`] =

View File

@@ -1,3 +1,4 @@
// Environment limit helpers for E2E subprocess scenarios.
export function readPositiveIntEnv(name, fallback, env = process.env) {
const raw = env[name] ?? fallback;
const text = raw == null ? "unset" : String(raw).trim();

View File

@@ -1,3 +1,4 @@
// Shared command fixture dispatcher for E2E scripts.
import { configCommands } from "./fixtures/config.mjs";
import { pluginCommands } from "./fixtures/plugins.mjs";
import { workspaceCommands } from "./fixtures/workspace.mjs";

View File

@@ -1,3 +1,4 @@
// Common file/assertion helpers for E2E fixture writers.
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Config fixture writer commands for E2E scenarios.
import path from "node:path";
import { requireArg, writeJson } from "./common.mjs";

View File

@@ -1,3 +1,4 @@
// Mock OpenAI model config helpers for E2E fixture generation.
export function applyMockOpenAiModelConfig(cfg, params) {
const modelRef = params.modelRef ?? "openai/gpt-5.5";
const modelId = modelRef.split("/").at(-1) ?? "gpt-5.5";

View File

@@ -1,3 +1,4 @@
// Plugin fixture writer commands for E2E scenarios.
import path from "node:path";
import { requireArg, write, writeJson } from "./common.mjs";

View File

@@ -1,3 +1,4 @@
// Workspace fixture writer commands for E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { assert, readJson, requireArg, write, writeJson } from "./common.mjs";

View File

@@ -1,3 +1,4 @@
// Gateway frame payload helpers for E2E WebSocket assertions.
function hasOwnEnvelopeField(frame, field) {
return (
((typeof frame === "object" && frame !== null) || typeof frame === "function") &&

View File

@@ -1,3 +1,4 @@
// WebSocket client helpers for gateway network E2E scenarios.
import { WebSocket } from "ws";
import { PROTOCOL_VERSION } from "../../../../dist/gateway/protocol/index.js";
import { waitForWebSocketOpen } from "../websocket-open.mjs";

View File

@@ -1,3 +1,4 @@
// Limits shared by gateway network E2E fixtures.
function readPositiveIntEnv(name, fallback, env) {
const text = String(env[name] ?? fallback).trim();
if (!/^\d+$/u.test(text)) {

View File

@@ -1,3 +1,4 @@
// WebSocket frame helpers for gateway network E2E fixtures.
function formatCloseValue(value) {
if (value === undefined || value === null) {
return "";

View File

@@ -1,3 +1,4 @@
// Incremental line reader for streaming E2E logs.
import { createHash } from "node:crypto";
import fs from "node:fs";

View File

@@ -1,3 +1,4 @@
// Assertions for kitchen-sink plugin E2E scenarios.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Assertions for live plugin tool E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { readPluginInstallRecords } from "../plugin-index-sqlite.mjs";

View File

@@ -1,3 +1,4 @@
// Mock OpenAI-compatible HTTP server helpers for E2E scenarios.
import fs from "node:fs";
import { readPositiveIntEnv } from "./env-limits.mjs";

View File

@@ -1,3 +1,4 @@
// Assertions for npm onboard channel-agent E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { DatabaseSync } from "node:sqlite";

View File

@@ -1,3 +1,4 @@
// Prepares package manifests for npm Telegram live E2E scenarios.
import fs from "node:fs";
for (const packageJsonPath of process.argv.slice(2)) {

View File

@@ -1,3 +1,4 @@
// Config assertions for onboard E2E scenarios.
import fs from "node:fs";
import JSON5 from "json5";

View File

@@ -1,3 +1,4 @@
// Log substring assertion helper for onboard E2E scenarios.
import fs from "node:fs";
const [file, needle] = process.argv.slice(2);

View File

@@ -1,3 +1,4 @@
// Config writer helper for onboard E2E scenarios.
import fs from "node:fs";
const [scenario, configPath] = process.argv.slice(2);

View File

@@ -1,3 +1,4 @@
// Gateway client for OpenAI chat tools E2E scenarios.
const port = process.env.PORT;
const token = process.env.OPENCLAW_GATEWAY_TOKEN;
const backendModel = process.env.MODEL_REF || "openai/gpt-5.4-mini";

View File

@@ -1,3 +1,4 @@
// Config writer for OpenAI chat tools E2E scenarios.
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Assertions for minimal OpenAI web-search E2E scenarios.
import fs from "node:fs";
import { readTextFileTail, tailText } from "../text-file-utils.mjs";

View File

@@ -1,3 +1,4 @@
// Client script for minimal OpenAI web-search E2E scenarios.
import { readdirSync } from "node:fs";
import { pathToFileURL } from "node:url";

View File

@@ -1,3 +1,4 @@
// Mock server for minimal OpenAI web-search E2E scenarios.
import http from "node:http";
import { readPositiveIntEnv } from "../env-limits.mjs";
import {

View File

@@ -1,3 +1,4 @@
// HTTP probe for OpenWebUI E2E scenarios.
import { readPositiveIntEnv } from "../env-limits.mjs";
const [url, expectedRaw = "200"] = process.argv.slice(2);

View File

@@ -1,3 +1,4 @@
// Package-version compatibility helpers for E2E acceptance scripts.
export function legacyPackageAcceptanceCompat(version) {
const match = /^(\d{4})\.(\d{1,2})\.(\d{1,2})(?:[-+].*)?/.exec(version || "");
const [year, month, day] = match?.slice(1, 4).map(Number) ?? [];

View File

@@ -1,3 +1,4 @@
// Validates build-info commit metadata for Parallels package E2E scenarios.
import fs from "node:fs";
const path = "dist/build-info.json";

View File

@@ -1,3 +1,4 @@
// Extracts progress markers from Parallels package E2E logs.
import fs from "node:fs";
import { readTextFileTail } from "../text-file-utils.mjs";

View File

@@ -1,3 +1,4 @@
// SQLite readers for plugin install indexes produced during E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { DatabaseSync } from "node:sqlite";

View File

@@ -1,3 +1,4 @@
// Measures plugin lifecycle matrix E2E command timings.
import { spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Probe script for plugin lifecycle matrix E2E scenarios.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Probe script for plugin update E2E scenarios.
import fs from "node:fs";
import http from "node:http";
import os from "node:os";

View File

@@ -1,3 +1,4 @@
// Fixture npm registry server for plugin update E2E scenarios.
import http from "node:http";
const metadata = {

View File

@@ -1,3 +1,4 @@
// Assertions for plugin install/runtime E2E scenarios.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Fixture npm registry server for plugin E2E scenarios.
import crypto from "node:crypto";
import fs from "node:fs";
import http from "node:http";

View File

@@ -1,3 +1,4 @@
// Assertions for release scenario E2E packages and plugin state.
import fs from "node:fs";
import path from "node:path";
import { DatabaseSync } from "node:sqlite";

View File

@@ -1,3 +1,4 @@
// Writes a CLI plugin fixture for release scenario E2E tests.
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Writes a marketplace fixture for release scenario E2E tests.
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Assertions for release user-journey E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

View File

@@ -1,3 +1,4 @@
// ClickClack fixture server for release user-journey E2E scenarios.
import crypto from "node:crypto";
import fs from "node:fs";
import http from "node:http";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Runs an E2E command under a pseudo-terminal.
import fs from "node:fs";
import process from "node:process";
import { spawn } from "@lydell/node-pty";

View File

@@ -1,3 +1,4 @@
// Text file tail helpers for E2E assertions.
import fs from "node:fs";
export function tailText(text, maxBytes) {

View File

@@ -1,3 +1,4 @@
// Assertions for update-channel switch E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { legacyPackageAcceptanceCompat } from "../package-compat.mjs";

View File

@@ -1,3 +1,4 @@
// Assertions for upgrade-survivor E2E scenarios.
import fs from "node:fs";
import path from "node:path";
import { readPluginInstallIndex } from "../plugin-index-sqlite.mjs";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Builds config recipes for upgrade-survivor E2E scenarios.
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env node
// Probes gateway state for upgrade-survivor E2E scenarios.
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// WebSocket open/close wait helper for E2E clients.
function formatCloseValue(value) {
if (value === undefined || value === null) {
return "";

View File

@@ -1,3 +1,4 @@
// Mock OpenAI-compatible server for broader E2E scenarios.
import { createHash } from "node:crypto";
import http from "node:http";
import { readPositiveIntEnv } from "./lib/env-limits.mjs";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Writes npm Telegram RTT config fixtures.
import fs from "node:fs";
const [configPath, mockPort, groupId, driverToken, sutToken, packageVersion] =

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Issues and writes npm Telegram RTT credential fixtures.
import fs from "node:fs/promises";
import { readBoundedResponseText } from "./lib/bounded-response-text.mjs";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Drives npm Telegram RTT test messages through the fixture server.
import fs from "node:fs/promises";
import path from "node:path";
import { readBoundedResponseText } from "./lib/bounded-response-text.mjs";

View File

@@ -1,3 +1,4 @@
// Probe script for OpenWebUI E2E connectivity.
import { Agent, setGlobalDispatcher } from "undici";
import { readBoundedResponseText as readBoundedResponseTextWithLimit } from "./lib/bounded-response-text.mjs";

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Runs secret-provider integration E2E checks with fixture processes.
import childProcess from "node:child_process";
import fs from "node:fs";
import net from "node:net";