11import { desiredCapConstraints } from './desiredCaps' ;
2- import { JWProxy , BaseDriver } from '@ appium/base- driver' ;
2+ import { JWProxy , BaseDriver } from 'appium/driver' ;
33import type {
44 DefaultCreateSessionResult ,
55 DriverData ,
@@ -137,6 +137,13 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
137137 required : [ 'imageId' ] ,
138138 } ,
139139 } ,
140+ 'flutter: getRenderTreeByType' : {
141+ command : 'getRenderTreeByType' ,
142+ params : {
143+ required : [ 'widgetType' ] ,
144+ optional : [ 'text' , 'key' ] ,
145+ } ,
146+ } ,
140147 } ;
141148
142149 async doubleClick ( origin : any , offset : any , locator : any ) {
@@ -325,13 +332,14 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
325332 ) ;
326333 }
327334
328- async dragAndDrop ( source : any , target : any ) {
335+ async dragAndDrop ( source : any , target : any , elementOptions : any ) {
329336 return this . proxy ?. command (
330337 `/session/:sessionId/appium/gestures/drag_drop` ,
331338 'POST' ,
332339 {
333340 source,
334341 target,
342+ elementOptions,
335343 } ,
336344 ) ;
337345 }
@@ -430,4 +438,15 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
430438 } ) ;
431439 return activateAppResponse ;
432440 }
433- }
441+
442+ async getRenderTreeByType ( widgetType : string , text ?: string , key ?: string ) {
443+ const query = new URLSearchParams ( { widgetType } ) ;
444+ if ( text ) query . append ( 'text' , text ) ;
445+ if ( key ) query . append ( 'key' , key ) ;
446+
447+ return this . proxy ?. command (
448+ `/session/${ this . sessionId } /element/render_tree?${ query . toString ( ) } ` ,
449+ 'GET'
450+ ) ;
451+ }
452+ }
0 commit comments