Documentation ¶
Overview ¶
Package browser provides helpers for writing integration tests that interact with the browser. It wraps chromedp to create a real browser, click buttons, and assert results.
This package should only be used by tests.
Index ¶
- func Cookies(dst *[]*http.Cookie) chromedp.Action
- func New(tb testing.TB) context.Context
- func NewFromOptions(tb testing.TB, opts []chromedp.ExecAllocatorOption) context.Context
- func NewHeadful(tb testing.TB) context.Context
- func Screenshot(dst *[]byte) chromedp.Action
- func SetCookie(c *http.Cookie) chromedp.Action
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromOptions ¶
NewFromOptions creates a new browser instance. All future calls to `Run` must use the context returned by this function!
If this function returns successfully, a browser is running and ready to be used. It's recommended that you wrap the returned context in a timeout.
func NewHeadful ¶
NewHeadful creates a new browser context so you can actually watch the test. This is for local debugging and will fail on CI where a browser isn't actually available.
func Screenshot ¶
Screenshot captures a screenshot of the browser page in its current state. This is useful for debugging a test failure. The dst will contain the screenshot bytes in PNG format when the runner finishes.
Types ¶
This section is empty.