47 lines
1.7 KiB
Bash
Executable File
47 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Regression: isolated vis-network browser performance trial
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
artifact_dir="${GRAPH_VIS_TRIAL_ARTIFACT_DIR:-}"
|
|
if [ -z "$artifact_dir" ]; then
|
|
artifact_dir="$(mktemp -d)"
|
|
fi
|
|
mkdir -p "$artifact_dir"
|
|
|
|
npm run build -w @llm-wiki/graph-engine > /dev/null 2>&1
|
|
|
|
playwright_node_path="${GRAPH_TRIAL_PLAYWRIGHT_NODE_PATH:-}"
|
|
if [ -z "$playwright_node_path" ]; then
|
|
playwright_node_path="$(
|
|
node -e 'const path=require("path"); try { console.log(path.dirname(path.dirname(require.resolve("playwright/package.json")))); } catch { process.exit(1); }' 2>/dev/null || true
|
|
)"
|
|
fi
|
|
if [ -z "$playwright_node_path" ] || [ ! -d "$playwright_node_path/playwright" ]; then
|
|
echo "ERROR: Playwright is not installed locally. Install Playwright for this checkout, or set GRAPH_TRIAL_PLAYWRIGHT_NODE_PATH." >&2
|
|
exit 1
|
|
fi
|
|
|
|
chrome_executable="${GRAPH_VIS_TRIAL_CHROME_EXECUTABLE:-}"
|
|
if [ -z "$chrome_executable" ]; then
|
|
candidate="$(
|
|
NODE_PATH="$playwright_node_path" node -e 'const { chromium } = require("playwright"); console.log(chromium.executablePath())'
|
|
)"
|
|
if [ -x "$candidate" ]; then
|
|
chrome_executable="$candidate"
|
|
elif [ -x "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
|
|
chrome_executable="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
fi
|
|
fi
|
|
|
|
cd "$REPO_ROOT"
|
|
NODE_PATH="$playwright_node_path" \
|
|
GRAPH_VIS_TRIAL_ARTIFACT_DIR="$artifact_dir" \
|
|
GRAPH_VIS_TRIAL_CHROME_EXECUTABLE="$chrome_executable" \
|
|
node --import tsx tests/browser/graph-vis-network-trial.ts
|
|
|
|
node tests/browser/validate-graph-trial-result.mjs "$artifact_dir/vis-network-trial-results.json"
|
|
echo "PASS: vis-network performance trial ($artifact_dir/vis-network-trial-results.json)"
|