Skip to content

Commit 6fbb999

Browse files
committed
Changed widgetType to an optional argument
1 parent 17e4d2f commit 6fbb999

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"appium",
66
"flutter"
77
],
8-
"version": "1.1.4",
8+
"version": "1.1.5",
99
"author": "",
1010
"license": "MIT License",
1111
"repository": {

src/driver.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
137137
required: ['imageId'],
138138
},
139139
},
140-
'flutter: getRenderTreeByType': {
141-
command: 'getRenderTreeByType',
140+
'flutter: getRenderTree': {
141+
command: 'getRenderTree',
142142
params: {
143-
required: ['widgetType'],
144-
optional: ['text', 'key'],
143+
required: [],
144+
optional: ['widgetType', 'text', 'key'],
145145
},
146146
},
147147
};
@@ -438,14 +438,23 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
438438
return activateAppResponse;
439439
}
440440

441-
async getRenderTreeByType(widgetType: string, text?: string, key?: string) {
442-
const query = new URLSearchParams({ widgetType });
443-
if (text) query.append('text', text);
444-
if (key) query.append('key', key);
441+
async getRenderTree(widgetType?: string, text?: string, key?: string) {
442+
const query = new URLSearchParams();
445443

446-
return this.proxy?.command(
447-
`/session/${this.sessionId}/element/render_tree?${query.toString()}`,
448-
'GET'
449-
);
444+
if (widgetType) {
445+
query.append('widgetType', widgetType);
446+
}
447+
if (text) {
448+
query.append('text', text);
449+
}
450+
if (key) {
451+
query.append('key', key);
452+
}
453+
454+
const queryString = query.toString();
455+
const url = queryString
456+
? `/session/${this.sessionId}/element/render_tree?${queryString}`
457+
: `/session/${this.sessionId}/element/render_tree`;
458+
return this.proxy?.command(url, 'GET');
450459
}
451460
}

0 commit comments

Comments
 (0)