Skip to content

Commit 904d875

Browse files
fix: update readMe and also add locator argument for doubleClick and longpress (#76)
* fix: update readMe and also add locator argument for doubleClick and longPress * fix linting * enable flutterMockCamera capability
1 parent 50e0d37 commit 904d875

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ For more details, refer to the documentation for each driver:
148148

149149
## Capabilities for Appium Flutter Integration Driver
150150

151-
| Capability | Description | Required |
152-
|----------------------------------|-------------------------------------------------------------------------|----------|
153-
| appium:flutterServerLaunchTimeout | Time in ms to wait for flutter server to be pingable. Default is 5000ms | No |
154-
| appium:flutterSystemPort | The number of the port on the host machine used for the Flutter server. By default the first free port from 10000..11000 range is selected. It is recommended to set this value if you are running parallel tests on the same machine.| No |
155-
| appium:flutterEnableMockCamera | Mock camera image. This works if the AUT uses [image_picker](https://pub.dev/packages/image_picker). Currently works on Android. Make sure the server is started with `--allow-insecure=adb_shell`| No |
156-
151+
| Capability | Description | Required |
152+
|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
153+
| appium:flutterServerLaunchTimeout | Time in ms to wait for flutter server to be pingable. Default is 5000ms | No |
154+
| appium:flutterSystemPort | The number of the port on the host machine used for the Flutter server. By default the first free port from 10000..11000 range is selected. It is recommended to set this value if you are running parallel tests on the same machine. | No |
155+
| appium:flutterEnableMockCamera | Mock camera image. This works if the AUT uses [image_picker](https://pub.dev/packages/image_picker). Make sure the server is started with `--allow-insecure=adb_shell` for android | No |
156+
| appium:flutterElementWaitTimeout | Time in ms to wait for element to be in viewport, Default is 5000ms | No |
157157
🚨 **Important Notice for iOS Testing**
158158

159159
⚠️ Testing on real iOS devices for `semanticsLabel` may not work due to an issue raised with Flutter. For updates and more information, please refer to [GitHub issue #151238](https://github.com/flutter/flutter/issues/151238).

android.conf.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @ts-nocheck
22
import { config as baseConfig } from './wdio.conf.ts';
3+
import { join } from 'node:path';
34

45
export const config: WebdriverIO.Config = {
56
...baseConfig,
@@ -12,7 +13,8 @@ export const config: WebdriverIO.Config = {
1213
'appium:app':
1314
process.env.APP_PATH || join(process.cwd(), 'app-debug.apk'),
1415
'appium:newCommandTimeout': 240,
15-
'appium:flutterServerLaunchTimeout': 10000
16+
'appium:flutterServerLaunchTimeout': 10000,
17+
'appium:flutterEnableMockCamera': true
1618
},
1719
],
1820
};

src/driver.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
7373
command: 'doubleClick',
7474
params: {
7575
required: [],
76-
optional: ['origin', 'offset'],
76+
optional: ['origin', 'offset', 'locator'],
7777
},
7878
},
7979
'flutter: waitForVisible': {
@@ -109,7 +109,7 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
109109
command: 'longPress',
110110
params: {
111111
required: [],
112-
optional: ['origin', 'offset'],
112+
optional: ['origin', 'offset', 'locator'],
113113
},
114114
},
115115
'flutter: dragAndDrop': {
@@ -139,13 +139,14 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
139139
},
140140
};
141141

142-
async doubleClick(origin: any, offset: any) {
142+
async doubleClick(origin: any, offset: any, locator: any) {
143143
return this.proxy?.command(
144144
`/session/:sessionId/appium/gestures/double_click`,
145145
'POST',
146146
{
147147
origin,
148148
offset,
149+
locator,
149150
},
150151
);
151152
//console.log('DoubleTap', value, JSON.parse(JSON.stringify(value)).elementId);
@@ -312,13 +313,14 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
312313
);
313314
}
314315

315-
async longPress(origin: any, offset: any) {
316+
async longPress(origin: any, offset: any, locator: any) {
316317
return this.proxy?.command(
317318
`/session/:sessionId/appium/gestures/long_press`,
318319
'POST',
319320
{
320321
origin,
321322
offset,
323+
locator,
322324
},
323325
);
324326
}

template.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ For more details, refer to the documentation for each driver:
148148

149149
## Capabilities for Appium Flutter Integration Driver
150150

151-
| Capability | Description | Required |
152-
|----------------------------------|-------------------------------------------------------------------------|----------|
153-
| appium:flutterServerLaunchTimeout | Time in ms to wait for flutter server to be pingable. Default is 5000ms | No |
154-
| appium:flutterSystemPort | The number of the port on the host machine used for the Flutter server. By default the first free port from 10000..11000 range is selected. It is recommended to set this value if you are running parallel tests on the same machine.| No |
155-
| appium:flutterEnableMockCamera | Mock camera image. This works if the AUT uses [image_picker](https://pub.dev/packages/image_picker). Currently works on Android. Make sure the server is started with `--allow-insecure=adb_shell`| No |
156-
151+
| Capability | Description | Required |
152+
|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
153+
| appium:flutterServerLaunchTimeout | Time in ms to wait for flutter server to be pingable. Default is 5000ms | No |
154+
| appium:flutterSystemPort | The number of the port on the host machine used for the Flutter server. By default the first free port from 10000..11000 range is selected. It is recommended to set this value if you are running parallel tests on the same machine. | No |
155+
| appium:flutterEnableMockCamera | Mock camera image. This works if the AUT uses [image_picker](https://pub.dev/packages/image_picker). Make sure the server is started with `--allow-insecure=adb_shell` for android | No |
156+
| appium:flutterElementWaitTimeout | Time in ms to wait for element to be in viewport, Default is 5000ms | No |
157157
🚨 **Important Notice for iOS Testing**
158158

159159
⚠️ Testing on real iOS devices for `semanticsLabel` may not work due to an issue raised with Flutter. For updates and more information, please refer to [GitHub issue #151238](https://github.com/flutter/flutter/issues/151238).

0 commit comments

Comments
 (0)