config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorExpectation

type ColorExpectation struct {
	RGB       []int `yaml:"rgb"`
	Tolerance int   `yaml:"tolerance"`
}

type Config

type Config struct {
	Metadata Metadata      `yaml:"metadata"`
	Original Target        `yaml:"original"`
	React    Target        `yaml:"react"`
	Sections []SectionSpec `yaml:"sections"`
	Styles   []StyleSpec   `yaml:"styles"`
	Output   OutputSpec    `yaml:"output"`
	Modes    []string      `yaml:"modes"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type ExpectedResult

type ExpectedResult struct {
	Format      []string `yaml:"format"`
	Description string   `yaml:"description"`
}

type Metadata

type Metadata struct {
	Slug               string         `yaml:"slug"`
	Title              string         `yaml:"title"`
	Description        string         `yaml:"description"`
	Goal               string         `yaml:"goal"`
	ExpectedResult     ExpectedResult `yaml:"expected_result"`
	PotentialQuestions []string       `yaml:"potential_questions"`
	RelatedFiles       []RelatedFile  `yaml:"related_files"`
}

type OutputSpec

type OutputSpec struct {
	Dir               string `yaml:"dir"`
	WriteJSON         bool   `yaml:"write_json"`
	WriteMarkdown     bool   `yaml:"write_markdown"`
	WritePNGs         bool   `yaml:"write_pngs"`
	WritePreparedHTML bool   `yaml:"write_prepared_html"`
	WriteInspectJSON  bool   `yaml:"write_inspect_json"`
	ValidatePNGs      bool   `yaml:"validate_pngs"`
}

type PNGExpectations

type PNGExpectations struct {
	Width              int               `yaml:"width"`
	Height             int               `yaml:"height"`
	MinWidth           int               `yaml:"min_width"`
	MinHeight          int               `yaml:"min_height"`
	MaxWidth           int               `yaml:"max_width"`
	MaxHeight          int               `yaml:"max_height"`
	TopStripNear       *ColorExpectation `yaml:"top_strip_near"`
	TopStripNotNear    *ColorExpectation `yaml:"top_strip_not_near"`
	BottomStripNear    *ColorExpectation `yaml:"bottom_strip_near"`
	BottomStripNotNear *ColorExpectation `yaml:"bottom_strip_not_near"`
}

type PrepareSpec

type PrepareSpec struct {
	Type string `yaml:"type"`

	Script     string `yaml:"script"`
	ScriptFile string `yaml:"script_file"`

	WaitFor          string `yaml:"wait_for"`
	WaitForTimeoutMS int    `yaml:"wait_for_timeout_ms"`
	AfterWaitMS      int    `yaml:"after_wait_ms"`

	Component    string         `yaml:"component"`
	Props        map[string]any `yaml:"props"`
	RootSelector string         `yaml:"root_selector"`
	Width        int            `yaml:"width"`
	MinHeight    int            `yaml:"min_height"`
	Background   string         `yaml:"background"`
}

type RelatedFile

type RelatedFile struct {
	Path   string `yaml:"path"`
	Reason string `yaml:"reason"`
}

type SectionSpec

type SectionSpec struct {
	Name               string            `yaml:"name"`
	Selector           string            `yaml:"selector"`
	SelectorOriginal   string            `yaml:"selector_original"`
	SelectorReact      string            `yaml:"selector_react"`
	OCRQuestion        string            `yaml:"ocr_question"`
	ExpectText         *TextExpectations `yaml:"expect_text"`
	ExpectTextOriginal *TextExpectations `yaml:"expect_text_original"`
	ExpectTextReact    *TextExpectations `yaml:"expect_text_react"`
	ExpectPNG          *PNGExpectations  `yaml:"expect_png"`
	ExpectPNGOriginal  *PNGExpectations  `yaml:"expect_png_original"`
	ExpectPNGReact     *PNGExpectations  `yaml:"expect_png_react"`
}

type StyleSpec

type StyleSpec struct {
	Name             string   `yaml:"name"`
	Selector         string   `yaml:"selector"`
	SelectorOriginal string   `yaml:"selector_original"`
	SelectorReact    string   `yaml:"selector_react"`
	Props            []string `yaml:"props"`
	IncludeBounds    bool     `yaml:"include_bounds"`
	Attributes       []string `yaml:"attributes"`
	Report           []string `yaml:"report"`
}

type Target

type Target struct {
	Name         string       `yaml:"name"`
	URL          string       `yaml:"url"`
	WaitMS       int          `yaml:"wait_ms"`
	Viewport     Viewport     `yaml:"viewport"`
	RootSelector string       `yaml:"root_selector"`
	Prepare      *PrepareSpec `yaml:"prepare"`
}

type TextExpectations

type TextExpectations struct {
	Includes []string `yaml:"includes"`
	Excludes []string `yaml:"excludes"`
}

type Viewport

type Viewport struct {
	Width  int `yaml:"width"`
	Height int `yaml:"height"`
}

Jump to

Keyboard shortcuts

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