eyes_core 3.17.22 → 3.18.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2f68b068dd48b9cdae7e9cfc0e46431595ea08f
4
- data.tar.gz: ee8077e2cbc57fd1f613b74726af18a4088b23b1
3
+ metadata.gz: b75c9b6d9f7188f819aa7e2e0402056ef87c2454
4
+ data.tar.gz: 912b814145c5b47d81bff5424a939806f38dd8cc
5
5
  SHA512:
6
- metadata.gz: ca66f4e8f3f6743671732d3a7aa5de14c6aa3ce49a2145556ed8c6be925f3365359d7daa9bffeeca4993297459b53cf978b0594ec86102038d5258cfcbb4e2f8
7
- data.tar.gz: 7f8464d5f9b98458d5cc99eacf76eeae3c26f73fb22d4ad5b5fac7ceaafc23beb2c8e3c39a163e6919814a51a1e61e9dcfaf9690af2ddaad3fc84d4990c932e9
6
+ metadata.gz: c87057e3092012f7621acc3a61868bcdde84813f4abdf6af9fdf1f8b0e3855ce60fb458bb89bc6907bb1f6949e4f9a6711ff7f805e2ab88aadd752eca96d384f
7
+ data.tar.gz: efa26a008603071e3734ad5033f3c20e55927aede90551e12bf68cd846a59608442836c5db3de7ffa96f8590b512912e11c22e04b42355f0e8075cdd6a1796b1
@@ -12,6 +12,14 @@ module Applitools
12
12
 
13
13
  def convert_viewport_rect_coordinates
14
14
  region = viewport_rect
15
+
16
+ session_info = Applitools::Appium::Utils.session_capabilities(driver)
17
+ if session_info['deviceScreenSize']
18
+ device_height = session_info['deviceScreenSize'].split('x').last.to_i
19
+ system_bars_height = driver.get_system_bars.map {|_,v| v['height'] }.sum
20
+ region['height'] = device_height - system_bars_height
21
+ end
22
+
15
23
  Applitools::Region.new(
16
24
  region['left'],
17
25
  region['top'],
@@ -14,6 +14,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
14
14
  self.runner = Applitools::ClassicRunner.new
15
15
  self.base_agent_id = "eyes.appium.ruby/#{Applitools::VERSION}".freeze
16
16
  self.status_bar_height = 0
17
+ self.utils = Applitools::Appium::Utils
17
18
  end
18
19
 
19
20
  private :perform_driver_settings_for_appium_driver
@@ -90,8 +91,8 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
90
91
  raise Applitools::EyesError.new('Unknown image format after scale!')
91
92
  end
92
93
  ),
93
- status_bar_height: Applitools::Utils::EyesSeleniumUtils.status_bar_height(driver),
94
- device_pixel_ratio: Applitools::Utils::EyesSeleniumUtils.device_pixel_ratio(driver)
94
+ status_bar_height: self.utils.status_bar_height(driver),
95
+ device_pixel_ratio: self.utils.device_pixel_ratio(driver)
95
96
  )
96
97
  end
97
98
  end
@@ -131,20 +132,20 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
131
132
  def obtain_viewport_screenshot
132
133
  self.screenshot = screenshot_class.new(
133
134
  Applitools::Screenshot.from_datastream(driver.screenshot_as(:png)),
134
- status_bar_height: Applitools::Utils::EyesSeleniumUtils.status_bar_height(driver),
135
- device_pixel_ratio: Applitools::Utils::EyesSeleniumUtils.device_pixel_ratio(driver)
135
+ status_bar_height: self.utils.status_bar_height(driver),
136
+ device_pixel_ratio: self.utils.device_pixel_ratio(driver)
136
137
  )
137
138
  end
138
139
 
139
140
  def screenshot_class
140
- return Applitools::Appium::IosScreenshot if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
141
- return Applitools::Appium::AndroidScreenshot if Applitools::Utils::EyesSeleniumUtils.android?(Applitools::Appium::Driver::AppiumLib)
141
+ return Applitools::Appium::IosScreenshot if self.utils.ios?(Applitools::Appium::Driver::AppiumLib)
142
+ return Applitools::Appium::AndroidScreenshot if self.utils.android?(Applitools::Appium::Driver::AppiumLib)
142
143
  raise Applitools::EyesError, 'Unknown device type'
143
144
  end
144
145
 
145
146
  def region_provider_class
146
- return Applitools::Appium::IosRegionProvider if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
147
- return Applitools::Appium::AndroidRegionProvider if Applitools::Utils::EyesSeleniumUtils.android?(Applitools::Appium::Driver::AppiumLib)
147
+ return Applitools::Appium::IosRegionProvider if self.utils.ios?(Applitools::Appium::Driver::AppiumLib)
148
+ return Applitools::Appium::AndroidRegionProvider if self.utils.android?(Applitools::Appium::Driver::AppiumLib)
148
149
  raise Applitools::EyesError, 'Unknown device type'
149
150
  end
150
151
  end
@@ -23,7 +23,7 @@ module Applitools
23
23
  private
24
24
 
25
25
  def viewport_rect
26
- Applitools::Utils::EyesSeleniumUtils.viewport_rect(driver)
26
+ Applitools::Appium::Utils.viewport_rect(driver)
27
27
  end
28
28
 
29
29
  def convert_region_coordinates
@@ -44,7 +44,7 @@ module Applitools
44
44
  end
45
45
 
46
46
  def scale_factor
47
- Applitools::Utils::EyesSeleniumUtils.device_pixel_ratio(driver)
47
+ Applitools::Appium::Utils.device_pixel_ratio(driver)
48
48
  end
49
49
  end
50
50
  end
@@ -54,7 +54,7 @@ module Applitools
54
54
  end
55
55
  when Applitools::Region
56
56
  result = first_argument.padding(requested_padding)
57
- if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
57
+ if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
58
58
  def result.converted?
59
59
  true
60
60
  end
@@ -77,7 +77,7 @@ module Applitools
77
77
  args.first
78
78
  when Applitools::Region
79
79
  result = Applitools::FloatingRegion.any(*args)
80
- if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
80
+ if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
81
81
  def result.converted?
82
82
  true
83
83
  end
@@ -147,7 +147,7 @@ module Applitools
147
147
  result = Applitools::AccessibilityRegion.new(
148
148
  args.first, options[:type]
149
149
  )
150
- if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
150
+ if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
151
151
  def result.converted?
152
152
  true
153
153
  end
@@ -189,7 +189,7 @@ module Applitools
189
189
  Applitools::Region.from_location_size(r.location, r.size)
190
190
  end
191
191
  when Applitools::Region
192
- if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
192
+ if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
193
193
  def r.converted?
194
194
  true
195
195
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Applitools::Appium
4
4
  module Utils
5
+ include Applitools::Utils::EyesSeleniumUtils
6
+ extend self
7
+
5
8
  # true if test is running on mobile device
6
9
  def mobile_device?(driver)
7
10
  defined?(Appium::Driver) &&
@@ -167,7 +167,7 @@ module Applitools::Connectivity
167
167
  Oj.load(response.body)
168
168
  end
169
169
 
170
- def download_resource(url, ua_string = nil)
170
+ def download_resource(url, ua_string = nil, cookies=nil)
171
171
  Applitools::EyesLogger.debug "Fetching #{url}..."
172
172
  resp_proc = proc do |u|
173
173
  faraday_connection(u, false).send(:get) do |req|
@@ -175,6 +175,7 @@ module Applitools::Connectivity
175
175
  req.headers[:accept_encoding] = 'identity'
176
176
  req.headers[:accept_language] = '*'
177
177
  req.headers[:user_agent] = ua_string if ua_string
178
+ req.headers[:Cookie] = cookies.map { |h| [h[:name], h[:value]].join('=') }.join('; ') unless cookies.to_a.empty?
178
179
  end
179
180
  end
180
181
  response = resp_proc.call(url)
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'securerandom'
4
+ require 'applitools/utils/utils'
4
5
  require_relative 'helpers'
5
6
 
6
7
  module Applitools
7
8
  class BatchInfo
8
9
  extend Helpers
9
- attr_accessor :started_at, :id, :notify_on_completion
10
+ attr_accessor :started_at, :id, :notify_on_completion, :properties
10
11
 
11
12
  environment_attribute :name, 'APPLITOOLS_BATCH_NAME'
12
13
  environment_attribute :id, 'APPLITOOLS_BATCH_ID'
@@ -14,10 +15,24 @@ module Applitools
14
15
  environment_attribute :env_notify_on_completion, 'APPLITOOLS_BATCH_NOTIFY'
15
16
 
16
17
 
17
- def initialize(name = nil, started_at = Time.now)
18
+ def initialize(args = nil, started_at = Time.now)
19
+ case args
20
+ when String
21
+ name = args
22
+ when Hash
23
+ sym_args = Applitools::Utils.symbolize_keys args
24
+ id ||= sym_args[:id]
25
+ name ||= sym_args[:name]
26
+ properties ||= sym_args[:properties]
27
+ end
18
28
  self.name = name if name
19
29
  @started_at = started_at
20
- self.id = SecureRandom.uuid unless id
30
+ if id
31
+ self.id = id
32
+ elsif self.id.nil? || self.id.empty?
33
+ self.id = SecureRandom.uuid
34
+ end
35
+ self.properties = properties if properties
21
36
  self.notify_on_completion = 'true'.casecmp(env_notify_on_completion || '') == 0 ? true : false
22
37
  end
23
38
 
@@ -27,7 +42,8 @@ module Applitools
27
42
  'name' => name,
28
43
  'startedAt' => @started_at.iso8601,
29
44
  'batchSequenceName' => sequence_name,
30
- 'notifyOnCompletion' => notify_on_completion
45
+ 'notifyOnCompletion' => notify_on_completion,
46
+ 'properties' => properties
31
47
  }
32
48
  end
33
49
 
@@ -319,7 +319,7 @@ module Applitools
319
319
  branch_name: branch_name, parent_branch_name: parent_branch_name,
320
320
  baseline_branch_name: baseline_branch_name, save_diffs: save_diffs,
321
321
  properties: properties
322
-
322
+ session_start_info.agent_run_id = agent_run_id if agent_run_id
323
323
  match_window_data.start_info = session_start_info
324
324
  match_window_data.update_baseline_if_new = save_new_tests
325
325
  match_window_data.update_baseline_if_different = save_failed_tests
@@ -597,6 +597,7 @@ module Applitools
597
597
  branch_name: branch_name, parent_branch_name: parent_branch_name,
598
598
  baseline_branch_name: baseline_branch_name, save_diffs: save_diffs,
599
599
  properties: properties
600
+ session_start_info.agent_run_id = agent_run_id if agent_run_id
600
601
 
601
602
  logger.info 'Starting server session...'
602
603
  self.running_session = server_connector.start_session session_start_info
@@ -25,7 +25,10 @@ module Applitools
25
25
  default_match_settings: Applitools::ImageMatchSettings.new,
26
26
  accessibility_validation: nil,
27
27
  properties: [],
28
- match_timeout: DEFAULT_MATCH_TIMEOUT
28
+ match_timeout: DEFAULT_MATCH_TIMEOUT,
29
+ dont_fetch_resources: true,
30
+ enable_cross_origin_rendering: true,
31
+ dont_use_cookies: false,
29
32
  }.freeze
30
33
 
31
34
  class << self
@@ -118,6 +121,10 @@ module Applitools
118
121
  object_field :accessibility_validation, Applitools::AccessibilitySettings, true
119
122
  object_field :properties, Array
120
123
  int_field :match_timeout
124
+ string_field :agent_run_id
125
+ boolean_field :dont_fetch_resources
126
+ boolean_field :enable_cross_origin_rendering
127
+ boolean_field :dont_use_cookies
121
128
 
122
129
  methods_to_delegate.delete(:batch_info)
123
130
  methods_to_delegate.delete(:batch_info=)
@@ -187,6 +194,10 @@ module Applitools
187
194
  properties << { name: name, value: value } if name && value
188
195
  end
189
196
 
197
+ def disable_browser_fetching=(value)
198
+ self.dont_fetch_resources = value
199
+ end
200
+
190
201
  methods_to_delegate.push(:set_proxy)
191
202
  methods_to_delegate.push(:add_property)
192
203
  end
@@ -87,6 +87,10 @@ module Applitools
87
87
  current_data['Options']['Name'] = value
88
88
  end
89
89
 
90
+ def variation_group_id=(value)
91
+ current_data['Options']['variantId'] = value
92
+ end
93
+
90
94
  def user_inputs=(value)
91
95
  Applitools::ArgumentGuard.is_a? value, 'value', Array
92
96
  current_data['UserInputs'] += value.select { |i| i.respond_to? :to_hash }
@@ -5,7 +5,7 @@ module Applitools
5
5
  include Applitools::Jsonable
6
6
  json_fields :batchInfo, :agentId, :appIdOrName, :verId, :environment, :environmentName, :branchName, :defaultMatchSettings,
7
7
  :scenarioIdOrName, :properties, :parentBranchName, :compareWithParentBranch, :baselineEnvName, :saveDiffs, :sessionType,
8
- :baselineBranchName
8
+ :baselineBranchName, :agentRunId
9
9
 
10
10
  wrap_data do |value|
11
11
  { startInfo: value }
@@ -28,6 +28,7 @@ module Applitools
28
28
  self.save_diffs = options[:save_diffs]
29
29
  self.session_type = options[:session_type]
30
30
  self.baseline_branch_name = options[:baseline_branch_name]
31
+ self.agentRunId = options[:agent_run_id] if options[:agent_run_id]
31
32
  end
32
33
 
33
34
  def to_hash
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.17.22'.freeze
4
+ VERSION = '3.18.3'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.22
4
+ version: 3.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-13 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -264,8 +264,6 @@ files:
264
264
  - lib/applitools/appium/android_screenshot.rb
265
265
  - lib/applitools/appium/driver.rb
266
266
  - lib/applitools/appium/eyes.rb
267
- - lib/applitools/appium/initialize_1.9.rb
268
- - lib/applitools/appium/initialize_2.0.rb
269
267
  - lib/applitools/appium/ios_region_provider.rb
270
268
  - lib/applitools/appium/ios_screenshot.rb
271
269
  - lib/applitools/appium/region_provider.rb
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: false
2
-
3
- module Applitools::Appium
4
- module Init19
5
- extend self
6
-
7
- def init
8
- Applitools::Utils::EyesSeleniumUtils.module_eval do
9
- alias_method :super_mobile_device?, :mobile_device?
10
- alias_method :super_android?, :android?
11
- alias_method :super_ios?, :ios?
12
- alias_method :super_platform_version, :platform_version
13
- alias_method :super_current_scroll_position, :current_scroll_position
14
- include Applitools::Appium::Utils
15
- end
16
- end
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: false
2
-
3
- module Applitools::Appium
4
- module Init20
5
- extend self
6
- def init
7
- Applitools::Utils::EyesSeleniumUtils.module_eval do
8
- prepend Applitools::Appium::Utils
9
- extend self
10
- end
11
- end
12
- end
13
- end