Skip to content

Commit

Permalink
Add TestBrowserContextSetGeolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Nov 5, 2024
1 parent 51cc649 commit 2c627af
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions common/browser_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,23 @@ func TestFilterCookies(t *testing.T) {
})
}
}

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

var opts BrowserContextOptions
err := opts.Parse(vu.Context(), vu.ToSobekValue((struct {
GeoLocation *Geolocation `js:"geolocation"`
}{
GeoLocation: &Geolocation{
Latitude: 1.0,
Longitude: 2.0,
Accuracy: 3.0,
},
})))
assert.NoError(t, err)
assert.NotNil(t, opts)
assert.Equal(t, 1.0, opts.Geolocation.Latitude)
assert.Equal(t, 2.0, opts.Geolocation.Longitude)
assert.Equal(t, 3.0, opts.Geolocation.Accuracy)
}

0 comments on commit 2c627af

Please sign in to comment.