test(chrome): one launch preamble, and parity now pins ground truth

48 of 51 call sites shared one eight-line block that opened a fixture server,
launched chrome and checked the error. The three left are the launch tests
themselves, where what the helper hardcodes is the subject.

The audit called four tests superseded by fact_parity_test.go. They were not:
parity asserts the two producers agree and that each fact appears both ways,
never that either reading is right, so deleting them would have removed the only
thing anchoring the pair to reality. The values they pinned are now asserted
inside parity against both producers, and the shadow fixture has ground truth
where it had none.
This commit is contained in:
pj committed 2026-08-22 21:31:13 +05:30
1 parent 5ae825109e
commit 3caf53cfb6
5 files changed
+273 -791

No files matched your search

+4 -23
View File
@@ -4,12 +4,9 @@ package chrome
import (
"context"
"net/http"
"net/http/httptest"
"path/filepath"
"strconv"
"testing"
"time"
"github.com/chromedp/chromedp"
@@ -28,9 +25,7 @@ const streamSeed = 1
// on 200 of 200 steps and created no todo at all. The run reported clean, so
// nothing but this distinguishes it from a seed that chose badly.
func TestNextActionFromV8_ReloadDoesNotRestartTheSeedStream(t *testing.T) {
server := httptest.NewServer(http.FileServer(http.Dir("testdata")))
defer server.Close()
url := server.URL + "/picker-stream.html"
url := testdataServer(t).URL + "/picker-stream.html"
const calls = 8
uninterrupted := pickerStream(t, url, calls, calls)
@@ -50,17 +45,9 @@ func TestNextActionFromV8_ReloadDoesNotRestartTheSeedStream(t *testing.T) {
// A navigation the trace cannot see is a run nobody can read: an analysis has
// no way to tell an app that reloaded from a generator that repeated itself.
func TestNavigations_ReportTheDocumentThatReplacedThePage(t *testing.T) {
server := httptest.NewServer(http.FileServer(http.Dir("testdata")))
defer server.Close()
url := server.URL + "/picker-stream.html"
url := testdataServer(t).URL + "/picker-stream.html"
d := New()
defer d.Terminate(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
if err := d.Launch(ctx, url, false, nil); err != nil {
t.Fatalf("Launch: %v", err)
}
d, ctx := launchChrome(t, url)
opening, err := d.Navigations(ctx)
if err != nil {
@@ -101,13 +88,7 @@ func TestNavigations_ReportTheDocumentThatReplacedThePage(t *testing.T) {
// calls. Reloading past the call count leaves the stream uninterrupted.
func pickerStream(t *testing.T, url string, calls, reloadAfter int) []string {
t.Helper()
d := New()
defer d.Terminate(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
defer cancel()
if err := d.Launch(ctx, url, false, nil); err != nil {
t.Fatalf("Launch: %v", err)
}
d, ctx := launchChrome(t, url)
installPickerStreamProbe(ctx, t, d)
chosen := make([]string, 0, calls)