Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930#!/usr/bin/env bash# Takes a picture of one page of the real App, in a macOS window, on a scratch Daemon of its own (daemon/test/live-tests.ts).# Run it with: just shot [place] [width] [open] [chat]. For example: just shot Repos 760, just shot Repos 1240 acme/api,# just shot Repos 1240 acme/api 3 for the Repo's Chat 3, open in its Sheet, or just shot Missions 1240 1 for Mission 1.# It prints the picture's path. For any other state, write a live test (app/live/live.ts) and run it with just live.set -euo pipefailcd "$(dirname "$0")/.."place=${1:-Home}width=${2:-1240}repo=${3:-}chat=${4:-}out="${TMPDIR:-/tmp}/pilot-shots/$place${repo:+-${repo//\//-}}${chat:+-chat-$chat}-$width.png"mkdir -p "$(dirname "$out")"# nsh test needs a test file inside the app, so this writes one for the run and removes it.test_file=app/live/.shot.test.tsxtrap 'rm -f "$test_file"' EXITcat > "$test_file" <<EOFimport { goTo, liveTest, openLive } from "./live";liveTest("shot", async () => { const app = await openLive($width); if ("$place" !== "Home") await goTo(app, "$place"); if ("$repo") await app.press("id:" + ("$place" === "Missions" ? "mission-" : "repo-") + "$repo"); if ("$chat") await app.press("id:chat-$chat"); await app.wait(600); await app.screenshot("$out");});EOFnode daemon/test/live-tests.ts live/.shot.test.tsx >&2echo "$out"