Skip to content

Commit

Permalink
Make Touchscreen.Tap async
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Apr 23, 2024
1 parent f18d21e commit 1fbff60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions browser/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,13 @@ func mapPage(vu moduleVU, p *common.Page) mapping {
}

// mapTouchscreen to the JS module.
func mapTouchscreen(_ moduleVU, ts *common.Touchscreen) mapping {
func mapTouchscreen(vu moduleVU, ts *common.Touchscreen) mapping {
return mapping{
"tap": ts.Tap,
"tap": func(x float64, y float64) *goja.Promise {
return k6ext.Promise(vu.Context(), func() (result any, reason error) {
return nil, ts.Tap(x, y) //nolint:wrapcheck
})
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion browser/mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ type keyboardAPI interface { //nolint: unused

// touchscreenAPI is the interface of a touchscreen.
type touchscreenAPI interface {
Tap(x float64, y float64) error
Tap(x float64, y float64) *goja.Promise
}

// mouseAPI is the interface of a mouse input device.
Expand Down

0 comments on commit 1fbff60

Please sign in to comment.