Sha256: 2cce764e6969c58df69d1729587a1459df53c8cf67583b824618afe2b40eb269

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

module Appium
  module Core
    module Ios
      module Xcuitest
        module Device
          module Battery
            def self.add_methods
              ::Appium::Core::Device.add_endpoint_method(:battery_info) do
                def battery_info
                  response = execute_script 'mobile: batteryInfo', {}

                  state = case response['state']
                          when 1, 2, 3
                            ::Appium::Core::Device::BatteryStatus::IOS[response['state']]
                          else
                            ::Appium::Logger.warn("The state is unknown or undefined: #{response['state']}")
                            ::Appium::Core::Device::BatteryStatus::IOS[0] # :unknown
                          end
                  { state: state, level: response['level'] }
                end
              end
            end
          end # module Battery
        end # module Device
      end # module Xcuitest
    end # module Ios
  end # module Core
end # module Appium

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appium_lib_core-1.7.2 lib/appium_lib_core/ios/xcuitest/device/battery.rb
appium_lib_core-1.7.1 lib/appium_lib_core/ios/xcuitest/device/battery.rb
appium_lib_core-1.7.0 lib/appium_lib_core/ios/xcuitest/device/battery.rb