Gathering detailed insights and metrics for @cloud-mobile/appium-flutter-driver-iosv14plus-test
Gathering detailed insights and metrics for @cloud-mobile/appium-flutter-driver-iosv14plus-test
Gathering detailed insights and metrics for @cloud-mobile/appium-flutter-driver-iosv14plus-test
Gathering detailed insights and metrics for @cloud-mobile/appium-flutter-driver-iosv14plus-test
npm install @cloud-mobile/appium-flutter-driver-iosv14plus-test
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Appium Flutter Driver is a test automation tool for Flutter apps on multiple platforms/OSes. Appium Flutter Driver is part of the Appium mobile test automation tool maintained by community. Feel free to create PRs to fix issues/improve this driver.
This package is still experiment, breaking changes and breaking codes are to be expected! All contributions, including non-code, are welcome! See TODO list below.
Even though Flutter comes with superb integration test support, Flutter Driver, it does not fit some specific use cases, such as
Under the hood, Appium Flutter Driver use the Dart VM Service Protocol with extension ext.flutter.driver
, similar to Flutter Driver, to control the Flutter app-under-test (AUT).
In order to use appium-flutter-driver
, we need to use appium
version 1.16.0
or higher.
The version 1.0.0 and higher requires Appium 2.0.
With Appium 2:
appium driver install flutter
With Appium 1:
npm i -g appium-flutter-driver
If you are unfamiliar with running Appium tests, start with Appium Getting Starting first.
Your Flutter app-under-test (AUT) must be compiled in debug
or profile
mode, because Flutter Driver does not support running in release mode.
. Also, ensure that your Flutter AUT has enableFlutterDriverExtension()
before runApp
. Then, please make sure your app imported flutter_driver
package as its devDependencies as well.
This snippet, taken from example dir, is a script written as an appium client with webdriverio
, and assumes you have appium
server (with appium-flutter-driver
installed) running on the same host and default port (4723
). For more info, see example's README.md
Capability | Description | Example Values |
---|---|---|
retryBackoffTime | the time wait for socket connection retry for get flutter session (default 3000ms) | 500 |
maxRetryCount | the count for socket connection retry for get flutter session (default 30) | 20 |
observatoryWsUri | the URL to attach to the Dart VM. In general, the flutter driver finds the WebSocket URL from device log such as logcat. You can skip the find the URL steps by specifying this capability. Then, this driver try to establish a session by following the given WebSocket URL. | 'ws://127.0.0.1:60992/aaaaaaaaaaa=/ws' |
Appium Flutter Driver allow you to send flutter_driver commands to the Dart VM in FLUTTER
context, but it does not support native Android/iOS automation. Instead, NATIVE_APP
context provide you to use UIA2 drier for Android and XCUITest for iOS automation. WEBVIEW_XXXX
cntext helps WebView testing.
Thus, you can automate proper application target by switching its context with FLUTTER
, NATIVE_APP
and WEBVIEW_XXXX
.
1const wdio = require('webdriverio'); 2const assert = require('assert'); 3const { byValueKey } = require('appium-flutter-finder'); 4 5const osSpecificOps = process.env.APPIUM_OS === 'android' ? { 6 'platformName': 'Android', 7 'appium:deviceName': 'Pixel 2', 8 // @todo support non-unix style path 9 app: __dirname + '/../apps/app-free-debug.apk', 10}: process.env.APPIUM_OS === 'ios' ? { 11 'platformName': 'iOS', 12 'appium:platformVersion': '12.2', 13 'appium:deviceName': 'iPhone X', 14 'appium:noReset': true, 15 'appium:app': __dirname + '/../apps/Runner.zip', 16 17} : {}; 18 19const opts = { 20 port: 4723, 21 capabilities: { 22 ...osSpecificOps, 23 'appium:automationName': 'Flutter', 24 'appium:retryBackoffTime': 500 25 } 26}; 27 28(async () => { 29 const counterTextFinder = byValueKey('counter'); 30 const buttonFinder = byValueKey('increment'); 31 32 const driver = await wdio.remote(opts); 33 34 if (process.env.APPIUM_OS === 'android') { 35 await driver.switchContext('NATIVE_APP'); 36 await (await driver.$('~fab')).click(); 37 await driver.switchContext('FLUTTER'); 38 } else { 39 console.log('Switching context to `NATIVE_APP` is currently only applicable to Android demo app.') 40 } 41 42 assert.strictEqual(await driver.getElementText(counterTextFinder), '0'); 43 44 await driver.elementClick(buttonFinder); 45 await driver.touchAction({ 46 action: 'tap', 47 element: { elementId: buttonFinder } 48 }); 49 50 assert.strictEqual(await driver.getElementText(counterTextFinder), '2'); 51 52 driver.deleteSession(); 53})();
Legend:
Icon | Description |
---|---|
:white_check_mark: | integrated to CI |
:ok: | manual tested without CI |
:warning: | available without manual tested |
:x: | unavailable |
Flutter Driver API | Status | WebDriver example |
---|---|---|
ancestor | :ok: | |
bySemanticsLabel | :ok: | |
byTooltip | :ok: | byTooltip('Increment') |
byType | :ok: | byType('TextField') |
byValueKey | :ok: | byValueKey('counter') |
descendant | :ok: | |
pageBack | :ok: | pageBack() |
text | :ok: | byText('foo') |
The below WebDriver example is by webdriverio.
flutter:
prefix commands are mobile:
command in appium for Android and iOS.
Please replace them properly with your client.
Flutter API | Status | WebDriver example (JavaScript, webdriverio) | Scope |
---|---|---|---|
FlutterDriver.connectedTo | :ok: | wdio.remote(opts) | Session |
checkHealth | :ok: | driver.execute('flutter:checkHealth') | Session |
clearTextbox | :ok: | driver.elementClear(find.byType('TextField')) | Session |
clearTimeline | :ok: | driver.execute('flutter:clearTimeline') | Session |
close | :ok: | driver.deleteSession() | Session |
enterText | :ok: | driver.elementSendKeys(find.byType('TextField'), 'I can enter text') (no focus required) driver.elementClick(find.byType('TextField')); driver.execute('flutter:enterText', 'I can enter text') (focus required by tap/click first) | Session |
forceGC | :ok: | driver.execute('flutter:forceGC') | Session |
getBottomLeft | :ok: | driver.execute('flutter:getBottomLeft', buttonFinder) | Widget |
getBottomRight | :ok: | driver.execute('flutter:getBottomRight', buttonFinder) | Widget |
getCenter | :ok: | driver.execute('flutter:getCenter', buttonFinder) | Widget |
getRenderObjectDiagnostics | :ok: | driver.execute('flutter:getRenderObjectDiagnostics', counterTextFinder) | Widget |
getRenderTree | :ok: | driver.execute('flutter: getRenderTree') | Session |
getSemanticsId | :ok: | driver.execute('flutter:getSemanticsId', counterTextFinder) | Widget |
getText | :ok: | driver.getElementText(counterTextFinder) | Widget |
getTopLeft | :ok: | driver.execute('flutter:getTopLeft', buttonFinder) | Widget |
getTopRight | :ok: | driver.execute('flutter:getTopRight', buttonFinder) | Widget |
getVmFlags | :x: | Session | |
getWidgetDiagnostics | :x: | Widget | |
requestData | :ok: | driver.execute('flutter:requestData', json.dumps({"deepLink": "myapp://item/id1"})) | Session |
runUnsynchronized | :x: | Session | |
setFrameSync | :ok: | driver.execute('flutter:setFrameSync', bool , durationMilliseconds) | Session |
screenshot | :ok: | driver.takeScreenshot() | Session |
screenshot | :ok: | driver.saveScreenshot('a.png') | Session |
scroll | :ok: | driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: -100, durationMilliseconds: 200, frequency: 30}) | Widget |
scrollIntoView | :ok: | driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1}) | Widget |
scrollUntilVisible | :ok: | driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400}); | Widget |
setSemantics | :x: | Session | |
setTextEntryEmulation | :ok: | driver.execute('flutter:setTextEntryEmulation', false) | Session |
startTracing | :x: | Session | |
stopTracingAndDownloadTimeline | :x: | Session | |
tap | :ok: | driver.elementClick(buttonFinder) | Widget |
tap | :ok: | driver.touchAction({action: 'tap', element: {elementId: buttonFinder}}) | Widget |
traceAction | :x: | Session | |
waitFor | :ok: | driver.execute('flutter:waitFor', buttonFinder, {durationMilliseconds: 100}) | Widget |
waitForAbsent | :ok: | driver.execute('flutter:waitForAbsent', buttonFinder) | Widget |
waitForTappable | :ok: | driver.execute('flutter:waitForTappable', buttonFinder) | Widget |
waitUntilNoTransientCallbacks | :x: | Widget | |
- | :ok: | driver.execute('flutter:getVMInfo') | System |
- | :ok: | driver.execute('flutter:setIsolateId', 'isolates/2978358234363215') | System |
- | :ok: | driver.execute('flutter:getIsolate', 'isolates/2978358234363215') or driver.execute('flutter:getIsolate') | System |
- | :ok: | setContext | Appium |
- | :ok: | getCurrentContext | Appium |
- | :ok: | getContexts | Appium |
:question: | :ok: | driver.execute('flutter:longTap', find.byValueKey('increment'), {durationMilliseconds: 10000, frequency: 30}) | Widget |
:question: | :ok: | driver.execute('flutter:waitForFirstFrame') | Widget |
getRenderTree
command insteadNATIVE_APP
contextid
key in the value of isolates
by flutter:getVMInfo
setIsolateId
1# ruby 2info = driver.execute_script 'flutter:getVMInfo' 3# Change the target engine to "info['isolates'][0]['id']" 4driver.execute_script 'flutter:setIsolateId', info['isolates'][0]['id']
driver.execute('flutter:getVMInfo').isolates
(JS)driver.execute('flutter:getIsolate')
(JS)driver.execute('flutter:getIsolate', 'isolates/2978358234363215')
(JS)$ cd driver
$ rm npm-shrinkwrap.json
$ npm run clean-dependency
$ npm prune --production
$ rm -rf node_modules/appium
$ npm shrinkwrap # to specify the dependencies in the npm module
$ npm version <major|minor|patch>
$ git commit -am 'chore: bump version'
$ git tag <version number> # e.g. git tag v0.0.32
$ git push origin v0.0.32
$ git push origin main
$ npm publish
No vulnerabilities found.
No security vulnerabilities found.