Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 4f692e3

Browse files
committed
Make Touchscreen.Tap async
1 parent afc9230 commit 4f692e3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

browser/mapping.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,13 @@ func mapPage(vu moduleVU, p *common.Page) mapping {
789789
}
790790

791791
// mapTouchscreen to the JS module.
792-
func mapTouchscreen(_ moduleVU, ts *common.Touchscreen) mapping {
792+
func mapTouchscreen(vu moduleVU, ts *common.Touchscreen) mapping {
793793
return mapping{
794-
"tap": ts.Tap,
794+
"tap": func(x float64, y float64) *goja.Promise {
795+
return k6ext.Promise(vu.Context(), func() (result any, reason error) {
796+
return nil, ts.Tap(x, y) //nolint:wrapcheck
797+
})
798+
},
795799
}
796800
}
797801

browser/mapping_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ type keyboardAPI interface { //nolint: unused
527527

528528
// touchscreenAPI is the interface of a touchscreen.
529529
type touchscreenAPI interface {
530-
Tap(x float64, y float64) error
530+
Tap(x float64, y float64) *goja.Promise
531531
}
532532

533533
// mouseAPI is the interface of a mouse input device.

0 commit comments

Comments
 (0)