Skip to content

Commit

Permalink
Fix reload & setContent to use navigation timeout (#1034)
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 e3cda41
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(
f.manager.timeoutSettings.navigationTimeout(),
)
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,
p.timeoutSettings.navigationTimeout(),
)
if err := parsedOpts.Parse(p.ctx, opts); err != nil {
k6ext.Panic(p.ctx, "parsing reload options: %w", err)
}
Expand Down

0 comments on commit e3cda41

Please sign in to comment.