appium_driver 0.1.1

appium_driver #

Build Status

This is not a stable project yet.

An appium client in Dart

Why #

Flutter has flutter_driver which runs UI tests like Espresso/EarlGrey/Appium. The driver is really awesome, but it can automate only flutter view. It cannot handle outside Flutter.

According to some issues on the Flutter repo, they have a plan to make findable Flutter elements by Espresso/EarlGrey framework. But it means test cases should be Java/Kotlin or Swift/Objective-C. After the change, Appium also can handle elements via UIA2 or Espresso driver and XCUITest driver though.

I assumed users, who use Flutter fully or a part of, would like to implement UI tests in Dart.

Hence, this repository is another PoC for calling flutter_driver via HTTP requests in https://github.com/KazuCocoa/proto-flutter-driver-server

Example #

Take a look at functional tests

Lint #

$ dartanalyzer --options analysis_options.yaml .

format #

$ dartfmt -w --fix .

Run tests #

Get dependencies #

$ pub get

Functional #

$ pub run test test/functional

Unit #

$ pub run test test/unit

release #

  • Bump the version in pubspec.yml
  • Run pub publish

Supported Commands #

WebDriver commands #

Please refer webdriver.dart APIs

Appium actions #

All W3C webdriver commands are available such as find_element/s, click and send keys. Below Appium specific commands are implementing.

  • [x] directConnectXxxx
  • [ ] batch command
  • [x] [HttpMethod.httpGet, 'sessions']
  • [x] [HttpMethod.httpGet, 'session/:session_id/contexts']
  • [x] [HttpMethod.httpPost, 'session/:session_id/context']
  • [x] [HttpMethod.httpGet, 'session/:session_id/context']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/touch/perform']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/touch/multi/perform']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/element/:id/value']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/element/:id/replace_value']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/app/launch']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/app/close']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/app/reset']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/app/background']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/app/strings']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/is_locked']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/unlock']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/lock']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/system_time']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/install_app']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/remove_app']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/app_installed']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/activate_app']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/terminate_app']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/app_state']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/shake']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/hide_keyboard']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/press_keycode']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/long_press_keycode']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/keyevent'] # Only for Selendroid
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/push_file']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/pull_file']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/pull_folder']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/get_clipboard']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/set_clipboard']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/finger_print']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/settings']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/settings']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/stop_recording_screen']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/start_recording_screen']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/compare_images']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/is_keyboard_shown']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/open_notifications']
  • [x] [HttpMethod.httpPost, 'session/:session_id/appium/device/start_activity']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/current_activity']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/current_package']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/system_bars']
  • [x] [HttpMethod.httpGet, 'session/:session_id/appium/device/display_density']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/toggle_airplane_mode']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/toggle_wifi']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/toggle_data']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/toggle_location_services']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/app/end_test_coverage']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/performanceData/types']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/getPerformanceData']
  • [ ] [HttpMethod.httpGet, 'session/:session_id/network_connection']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/network_connection']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/send_sms']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/gsm_call']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/gsm_signal']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/gsm_voice']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/network_speed']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/power_capacity']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/device/power_ac']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/simulator/touch_id']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment']
  • [x] [HttpMethod.httpGet, 'status']
  • [x] [HttpMethod.httpGet, 'session/:session_id/element/:id/displayed']
  • [ ] [HtMethod.httpGet, 'session/:session_id/timeouts'] <= already has
  • [x] [HttpMethod.httpGet, 'session/:session_id']
  • [ ] [HttpMethod.httpGet, 'session/:session_id/orientation']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/orientation']
  • [x] [HtMethod.httpGet, 'session/:session_id/location']
  • [x] [HttpMethod.httpPost, 'session/:session_id/location']
  • [x] [HttpMethod.httpGet, 'session/:session_id/ime/available_engines']
  • [x] [HttpMethod.httpGet, 'session/:session_id/ime/active_engine']
  • [x] [HttpMethod.httpGet, 'session/:session_id/ime/activated']
  • [x] [HttpMethod.httpPost, 'session/:session_id/ime/deactivate']
  • [x] [HttpMethod.httpPost, 'session/:session_id/ime/activate']
  • [ ] [HttpMethod.httpPost, 'session/:session_id/keys'] <= will be deprecated in W3C. Use W3C actions instead.
  • [x] [HttpMethod.httpGet, 'session/:session_id/log/types']
  • [x] [HttpMethod.httpPost, 'session/:session_id/log']

[Unreleased]

  • Fix parsing element/s by find element/s which have only MJSONWP key

[0.1.0] - 2019-07-14

Basic actions have been implemented.

  • Add location methods: driver.device.getLocation, driver.device.setLocation
  • Add system bars and density: driver.device.getSystemBars, driver.device.getDisplayDensity
  • Add log methods for Appium: driver.logs.getAvailableType, driver.logs.get

[0.0.7] - 2019-07-07

  • Add get sessions command: driver.sessions.get()
  • Add get status: driver.status.get()
  • Add get capabilities: driver.session.getCapabilities()
  • Add push/pull files and folder: driver.device.pushFile, driver.device.pullFile, driver.device.pullFolder
  • Add set/get clipboard: driver.device.setClipboard, driver.device.getClipboard
  • Add open notification: driver.device.openNotification
  • Add start activity: driver.device.startActivity
  • Add get current activity/package: driver.device.getCurrentPackage, driver.device.getCurrentActivity

[0.0.6] - 2019-06-30

  • Add device lock related commands: driver.device.*
  • Add device system time command: driver.device.getSystemTime()
  • Add device shake command: driver.device.shake()
  • Add keyboard commands: driver.keyboard.isShown() and driver.keyboard.hide()
  • Add keycode commands: driver.device.pressKeycode and driver.device.longPressKeycode
  • Add element commands: element.displayed, element.replaceValue, element.setImmediateValue
  • Add settings commands: driver.settings.update, driver.settings.get

[0.0.5] - 2019-06-22

  • Add context related commands: driver.contexts.*
  • Add app state related commands: driver.appState.*
  • Add app management commands: driver.app.*
    • e.g. install, terminate
  • Add IME related commands: driver.ime.*

[0.0.4] - 2019-06-19

  • Add driver.contexts.getAvailableContexts()
  • Add driver.appState.get('com.apple.mobilesafari'))

[0.0.3] - 2019-06-03

  • Add an example

[0.0.2] - 2019-06-03

  • Apply formatter

[0.0.1] - 2019-06-02

  • initial release

example/README.md

An example of running appium_dart

$ pub get
$ dart --enable-asserts main.dart

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  appium_driver: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:appium_driver/async_core.dart';
import 'package:appium_driver/async_io.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
webdriver >=2.0.0 <3.0.0 2.1.1
Transitive dependencies
archive 2.0.10
args 1.5.2
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.2
matcher 0.12.5
path 1.6.4
stack_trace 1.9.3
sync_http 0.1.4
typed_data 1.1.6
Dev dependencies
test ^1.0.0