From ed0d700ac668a514207f910983fc7cf9faa4dcdc Mon Sep 17 00:00:00 2001 From: Kazuaki MATSUO Date: Sun, 17 Dec 2017 22:12:10 +0900 Subject: [PATCH 1/2] add mobile shell methods --- lib/appium_lib/android/android.rb | 1 + .../android/common/command/command.rb | 21 +++++++++++++++++++ lib/appium_lib/android/espresso/bridge.rb | 1 + lib/appium_lib/android/uiautomator2/bridge.rb | 1 + 4 files changed, 24 insertions(+) create mode 100644 lib/appium_lib/android/common/command/command.rb diff --git a/lib/appium_lib/android/android.rb b/lib/appium_lib/android/android.rb index 37452361..a82f9741 100644 --- a/lib/appium_lib/android/android.rb +++ b/lib/appium_lib/android/android.rb @@ -1,4 +1,5 @@ require_relative 'common/helper' +require_relative 'common/command/command' require_relative 'element/alert' require_relative 'element/button' diff --git a/lib/appium_lib/android/common/command/command.rb b/lib/appium_lib/android/common/command/command.rb new file mode 100644 index 00000000..5515c286 --- /dev/null +++ b/lib/appium_lib/android/common/command/command.rb @@ -0,0 +1,21 @@ +module Appium + module Android + module Command + # Conduct an adb shell script on Appium server. + # Require `--relaxed-security` arguments when run Appium server as server side arguments. + # + # @param [String] command Command for "adb shell" + # @param [Array] arguments Arguments for the adb command + # + # @example + # + # shell "echo", "list" #=> "list" + # + def shell(command, arguments) + args = { command: command, args: arguments } + # --relaxed-security + @driver.execute_script 'mobile: shell', args + end + end + end +end diff --git a/lib/appium_lib/android/espresso/bridge.rb b/lib/appium_lib/android/espresso/bridge.rb index 7d36f944..ac467d81 100644 --- a/lib/appium_lib/android/espresso/bridge.rb +++ b/lib/appium_lib/android/espresso/bridge.rb @@ -6,6 +6,7 @@ module Espresso class Bridge def self.for(target) target.extend Appium::Android + target.extend Appium::Android::Command target.extend Appium::Android::Espresso end end diff --git a/lib/appium_lib/android/uiautomator2/bridge.rb b/lib/appium_lib/android/uiautomator2/bridge.rb index 7727791e..f600940b 100644 --- a/lib/appium_lib/android/uiautomator2/bridge.rb +++ b/lib/appium_lib/android/uiautomator2/bridge.rb @@ -6,6 +6,7 @@ module Uiautomator2 class Bridge def self.for(target) target.extend Appium::Android + target.extend Appium::Android::Command target.extend Appium::Android::Uiautomator2 target.extend Appium::Android::Uiautomator2::Helper target.extend Appium::Android::Uiautomator2::Element From 68c1cb0fd5d68bc13737d7ff6a1b32f712fbd734 Mon Sep 17 00:00:00 2001 From: Kazuaki MATSUO Date: Sun, 17 Dec 2017 22:18:55 +0900 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 7 +++++++ lib/appium_lib/android/android.rb | 1 + 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fba071ed..ab9fb198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Commit based release not is [release_notes.md](./release_notes.md) Release tags are https://github.com/appium/ruby_lib/releases . +## v9.8.2 +### 1. Enhancements +- add `shell` command wrapped `mobile: shell` for Android [] + +### 2. Bug fixes + +### 3. Deprecations ## v9.8.1 ### 1. Enhancements diff --git a/lib/appium_lib/android/android.rb b/lib/appium_lib/android/android.rb index a82f9741..84695fde 100644 --- a/lib/appium_lib/android/android.rb +++ b/lib/appium_lib/android/android.rb @@ -18,6 +18,7 @@ module Android class Bridge def self.for(target) target.extend Appium::Android + target.extend Appium::Android::Command end end end