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 ¶
- type StubBrowser
- func (StubBrowser) Activate(context.Context, string) (map[string]any, error)
- func (StubBrowser) AttrGet(context.Context, string, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) AttrList(context.Context, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) AttrRemove(context.Context, string, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) AttrSet(context.Context, string, string, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) Close() error
- func (StubBrowser) CloseTabs(_ context.Context, ids []string) (map[string]any, error)
- func (StubBrowser) Console(context.Context, string, chrome.ConsoleOpts) (any, error)
- func (StubBrowser) ConsoleStream(context.Context, string, chrome.ConsoleOpts, func(any) error) error
- func (StubBrowser) CookieClear(context.Context, string) (map[string]any, error)
- func (StubBrowser) CookieDelete(context.Context, string, string) (map[string]any, error)
- func (StubBrowser) CookieList(context.Context, string) (any, error)
- func (StubBrowser) CookieSet(context.Context, string, string, string, string, string) (map[string]any, error)
- func (StubBrowser) EmulateGeo(context.Context, string, float64, float64) (map[string]any, error)
- func (StubBrowser) EmulateReset(context.Context, string) (map[string]any, error)
- func (StubBrowser) EmulateViewport(context.Context, string, int64, int64) (map[string]any, error)
- func (StubBrowser) Eval(context.Context, string, string, chrome.EvalOpts) (any, error)
- func (StubBrowser) Fill(context.Context, string, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) Find(_ context.Context, _, query string, _ chrome.FindOpts) (map[string]any, error)
- func (StubBrowser) Frames(context.Context, string) (any, error)
- func (StubBrowser) Grid(context.Context, string, string, chrome.QueryOpts) (any, error)
- func (StubBrowser) HTML(context.Context, string, string, bool, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) History(context.Context, string, int) (map[string]any, error)
- func (StubBrowser) Key(_ context.Context, _, _ string, keys []chrome.KeyStroke, opts chrome.KeyOpts) (map[string]any, error)
- func (StubBrowser) List(context.Context) ([]target.Info, error)
- func (StubBrowser) Navigate(context.Context, string, string) (map[string]any, error)
- func (StubBrowser) Net(context.Context, string, chrome.NetOpts) (any, error)
- func (StubBrowser) NetStream(context.Context, string, chrome.NetOpts, func(any) error) error
- func (StubBrowser) NetWait(context.Context, string, chrome.NetCond) (map[string]any, error)
- func (StubBrowser) Open(_ context.Context, url string) (map[string]any, error)
- func (StubBrowser) PDF(context.Context, string, chrome.PDFOpts) ([]byte, map[string]any, error)
- func (StubBrowser) Pointer(_ context.Context, _ string, _ string, opts chrome.PointerOpts) (map[string]any, error)
- func (StubBrowser) Raw(context.Context, string, string, json.RawMessage) (any, error)
- func (StubBrowser) RecordCancel(context.Context, string) (map[string]any, error)
- func (StubBrowser) RecordRestore(context.Context, string, []chrome.Frame, map[string]any) error
- func (StubBrowser) RecordStart(context.Context, string, chrome.RecordOpts) (map[string]any, error)
- func (StubBrowser) RecordStatus(context.Context, string) (map[string]any, error)
- func (StubBrowser) RecordStop(context.Context, string) ([]chrome.Frame, map[string]any, error)
- func (StubBrowser) Reload(context.Context, string, bool) (map[string]any, error)
- func (StubBrowser) Screenshot(context.Context, string, chrome.ShotOpts) ([]byte, map[string]any, error)
- func (StubBrowser) Scroll(context.Context, string, string, chrome.ScrollOpts) (map[string]any, error)
- func (StubBrowser) Select(context.Context, string, string, string, chrome.SelectOpts) (map[string]any, error)
- func (StubBrowser) SetHeaders(context.Context, string, map[string]string) (map[string]any, error)
- func (StubBrowser) Snapshot(context.Context, string, chrome.SnapOpts) (any, error)
- func (StubBrowser) Text(context.Context, string, string, chrome.TextOpts) (map[string]any, error)
- func (StubBrowser) Type(context.Context, string, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) Upload(context.Context, string, string, []string, chrome.UploadOpts) (map[string]any, error)
- func (StubBrowser) Value(context.Context, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) Values(context.Context, string, string, chrome.QueryOpts) (map[string]any, error)
- func (StubBrowser) Wait(context.Context, string, chrome.WaitCond) (map[string]any, error)
- func (StubBrowser) Window(_ context.Context, _ string, opts chrome.WindowOpts) (chrome.WindowBounds, error)
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) AttrRemove ¶
func (StubBrowser) Close ¶
func (StubBrowser) Close() error
func (StubBrowser) Console ¶ added in v0.2.0
func (StubBrowser) Console(context.Context, string, chrome.ConsoleOpts) (any, error)
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) CookieDelete ¶
func (StubBrowser) CookieList ¶
func (StubBrowser) EmulateGeo ¶
func (StubBrowser) EmulateReset ¶
func (StubBrowser) EmulateViewport ¶
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) Raw(context.Context, string, string, json.RawMessage) (any, error)
func (StubBrowser) RecordCancel ¶ added in v0.2.0
func (StubBrowser) RecordRestore ¶ added in v0.2.0
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) RecordStart(context.Context, string, chrome.RecordOpts) (map[string]any, error)
func (StubBrowser) RecordStatus ¶ added in v0.2.0
func (StubBrowser) RecordStop ¶ added in v0.2.0
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) Screenshot ¶
func (StubBrowser) Scroll ¶
func (StubBrowser) Scroll(context.Context, string, string, chrome.ScrollOpts) (map[string]any, error)
func (StubBrowser) SetHeaders ¶
func (StubBrowser) Window ¶ added in v0.2.0
func (StubBrowser) Window(_ context.Context, _ string, opts chrome.WindowOpts) (chrome.WindowBounds, error)