Class: Applitools::Selenium::AndroidDeviceInfo

Inherits:
IRenderBrowserInfo show all
Defined in:
lib/applitools/selenium/visual_grid/android_device_info.rb

Overview

AndroidDeviceInfo represents configuration for Android devices in mobile app testing

Defined Under Namespace

Classes: EmulationInfo

Constant Summary collapse

DEFAULT_CONFIG =

Default configuration for Android devices

proc do
  {
    platform: 'android',
    # Note: Browser type is less relevant for mobile app testing but kept for API consistency
    browser_type: BrowserType::CHROME,
    viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
  }
end

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AndroidDeviceInfo

Initialize with device name, orientation, and version

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :device_name (String)

    The Android device name

  • :screen_orientation (String) — default: 'portrait' or 'landscape'
  • :android_version (String)

    The Android OS version



34
35
36
37
38
39
40
41
# File 'lib/applitools/selenium/visual_grid/android_device_info.rb', line 34

def initialize(options = {})
  super
  self.android_device_info = EmulationInfo.new.tap do |ei|
    ei.device_name = options[:device_name]
    ei.screen_orientation = options[:screen_orientation] || options[:orientation] || Orientation::PORTRAIT
    ei.version = options[:android_version] || options[:version] || 'latest'
  end
end

Class Method Details

.default_configObject



24
25
26
# File 'lib/applitools/selenium/visual_grid/android_device_info.rb', line 24

def default_config
  DEFAULT_CONFIG.call
end

Instance Method Details

#device_nameString

Get the device name

Returns:

  • (String)


51
52
53
# File 'lib/applitools/selenium/visual_grid/android_device_info.rb', line 51

def device_name
  android_device_info.device_name
end

#to_hashHash

Convert to hash for API requests

Returns:

  • (Hash)


57
58
59
# File 'lib/applitools/selenium/visual_grid/android_device_info.rb', line 57

def to_hash
  {androidDeviceInfo: android_device_info.to_hash}
end

#to_sString

String representation of the Android device

Returns:

  • (String)


45
46
47
# File 'lib/applitools/selenium/visual_grid/android_device_info.rb', line 45

def to_s
  "#{android_device_info.device_name} - #{android_device_info.screen_orientation}"
end