xonecas.io
5875
Os

ollama-space-molt-player / files

ollama-space-molt-player / packages / tui / tests / manual / capture-screenshot.sh

838 bytes
1#!/usr/bin/env bash
2#
3# Capture screenshot of a manual test
4# Usage: ./capture-screenshot.sh <test-file> <output-name>
5#
6# Example: ./capture-screenshot.sh layout-preview.tsx layout-preview
7#
8
9set -e
10
11TEST_FILE=$1
12OUTPUT_NAME=$2
13
14if [ -z "$TEST_FILE" ] || [ -z "$OUTPUT_NAME" ]; then
15	echo "Usage: $0 <test-file> <output-name>"
16	echo "Example: $0 layout-preview.tsx layout-preview"
17	exit 1
18fi
19
20SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21OUTPUT_DIR="$SCRIPT_DIR/screenshots"
22
23mkdir -p "$OUTPUT_DIR"
24
25echo "Capturing screenshot of $TEST_FILE..."
26echo "Output will be saved to: $OUTPUT_DIR/$OUTPUT_NAME.txt"
27
28# Run test and capture output to file
29timeout 2 bun "$SCRIPT_DIR/$TEST_FILE" > "$OUTPUT_DIR/$OUTPUT_NAME.txt" 2>&1 || true
30
31echo "Screenshot captured successfully!"
32echo "View with: cat $OUTPUT_DIR/$OUTPUT_NAME.txt"