browserfixt

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package browserfixt provides a function for obtaining a Browser instance for a given tast fixture and browser type.

Index

Constants

View Source
const LacrosDeployedBinary = lacrosfixt.LacrosDeployedBinary

LacrosDeployedBinary is lacrosfixt.LacrosDeployedBinary.

Variables

This section is empty.

Functions

func SetUp

func SetUp(ctx context.Context, f interface{}, bt browser.Type) (*browser.Browser, func(ctx context.Context), error)

SetUp returns a Browser instance for a given fixture value and browser type. It also returns a closure to be called in order to close the browser instance, after which the instance should not be used any further. If browser type is TypeAsh, the fixture value must implement the HasChrome interface. If browser type is TypeLacros, the fixture value must be of lacrosfixt.FixtValue type. TODO(crbug.com/1315088): Replace f with just the HasChrome interface.

func SetUpWithNewChrome

func SetUpWithNewChrome(ctx context.Context, bt browser.Type, cfg *lacrosfixt.Config, opts ...chrome.Option) (*chrome.Chrome, *browser.Browser, func(ctx context.Context), error)

SetUpWithNewChrome returns a Browser instance along with a new Chrome instance created. This is useful when no fixture is used but the new chrome needs to be instantiated in test for a fresh UI restart between tests. It also returns a closure to be called in order to close the browser instance. The caller is responsible for calling the closure first, then Close() on the chrome instance for deferred cleanup. LacrosConfig is the configurations to be set to enable Lacros for use by tests. For convenience, DefaultLacrosConfig().WithVar(s) could be passed in when rootfs-lacros is needed as a primary browser unless specified with the runtime var.

func SetUpWithURL

func SetUpWithURL(ctx context.Context, f interface{}, bt browser.Type, url string) (*chrome.Conn, *browser.Browser, func(ctx context.Context), error)

SetUpWithURL is a combination of SetUp and NewConn that avoids an extra blank tab in the case of Lacros. The caller is responsible for closing the returned connection via its Close() method prior to calling the returned closure. TODO(crbug.com/1315088): Replace f with just the HasChrome interface.

Types

This section is empty.

Jump to

Keyboard shortcuts

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