diff --git a/.github/actions/replay-ui-fixture/action.yml b/.github/actions/replay-ui-fixture/action.yml new file mode 100644 index 0000000..11d5be3 --- /dev/null +++ b/.github/actions/replay-ui-fixture/action.yml @@ -0,0 +1,55 @@ +name: replay ui fixture +description: Record a trace with sanderling, then serve it with sanderling replay. + +outputs: + url: + description: the step page of the served run, for a spec to drive + value: ${{ steps.serve.outputs.url }} + +runs: + using: composite + steps: + # A trace with a violation and uncaught exceptions in it, so the UI has + # something to render in every panel the spec looks at. No + # --exit-on-violation here: the run is the fixture, and stopping it at the + # first violation would leave a four-step trace to fuzz. + - name: Record a fixture trace + shell: bash + run: | + python3 -m http.server 8792 --bind 127.0.0.1 \ + --directory test/browser/testdata/throwing & + ready="" + for _ in $(seq 1 30); do + curl -sf http://127.0.0.1:8792/ >/dev/null && { ready=1; break; } + sleep 1 + done + if [ -z "$ready" ]; then + echo "the fixture http server never answered on 127.0.0.1:8792" >&2 + exit 1 + fi + ./bin/sanderling test \ + --platform web \ + --spec test/browser/testdata/throwing/spec.ts \ + --bundle-id http://127.0.0.1:8792/ \ + --duration 5m --max-steps 25 --seed 7 \ + --output runs/fixture + + - name: Serve the trace with sanderling replay + id: serve + shell: bash + run: | + # Flags before the positional argument: Go's flag package stops + # parsing at the first non-flag word. + ./bin/sanderling replay --port 8793 --no-open runs/fixture & + ready="" + for _ in $(seq 1 30); do + curl -sf http://127.0.0.1:8793/api/runs >/dev/null && { ready=1; break; } + sleep 1 + done + if [ -z "$ready" ]; then + echo "sanderling replay never served /api/runs on 127.0.0.1:8793" >&2 + exit 1 + fi + run_id="$(ls runs/fixture | head -1)" + echo "url=http://127.0.0.1:8793/runs/$run_id/steps/1" >> "$GITHUB_OUTPUT" + curl -sf "http://127.0.0.1:8793/runs/$run_id/steps/1" >/dev/null