File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import {
25
25
import {
26
26
attachAppLaunchArguments ,
27
27
fetchFlutterServerPort ,
28
+ FLUTTER_LOCATORS ,
28
29
getFreePort ,
29
30
isFlutterDriverCommand ,
30
31
waitForFlutterServerToBeActive ,
@@ -56,16 +57,14 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
56
57
'xpath' ,
57
58
'css selector' ,
58
59
'id' ,
60
+ 'name' ,
61
+ 'class name' ,
59
62
'-android uiautomator' ,
60
63
'accessibility id' ,
61
64
'-ios predicate string' ,
62
65
'-ios class chain' ,
63
- 'name' ,
64
- 'key' ,
65
- 'class name' ,
66
- 'semantics label' ,
67
- 'text' ,
68
- 'type' ,
66
+ ...FLUTTER_LOCATORS , //to support backward compatibility
67
+ ...FLUTTER_LOCATORS . map ( ( locator ) => `-flutter ${ locator } ` ) ,
69
68
] ;
70
69
}
71
70
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { findAPortNotInUse } from 'portscanner';
3
3
import { waitForCondition } from 'asyncbox' ;
4
4
import { JWProxy } from 'appium/driver' ;
5
5
import type { PortForwardCallback , PortReleaseCallback } from './types' ;
6
- import type { AppiumFlutterDriver } from './driver' ;
6
+ import { type AppiumFlutterDriver } from './driver' ;
7
7
import _ from 'lodash' ;
8
8
import type { StringRecord } from '@appium/types' ;
9
9
import { node } from 'appium/support' ;
@@ -17,12 +17,18 @@ const {
17
17
appium : { flutterServerVersion : FLUTTER_SERVER_VERSION_REQ } ,
18
18
version : PACKAGE_VERSION ,
19
19
} = readManifest ( ) ;
20
-
20
+ export const FLUTTER_LOCATORS = [
21
+ 'key' ,
22
+ 'semantics label' ,
23
+ 'text' ,
24
+ 'type' ,
25
+ 'text containing' ,
26
+ ] ;
21
27
export async function getProxyDriver (
22
28
this : AppiumFlutterDriver ,
23
29
strategy : string ,
24
30
) : Promise < JWProxy | undefined > {
25
- if ( [ 'key' , 'semantics label' , 'text' , 'type' ] . includes ( strategy ) ) {
31
+ if ( strategy . startsWith ( '-flutter' ) || FLUTTER_LOCATORS . includes ( strategy ) ) {
26
32
return this . proxy ;
27
33
} else if ( this . proxydriver instanceof AndroidUiautomator2Driver ) {
28
34
// @ts -ignore Proxy instance is OK
You can’t perform that action at this time.
0 commit comments