//go:build browser
// Fiesta's rhythm audit over Calls' own pages, in a real Chromium
// (test/browser/rhythm.mjs). `make browser` runs it.
//
// Paul, 2026-11-22: no ad-hoc spacing ("Can we somehow put something in
// place to avoid weird spacing issues like this in future?"), then
// "Release and start the rollout". `make ci` runs the stylesheet half
// (go tool fiesta spacing); this is the half only a laid-out page can
// answer: every gap between two blocks is a step of the scale, no text
// rests on a control, and every heading sits closer to its own content
// than to what comes before it.
//
// What it reads: the meetings list (empty, with upcoming and ended
// meetings, the ended list open, the new-meeting form refused), Settings
// (empty, with agents, saved, refused), a meeting's settings, the three
// confirm pages, the meeting and agent pages shown once, Share (with
// script and without), the holding screen (a member's with script, with
// its audio test open, with no camera or microphone to reach, and
// without script; a guest's), the guest's name page (and refused), the
// app hand-off page, Welcome, and the Colophon under Help.
//
// What it does not: the call itself (room.html), whose window of video,
// bar, PiP, tiles and speaking light is component geometry pinned to the
// Mac app's, not a page's flow; its spacing allowances say so in
// calls.css. The sign-in door is estilo's card and is audited in estilo
// (6238a47). The error page is one component, rastrillo's rst-error,
// which the audit reads as one block and which is Fiesta's to space.
//
// RHYTHM_SHOTS=
keeps a screenshot of every state.
//
// Written against origin/main (9220b05) first, its static/ and
// templates/ under this branch's go.mod: see the commit for the count.
package callstest
import (
"bufio"
"bytes"
"context"
"encoding/json"
"io"
"net/http"
"net/url"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
"testing"
"time"
"amadan.net/rastrillo/fiesta/check/rhythm"
)
// rhythmSkip is what the audit does not read. The holding screen's
// camera preview is a