Documentation
¶
Index ¶
- type Baseline
- type CompareResult
- type Config
- type Differ
- type IgnoreRegion
- type Manager
- func (m *Manager) CompareToBaseline(baselineName string, currentPages []PageCapture) (*CompareResult, error)
- func (m *Manager) CreateBaseline(name string, pages []PageCapture) (*Baseline, error)
- func (m *Manager) DeleteBaseline(name string) error
- func (m *Manager) GetBaseline(name string) (*Baseline, error)
- func (m *Manager) ListBaselines() ([]*Baseline, error)
- type PageCapture
- type PageComparison
- type PageState
- type Storage
- func (s *Storage) DeleteBaseline(name string) error
- func (s *Storage) GetBaselinePath(name string) (string, error)
- func (s *Storage) GetDiffsPath() string
- func (s *Storage) GetScreenshotPath(baselineName, filename string) (string, error)
- func (s *Storage) ListBaselines() ([]*Baseline, error)
- func (s *Storage) LoadBaseline(name string) (*Baseline, error)
- func (s *Storage) SaveBaseline(baseline *Baseline) error
- func (s *Storage) SaveDiff(result *CompareResult) error
- func (s *Storage) SaveScreenshot(baselineName, filename string, data []byte) error
- type Summary
- type Viewport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Baseline ¶
type Baseline struct {
Name string `json:"name"`
Timestamp time.Time `json:"timestamp"`
GitCommit string `json:"git_commit,omitempty"`
GitBranch string `json:"git_branch,omitempty"`
Pages []PageState `json:"pages"`
Config Config `json:"config"`
}
Baseline represents a saved set of screenshots for comparison
type CompareResult ¶
type CompareResult struct {
BaselineName string `json:"baseline_name"`
Timestamp time.Time `json:"timestamp"`
Pages []PageComparison `json:"pages"`
Summary Summary `json:"summary"`
}
CompareResult holds the results of a baseline comparison
type Config ¶
type Config struct {
DiffThreshold float64 `json:"diff_threshold"` // 0.0 - 1.0
IgnoreRegions []IgnoreRegion `json:"ignore_regions,omitempty"`
}
Config holds snapshot configuration
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ handles image comparison
func (*Differ) HasSignificantChanges ¶
HasSignificantChanges checks if diff percentage exceeds threshold
type IgnoreRegion ¶
IgnoreRegion defines areas to skip during comparison
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates snapshot operations
func NewManager ¶
NewManager creates a new snapshot manager
func (*Manager) CompareToBaseline ¶
func (m *Manager) CompareToBaseline(baselineName string, currentPages []PageCapture) (*CompareResult, error)
CompareToBaseline compares current screenshots to a baseline
func (*Manager) CreateBaseline ¶
func (m *Manager) CreateBaseline(name string, pages []PageCapture) (*Baseline, error)
CreateBaseline captures screenshots and saves them as a baseline
func (*Manager) DeleteBaseline ¶
DeleteBaseline removes a baseline
func (*Manager) GetBaseline ¶
GetBaseline loads a specific baseline
func (*Manager) ListBaselines ¶
ListBaselines returns all available baselines
type PageCapture ¶
type PageCapture struct {
URL string `json:"url"`
Viewport Viewport `json:"viewport"`
ScreenshotData string `json:"screenshot_data"` // Base64 encoded PNG
}
PageCapture represents a page to capture or that was captured
type PageComparison ¶
type PageComparison struct {
URL string `json:"url"`
DiffPercentage float64 `json:"diff_percentage"`
DiffImagePath string `json:"diff_image_path"`
BaselineImagePath string `json:"baseline_image_path"`
CurrentImagePath string `json:"current_image_path"`
HasChanges bool `json:"has_changes"`
Description string `json:"description,omitempty"`
}
PageComparison holds diff results for a single page
type PageState ¶
type PageState struct {
URL string `json:"url"`
Viewport Viewport `json:"viewport"`
Screenshot string `json:"screenshot"` // Filename
Timestamp time.Time `json:"timestamp"`
Metadata map[string]string `json:"metadata,omitempty"`
}
PageState represents the captured state of a single page
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage handles baseline persistence
func NewStorage ¶
NewStorage creates a new storage manager
func (*Storage) DeleteBaseline ¶
DeleteBaseline removes a baseline from disk
func (*Storage) GetBaselinePath ¶
GetBaselinePath returns the directory path for a baseline. Returns an error if the name would escape the base directory.
func (*Storage) GetDiffsPath ¶
GetDiffsPath returns the diffs directory path
func (*Storage) GetScreenshotPath ¶
GetScreenshotPath returns the path to a screenshot file. Returns an error if the path would escape the base directory.
func (*Storage) ListBaselines ¶
ListBaselines returns all available baselines
func (*Storage) LoadBaseline ¶
LoadBaseline loads a baseline from disk
func (*Storage) SaveBaseline ¶
SaveBaseline persists a baseline to disk
func (*Storage) SaveDiff ¶
func (s *Storage) SaveDiff(result *CompareResult) error
SaveDiff saves comparison results to disk