Skip to content

Commit

Permalink
Fix reload & setContent to use navigation timeout
Browse files Browse the repository at this point in the history
These methods should work with the default navigation instead of the
default timeout to match the behaviour in Playwright.
  • Loading branch information
ankur22 committed Sep 18, 2023
1 parent 9cd064e commit 499d0d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion common/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,9 @@ func (f *Frame) selectOption(selector string, values goja.Value, opts *FrameSele
func (f *Frame) SetContent(html string, opts goja.Value) {
f.log.Debugf("Frame:SetContent", "fid:%s furl:%q", f.ID(), f.URL())

parsedOpts := NewFrameSetContentOptions(f.defaultTimeout())
parsedOpts := NewFrameSetContentOptions(
time.Duration(f.manager.timeoutSettings.navigationTimeout()) * time.Second,

Check failure on line 1432 in common/frame.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
)
if err := parsedOpts.Parse(f.ctx, opts); err != nil {
k6ext.Panic(f.ctx, "parsing set content options: %w", err)
}
Expand Down
5 changes: 4 additions & 1 deletion common/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@ func (p *Page) QueryAll(selector string) ([]api.ElementHandle, error) {
func (p *Page) Reload(opts goja.Value) api.Response {
p.logger.Debugf("Page:Reload", "sid:%v", p.sessionID())

parsedOpts := NewPageReloadOptions(LifecycleEventLoad, p.defaultTimeout())
parsedOpts := NewPageReloadOptions(
LifecycleEventLoad,
time.Duration(p.timeoutSettings.navigationTimeout())*time.Second,

Check failure on line 865 in common/page.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
)
if err := parsedOpts.Parse(p.ctx, opts); err != nil {
k6ext.Panic(p.ctx, "parsing reload options: %w", err)
}
Expand Down

0 comments on commit 499d0d0

Please sign in to comment.