#!/usr/bin/env bash
set -euo pipefail
# Run from scripts/ in a checkout containing the scenario harness.
# Argument 1 is a separate checkout of the app commit. Argument 2 is base or head.
app_checkout=$(realpath "$1")
evidence_side=$2
mkdir -p /tmp/factory-pr-23251-evidence-3
cat > /tmp/factory-pr-23251-evidence-3/scenario-shell <<'SH'
#!/bin/sh
export PS1='demo $ '
exec /bin/bash --noprofile --norc
SH
chmod +x /tmp/factory-pr-23251-evidence-3/scenario-shell
python3 - <<'PY'
p='e2e.config.ts'
s=open(p).read().replace('width: 1280, height: 800', 'width: 1600, height: 900')
s=s.replace('  ],\n  // One server', '  ].filter((target) => target.name === "web"),\n  // One server')
open(p,'w').write(s)
PY
SHELL=/tmp/factory-pr-23251-evidence-3/scenario-shell EVIDENCE_SIDE="$evidence_side" T3_SCENARIO_APP_DIR="$app_checkout" T3CODE_DEV_SEED=0 \
  node_modules/.bin/e2e run scenarios/missing-terminal-folder.e2e.ts --target web \
  --output ".e2e/evidence-$evidence_side"
