chrometest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package chrometest provides a shared chrome.Browser test double. Both the cli and daemon test suites embed StubBrowser and override only the methods they assert on, so a new Browser method needs a default in exactly one place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StubBrowser

type StubBrowser struct{}

StubBrowser implements chrome.Browser with permissive defaults so tests override only what they assert on; a new interface method gets a default here.

func (StubBrowser) Activate added in v0.2.0

func (StubBrowser) Activate(context.Context, string) (map[string]any, error)

func (StubBrowser) AttrGet

func (StubBrowser) AttrList

func (StubBrowser) AttrRemove

func (StubBrowser) AttrSet

func (StubBrowser) Close

func (StubBrowser) Close() error

func (StubBrowser) CloseTabs added in v0.2.0

func (StubBrowser) CloseTabs(_ context.Context, ids []string) (map[string]any, error)

func (StubBrowser) Console added in v0.2.0

func (StubBrowser) ConsoleStream added in v0.2.0

func (StubBrowser) ConsoleStream(context.Context, string, chrome.ConsoleOpts, func(any) error) error

func (StubBrowser) CookieClear

func (StubBrowser) CookieClear(context.Context, string) (map[string]any, error)

func (StubBrowser) CookieDelete

func (StubBrowser) CookieDelete(context.Context, string, string) (map[string]any, error)

func (StubBrowser) CookieList

func (StubBrowser) CookieList(context.Context, string) (any, error)

func (StubBrowser) CookieSet

func (StubBrowser) EmulateGeo

func (StubBrowser) EmulateReset

func (StubBrowser) EmulateReset(context.Context, string) (map[string]any, error)

func (StubBrowser) EmulateViewport

func (StubBrowser) EmulateViewport(context.Context, string, int64, int64) (map[string]any, error)

func (StubBrowser) Eval

func (StubBrowser) Fill

func (StubBrowser) Find added in v0.2.0

func (StubBrowser) Find(_ context.Context, _, query string, _ chrome.FindOpts) (map[string]any, error)

func (StubBrowser) Frames

func (StubBrowser) Frames(context.Context, string) (any, error)

func (StubBrowser) Grid

func (StubBrowser) HTML

func (StubBrowser) History added in v0.2.0

func (StubBrowser) History(context.Context, string, int) (map[string]any, error)

func (StubBrowser) Key added in v0.2.0

func (StubBrowser) Key(_ context.Context, _, _ string, keys []chrome.KeyStroke, opts chrome.KeyOpts) (map[string]any, error)

func (StubBrowser) List

func (StubBrowser) Navigate

func (StubBrowser) Navigate(context.Context, string, string) (map[string]any, error)

func (StubBrowser) Net added in v0.2.0

func (StubBrowser) NetStream added in v0.2.0

func (StubBrowser) NetWait added in v0.2.0

func (StubBrowser) Open

func (StubBrowser) Open(_ context.Context, url string) (map[string]any, error)

func (StubBrowser) PDF

func (StubBrowser) Pointer added in v0.2.0

func (StubBrowser) Pointer(_ context.Context, _ string, _ string, opts chrome.PointerOpts) (map[string]any, error)

func (StubBrowser) Raw

func (StubBrowser) RecordCancel added in v0.2.0

func (StubBrowser) RecordCancel(context.Context, string) (map[string]any, error)

func (StubBrowser) RecordRestore added in v0.2.0

func (StubBrowser) RecordRestore(context.Context, string, []chrome.Frame, map[string]any) error

RecordRestore accepts a re-seated recording and forgets it: a stub has nowhere to hold one, and every test that cares about the retry overrides this.

func (StubBrowser) RecordStart added in v0.2.0

func (StubBrowser) RecordStatus added in v0.2.0

func (StubBrowser) RecordStatus(context.Context, string) (map[string]any, error)

func (StubBrowser) RecordStop added in v0.2.0

func (StubBrowser) RecordStop(context.Context, string) ([]chrome.Frame, map[string]any, error)

RecordStop hands back two REAL frames, small but decodable.

A stub that returned empty bytes would make every CLI-level export test pass through a code path that never encodes anything — and encoding is most of what `record stop` does. Two frames also make the result an animation rather than a still, which is what the command promises.

func (StubBrowser) Reload added in v0.2.0

func (StubBrowser) Reload(context.Context, string, bool) (map[string]any, error)

func (StubBrowser) Screenshot

func (StubBrowser) Screenshot(context.Context, string, chrome.ShotOpts) ([]byte, map[string]any, error)

func (StubBrowser) Scroll

func (StubBrowser) Select

func (StubBrowser) SetHeaders

func (StubBrowser) SetHeaders(context.Context, string, map[string]string) (map[string]any, error)

func (StubBrowser) Snapshot

func (StubBrowser) Text

func (StubBrowser) Type

func (StubBrowser) Upload added in v0.2.0

func (StubBrowser) Value

func (StubBrowser) Values

func (StubBrowser) Wait

func (StubBrowser) Window added in v0.2.0

Jump to

Keyboard shortcuts

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