| 1 | //go:build webkit |
| 2 | |
| 3 | package thintest |
| 4 | |
| 5 | import ( |
| 6 | "encoding/json" |
| 7 | "os" |
| 8 | "os/exec" |
| 9 | "testing" |
| 10 | ) |
| 11 | |
| 12 | // TestWebKitRosterAlignment: Paul, staging 991f12d5, Safari on an iPhone: |
| 13 | // "Lots of alignment issues here." In WebKit at 390 (3x, touch) and 1280, |
| 14 | // light and dark, testdata/roster-geometry.js finds nothing out of line. |
| 15 | // Needs EQUIPO_PLAYWRIGHT_CORE. EQUIPO_BROWSER_ARTIFACTS saves the shots. |
| 16 | func TestWebKitRosterAlignment(t *testing.T) { |
| 17 | core := os.Getenv("EQUIPO_PLAYWRIGHT_CORE") |
| 18 | if core == "" { |
| 19 | t.Skip("EQUIPO_PLAYWRIGHT_CORE is not set") |
| 20 | } |
| 21 | r := newAlignRig(t) |
| 22 | c := r.inst.Cookie() |
| 23 | raw, _ := json.Marshal(map[string]any{"base": r.inst.URL, "cookie": map[string]string{"name": c.Name, "value": c.Value}, "art": os.Getenv("EQUIPO_BROWSER_ARTIFACTS")}) |
| 24 | cmd := exec.Command("node", "testdata/roster.mjs") |
| 25 | cmd.Env = append(os.Environ(), "EQUIPO_ROSTER="+string(raw)) |
| 26 | cmd.Stderr = os.Stderr |
| 27 | got, err := cmd.Output() |
| 28 | if err != nil { |
| 29 | t.Fatalf("webkit: %v", err) |
| 30 | } |
| 31 | var res map[string]map[string]string |
| 32 | if err := json.Unmarshal(got, &res); err != nil { |
| 33 | t.Fatalf("webkit output %q: %v", got, err) |
| 34 | } |
| 35 | if len(res) != 4 { |
| 36 | t.Fatalf("webkit measured %d screens, want 4", len(res)) |
| 37 | } |
| 38 | for screen, phases := range res { |
| 39 | for phase, bad := range phases { |
| 40 | if bad != "" { |
| 41 | t.Errorf("%s %s: %s", screen, phase, bad) |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |