Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

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 30, 2023
1 parent 2300e7d commit 6f5222b
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 @@ -432,3 +432,18 @@ func TestBrowserContextCookies(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 6f5222b

Please sign in to comment.