Skip to content

Add battery info - #85

Merged
KazuCocoa merged 10 commits into
appium:masterfrom
KazuCocoa:add_battery_info
May 6, 2018
Merged

KazuCocoa merged 10 commits into
appium:masterfrom
KazuCocoa:add_battery_info

Conversation

@KazuCocoa

@KazuCocoa KazuCocoa commented May 1, 2018 •

Copy link
Copy Markdown
Member
  • add android
  • add doc
  • add changelog
  • test with the real server and add func tests

Add battery information accessors #83

Comment thread lib/appium_lib_core/android/device.rb Outdated

def add_battery_info
::Appium::Core::Device.add_endpoint_method(:get_battery_info) do
def get_clipboard(content_type: :plaintext)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copypaste?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, yup...
I forgot the change... (I've implemented the only iOS so far...)

def test_get_battery_info
stub_request(:post, "#{SESSION}/execute/sync")
.with(body: { script: 'mobile: batteryInfo', args: [{}] }.to_json)
.to_return(headers: HEADER, status: 200, body: { value: { state: 5, level: 0.5 } }.to_json)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value has status, then Ruby client raise parse response error.
I guess the implementation is https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#responses 's one.

  test_get_battery_info                                          ERROR (0.02s)
Selenium::WebDriver::Error::NoCollectionError:         Selenium::WebDriver::Error::NoCollectionError: unknown error, status=2: nil
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/common.rb:81:in `new'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/common.rb:81:in `create_response'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/oss/bridge.rb:579:in `execute'
            /Users/kazuaki/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/oss/bridge.rb:267:in `execute_script'
            /Users/kazuaki/GitHub/ruby_lib_core/lib/appium_lib_core/android/uiautomator2/device.rb:15:in `battery_info'
            /Users/kazuaki/GitHub/ruby_lib_core/test/unit/android/device_test.rb:763:in `test_get_battery_info'

@KazuCocoa
KazuCocoa force-pushed the add_battery_info branch from 5abefa2 to 4736dd4 Compare May 1, 2018 23:23
@KazuCocoa KazuCocoa changed the title [wip]add battery info Add battery info May 6, 2018
@KazuCocoa

Copy link
Copy Markdown
Member Author

image

Applied every related PRs in my locale and ensured they worked fine. For Android, I changed emulator settings and made sure them.

I'll merge after the CI 🍏

@KazuCocoa
KazuCocoa merged commit 59a920f into appium:master May 6, 2018
@KazuCocoa
KazuCocoa deleted the add_battery_info branch May 6, 2018 10:11
@KazuCocoa KazuCocoa mentioned this pull request May 6, 2018
1 of 3 tasks
@KazuCocoa

Copy link
Copy Markdown
Member Author

cc @mykola-mokhnach
I've checked applying the Android related PRs in my locale and ✅ they work fine. ^

@mykola-mokhnach

Copy link
Copy Markdown

Thanks @KazuCocoa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants