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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/appium_lib_core/ios/xcuitest/device.rb', line 69

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_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

Parameters:

  • duration (Integer) (defaults to: 0)

    How many seconds to background the app for.



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


#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

Parameters:

  • close_key (String) (defaults to: nil)

    The name of the key which closes the keyboard.

  • strategy (Symbol) (defaults to: nil)

    The symbol of the strategy which closes the keyboard. XCUITest ignore this argument. Default for iOS is ‘:pressKey`. Default for Android is `:tapOutside`.



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


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

Parameters:

  • remote_path: (String) (defaults to: nil)

    The path to the remote location, where the resulting video should be uploaded. The following protocols are supported: http/https, ftp. Null or empty string value (the default setting) means the content of resulting file should be encoded as Base64 and passed as the endpount response value. An exception will be thrown if the generated media file is too big to fit into the available process memory. This option only has an effect if there is screen recording process in progreess and ‘forceRestart` parameter is not set to `true`.

  • user: (String) (defaults to: nil)

    The name of the user for the remote authentication.

  • pass: (String) (defaults to: nil)

    The password for the remote authentication.

  • method: (String) (defaults to: nil)

    The http multipart upload method name. The ‘PUT’ one is used by default.

  • force_restart: (Boolean) (defaults to: nil)

    Whether to try to catch and upload/return the currently running screen recording (‘false`, the default setting on server) or ignore the result of it and start a new recording immediately (`true`).

  • video_type: (String) (defaults to: 'mp4')

    The format of the screen capture to be recorded. Available formats: “h264”, “mp4” or “fmp4”. Default is “mp4”. Only works for Simulator.

  • time_limit: (String) (defaults to: '180')

    Recording time. 180 seconds is by default.

  • video_quality: (String) (defaults to: 'medium')

    The video encoding quality (low, medium, high, photo - defaults to medium). Only works for real devices.



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