chromatic

package
v0.0.0-...-88ee3f8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorTimeoutExceeded = errors.New("timeout exceeded")
)

Functions

func Match

func Match(actual Page, targetTitle string, targetURL string, targetCookie cookieConfig) bool

func Report

func Report(result Page) (string, error)

func Run

func Run(filename string) error

func RunWithConfig

func RunWithConfig(config *Config) error

Types

type Browser

type Browser struct {
	// contains filtered or unexported fields
}

Browser represents a single Chrome instance that can be started, stopped, and waited on.

func NewBrowser

func NewBrowser(ctx context.Context, url string, args ...string) (*Browser, error)

NewBrowser creates a Browser object that can start Chrome with optional args, and will initially load the given url.

func (*Browser) Address

func (b *Browser) Address() string

Address returns the Chrome Debugging Protocol address.

func (*Browser) Start

func (b *Browser) Start() error

Start creates a Chrome process, and will make a browser window appear.

func (*Browser) Stop

func (b *Browser) Stop() error

Stop terminates the Chrome process.

func (*Browser) Wait

func (b *Browser) Wait() error

Wait returns when the Chrome process eventually terminates.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a single connection to the Chrome Debugging Protocol.

func NewClient

func NewClient(ctx context.Context, url string) *Client

NewClient creates Client object that can be used to connect to and receive events from the Chrome Debugging Protocol.

func (*Client) Connect

func (c *Client) Connect() error

Connect to the Chrome Debugging Protocol endpoint.

func (*Client) Events

func (c *Client) Events() (<-chan Page, <-chan error, error)

Events listens for page load events and returns any errors on a channel.

type Config

type Config struct {
	Browser browserConfig `yaml:"browser"`
	Start   startConfig   `yaml:"start"`
	End     endConfig     `yaml:"end"`
}

func Load

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

func LoadBytes

func LoadBytes(body []byte) (*Config, error)

type Page

type Page struct {
	Title   string
	URL     string
	Cookies []network.Cookie
	Body    string
}

Jump to

Keyboard shortcuts

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