percy-appium-app 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +191 -1
- data/percy/environment.rb +15 -13
- data/percy/exceptions/exceptions.rb +0 -2
- data/percy/lib/app_percy.rb +36 -34
- data/percy/lib/cache.rb +42 -41
- data/percy/lib/cli_wrapper.rb +94 -92
- data/percy/lib/ignore_region.rb +4 -3
- data/percy/lib/percy_automate.rb +44 -42
- data/percy/lib/percy_options.rb +30 -28
- data/percy/lib/region.rb +15 -13
- data/percy/lib/tile.rb +24 -22
- data/percy/metadata/android_metadata.rb +60 -58
- data/percy/metadata/driver_metadata.rb +29 -27
- data/percy/metadata/ios_metadata.rb +64 -62
- data/percy/metadata/metadata.rb +80 -78
- data/percy/metadata/metadata_resolver.rb +14 -12
- data/percy/{screenshot.rb → percy-appium-app.rb} +3 -3
- data/percy/providers/app_automate.rb +131 -129
- data/percy/providers/generic_provider.rb +166 -164
- data/percy/providers/provider_resolver.rb +9 -7
- data/percy/version.rb +1 -1
- data/percy-appium-app.gemspec +1 -0
- data/specs/android_metadata.rb +2 -4
- data/specs/app_automate.rb +10 -13
- data/specs/app_percy.rb +20 -22
- data/specs/cache.rb +16 -16
- data/specs/cli_wrapper.rb +6 -8
- data/specs/driver_metadata.rb +2 -4
- data/specs/generic_providers.rb +9 -12
- data/specs/ignore_regions.rb +10 -12
- data/specs/ios_metadata.rb +2 -2
- data/specs/metadata.rb +2 -5
- data/specs/metadata_resolver.rb +6 -6
- data/specs/mocks/mock_methods.rb +0 -2
- data/specs/percy_options.rb +16 -16
- data/specs/screenshot.rb +7 -10
- data/specs/tile.rb +2 -2
- metadata +17 -3
data/percy/lib/ignore_region.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
# lib/ignore_region.rb
|
4
4
|
require_relative 'region'
|
5
|
-
|
6
|
-
class IgnoreRegion < Region
|
7
|
-
|
5
|
+
module Percy
|
6
|
+
class IgnoreRegion < Percy::Region
|
7
|
+
# Inherits everything from Percy::Region; no additional code needed unless you want to extend or modify the behavior
|
8
|
+
end
|
8
9
|
end
|
data/percy/lib/percy_automate.rb
CHANGED
@@ -10,50 +10,52 @@ IGNORE_ELEMENT_ALT_KEY = 'ignoreRegionAppiumElements'
|
|
10
10
|
CONSIDER_ELEMENT_KEY = 'consider_region_appium_elements'
|
11
11
|
CONSIDER_ELEMENT_ALT_KEY = 'considerRegionAppiumElements'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
module Percy
|
14
|
+
class PercyOnAutomate
|
15
|
+
def initialize(driver)
|
16
|
+
unless driver.is_a?(Appium::Core::Base::Driver)
|
17
|
+
raise DriverNotSupported, 'The provided driver instance is not supported.'
|
18
|
+
end
|
19
|
+
|
20
|
+
@driver = driver
|
21
|
+
@percy_options = Percy::PercyOptions.new(@driver.capabilities)
|
17
22
|
end
|
18
23
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
log("Could not take Screenshot '#{name}'")
|
55
|
-
log(e.message, on_debug: true)
|
24
|
+
def screenshot(name, **options)
|
25
|
+
return nil unless @percy_options.enabled
|
26
|
+
raise TypeError, 'Argument name should be a string' unless name.is_a?(String)
|
27
|
+
raise KeyError, 'Please pass the last parameter as "options" key' unless options.key?(:options)
|
28
|
+
|
29
|
+
metadata = Percy::DriverMetadata.new(@driver)
|
30
|
+
options = options[:options] || {}
|
31
|
+
|
32
|
+
begin
|
33
|
+
options[IGNORE_ELEMENT_KEY] = options.delete(IGNORE_ELEMENT_ALT_KEY) if options.key?(IGNORE_ELEMENT_ALT_KEY)
|
34
|
+
options[CONSIDER_ELEMENT_KEY] = options.delete(CONSIDER_ELEMENT_ALT_KEY) if options.key?(CONSIDER_ELEMENT_ALT_KEY)
|
35
|
+
|
36
|
+
ignore_region_elements = options.fetch(IGNORE_ELEMENT_KEY, []).map(&:id)
|
37
|
+
consider_region_elements = options.fetch(CONSIDER_ELEMENT_KEY, []).map(&:id)
|
38
|
+
options.delete(IGNORE_ELEMENT_KEY)
|
39
|
+
options.delete(CONSIDER_ELEMENT_KEY)
|
40
|
+
|
41
|
+
additional_options = {
|
42
|
+
'ignore_region_elements' => ignore_region_elements,
|
43
|
+
'consider_region_elements' => consider_region_elements
|
44
|
+
}
|
45
|
+
|
46
|
+
Percy::CLIWrapper.new.post_poa_screenshots(
|
47
|
+
name,
|
48
|
+
metadata.session_id,
|
49
|
+
metadata.command_executor_url,
|
50
|
+
metadata.capabilities,
|
51
|
+
metadata.session_capabilities,
|
52
|
+
options.merge(additional_options)
|
53
|
+
)
|
54
|
+
rescue StandardError => e
|
55
|
+
log("Could not take Screenshot '#{name}'")
|
56
|
+
log(e.message, on_debug: true)
|
57
|
+
end
|
58
|
+
nil
|
56
59
|
end
|
57
|
-
nil
|
58
60
|
end
|
59
61
|
end
|
data/percy/lib/percy_options.rb
CHANGED
@@ -1,37 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Percy
|
4
|
+
class PercyOptions
|
5
|
+
IGNORE_ERRORS = 'ignoreErrors'
|
6
|
+
ENABLED = 'enabled'
|
7
|
+
PERCY_OPTIONS = ['percy:options', 'percyOptions'].freeze
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def initialize(capabilities)
|
10
|
+
@capabilities = capabilities
|
11
|
+
@capabilities = @capabilities.as_json unless @capabilities.is_a?(Hash)
|
12
|
+
@percy_options = _parse_percy_options || {}
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def _parse_percy_options
|
16
|
+
options = PERCY_OPTIONS.map { |key| @capabilities.fetch(key, nil) }
|
17
|
+
options = if options.any? { |element| !element.nil? }
|
18
|
+
options[0] || options[1]
|
19
|
+
else
|
20
|
+
{}
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
if options
|
24
|
+
options[IGNORE_ERRORS] = @capabilities.fetch("percy.#{IGNORE_ERRORS}", true) unless options.key?(IGNORE_ERRORS)
|
25
|
+
options[ENABLED] = @capabilities.fetch("percy.#{ENABLED}", true) unless options.key?(ENABLED)
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
options
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def ignore_errors
|
32
|
+
@percy_options.fetch(IGNORE_ERRORS, true)
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
def enabled
|
36
|
+
@percy_options.fetch(ENABLED, true)
|
37
|
+
end
|
36
38
|
end
|
37
|
-
end
|
39
|
+
end
|
data/percy/lib/region.rb
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# lib/region.rb
|
4
|
-
|
5
|
-
|
4
|
+
module Percy
|
5
|
+
class Region
|
6
|
+
attr_accessor :top, :bottom, :left, :right
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def initialize(top, bottom, left, right)
|
9
|
+
raise ArgumentError, 'Only Positive integer is allowed!' if [top, bottom, left, right].any?(&:negative?)
|
10
|
+
raise ArgumentError, 'Invalid ignore region parameters!' if top >= bottom || left >= right
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
@top = top
|
13
|
+
@bottom = bottom
|
14
|
+
@left = left
|
15
|
+
@right = right
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
def valid?(screen_height, screen_width)
|
19
|
+
return false if @top >= screen_height || @bottom > screen_height || @left >= screen_width || @right > screen_width
|
19
20
|
|
20
|
-
|
21
|
+
true
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
data/percy/lib/tile.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module Percy
|
4
|
+
class Tile
|
5
|
+
attr_reader :filepath, :status_bar_height, :nav_bar_height, :header_height, :footer_height, :fullscreen, :sha
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def initialize(status_bar_height, nav_bar_height, header_height, footer_height, filepath: nil, sha: nil,
|
8
|
+
fullscreen: false)
|
9
|
+
@filepath = filepath
|
10
|
+
@status_bar_height = status_bar_height
|
11
|
+
@nav_bar_height = nav_bar_height
|
12
|
+
@header_height = header_height
|
13
|
+
@footer_height = footer_height
|
14
|
+
@fullscreen = fullscreen
|
15
|
+
@sha = sha
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
def to_h
|
19
|
+
{
|
20
|
+
'filepath' => @filepath,
|
21
|
+
'status_bar_height' => @status_bar_height,
|
22
|
+
'nav_bar_height' => @nav_bar_height,
|
23
|
+
'header_height' => @header_height,
|
24
|
+
'footer_height' => @footer_height,
|
25
|
+
'fullscreen' => @fullscreen,
|
26
|
+
'sha' => @sha
|
27
|
+
}
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
@@ -4,76 +4,78 @@ require 'json'
|
|
4
4
|
require_relative 'metadata'
|
5
5
|
require_relative '../lib/cache'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
module Percy
|
8
|
+
class AndroidMetadata < Percy::Metadata
|
9
|
+
def initialize(driver)
|
10
|
+
super(driver)
|
11
|
+
@_bars = nil
|
12
|
+
@_viewport_rect = capabilities.to_json['viewportRect']
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def device_screen_size
|
16
|
+
caps = capabilities
|
17
|
+
caps = caps.as_json unless caps.is_a?(Hash)
|
18
|
+
width, height = caps['deviceScreenSize'].split('x')
|
19
|
+
{ 'width' => width.to_i, 'height' => height.to_i }
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
def get_system_bars
|
23
|
+
@_bars = Percy::Cache.get_cache(session_id, Percy::Cache::SYSTEM_BARS)
|
24
|
+
if @_viewport_rect
|
25
|
+
begin
|
26
|
+
@_bars = {
|
27
|
+
'statusBar' => { 'height' => @_viewport_rect['top'] },
|
28
|
+
'navigationBar' => {
|
29
|
+
'height' => device_screen_size['height'] - @_viewport_rect['height'] - @_viewport_rect['top']
|
30
|
+
}
|
29
31
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
rescue StandardError
|
33
|
+
@_bars = nil
|
34
|
+
end
|
33
35
|
end
|
36
|
+
if @_bars.nil?
|
37
|
+
@_bars = driver.get_system_bars
|
38
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::SYSTEM_BARS, @_bars)
|
39
|
+
end
|
40
|
+
@_bars
|
34
41
|
end
|
35
|
-
if @_bars.nil?
|
36
|
-
@_bars = driver.get_system_bars
|
37
|
-
Cache.set_cache(session_id, Cache::SYSTEM_BARS, @_bars)
|
38
|
-
end
|
39
|
-
@_bars
|
40
|
-
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def status_bar
|
44
|
+
status_bar = get_system_bars['statusBar']
|
45
|
+
if status_bar['height'] == 1
|
46
|
+
response = value_from_devices_info('status_bar', _device_name.upcase, os_version)
|
47
|
+
return { 'height' => response }
|
48
|
+
end
|
49
|
+
status_bar
|
47
50
|
end
|
48
|
-
status_bar
|
49
|
-
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
def navigation_bar
|
53
|
+
navigation_bar = get_system_bars['navigationBar']
|
54
|
+
if navigation_bar['height'] == 1
|
55
|
+
response = { 'height' => value_from_devices_info('nav_bar', _device_name.upcase, os_version) }
|
56
|
+
return response
|
57
|
+
end
|
58
|
+
navigation_bar
|
56
59
|
end
|
57
|
-
navigation_bar
|
58
|
-
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
def viewport
|
62
|
+
capabilities.to_json['viewportRect']
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
def scale_factor
|
66
|
+
1
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
def _device_name
|
70
|
+
if @device_name.nil?
|
71
|
+
desired_caps = capabilities.to_json['desired'] || {}
|
72
|
+
device_name = desired_caps['deviceName']
|
73
|
+
device = desired_caps['device']
|
74
|
+
device_name ||= device
|
75
|
+
device_model = capabilities.to_json['deviceModel']
|
76
|
+
@device_name = device_name || device_model
|
77
|
+
end
|
78
|
+
@device_name
|
76
79
|
end
|
77
|
-
@device_name
|
78
80
|
end
|
79
81
|
end
|
@@ -2,39 +2,41 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/cache'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
module Percy
|
6
|
+
class DriverMetadata
|
7
|
+
def initialize(driver)
|
8
|
+
@driver = driver
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def session_id
|
12
|
+
@driver.session_id
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def command_executor_url
|
16
|
+
url = Percy::Cache.get_cache(session_id, Percy::Cache::COMMAND_EXECUTOR_URL)
|
17
|
+
if url.nil?
|
18
|
+
url = @driver.instance_variable_get(:@bridge).instance_variable_get(:@http).instance_variable_get(:@server_url).to_s
|
19
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::COMMAND_EXECUTOR_URL, url)
|
20
|
+
end
|
21
|
+
url
|
19
22
|
end
|
20
|
-
url
|
21
|
-
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def capabilities
|
25
|
+
caps = Percy::Cache.get_cache(session_id, Percy::Cache::SESSION_CAPABILITIES)
|
26
|
+
if caps.nil?
|
27
|
+
caps = @driver.capabilities.dup # In Ruby, use dup to create a shallow copy of the hash
|
28
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::SESSION_CAPABILITIES, caps)
|
29
|
+
end
|
30
|
+
caps
|
28
31
|
end
|
29
|
-
caps
|
30
|
-
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
def session_capabilities
|
34
|
+
session_caps = Percy::Cache.get_cache(session_id, Percy::Cache::SESSION_CAPABILITIES)
|
35
|
+
if session_caps.nil?
|
36
|
+
session_caps = @driver.desired_capabilities.dup # Assuming there is a desired_capabilities method
|
37
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::SESSION_CAPABILITIES, session_caps)
|
38
|
+
end
|
39
|
+
session_caps
|
37
40
|
end
|
38
|
-
session_caps
|
39
41
|
end
|
40
42
|
end
|
@@ -3,81 +3,83 @@
|
|
3
3
|
require_relative 'metadata'
|
4
4
|
require_relative '../lib/cache'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
module Percy
|
7
|
+
class IOSMetadata < Percy::Metadata
|
8
|
+
attr_reader :_window_size
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def initialize(driver)
|
11
|
+
super(driver)
|
12
|
+
@_viewport = {}
|
13
|
+
@_window_size = {}
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def device_screen_size
|
17
|
+
vp = viewport
|
18
|
+
height = vp.fetch('top', 0) + vp.fetch('height', 0)
|
19
|
+
width = vp.fetch('width', 0)
|
20
|
+
if height.zero? && width.zero?
|
21
|
+
scale_factor = value_from_devices_info('scale_factor', device_name)
|
22
|
+
height = get_window_size['height'] * scale_factor
|
23
|
+
width = get_window_size['width'] * scale_factor
|
24
|
+
end
|
25
|
+
{ 'width' => width, 'height' => height }
|
23
26
|
end
|
24
|
-
{ 'width' => width, 'height' => height }
|
25
|
-
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
def status_bar
|
29
|
+
height = 0
|
30
|
+
view_port = viewport
|
31
|
+
if view_port.fetch('top', 0) != 0
|
32
|
+
height = view_port['top']
|
33
|
+
else
|
34
|
+
scale_factor = value_from_devices_info('scale_factor', device_name)
|
35
|
+
status_bar_height = value_from_devices_info('status_bar', device_name)
|
36
|
+
height = status_bar_height.to_i * scale_factor.to_i
|
37
|
+
end
|
38
|
+
{ 'height' => height }
|
36
39
|
end
|
37
|
-
{ 'height' => height }
|
38
|
-
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
def navigation_bar
|
42
|
+
{ 'height' => 0 }
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
def get_window_size
|
46
|
+
@_window_size = Percy::Cache.get_cache(session_id, Percy::Cache::WINDOW_SIZE)
|
47
|
+
unless @_window_size
|
48
|
+
@_window_size = driver.get_window_size
|
49
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::WINDOW_SIZE, @_window_size)
|
50
|
+
end
|
51
|
+
@_window_size
|
49
52
|
end
|
50
|
-
@_window_size
|
51
|
-
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
def viewport
|
55
|
+
@_viewport = Percy::Cache.get_cache(session_id, Percy::Cache::VIEWPORT)
|
56
|
+
if @_viewport.nil? || (@_viewport.is_a?(Hash) && @_viewport.empty?)
|
57
|
+
begin
|
58
|
+
@_viewport = execute_script('mobile: viewportRect')
|
59
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::VIEWPORT, @_viewport)
|
60
|
+
rescue StandardError
|
61
|
+
log('Could not use viewportRect; using static config', on_debug: true)
|
62
|
+
# setting `viewport` as empty hash so that it's not nil anymore
|
63
|
+
Percy::Cache.set_cache(session_id, Percy::Cache::VIEWPORT, {})
|
64
|
+
end
|
63
65
|
end
|
66
|
+
@_viewport || { 'top' => 0, 'height' => 0, 'width' => 0 }
|
64
67
|
end
|
65
|
-
@_viewport || { 'top' => 0, 'height' => 0, 'width' => 0 }
|
66
|
-
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
def device_name
|
70
|
+
if @device_name.nil?
|
71
|
+
caps = capabilities
|
72
|
+
caps = caps.as_json unless caps.is_a?(Hash)
|
73
|
+
@device_name = caps['deviceName']
|
74
|
+
end
|
75
|
+
@device_name
|
73
76
|
end
|
74
|
-
@device_name
|
75
|
-
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
def scale_factor
|
79
|
+
scale_factor = value_from_devices_info('scale_factor', device_name)
|
80
|
+
return viewport['width'] / get_window_size['width'] if scale_factor.zero?
|
80
81
|
|
81
|
-
|
82
|
+
scale_factor
|
83
|
+
end
|
82
84
|
end
|
83
|
-
end
|
85
|
+
end
|