|
1 | | -## Setup: |
2 | | - |
3 | | -1. Clone the repository |
4 | | -2. Create new flutter application or clone any exiting flutter application |
5 | | -3. Add below dependency in pubspec.yaml file of the flutter application |
6 | | - |
7 | | -``` |
8 | | -dev_dependencies: |
9 | | -appium_flutter_server: |
10 | | - path: /Users/sselvarj/Documents/git/personal/appium_flutter_server |
11 | | -``` |
12 | | - |
13 | | -NOTE: Update the path with cloned driver repository |
14 | | - |
15 | | -4. create a new folder `integration_test` and create a new file `appium_server.dart` with below content |
16 | | - |
17 | | -``` |
18 | | -import 'package:appium_flutter_server/appium_flutter_server.dart'; |
19 | | -import 'package:counter_app/main.dart'; |
20 | | -
|
21 | | -void main() async { |
22 | | - initializeTest(app: const MyApp()); |
23 | | -} |
24 | | -``` |
25 | | - |
26 | | -5. run `flutter build apk` |
27 | | -6. run `./gradlew app:assembleDebug -Ptarget=/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/integration_test/appium_server.dart` (Replace the path) |
28 | | -7. It will now generate a debug apk under `build/app/outputs/apk/debug/app-debug.apk` |
29 | | -8. Start appium server with uiautomator2 driver with below capabilities |
30 | | - |
31 | | -``` |
32 | | -{ |
33 | | - "capabilities": { |
34 | | - "alwaysMatch": { |
35 | | - "platformName": "Android", |
36 | | - "appium:orientation": "PORTRAIT", |
37 | | - "appium:automationName": "uiautomator2", |
38 | | - "appium:app": "/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/build/app/outputs/apk/debug/app-debug.apk", |
39 | | - "appium:newCommandTimeout": 240, |
40 | | - "appium:intercept": true, |
41 | | - "appium:noReset": false, |
42 | | - "appium:fullReset": true |
43 | | - }, |
44 | | - "firstMatch": [ |
45 | | - {} |
46 | | - ] |
47 | | - }, |
48 | | - "desiredCapabilities": { |
49 | | - "platformName": "Android", |
50 | | - "appium:orientation": "PORTRAIT", |
51 | | - "appium:automationName": "uiautomator2", |
52 | | - "appium:app": "/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/build/app/outputs/apk/debug/app-debug.apk", |
53 | | - "appium:newCommandTimeout": 240, |
54 | | - "appium:intercept": true, |
55 | | - "appium:noReset": false, |
56 | | - "appium:fullReset": true |
57 | | - } |
58 | | -} |
59 | | -``` |
60 | | - |
61 | | -9. adb forward tcp:8080 tcp:8888 |
62 | | -10. From the browser hit `http://localhost:8080/tap` and it should click the counter (+) icon from the app |
63 | | -11. From the browser hit `http://localhost:8080/screenshot` and it will return base64 screenshot image |
64 | | - |
65 | | -## Ios simulator |
66 | | - |
67 | | -1. flutter build ios integration_test/appium_server.dart --simulator |
68 | | -2. App path `flutter-learnings/counter_app/build/ios/iphonesimulator/Runner.app` |
69 | | -3. Simulator logs `xcrun simctl spawn booted log stream | grep flutter` |
| 1 | +### For Usage please refer https://github.com/AppiumTestDistribution/appium-flutter-integration-driver?tab=readme-ov-file#how-to-use-appium-flutter-integration-driver |
0 commit comments