This repository was archived by the owner on Jan 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ func mapPage(vu moduleVU, p *common.Page) mapping {
709
709
"throttleCPU" : p .ThrottleCPU ,
710
710
"throttleNetwork" : p .ThrottleNetwork ,
711
711
"title" : p .Title ,
712
- "touchscreen" : rt . ToValue ( p .GetTouchscreen ()). ToObject ( rt ),
712
+ "touchscreen" : mapTouchscreen ( vu , p .GetTouchscreen ()),
713
713
"type" : p .Type ,
714
714
"uncheck" : p .Uncheck ,
715
715
"url" : p .URL ,
@@ -788,6 +788,13 @@ func mapPage(vu moduleVU, p *common.Page) mapping {
788
788
return maps
789
789
}
790
790
791
+ // mapTouchscreen to the JS module.
792
+ func mapTouchscreen (_ moduleVU , ts * common.Touchscreen ) mapping {
793
+ return mapping {
794
+ "tap" : ts .Tap ,
795
+ }
796
+ }
797
+
791
798
// mapWorker to the JS module.
792
799
func mapWorker (vu moduleVU , w * common.Worker ) mapping {
793
800
return mapping {
Original file line number Diff line number Diff line change @@ -193,6 +193,12 @@ func TestMappings(t *testing.T) {
193
193
return mapConsoleMessage (moduleVU {VU : vu }, & common.ConsoleMessage {})
194
194
},
195
195
},
196
+ "mapTouchscreen" : {
197
+ apiInterface : (* touchscreenAPI )(nil ),
198
+ mapp : func () mapping {
199
+ return mapTouchscreen (moduleVU {VU : vu }, & common.Touchscreen {})
200
+ },
201
+ },
196
202
} {
197
203
tt := tt
198
204
t .Run (name , func (t * testing.T ) {
@@ -520,10 +526,7 @@ type keyboardAPI interface { //nolint: unused
520
526
}
521
527
522
528
// touchscreenAPI is the interface of a touchscreen.
523
- // TODO: map this to page.GetTouchscreen(). Currently, the common.TouchscreenAPI type
524
- // mapping is not tested using this interface. We use the concrete type
525
- // without testing its exported methods.
526
- type touchscreenAPI interface { //nolint: unused
529
+ type touchscreenAPI interface {
527
530
Tap (x float64 , y float64 ) error
528
531
}
529
532
You can’t perform that action at this time.
0 commit comments