Module: Appium::Core::Ios::Xcuitest::Device

Extended by:
Forwardable
Defined in:
lib/appium_lib_core/ios/xcuitest/device.rb,
lib/appium_lib_core/ios/xcuitest/device/screen.rb,
lib/appium_lib_core/ios/xcuitest/device/battery.rb,
lib/appium_lib_core/ios/xcuitest/device/performance.rb

Defined Under Namespace

Modules: Battery, Performance, Screen

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(_mod) ⇒ Object


165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 165

def extended(_mod)
  # Xcuitest, Override included method in bridge
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
    def hide_keyboard(close_key = nil, strategy = nil)
      option = {}

      option[:key] = close_key if close_key
      option[:strategy] = strategy if strategy

      execute :hide_keyboard, {}, option
    end
  end

  # Xcuitest, Override included method in bridge
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
    def background_app(duration = 0)
      # https://github.com/appium/ruby_lib/issues/500, https://github.com/appium/appium/issues/7741
      # `execute :background_app, {}, seconds: { timeout: duration_milli_sec }` works over Appium 1.6.4
      duration_milli_sec = duration.nil? ? nil : duration * 1000
      execute :background_app, {}, seconds: { timeout: duration_milli_sec }
    end
  end

  Performance.add_methods
  Screen.add_methods
  Battery.add_methods
end

Instance Method Details

#background_app(duration = 0) ⇒ Object

Backgrounds the app for a set number of seconds. This is a blocking application.

Examples:


@driver.background_app
@driver.background_app(5)
@driver.background_app(-1) #=> the app never come back. https://github.com/appium/appium/issues/7741

# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 41


#battery_infoHash

Get battery information.

Examples:


@driver.battery_info #=> { state: :full, level: 0.7 }

Since:

  • Appium 1.6.0


# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 141


#get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor', remote_path: nil, user: nil, pass: nil, method: 'PUT') ⇒ Object

This is a blocking application.

Examples:


@driver.get_performance_record
@driver.get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor')

Since:

  • Appium 1.3.4


# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 117


#hide_keyboard(close_key = nil, strategy = nil) ⇒ Object

Hide the onscreen keyboard

Examples:


@driver.hide_keyboard             # Close a keyboard with the 'Done' button
@driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button

# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 28


#start_performance_record(timeout: 300000, profile_name: 'Activity Monitor', pid: nil) ⇒ Object

This is a blocking application. Read help.apple.com/instruments/mac/current/ to understand the profiler.

Examples:


@driver.start_performance_record # default: (timeout: 300000, profile_name: 'Activity Monitor')
@driver.start_performance_record(timeout: 300000, profile_name: 'Activity Monitor')

Since:

  • Appium 1.3.4


# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 93


#start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mjpeg', video_fps: nil, time_limit: '180', video_quality: 'medium', video_scale: '320:240') ⇒ Object

Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11 (ffmpeg utility is required: 'brew install ffmpeg'). We would recommend to play the video by VLC or Mplayer if you can not play the video with other video players.

Examples:


@driver.start_recording_screen
@driver.start_recording_screen video_type: 'mjpeg', time_limit: '260'
@driver.start_recording_screen video_type: 'libx264', time_limit: '260' # Can get `.mp4` video

Since:

  • Appium 1.9.1


# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 53