conformance

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package conformance compares deterministic browser snapshots without retaining document, network body, image, or credential payloads.

Index

Constants

View Source
const (
	DefaultGeometryPixels  = 2.0
	DefaultGeometryPercent = 0.01
)
View Source
const (
	DefaultPerceptualPixelDelta = 0.05
	DefaultPerceptualDiffLimit  = 0.02
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Difference

type Difference struct {
	Category string `json:"category"`
	Subject  string `json:"subject"`
	Expected string `json:"expected"`
	Actual   string `json:"actual"`
}

type Extent

type Extent struct {
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

type PerformanceGate

type PerformanceGate struct {
	Runner   string             `json:"runner"`
	Baseline PerformanceMetrics `json:"baseline"`
	Budget   PerformanceMetrics `json:"budget"`
	Current  PerformanceMetrics `json:"current"`
}

type PerformanceMetrics

type PerformanceMetrics struct {
	LongFrameRatio        float64 `json:"longFrameRatio"`
	InputToNextFrameP95MS float64 `json:"inputToNextFrameP95Ms"`
	ScrollFrameP95MS      float64 `json:"scrollFrameP95Ms"`
	AnimationFrameP95MS   float64 `json:"animationFrameP95Ms"`
}

type PerformanceReport

type PerformanceReport struct {
	Runner      string       `json:"runner"`
	Differences []Difference `json:"differences,omitempty"`
}

func ComparePerformance

func ComparePerformance(gate PerformanceGate) PerformanceReport

ComparePerformance rejects both absolute budget violations and regressions from the checked-in v0.16.0 result on the same fixed runner.

func (PerformanceReport) Passed

func (report PerformanceReport) Passed() bool

type Rect

type Rect struct {
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

type Report

type Report struct {
	Scenario    string       `json:"scenario"`
	Differences []Difference `json:"differences,omitempty"`
}

func Compare

func Compare(reference, actual Snapshot) Report

Compare applies the v0.18.0 semantic and geometry release thresholds.

func (Report) Passed

func (report Report) Passed() bool

type Snapshot

type Snapshot struct {
	Scenario     string                       `json:"scenario"`
	Viewport     Extent                       `json:"viewport"`
	DOMLandmarks []string                     `json:"domLandmarks"`
	Computed     map[string]map[string]string `json:"computed"`
	Geometry     map[string]Rect              `json:"geometry"`
	ScrollExtent Extent                       `json:"scrollExtent"`
	Focus        string                       `json:"focus"`
	Resources    map[string]string            `json:"resources"`
}

Snapshot is the body-free state captured from Chromium or Growse at one corpus checkpoint.

type VisualRegion

type VisualRegion struct {
	Name   string          `json:"name"`
	Bounds image.Rectangle `json:"bounds"`
	Limit  float64         `json:"limit,omitempty"`
}

type VisualRegionResult

type VisualRegionResult struct {
	Name       string  `json:"name"`
	Compared   int     `json:"compared"`
	Different  int     `json:"different"`
	Difference float64 `json:"difference"`
	Limit      float64 `json:"limit"`
	Passed     bool    `json:"passed"`
}

type VisualReport

type VisualReport struct {
	DimensionMatch bool                 `json:"dimensionMatch"`
	Regions        []VisualRegionResult `json:"regions"`
}

func CompareVisual

func CompareVisual(reference, actual image.Image, regions []VisualRegion, masks []image.Rectangle) VisualReport

CompareVisual reports the ratio of perceptually changed pixels after excluding explicit dynamic/font masks. Every named region is gated independently so a small but important panel cannot disappear unnoticed.

func (VisualReport) Passed

func (report VisualReport) Passed() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL