package console // The action confirm interstitial (confirm.go). The properties under test are // the ones the file's own doc comment calls load-bearing: the card describes a // request that would otherwise proceed, it never renders for someone the owner // 404 is meant to turn away, and it sits strictly BETWEEN that 404 and the // passkey — so an owner sees the card first and is asked for the passkey only // on the confirmed replay. // // Every card test also lands the confirmed POST. A card that renders but whose // resubmit does not carry the action through is a dead end, and asserting only // on the markup would not notice. import ( "context" "errors" "net/http" "net/url" "os" "strings" "testing" "time" "github.com/carlosframework/platform/internal/registry" "github.com/carlosframework/platform/internal/release" ) // confirmCard asserts the response IS a confirm card — 200, the titled // heading, the confirmed=1 marker the resubmit turns on, the CSRF token // carried through, and a submit button — and hands the body back for the // card-specific assertions. Everything here is what makes the card a working // resubmit rather than a screenshot of one. func confirmCard(t *testing.T, status int, body, title, csrf string) string { t.Helper() if status != http.StatusOK { t.Fatalf("confirm step = %d, want a 200 card:\n%s", status, body) } if !strings.Contains(body, title) { t.Fatalf("card is not titled %q:\n%s", title, body) } if !strings.Contains(body, ``) { t.Fatalf("card carries no confirmed=1 marker, so its button cannot land the action:\n%s", body) } if !strings.Contains(body, ``) { t.Fatalf("card carries no csrf field, so its resubmit would be refused:\n%s", body) } if !strings.Contains(body, `