Skip to content

Commit 1d69c51

Browse files
committed
feat(k6): add run-k6.sh wrapper script
- Enables xk6-dashboard live view at http://localhost:5665 - Exports self-contained dashboard HTML report on completion - Passes BASE_URL and REPORT_DIR env vars through to k6 - Accepts optional test script path argument (defaults to customers.js)
1 parent 29c98fe commit 1d69c51

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/k6/run-k6.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
REPORT_DIR="${REPORT_DIR:-$SCRIPT_DIR/reports}"
5+
BASE_URL="${BASE_URL:-http://localhost:5173}"
6+
TEST_SCRIPT="${1:-$SCRIPT_DIR/customers.js}"
7+
8+
mkdir -p "$REPORT_DIR"
9+
10+
echo "Running k6 test: $TEST_SCRIPT"
11+
echo "Target: $BASE_URL"
12+
echo "Reports dir: $REPORT_DIR"
13+
echo "Dashboard: http://localhost:5665"
14+
echo ""
15+
16+
K6_WEB_DASHBOARD=true \
17+
K6_WEB_DASHBOARD_EXPORT="$REPORT_DIR/dashboard-$(date -u +%Y-%m-%dT%H-%M-%SZ).html" \
18+
k6 run \
19+
-e BASE_URL="$BASE_URL" \
20+
-e REPORT_DIR="$REPORT_DIR" \
21+
"$TEST_SCRIPT"

0 commit comments

Comments
 (0)