- Clone the repository
- Create new flutter application or clone any exiting flutter application
- Add below dependency in pubspec.yaml file of the flutter application
dev_dependencies:
appium_flutter_server:
path: /Users/sselvarj/Documents/git/personal/appium_flutter_server
NOTE: Update the path with cloned driver repository
- create a new folder
integration_testand create a new fileappium_server.dartwith below content
import 'package:appium_flutter_server/appium_flutter_server.dart';
import 'package:counter_app/main.dart';
void main() async {
initializeTest(app: const MyApp());
}
- run
flutter build apk - run
./gradlew app:assembleDebug -Ptarget=/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/integration_test/appium_server.dart(Replace the path) - It will now generate a debug apk under
build/app/outputs/apk/debug/app-debug.apk - Start appium server with uiautomator2 driver with below capabilities
{
"capabilities": {
"alwaysMatch": {
"platformName": "Android",
"appium:orientation": "PORTRAIT",
"appium:automationName": "uiautomator2",
"appium:app": "/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/build/app/outputs/apk/debug/app-debug.apk",
"appium:newCommandTimeout": 240,
"appium:intercept": true,
"appium:noReset": false,
"appium:fullReset": true
},
"firstMatch": [
{}
]
},
"desiredCapabilities": {
"platformName": "Android",
"appium:orientation": "PORTRAIT",
"appium:automationName": "uiautomator2",
"appium:app": "/Users/sselvarj/Documents/git/personal/flutter-learnings/counter_app/build/app/outputs/apk/debug/app-debug.apk",
"appium:newCommandTimeout": 240,
"appium:intercept": true,
"appium:noReset": false,
"appium:fullReset": true
}
}
- adb forward tcp:8080 tcp:8888
- From the browser hit
http://localhost:8080/tapand it should click the counter (+) icon from the app - From the browser hit
http://localhost:8080/screenshotand it will return base64 screenshot image
- flutter build ios integration_test/appium_server.dart --simulator
- App path
flutter-learnings/counter_app/build/ios/iphonesimulator/Runner.app - Simulator logs
xcrun simctl spawn booted log stream | grep flutter