Skip to content

Commit

Permalink
Add TestBrowserContextAllOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Nov 7, 2024
1 parent a5ba0c4 commit 5854f19
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions browser/browser_context_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,46 @@ func TestBrowserContextDefaultOptions(t *testing.T) {
assert.NotEqual(t, defaults.DeviceScaleFactor, opts.DeviceScaleFactor)
assert.Equal(t, defaults.Locale, opts.Locale) // should remain as default
}

func TestBrowserContextAllOptions(t *testing.T) {
vu := k6test.NewVU(t)

opts := common.BrowserContextOptions{
AcceptDownloads: true,
DownloadsPath: "/tmp",
BypassCSP: true,
ColorScheme: common.ColorSchemeDark,
DeviceScaleFactor: 2.0,
ExtraHTTPHeaders: map[string]string{
"X-Header": "value",
},
Geolocation: &common.Geolocation{
Latitude: 1.0,
Longitude: 2.0,
Accuracy: 3.0,
},
HasTouch: true,
HTTPCredentials: common.Credentials{Username: "user", Password: "pass"},
IgnoreHTTPSErrors: true,
IsMobile: true,
JavaScriptEnabled: true,
Locale: "en-US",
Offline: true,
Permissions: []string{"great power requires great responsibility"},
ReducedMotion: common.ReducedMotionReduce,
Screen: common.Screen{
Width: 1920,
Height: 1080,
},
TimezoneID: "America/New_York",
UserAgent: "k6",
VideosPath: "/tmp",
Viewport: common.Viewport{
Width: 1920,
Height: 1080,
},
}
parsedOpts, err := parseBrowserContextOptions(vu.Runtime(), vu.ToSobekValue(opts))
require.NoError(t, err)
assert.Equal(t, opts, *parsedOpts)
}

0 comments on commit 5854f19

Please sign in to comment.