Skip to content

Commit

Permalink
add test for isNilContextErr
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Sep 13, 2020
1 parent 1db9370 commit 241cbc8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"time"

"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/cdp"
"github.com/go-rod/rod/lib/defaults"
"github.com/go-rod/rod/lib/devices"
"github.com/go-rod/rod/lib/input"
Expand Down Expand Up @@ -272,6 +273,16 @@ func (s *S) TestPageEval() {
s.NotEqualValues(1, page.MustEval(`/* ) */`))
}

func (s *S) TestPageEvalNilContext() {
page := s.browser.MustPage(srcFile("fixtures/click.html"))
defer page.MustClose()

s.stub(1, proto.RuntimeEvaluate{}, func(func() ([]byte, error)) ([]byte, error) {
return nil, &cdp.Error{Code: -32000}
})
s.EqualValues(1, page.MustEval(`1`).Int())
}

func (s *S) TestPageExposeJSHelper() {
page := s.browser.MustPage(srcFile("fixtures/click.html"))
defer page.MustClose()
Expand Down

0 comments on commit 241cbc8

Please sign in to comment.