//go:build browser package thintest import ( "fmt" "os" "testing" ) // TestBrowserRosterAlignment holds the Roster stream's geometry at 1280 // and 390, light and dark: reports are flat on a neutral rail, a report // beside its decision is one compact line, the stage track spans the // content with its label under its dot, bylines sit a fixed gap above // what they introduce, the card composer matches the main one, and the // last item clears the composer. testdata/roster-geometry.js measures. func TestBrowserRosterAlignment(t *testing.T) { src, err := os.ReadFile("testdata/roster-geometry.js") if err != nil { t.Fatal(err) } r := newAlignRig(t) for _, width := range []int64{1280, 390} { for _, scheme := range []string{"light", "dark"} { t.Run(fmt.Sprintf("%d-%s", width, scheme), func(t *testing.T) { p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 844, width == 390, scheme, "reduce") defer p.stop() p.open("/conversation") p.wait(`document.querySelector('[equipo-offline]').hidden && document.querySelector('[data-roster-enhanced]')`, "connected") measure := func(phase string) { t.Helper() if bad := eval[string](p, fmt.Sprintf(`(%s)(%q, %t)`, src, phase, width == 390)); bad != "" { t.Errorf("%s: %s", phase, bad) } } measure("compact") p.shot(fmt.Sprintf("roster-align-compact-%d-%s", width, scheme)) p.click(`[equipo-card="merge"] [data-set-aside]`) p.wait(`document.querySelector('[equipo-card="merge"] [equipo-aside-stub]') && document.querySelector('[equipo-roster-report] [data-track]')`, "full report") measure("full") p.shot(fmt.Sprintf("roster-align-full-%d-%s", width, scheme)) p.fits("Roster alignment") p.click(`[equipo-card="merge"] [equipo-aside-stub] [data-aside-undo]`) p.wait(`document.querySelector('[equipo-card="merge"] [data-set-aside]')`, "restored") }) } } }