diff --git a/browser/browser_context_options_test.go b/browser/browser_context_options_test.go index 31decabbe..82c713eda 100644 --- a/browser/browser_context_options_test.go +++ b/browser/browser_context_options_test.go @@ -45,7 +45,7 @@ func TestBrowserContextSetGeolocation(t *testing.T) { func TestBrowserContextDefaultOptions(t *testing.T) { vu := k6test.NewVU(t) - defaults := common.NewBrowserContextOptions() + defaults := common.DefaultBrowserContextOptions() // gets the default options by default opts, err := parseBrowserContextOptions(vu.Runtime(), nil) diff --git a/browser/browser_mapping.go b/browser/browser_mapping.go index 8f6d4860a..4d28d396e 100644 --- a/browser/browser_mapping.go +++ b/browser/browser_mapping.go @@ -110,7 +110,7 @@ func initBrowserContext(bctx *common.BrowserContext, testRunID string) error { // parseBrowserContextOptions parses the [common.BrowserContext] options from a Sobek value. func parseBrowserContextOptions(rt *sobek.Runtime, opts sobek.Value) (*common.BrowserContextOptions, error) { - b := common.NewBrowserContextOptions() + b := common.DefaultBrowserContextOptions() if err := mergeWith(rt, b, opts); err != nil { return nil, err } diff --git a/common/browser.go b/common/browser.go index 8a1638caf..d6e2d309a 100644 --- a/common/browser.go +++ b/common/browser.go @@ -157,7 +157,7 @@ func (b *Browser) connect() error { } // We don't need to lock this because `connect()` is called only in NewBrowser - b.defaultContext, err = NewBrowserContext(b.vuCtx, b, "", NewBrowserContextOptions(), b.logger) + b.defaultContext, err = NewBrowserContext(b.vuCtx, b, "", DefaultBrowserContextOptions(), b.logger) if err != nil { return fmt.Errorf("browser connect: %w", err) } diff --git a/common/browser_context.go b/common/browser_context.go index ad78e79ea..70de498e4 100644 --- a/common/browser_context.go +++ b/common/browser_context.go @@ -116,7 +116,7 @@ func NewBrowserContext( ) (*BrowserContext, error) { // set the default options if none provided. if opts == nil { - opts = NewBrowserContextOptions() + opts = DefaultBrowserContextOptions() } b := BrowserContext{ diff --git a/common/browser_context_options.go b/common/browser_context_options.go index 0dc246f8d..f20a99da9 100644 --- a/common/browser_context_options.go +++ b/common/browser_context_options.go @@ -55,8 +55,8 @@ type BrowserContextOptions struct { Viewport Viewport `js:"viewport"` } -// NewBrowserContextOptions creates a default set of browser context options. -func NewBrowserContextOptions() *BrowserContextOptions { +// DefaultBrowserContextOptions returns the default browser context options. +func DefaultBrowserContextOptions() *BrowserContextOptions { return &BrowserContextOptions{ ColorScheme: ColorSchemeLight, DeviceScaleFactor: 1.0, diff --git a/tests/browser_context_options_test.go b/tests/browser_context_options_test.go index 916dc917c..0f71aba28 100644 --- a/tests/browser_context_options_test.go +++ b/tests/browser_context_options_test.go @@ -15,7 +15,7 @@ import ( func TestBrowserContextOptionsDefaultValues(t *testing.T) { t.Parallel() - opts := common.NewBrowserContextOptions() + opts := common.DefaultBrowserContextOptions() assert.False(t, opts.AcceptDownloads) assert.Empty(t, opts.DownloadsPath) assert.False(t, opts.BypassCSP) @@ -52,7 +52,7 @@ func TestBrowserContextOptionsSetViewport(t *testing.T) { t.Parallel() tb := newTestBrowser(t) - opts := common.NewBrowserContextOptions() + opts := common.DefaultBrowserContextOptions() opts.Viewport = common.Viewport{ Width: 800, Height: 600, @@ -77,7 +77,7 @@ func TestBrowserContextOptionsExtraHTTPHeaders(t *testing.T) { tb := newTestBrowser(t, withHTTPServer()) - opts := common.NewBrowserContextOptions() + opts := common.DefaultBrowserContextOptions() opts.ExtraHTTPHeaders = map[string]string{ "Some-Header": "Some-Value", } diff --git a/tests/element_handle_test.go b/tests/element_handle_test.go index 1d125de8d..66ce0f48c 100644 --- a/tests/element_handle_test.go +++ b/tests/element_handle_test.go @@ -182,7 +182,7 @@ func TestElementHandleClickConcealedLink(t *testing.T) { tb := newTestBrowser(t, withFileServer()) - bcopts := common.NewBrowserContextOptions() + bcopts := common.DefaultBrowserContextOptions() bcopts.Viewport = common.Viewport{ Width: 500, Height: 240, diff --git a/tests/network_manager_test.go b/tests/network_manager_test.go index 39fa974f2..4e4011e0a 100644 --- a/tests/network_manager_test.go +++ b/tests/network_manager_test.go @@ -113,7 +113,7 @@ func TestBasicAuth(t *testing.T) { browser := newTestBrowser(t, withHTTPServer()) - bcopts := common.NewBrowserContextOptions() + bcopts := common.DefaultBrowserContextOptions() bcopts.HTTPCredentials = common.Credentials{ Username: validUser, Password: validPassword,