Skip to content

Commit

Permalink
Rename parsedOpts to popts to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Jan 25, 2024
1 parent 90c53af commit 65e6bd8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions browser/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,16 +751,16 @@ func mapBrowserContext(vu moduleVU, bc *common.BrowserContext) mapping { //nolin
"unroute": bc.Unroute,
"waitForEvent": func(event string, optsOrPredicate goja.Value) (*goja.Promise, error) {
ctx := vu.Context()
parsedOpts := common.NewWaitForEventOptions(
popts := common.NewWaitForEventOptions(
bc.Timeout(),
)
if err := parsedOpts.Parse(ctx, optsOrPredicate); err != nil {
if err := popts.Parse(ctx, optsOrPredicate); err != nil {
return nil, fmt.Errorf("parsing waitForEvent options: %w", err)
}

return k6ext.Promise(ctx, func() (result any, reason error) {
var runInTaskQueue func(p *common.Page) (bool, error)
if parsedOpts.PredicateFn != nil {
if popts.PredicateFn != nil {
runInTaskQueue = func(p *common.Page) (bool, error) {
tq := vu.taskQueueRegistry.get(p.TargetID())

Expand All @@ -772,7 +772,7 @@ func mapBrowserContext(vu moduleVU, bc *common.BrowserContext) mapping { //nolin
c := make(chan bool)
tq.Queue(func() error {
var resp goja.Value
resp, err = parsedOpts.PredicateFn(vu.Runtime().ToValue(p))
resp, err = popts.PredicateFn(vu.Runtime().ToValue(p))
rtn = resp.ToBoolean()
close(c)
return nil
Expand All @@ -783,7 +783,7 @@ func mapBrowserContext(vu moduleVU, bc *common.BrowserContext) mapping { //nolin
}
}

resp, err := bc.WaitForEvent(event, runInTaskQueue, parsedOpts.Timeout)
resp, err := bc.WaitForEvent(event, runInTaskQueue, popts.Timeout)
panicIfFatalError(ctx, err)
if err != nil {
return nil, err //nolint:wrapcheck
Expand Down

0 comments on commit 65e6bd8

Please sign in to comment.