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

Extended by:
Forwardable
Defined in:
lib/appium_lib_core/ios/xcuitest/device.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(_mod) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 119

def extended(_mod)
  ::Appium::Core::Device.extend_webdriver_with_forwardable

  # Override
  ::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

  # Override
  ::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

  add_performance
  add_screen_recording
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 22


#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:

  • 1.3.4



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


#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 9


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

This is a blocking application.

Examples:


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

Since:

  • 1.3.4



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


#start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mp4', time_limit: '180', video_quality: 'medium') ⇒ Object

Examples:


@driver.start_recording_screen
@driver.start_recording_screen video_type: 'h264', time_limit: '260'


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