High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test(smoke): add OpenClaw plugin smoke harness
Bosch9df76831e276
diff --git a/dev b/devindex e116a47a..1a06ceae 100755--- a/dev+++ b/dev@@ -31,6 +31,7 @@ COMMANDS=(" extended:π³:Extended suite (all extended)"" smoke:π³:Smoke suite"" smoke-docker:π³:Host Docker smoke checks only"+ " smoke-plugin:π³:OpenClaw plugin Docker smoke"" api:π³:API basic tests"" cli:π³:CLI basic tests"" infra:π³:Infra basic tests"@@ -263,6 +264,11 @@ run_command() {echo ""exec env E2E_LOGS="${E2E_LOGS:-show}" bash scripts/dev-e2e.sh "$test_name";;+ "e2e smoke-plugin")+ echo " ${ACCENT}${BOLD}π³ OpenClaw plugin smoke${NC}"+ echo ""+ exec bash tests/manual/openclaw-plugin-smoke/run.sh+ ;;"e2e"*)local -a e2e_args=()if [ "$target" != "e2e" ]; then@@ -409,6 +415,12 @@ if [ $# -gt 0 ]; thenecho ""exec env E2E_LOGS="${E2E_LOGS:-show}" bash scripts/dev-e2e.sh "$3"fi+ if [ "${2:-}" = "smoke-plugin" ]; then+ echo ""+ echo " ${ACCENT}${BOLD}π³ OpenClaw plugin smoke${NC}"+ echo ""+ exec bash tests/manual/openclaw-plugin-smoke/run.sh+ firun_e2e_runner "${@:2}";;binary)diff --git a/tests/manual/openclaw-plugin-smoke/.gitignore b/tests/manual/openclaw-plugin-smoke/.gitignorenew file mode 100644index 00000000..02196041--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/.gitignore@@ -0,0 +1,2 @@+artifacts/*+!artifacts/.gitkeepdiff --git a/tests/manual/openclaw-plugin-smoke/Dockerfile b/tests/manual/openclaw-plugin-smoke/Dockerfilenew file mode 100644index 00000000..7d687048--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/Dockerfile@@ -0,0 +1,15 @@+FROM node:22-bookworm-slim++ENV DEBIAN_FRONTEND=noninteractive \+ npm_config_update_notifier=false++RUN apt-get update && apt-get install -y --no-install-recommends \+ bash \+ ca-certificates \+ python3 \+ && rm -rf /var/lib/apt/lists/*++WORKDIR /workspace++ARG OPENCLAW_VERSION=2026.4.27+RUN npm install -g openclaw@$OPENCLAW_VERSIONdiff --git a/tests/manual/openclaw-plugin-smoke/README.md b/tests/manual/openclaw-plugin-smoke/README.mdnew file mode 100644index 00000000..e6b90686--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/README.md@@ -0,0 +1,52 @@+# OpenClaw + Pinchtab Docker Mock Test++Deterministic end-to-end harness for the Pinchtab OpenClaw plugin.++What it does:+- builds a local Pinchtab image from this repo+- starts a local fixture server inside Docker+- installs the repo plugin into a fresh OpenClaw container+- disables the bundled OpenClaw browser plugin so `browser` resolves to Pinchtab's compatibility alias+- runs several `openclaw agent` prompts against the fixture site+- verifies the returned answers+- verifies fixture access logs show real browser traffic from Pinchtab++## Requirements++- Docker+- valid OpenClaw auth in `~/.openclaw/agents/main/agent/auth-profiles.json`+- a usable `~/.openclaw/openclaw.json`++## Run++```bash+./tests/manual/openclaw-plugin-smoke/run.sh+# or+./dev e2e smoke-plugin+```++Optional overrides:++```bash+OPENCLAW_STATE_SOURCE=$HOME/.openclaw \+OPENCLAW_VERSION=2026.5.2 \+./tests/manual/openclaw-plugin-smoke/run.sh+```++## Artifacts++The script copies results into `tests/manual/openclaw-plugin-smoke/artifacts/<timestamp>/`:++- `summary.json` β scenario results + log checks+- `agent-*.json` β raw OpenClaw CLI output per prompt+- `gateway.log` β OpenClaw gateway log+- `plugin-install.log` β plugin install log+- `fixtures-access.log` β JSONL access log from the fixture server+- `docker-compose.log` β combined compose output++## Why this proves Pinchtab was used++Two layers:++1. The bundled OpenClaw browser plugin is disabled, while the Pinchtab plugin re-registers `browser`.+2. The fixture log must show Chrome/Chromium-style traffic for the exercised pages, including a JS-driven cookie/state flow that plain `web_fetch` cannot satisfy.diff --git a/tests/manual/openclaw-plugin-smoke/artifacts/.gitkeep b/tests/manual/openclaw-plugin-smoke/artifacts/.gitkeepnew file mode 100644index 00000000..e69de29bdiff --git a/tests/manual/openclaw-plugin-smoke/docker-compose.yml b/tests/manual/openclaw-plugin-smoke/docker-compose.ymlnew file mode 100644index 00000000..d9903863--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/docker-compose.yml@@ -0,0 +1,62 @@+services:+ fixtures:+ image: node:22-bookworm-slim+ working_dir: /app+ command: ["node", "/app/fixtures/server.mjs"]+ environment:+ PORT: "8080"+ LOG_FILE: /artifacts/fixtures-access.log+ volumes:+ - ./fixtures:/app/fixtures:ro+ - ${ARTIFACTS_DIR}:/artifacts+ healthcheck:+ test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8080/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))\""]+ interval: 1s+ timeout: 5s+ retries: 20++ pinchtab:+ build:+ context: ../../..+ dockerfile: Dockerfile+ environment:+ PINCHTAB_CONFIG: /data/pinchtab.json+ command:+ [+ "/bin/sh",+ "-lc",+ "cp /fixture-config/pinchtab.json /data/pinchtab.json && /usr/local/bin/docker-entrypoint.sh pinchtab 2>&1 | tee /artifacts/pinchtab.log",+ ]+ volumes:+ - ./pinchtab.config.json:/fixture-config/pinchtab.json:ro+ - ${ARTIFACTS_DIR}:/artifacts+ shm_size: 2gb+ healthcheck:+ test: ["CMD-SHELL", "wget --header='Authorization: Bearer smoke-token' -q -O /dev/null http://127.0.0.1:9999/health"]+ interval: 1s+ timeout: 5s+ retries: 30+ start_period: 5s++ openclaw:+ build:+ context: .+ dockerfile: Dockerfile+ args:+ OPENCLAW_VERSION: ${OPENCLAW_VERSION}+ depends_on:+ fixtures:+ condition: service_healthy+ pinchtab:+ condition: service_healthy+ working_dir: /workspace+ environment:+ PINCHTAB_BASE_URL: http://pinchtab:9999+ PINCHTAB_TOKEN: smoke-token+ FIXTURES_URL: http://fixtures:8080+ volumes:+ - ${OPENCLAW_STATE_DIR}:/root/.openclaw+ - ../../../:/workspace+ - ./openclaw-runner.sh:/usr/local/bin/openclaw-runner.sh:ro+ - ${ARTIFACTS_DIR}:/artifacts+ command: ["bash", "/usr/local/bin/openclaw-runner.sh"]diff --git a/tests/manual/openclaw-plugin-smoke/fixtures/server.mjs b/tests/manual/openclaw-plugin-smoke/fixtures/server.mjsnew file mode 100644index 00000000..f799c68e--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/fixtures/server.mjs@@ -0,0 +1,123 @@+import http from 'node:http';+import { appendFile, mkdir } from 'node:fs/promises';+import { dirname } from 'node:path';++const port = Number(process.env.PORT || 8080);+const logFile = process.env.LOG_FILE;++async function logRequest(req) {+ if (!logFile) return;+ const entry = {+ ts: new Date().toISOString(),+ method: req.method,+ path: req.url,+ userAgent: req.headers['user-agent'] || '',+ remoteAddress: req.socket.remoteAddress || '',+ };+ await mkdir(dirname(logFile), { recursive: true });+ await appendFile(logFile, JSON.stringify(entry) + '\n');+}++function send(res, status, body, contentType = 'text/html; charset=utf-8', extraHeaders = {}) {+ res.writeHead(status, { 'content-type': contentType, ...extraHeaders });+ res.end(body);+}++function page(title, body, extraHead = '') {+ return `<!doctype html>+<html>+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>${title}</title>+ ${extraHead}+ </head>+ <body>+ ${body}+ </body>+</html>`;+}++const server = http.createServer(async (req, res) => {+ await logRequest(req);+ const url = new URL(req.url, `http://127.0.0.1:${port}`);++ if (url.pathname === '/health') {+ return send(res, 200, 'ok', 'text/plain; charset=utf-8');+ }++ if (url.pathname === '/alpha') {+ return send(+ res,+ 200,+ page('Alpha Verification', '<main><h1>ALPHA-17</h1><p>This is the first verification page.</p></main>'),+ );+ }++ if (url.pathname === '/journey/start') {+ return send(+ res,+ 200,+ page(+ 'Journey Start',+ `<main>+ <h1>Journey Start</h1>+ <p>Press the button to continue.</p>+ <button id="begin">Begin journey</button>+ </main>+ <script>+ document.getElementById('begin').addEventListener('click', () => {+ document.cookie = 'journey=1; Path=/; SameSite=Lax';+ window.location.href = '/journey/final';+ });+ </script>`,+ ),+ );+ }++ if (url.pathname === '/journey/final') {+ const hasCookie = (req.headers.cookie || '').split(/;\s*/).includes('journey=1');+ if (!hasCookie) {+ return send(+ res,+ 200,+ page('Journey Incomplete', '<main><h1>MISSING-STATE</h1><p>Start from the journey page first.</p></main>'),+ );+ }+ return send(+ res,+ 200,+ page('Journey Complete', '<main><h1>ORBIT-42</h1><p>Browser state carried across correctly.</p></main>'),+ );+ }++ if (url.pathname === '/chain/one') {+ return send(+ res,+ 200,+ page('Chain One', '<main><h1>Chain One</h1><a href="/chain/two">Go to step two</a></main>'),+ );+ }++ if (url.pathname === '/chain/two') {+ return send(+ res,+ 200,+ page('Chain Two', '<main><h1>Chain Two</h1><a href="/chain/final">Open the final page</a></main>'),+ );+ }++ if (url.pathname === '/chain/final') {+ return send(+ res,+ 200,+ page('Chain Final', '<main><h1>BLUE-SUN-9</h1><p>You made it through the chain.</p></main>'),+ );+ }++ return send(res, 404, page('Not Found', `<main><h1>404</h1><p>No route for ${url.pathname}</p></main>`));+});++server.listen(port, '0.0.0.0', () => {+ console.log(`fixture server listening on ${port}`);+});diff --git a/tests/manual/openclaw-plugin-smoke/openclaw-runner.sh b/tests/manual/openclaw-plugin-smoke/openclaw-runner.shnew file mode 100755index 00000000..4e4a6cd3--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/openclaw-runner.sh@@ -0,0 +1,133 @@+#!/usr/bin/env bash+set -euo pipefail++: "${PINCHTAB_BASE_URL:?missing PINCHTAB_BASE_URL}"+: "${PINCHTAB_TOKEN:?missing PINCHTAB_TOKEN}"+: "${FIXTURES_URL:?missing FIXTURES_URL}"++node /workspace/plugin/scripts/sync-skills.mjs++openclaw plugins install /workspace/plugin --link >/artifacts/plugin-install.log 2>&1++(openclaw gateway >/artifacts/gateway.log 2>&1) &+GW_PID=$!+cleanup() {+ kill "$GW_PID" >/dev/null 2>&1 || true+ wait "$GW_PID" >/dev/null 2>&1 || true+}+trap cleanup EXIT++for _ in $(seq 1 45); do+ if openclaw health >/artifacts/health.json 2>/artifacts/health.err; then+ break+ fi+ sleep 2+done+openclaw health >/artifacts/health.json 2>/artifacts/health.err++python3 <<'PY'+import json+import subprocess+from pathlib import Path++artifacts = Path('/artifacts')+fixtures_url = 'http://fixtures:8080'+scenarios = [+ {+ 'id': 'alpha',+ 'prompt': f'Use the pinchtab tool to navigate to {fixtures_url}/alpha and reply with only the verification code on the page.',+ 'expected': 'ALPHA-17',+ 'paths': ['/alpha'],+ 'requiredTool': 'pinchtab',+ },+ {+ 'id': 'journey',+ 'prompt': f'Use the pinchtab tool to navigate to {fixtures_url}/journey/start, click the Begin journey button, wait for the next page, and reply with only the final verification code.',+ 'expected': 'ORBIT-42',+ 'paths': ['/journey/start', '/journey/final'],+ 'requiredTool': 'pinchtab',+ },+ {+ 'id': 'chain',+ 'prompt': f'Use the pinchtab tool to navigate to {fixtures_url}/chain/one, click through until you reach the last page, and reply with only the full final verification code.',+ 'expected': 'BLUE-SUN-9',+ 'paths': ['/chain/one', '/chain/two', '/chain/final'],+ 'requiredTool': 'pinchtab',+ },+ {+ 'id': 'browser-alias',+ 'prompt': f'Use the browser tool to navigate to {fixtures_url}/alpha and reply with only the verification code on the page.',+ 'expected': 'ALPHA-17',+ 'paths': ['/alpha'],+ 'requiredTool': 'browser',+ },+]++results = []+for scenario in scenarios:+ out_path = artifacts / f"agent-{scenario['id']}.json"+ cmd = [+ 'openclaw', 'agent',+ '--agent', 'main',+ '--message', scenario['prompt'],+ '--json',+ '--timeout', '240',+ ]+ completed = subprocess.run(cmd, capture_output=True, text=True)+ if completed.returncode != 0:+ raise SystemExit(f"agent command failed for {scenario['id']}:\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}")+ out_path.write_text(completed.stdout)+ payload = json.loads(completed.stdout)+ text = payload['result']['payloads'][0]['text'].strip()+ tool_summary = payload['result']['meta'].get('toolSummary', {})+ tools_used = tool_summary.get('tools', []) or []+ results.append({+ 'id': scenario['id'],+ 'expected': scenario['expected'],+ 'actual': text,+ 'ok': text == scenario['expected'],+ 'paths': scenario['paths'],+ 'requiredTool': scenario['requiredTool'],+ 'toolsUsed': tools_used,+ 'toolOk': scenario['requiredTool'] in tools_used,+ })++log_path = artifacts / 'fixtures-access.log'+entries = []+if log_path.exists():+ for line in log_path.read_text().splitlines():+ line = line.strip()+ if not line:+ continue+ entries.append(json.loads(line))++pinchtab_log = (artifacts / 'pinchtab.log').read_text() if (artifacts / 'pinchtab.log').exists() else ''+pinchtab_api_lines = [+ line for line in pinchtab_log.splitlines()+ if 'path=/health' not in line and ' path=/' in line+]++for result in results:+ missing = []+ for path in result['paths']:+ hits = [+ entry for entry in entries+ if entry.get('path', '').split('?', 1)[0] == path+ ]+ if not hits:+ missing.append(path)+ result['fixtureLogOk'] = not missing+ result['missingFixturePaths'] = missing++summary = {+ 'ok': all(r['ok'] and r['fixtureLogOk'] and r['toolOk'] for r in results) and bool(pinchtab_api_lines),+ 'results': results,+ 'logEntries': len(entries),+ 'pinchtabApiCallCount': len(pinchtab_api_lines),+ 'pinchtabApiSample': pinchtab_api_lines[:10],+}+(artifacts / 'summary.json').write_text(json.dumps(summary, indent=2) + '\n')+print(json.dumps(summary, indent=2))+if not summary['ok']:+ raise SystemExit('mock smoke verification failed')+PYdiff --git a/tests/manual/openclaw-plugin-smoke/pinchtab.config.json b/tests/manual/openclaw-plugin-smoke/pinchtab.config.jsonnew file mode 100644index 00000000..24b7c880--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/pinchtab.config.json@@ -0,0 +1,14 @@+{+ "server": {+ "bind": "0.0.0.0",+ "port": "9999",+ "token": "smoke-token"+ },+ "security": {+ "allowEvaluate": false,+ "allowDownload": false,+ "allowUpload": false,+ "allowStateExport": true,+ "allowedDomains": ["fixtures"]+ }+}diff --git a/tests/manual/openclaw-plugin-smoke/run.sh b/tests/manual/openclaw-plugin-smoke/run.shnew file mode 100755index 00000000..e21ce34c--- /dev/null+++ b/tests/manual/openclaw-plugin-smoke/run.sh@@ -0,0 +1,78 @@+#!/usr/bin/env bash+set -euo pipefail++ROOT_DIR=$(cd "$(dirname "$0")/../../.." && pwd)+SMOKE_DIR="$ROOT_DIR/tests/manual/openclaw-plugin-smoke"+STATE_SOURCE=${OPENCLAW_STATE_SOURCE:-$HOME/.openclaw}+OPENCLAW_VERSION=${OPENCLAW_VERSION:-$(openclaw --version | awk '{print $2}')}+PROJECT_NAME=${PROJECT_NAME:-pinchtab-openclaw-mock-$(date +%s)}+TEMP_STATE=$(mktemp -d /tmp/pinchtab-openclaw-state.XXXXXX)+TEMP_ARTIFACTS=$(mktemp -d /tmp/pinchtab-openclaw-artifacts.XXXXXX)+FINAL_ARTIFACTS_DIR=${FINAL_ARTIFACTS_DIR:-$SMOKE_DIR/artifacts/$(date +%Y%m%d-%H%M%S)}++cleanup() {+ docker compose -p "$PROJECT_NAME" -f "$SMOKE_DIR/docker-compose.yml" down -v --remove-orphans >/dev/null 2>&1 || true+}+trap cleanup EXIT++require_file() {+ local path=$1+ if [[ ! -f "$path" ]]; then+ echo "missing required file: $path" >&2+ exit 1+ fi+}++require_file "$STATE_SOURCE/openclaw.json"+require_file "$STATE_SOURCE/agents/main/agent/auth-profiles.json"++mkdir -p "$TEMP_STATE/agents/main/agent"+cp "$STATE_SOURCE/openclaw.json" "$TEMP_STATE/openclaw.json"+cp "$STATE_SOURCE/agents/main/agent/auth-profiles.json" "$TEMP_STATE/agents/main/agent/auth-profiles.json"+for dir in credentials identity gateway service-env; do+ if [[ -d "$STATE_SOURCE/$dir" ]]; then+ cp -R "$STATE_SOURCE/$dir" "$TEMP_STATE/$dir"+ fi+done++python3 - "$TEMP_STATE/openclaw.json" <<'PY'+import json, sys+from pathlib import Path+path = Path(sys.argv[1])+obj = json.loads(path.read_text())+plugins = obj.setdefault('plugins', {}).setdefault('entries', {})+plugins.setdefault('pinchtab', {})['enabled'] = True+pinchtab_cfg = plugins.setdefault('pinchtab', {}).setdefault('config', {})+pinchtab_cfg['baseUrl'] = 'http://pinchtab:9999'+pinchtab_cfg['token'] = 'smoke-token'+pinchtab_cfg['registerBrowserTool'] = True+plugins.setdefault('browser', {})['enabled'] = False+allow = plugins.get('allow')+if isinstance(allow, list) and 'pinchtab' not in allow:+ allow.append('pinchtab')+obj['browser'] = {'enabled': False}+tools = obj.setdefault('tools', {})+existing = list(tools.get('allow', [])) if isinstance(tools.get('allow'), list) else []+if 'pinchtab' not in existing:+ existing.append('pinchtab')+tools['allow'] = existing+path.write_text(json.dumps(obj, indent=2) + '\n')+PY++mkdir -p "$FINAL_ARTIFACTS_DIR"+export OPENCLAW_STATE_DIR="$TEMP_STATE"+export ARTIFACTS_DIR="$TEMP_ARTIFACTS"+export OPENCLAW_VERSION++echo "running docker mock smoke..."+if ! docker compose -p "$PROJECT_NAME" -f "$SMOKE_DIR/docker-compose.yml" up --build --abort-on-container-exit --exit-code-from openclaw 2>&1 | tee "$TEMP_ARTIFACTS/docker-compose.log"; then+ cp -R "$TEMP_ARTIFACTS/." "$FINAL_ARTIFACTS_DIR/"+ echo+ echo "failed β artifacts copied to $FINAL_ARTIFACTS_DIR" >&2+ exit 1+fi++cp -R "$TEMP_ARTIFACTS/." "$FINAL_ARTIFACTS_DIR/"+echo+echo "ok: artifacts copied to $FINAL_ARTIFACTS_DIR"+cat "$FINAL_ARTIFACTS_DIR/summary.json"