Skip to content

Commit

Permalink
Add a integration test for k6 object injection
Browse files Browse the repository at this point in the history
This test will evaluate and return the value. It should be an empty
object and not null.
  • Loading branch information
ankur22 committed Aug 21, 2023
1 parent 2003fe1 commit 3cf3de1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/browser_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,18 @@ func TestBrowserContextAddCookies(t *testing.T) {
})
}
}

func TestK6Object(t *testing.T) {
b := newTestBrowser(t, withFileServer())
p := b.NewPage(nil)

url := b.staticURL("empty.html")
r, err := p.Goto(url, nil)
require.NoError(t, err)
require.NotNil(t, r)

k6Obj := p.Evaluate(b.toGojaValue(`() => window.k6`))
k6ObjGoja := b.toGojaValue(k6Obj)

assert.False(t, k6ObjGoja.Equals(goja.Null()))
}

0 comments on commit 3cf3de1

Please sign in to comment.