Coder Social home page Coder Social logo

android-adb-extension's Introduction

Gem Version Build Status Code Climate Dependency Status

android-adb-extension

Android Debug Bridge extension provides convenient metaclass to execute ADB shell commands.

This gem is useful when working with test automation frameworks like Calabash-android and Appium.

Installation

In your Gemfile:

gem 'android-adb-extension'

Install gem manually:

$ gem install android-adb-extension

Tested devices

Current implementation is tested against

Device: HTC One M7

SDK: 19

Release: 4.4.3

Example use cases

Connect your device and enable USB debugging mode

Launch your favorite application which supports portrait and landscape orientations

Launch irb

$ irb

Load android-adb-extension

irb> require 'android-adb-extension'

Execute android-adb-extension commands

SDK version

ADB.sdk

Release version

ADB.release

Major version

ADB.major

Device Serial number

ADB.serial

Device name

ADB.device_name

Orientation

ADB.orientation

ADB.portrait?

ADB.landscape?

ADB.set_portrait

ADB.set_landscape

Airplane mode

ADB.airplane_mode

ADB.airplane_mode?

ADB.enable_airplane_mode

ADB.disable_airplane_mode

Monkey

ADB.monkey('your.package.name') # Default event count is 500

ADB.monkey('your.package.name', 5000)

Lock and unlock screen

ADB.lock

ADB.unlock

Send application to background

ADB.send_to_background

Bring application to foreground

ADB.bring_to_foreground('your.package.name', 'path.to.activity')

Reset app

ADB.reset_app('your.package.name')

Stop app

ADB.stop_app('your.package.name')

Uninstall app

ADB.uninstall_app('your.package.name')

Input text

ADB.input_text('string.to.input')

Take screenshot

ADB.take_screenshot('file.name')

Swipe

ADB.swipe(800, 800, 200, 800)

ADB.swipe(800, 800, 200, 800, 100)

See all available methods

ADB.help

Did you notice alias methods?

ADB.help --> ADB.h

Multiple devices connected

Define the device where you want adb commands to run. You can do that by defining environment variable ANDROID_SERIAL

ENV['ANDROID_SERIAL'] = 'ABCD1234'

Run the tests

TODO

License

MIT

android-adb-extension's People

Contributors

janijegoroff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

android-adb-extension's Issues

The disable air plane command does not work in Nexus 6

When connect with Google Nexux 6 (Exact Version: 5.1.1) and try to disable airplane mode does not response as required. it shows that air plane mode is off in settings menu but the air plan mode disable icon still shows on top right hand side of screen

ADB shell commands should direct to specific device

ADB shell commands raises an error error: more than one device and emulator when running calabash-android scenarios and multiple devices are connected.

Simple steps to reproduce:

  1. Connect two android devices
  2. Execute irb
  3. Execute require 'android-adb-extension'
  4. Execute ADB.sdk

irb(main):004:0> ADB.sdk error: more than one device and emulator => 0

How do i use this in real live automation test

Thanks for the link please how to i use this gem in a scenario where i have a calabash-android framework set with gemfile etc.
And i want to run few of my scenarios for the app to start without airplay active or no internet access.

Expected result is meant to be:
The web app should show an offline page for user.

I will really appreciate your prompt response.

Thanks

reverse landscape is not recognised in v 0.0.9

device set to reverse landscape, but is not recognised as landscape, here is the output from ruby console

irb(main):017:0> ADB.landscape?
true
irb(main):018:0> ADB.orientation
1
irb(main):019:0> ADB.portrait?
true
irb(main):020:0> ADB.orientation
0
irb(main):021:0> ADB.landscape?
false
irb(main):022:0> ADB.orientation
3

irb(main):023:0> ADB.portrait?
true
irb(main):024:0> ADB.orientation
2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.