eyes_selenium 3.15.39 → 3.15.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applitools/selenium/browser_types.rb +1 -0
  3. data/lib/applitools/selenium/browsers_info.rb +24 -23
  4. data/lib/applitools/selenium/concerns/selenium_eyes.rb +154 -0
  5. data/lib/applitools/selenium/configuration.rb +5 -4
  6. data/lib/applitools/selenium/css_parser/find_embedded_resources.rb +4 -1
  7. data/lib/applitools/selenium/css_translate_position_provider.rb +1 -1
  8. data/lib/applitools/selenium/devices.rb +1 -0
  9. data/lib/applitools/selenium/dom_capture/dom_capture.rb +9 -8
  10. data/lib/applitools/selenium/dom_capture/dom_capture_script.rb +3 -1
  11. data/lib/applitools/selenium/external_css_resources.rb +7 -3
  12. data/lib/applitools/selenium/eyes.rb +2 -3
  13. data/lib/applitools/selenium/full_page_capture_algorithm.rb +5 -1
  14. data/lib/applitools/selenium/orientations.rb +1 -0
  15. data/lib/applitools/selenium/render_browser_info_fluent.rb +3 -1
  16. data/lib/applitools/selenium/render_resources.rb +12 -5
  17. data/lib/applitools/selenium/rgrid_dom.rb +4 -8
  18. data/lib/applitools/selenium/scripts/get_element_xpath.rb +3 -1
  19. data/lib/applitools/selenium/scripts/process_page_and_poll.rb +154 -72
  20. data/lib/applitools/selenium/scripts/process_page_and_serialize.rb +3 -1
  21. data/lib/applitools/selenium/selenium_eyes.rb +66 -221
  22. data/lib/applitools/selenium/stitch_modes.rb +2 -1
  23. data/lib/applitools/selenium/target.rb +31 -14
  24. data/lib/applitools/selenium/test_list.rb +16 -10
  25. data/lib/applitools/selenium/visual_grid/chrome_emulation_info.rb +2 -1
  26. data/lib/applitools/selenium/visual_grid/emulation_base_info.rb +2 -1
  27. data/lib/applitools/selenium/visual_grid/eyes_connector.rb +13 -7
  28. data/lib/applitools/selenium/visual_grid/render_browser_info.rb +2 -1
  29. data/lib/applitools/selenium/visual_grid/render_info.rb +2 -1
  30. data/lib/applitools/selenium/visual_grid/render_request.rb +4 -3
  31. data/lib/applitools/selenium/visual_grid/render_requests.rb +2 -1
  32. data/lib/applitools/selenium/visual_grid/render_task.rb +71 -46
  33. data/lib/applitools/selenium/visual_grid/resource_cache.rb +4 -3
  34. data/lib/applitools/selenium/visual_grid/running_test.rb +26 -4
  35. data/lib/applitools/selenium/visual_grid/thread_pool.rb +3 -2
  36. data/lib/applitools/selenium/visual_grid/vg_match_window_data.rb +9 -3
  37. data/lib/applitools/selenium/visual_grid/vg_region.rb +2 -1
  38. data/lib/applitools/selenium/visual_grid/vg_resource.rb +8 -7
  39. data/lib/applitools/selenium/visual_grid/vg_task.rb +2 -1
  40. data/lib/applitools/selenium/visual_grid/visual_grid_eyes.rb +114 -168
  41. data/lib/applitools/selenium/visual_grid/visual_grid_runner.rb +38 -11
  42. data/lib/applitools/selenium/visual_grid/web_element_region.rb +3 -1
  43. data/lib/applitools/version.rb +1 -1
  44. data/lib/eyes_selenium.rb +1 -1
  45. metadata +5 -4
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'thread'
2
3
  module Applitools
3
4
  module Selenium
@@ -31,12 +32,12 @@ module Applitools
31
32
  update_cache_map(key, value)
32
33
  end
33
34
 
34
- def fetch_and_store(key, &block)
35
+ def fetch_and_store(key, &_block)
35
36
  semaphore.synchronize do
36
37
  return cache_map[key] if check_key(key)
37
38
  return unless block_given?
38
39
  cache_map[key] = Applitools::Future.new(semaphore) do |semaphore|
39
- block.call(semaphore, key)
40
+ yield(semaphore, key)
40
41
  end
41
42
  return true if cache_map[key].is_a? Applitools::Future
42
43
  false
@@ -56,4 +57,4 @@ module Applitools
56
57
  end
57
58
  end
58
59
  end
59
- end
60
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'state_machine'
2
3
  require 'digest'
3
4
  require 'applitools/selenium/visual_grid/render_task'
@@ -8,7 +9,8 @@ module Applitools
8
9
  extend Forwardable
9
10
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
10
11
  def_delegators 'eyes', :abort_if_not_closed
11
-
12
+ attr_accessor :on_results
13
+ # rubocop:disable Metrics/BlockLength
12
14
  state_machine :initial => :new do
13
15
  state :new do
14
16
  def close
@@ -74,9 +76,18 @@ module Applitools
74
76
  def queue
75
77
  Applitools::Selenium::VisualGridRunner::EMPTY_QUEUE
76
78
  end
79
+
80
+ def close; end
77
81
  end
78
82
 
79
- state :new, :not_rendered, :opened, :rendered, :tested do
83
+ state :new do
84
+ def close
85
+ self.test_result = nil
86
+ becomes_completed
87
+ end
88
+ end
89
+
90
+ state :not_rendered, :opened, :rendered, :tested do
80
91
  def close
81
92
  self.test_result = nil
82
93
  close_task = Applitools::Selenium::VGTask.new("close #{browser_info}") do
@@ -84,6 +95,7 @@ module Applitools
84
95
  end
85
96
  close_task.on_task_succeeded do |task_result|
86
97
  self.test_result = task_result
98
+ on_results.call(task_result) if on_results.respond_to? :call
87
99
  end
88
100
  close_task.on_task_error do |e|
89
101
  pending_exceptions << e
@@ -114,7 +126,7 @@ module Applitools
114
126
  end
115
127
 
116
128
  event :becomes_completed do
117
- transition [:not_rendered, :rendered, :opened, :tested] => :completed
129
+ transition [:new, :not_rendered, :rendered, :opened, :tested] => :completed
118
130
  end
119
131
  end
120
132
 
@@ -147,6 +159,15 @@ module Applitools
147
159
  init
148
160
  end
149
161
 
162
+ def on_results_received(&block)
163
+ self.on_results = block if block_given?
164
+ end
165
+
166
+ def abort_if_not_closed
167
+ eyes.abort_if_not_closed
168
+ becomes_completed
169
+ end
170
+
150
171
  def init
151
172
  open_task = Applitools::Selenium::VGTask.new("open #{browser_info}") { eyes.open(driver, browser_info) }
152
173
 
@@ -201,6 +222,7 @@ module Applitools
201
222
  uniq_values = watch.values.uniq
202
223
  uniq_values.count == 1 && uniq_values.first == true
203
224
  end
225
+ # rubocop:enable Metrics/BlockLength
204
226
  end
205
227
  end
206
- end
228
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'thread'
2
3
 
3
4
  module Applitools
@@ -83,11 +84,11 @@ module Applitools
83
84
  rescue => e
84
85
  Applitools::EyesLogger.logger.error "Failed to execute task - #{task_to_run.name}"
85
86
  Applitools::EyesLogger.logger.error e.message
86
- Applitools::EyesLogger.logger.error e.backtrace.join( ' ')
87
+ Applitools::EyesLogger.logger.error e.backtrace.join(' ')
87
88
  end
88
89
  end
89
90
  @thread_group.add thread
90
91
  end
91
92
  end
92
93
  end
93
- end
94
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  module Selenium
3
5
  class VgMatchWindowData < Applitools::MatchWindowData
@@ -30,10 +32,14 @@ module Applitools
30
32
  when Applitools::Region
31
33
  @ignored_regions << r
32
34
  when Applitools::Selenium::VGRegion
33
- region = selector_regions[target.regions[r.region]]
35
+ region = target.regions.key?(r.region) ? selector_regions[target.regions[r.region]] : r.region
34
36
  raise RegionCoordinatesError.new(r, region['error']) if region['error']
35
37
  retrieved_region = Applitools::Region.new(region['x'], region['y'], region['width'], region['height'])
36
- @ignored_regions << r.padding_proc.call(retrieved_region)
38
+ @ignored_regions << if r.padding_proc.is_a?(Proc)
39
+ r.padding_proc.call(retrieved_region)
40
+ else
41
+ retrieved_region
42
+ end
37
43
  end
38
44
  end
39
45
  end
@@ -147,4 +153,4 @@ module Applitools
147
153
  end
148
154
  end
149
155
  end
150
- end
156
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Applitools
2
3
  module Selenium
3
4
  class VGRegion
@@ -12,4 +13,4 @@ module Applitools
12
13
  end
13
14
  end
14
15
  end
15
- end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
  require 'digest'
3
5
  module Applitools
@@ -6,8 +8,8 @@ module Applitools
6
8
  include Applitools::Jsonable
7
9
  json_fields :contentType, :hash, :hashFormat
8
10
  attr_accessor :url, :content, :handle_css_block
9
- alias :content_type :contentType
10
- alias :content_type= :contentType=
11
+ alias content_type contentType
12
+ alias content_type= contentType=
11
13
 
12
14
  class << self
13
15
  def parse_blob_from_script(blob, options = {})
@@ -36,10 +38,9 @@ module Applitools
36
38
  end
37
39
 
38
40
  def lookup_for_resources
39
- if %r{^text/css}i =~ content_type && handle_css_block
40
- parser = Applitools::Selenium::CssParser::FindEmbeddedResources.new(content)
41
- handle_css_block.call(parser.imported_css + parser.fonts + parser.images, url)
42
- end
41
+ return unless %r{^text/css}i =~ content_type && handle_css_block
42
+ parser = Applitools::Selenium::CssParser::FindEmbeddedResources.new(content)
43
+ handle_css_block.call(parser.imported_css + parser.fonts + parser.images, url)
43
44
  end
44
45
 
45
46
  def stringify
@@ -47,4 +48,4 @@ module Applitools
47
48
  end
48
49
  end
49
50
  end
50
- end
51
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'securerandom'
2
3
  module Applitools
3
4
  module Selenium
@@ -49,4 +50,4 @@ module Applitools
49
50
  end
50
51
  end
51
52
  end
52
- end
53
+ end
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'applitools/selenium/configuration'
2
4
  require 'timeout'
3
5
 
4
6
  module Applitools
5
7
  module Selenium
6
8
  class VisualGridEyes
7
- DOM_EXTRACTION_TIMEOUT = 300 #seconds or 5 minutes
9
+ include Applitools::Selenium::Concerns::SeleniumEyes
10
+ DOM_EXTRACTION_TIMEOUT = 300 # seconds or 5 minutes
8
11
  USE_DEFAULT_MATCH_TIMEOUT = -1
9
12
  extend Forwardable
10
13
 
@@ -29,6 +32,7 @@ module Applitools
29
32
  self.visual_grid_manager = visual_grid_manager
30
33
  self.test_list = Applitools::Selenium::TestList.new
31
34
  self.opened = false
35
+ self.test_list ||= Applitools::Selenium::TestList.new
32
36
  self.driver_lock = Mutex.new
33
37
  end
34
38
 
@@ -42,15 +46,17 @@ module Applitools
42
46
  end
43
47
 
44
48
  def open(*args)
45
- self.test_list = Applitools::Selenium::TestList.new
46
49
  options = Applitools::Utils.extract_options!(args)
47
50
  Applitools::ArgumentGuard.hash(options, 'options', [:driver])
48
51
 
49
52
  config.app_name = options[:app_name] if config.app_name.nil? || config.app_name && config.app_name.empty?
50
53
  config.test_name = options[:test_name] if config.test_name.nil? || config.test_name && config.test_name.empty?
51
- config.viewport_size = Applitools::RectangleSize.from_any_argument(options[:viewport_size]) if config.viewport_size.nil? || config.viewport_size && config.viewport_size.empty?
52
54
 
53
- self.driver = options.delete(:driver)
55
+ if config.viewport_size.nil? || config.viewport_size && config.viewport_size.empty?
56
+ config.viewport_size = Applitools::RectangleSize.from_any_argument(options[:viewport_size])
57
+ end
58
+
59
+ self.driver = Applitools::Selenium::SeleniumEyes.eyes_driver(options.delete(:driver), self)
54
60
  self.current_url = driver.current_url
55
61
 
56
62
  if viewport_size
@@ -64,14 +70,18 @@ module Applitools
64
70
  server_connector.close_batch(batch.id)
65
71
  end
66
72
 
67
- logger.info("getting all browsers info...")
73
+ logger.info('Getting all browsers info...')
68
74
  browsers_info_list = config.browsers_info
69
- logger.info("creating test descriptors for each browser info...")
75
+ logger.info('Creating test descriptors for each browser info...')
70
76
  browsers_info_list.each(viewport_size) do |bi|
71
- test_list.push Applitools::Selenium::RunningTest.new(eyes_connector, bi, driver)
77
+ test = Applitools::Selenium::RunningTest.new(eyes_connector, bi, driver).tap do |t|
78
+ t.on_results_received do |results|
79
+ visual_grid_manager.aggregate_result(results)
80
+ end
81
+ end
82
+ test_list.push test
72
83
  end
73
84
  self.opened = true
74
-
75
85
  driver
76
86
  end
77
87
 
@@ -81,7 +91,7 @@ module Applitools
81
91
  end
82
92
 
83
93
  def eyes_connector
84
- logger.info("creating VisualGridEyes server connector")
94
+ logger.info('Creating VisualGridEyes server connector')
85
95
  ::Applitools::Selenium::EyesConnector.new(server_url, driver_lock: driver_lock).tap do |connector|
86
96
  connector.batch = batch
87
97
  connector.config = config.deep_clone
@@ -90,51 +100,57 @@ module Applitools
90
100
 
91
101
  def check(tag, target)
92
102
  script = <<-END
93
- #{Applitools::Selenium::Scripts::PROCESS_PAGE_AND_POLL} return __processPageAndPoll();
103
+ #{Applitools::Selenium::Scripts::PROCESS_PAGE_AND_POLL} return __processPageAndSerializePoll();
94
104
  END
105
+ render_task = nil
106
+ target.default_full_page_for_vg
107
+
108
+ target_to_check = target.finalize
95
109
  begin
96
- sleep wait_before_screenshots
97
- Applitools::EyesLogger.info 'Trying to get DOM snapshot...'
98
-
99
- script_thread = Thread.new do
100
- result = {}
101
- while result['status'] != 'SUCCESS'
102
- Thread.current[:script_result] = driver.execute_script(script)
103
- begin
104
- Thread.current[:result] = result = Oj.load(Thread.current[:script_result])
105
- sleep 0.5
106
- rescue Oj::ParseError => e
107
- Applitools::EyesLogger.warn e.message
110
+ check_in_frame(target_frames: target_to_check.frames) do
111
+ sleep wait_before_screenshots
112
+ Applitools::EyesLogger.info 'Trying to get DOM snapshot...'
113
+
114
+ script_thread = Thread.new do
115
+ result = {}
116
+ while result['status'] != 'SUCCESS'
117
+ Thread.current[:script_result] = driver.execute_script(script)
118
+ begin
119
+ Thread.current[:result] = result = Oj.load(Thread.current[:script_result])
120
+ sleep 0.5
121
+ rescue Oj::ParseError => e
122
+ Applitools::EyesLogger.warn e.message
123
+ end
108
124
  end
109
125
  end
126
+ sleep 0.5
127
+ script_thread_result = script_thread.join(DOM_EXTRACTION_TIMEOUT)
128
+
129
+ raise ::Applitools::EyesError.new 'Timeout error while getting dom snapshot!' unless script_thread_result
130
+ Applitools::EyesLogger.info 'Done!'
131
+
132
+ mod = Digest::SHA2.hexdigest(script_thread_result[:script_result])
133
+
134
+ region_x_paths = get_regions_x_paths(target_to_check)
135
+ render_task = RenderTask.new(
136
+ "Render #{config.short_description} - #{tag}",
137
+ script_thread_result[:result]['value'],
138
+ visual_grid_manager,
139
+ server_connector,
140
+ region_x_paths,
141
+ size_mod,
142
+ region_to_check,
143
+ target_to_check.options[:script_hooks],
144
+ mod
145
+ )
110
146
  end
111
- sleep 0.5
112
- script_thread_result = script_thread.join(DOM_EXTRACTION_TIMEOUT)
113
- raise ::Applitools::EyesError.new 'Timeout error while getting dom snapshot!' unless script_thread_result
114
- Applitools::EyesLogger.info 'Done!'
115
-
116
- mod = Digest::SHA2.hexdigest(script_thread_result[:script_result])
117
-
118
- region_x_paths = get_regions_x_paths(target)
119
- render_task = RenderTask.new(
120
- "Render #{config.short_description} - #{tag}",
121
- script_thread_result[:result]['value'],
122
- visual_grid_manager,
123
- server_connector,
124
- region_x_paths,
125
- size_mod,
126
- region_to_check,
127
- target.options[:script_hooks],
128
- mod
129
- )
130
147
  test_list.each do |t|
131
- t.check(tag, target, render_task)
148
+ t.check(tag, target_to_check, render_task)
132
149
  end
133
- test_list.each { |t| t.becomes_not_rendered }
134
- test_list.each { |t| t.becomes_not_rendered }
150
+ test_list.each(&:becomes_not_rendered)
135
151
  visual_grid_manager.enqueue_render_task render_task
136
152
  rescue StandardError => e
137
- test_list.each { |t| t.becomes_tested }
153
+ test_list.each(&:becomes_tested)
138
154
  Applitools::EyesLogger.error e.class.to_s
139
155
  Applitools::EyesLogger.error e.message
140
156
  end
@@ -143,13 +159,13 @@ module Applitools
143
159
  def get_regions_x_paths(target)
144
160
  result = []
145
161
  collect_selenium_regions(target).each do |el, v|
146
- if [::Selenium::WebDriver::Element, Applitools::Selenium::Element].include?(el.class)
147
- xpath = driver.execute_script(Applitools::Selenium::Scripts::GET_ELEMENT_XPATH_JS, el)
148
- web_element_region = Applitools::Selenium::WebElementRegion.new(xpath, v)
149
- self.region_to_check = web_element_region if v == :target && size_mod == 'selector'
150
- result << web_element_region
151
- target.regions[el] = result.size - 1
152
- end
162
+ next unless [::Selenium::WebDriver::Element, Applitools::Selenium::Element].include?(el.class)
163
+
164
+ xpath = driver.execute_script(Applitools::Selenium::Scripts::GET_ELEMENT_XPATH_JS, el)
165
+ web_element_region = Applitools::Selenium::WebElementRegion.new(xpath, v)
166
+ self.region_to_check = web_element_region.dup if v == :target && size_mod == 'selector'
167
+ result << web_element_region
168
+ target.regions[el] = result.size - 1
153
169
  end
154
170
  result
155
171
  end
@@ -193,14 +209,25 @@ module Applitools
193
209
 
194
210
  element_or_region = element_or_region(target_element, target, key)
195
211
 
196
- case element_or_region
197
- when ::Selenium::WebDriver::Element, Applitools::Selenium::Element
198
- self.size_mod = 'selector'
199
- when Applitools::Region
200
- self.size_mod = 'region' unless element_or_region == Applitools::Region::EMPTY
201
- else
202
- self.size_mod = 'full-page'
203
- end
212
+ self.size_mod = case element_or_region
213
+ when ::Selenium::WebDriver::Element, Applitools::Selenium::Element
214
+ 'selector'
215
+ when Applitools::Region
216
+ if element_or_region == Applitools::Region::EMPTY
217
+ if target.options[:stitch_content]
218
+ 'full-page'
219
+ else
220
+ element_or_region = Applitools::Region.from_location_size(
221
+ Applitools::Location::TOP_LEFT, viewport_size
222
+ )
223
+ 'region'
224
+ end
225
+ else
226
+ 'region'
227
+ end
228
+ else
229
+ 'full-page'
230
+ end
204
231
 
205
232
  self.region_to_check = element_or_region
206
233
  end
@@ -221,11 +248,15 @@ module Applitools
221
248
  end
222
249
  end
223
250
 
251
+ def close_async
252
+ test_list.each(&:close)
253
+ end
254
+
224
255
  def close(throw_exception = true)
225
256
  return false if test_list.empty?
226
- test_list.each(&:close)
257
+ close_async
227
258
 
228
- until ((states = test_list.map(&:state_name).uniq).count == 1 && states.first == :completed) do
259
+ until (states = test_list.map(&:state_name).uniq).count == 1 && states.first == :completed
229
260
  sleep 0.5
230
261
  end
231
262
  self.opened = false
@@ -236,18 +267,22 @@ module Applitools
236
267
  end
237
268
  end
238
269
 
270
+ all_results = test_list.map(&:test_result).compact
271
+ failed_results = all_results.select { |r| !r.as_expected? }
272
+
239
273
  if throw_exception
240
- test_list.map(&:test_result).compact.each do |r|
274
+ all_results.each do |r|
241
275
  raise Applitools::NewTestError.new new_test_error_message(r), r if r.new?
242
276
  raise Applitools::DiffsFoundError.new diffs_found_error_message(r), r if r.unresolved? && !r.new?
243
277
  raise Applitools::TestFailedError.new test_failed_error_message(r), r if r.failed?
244
278
  end
245
279
  end
246
- failed_results = test_list.map(&:test_result).compact.select { |r| !r.as_expected? }
247
- failed_results.empty? ? test_list.map(&:test_result).compact.first : failed_results
280
+
281
+ failed_results.empty? ? all_results.first : failed_results
248
282
  end
249
283
 
250
284
  def abort_if_not_closed
285
+ self.opened = false
251
286
  test_list.each(&:abort_if_not_closed)
252
287
  end
253
288
 
@@ -255,19 +290,21 @@ module Applitools
255
290
  opened
256
291
  end
257
292
 
293
+ # rubocop:disable Style/AccessorMethodName
258
294
  def get_all_test_results
259
295
  test_list.map(&:test_result)
260
296
  end
297
+ # rubocop:enable Style/AccessorMethodName
261
298
 
299
+ # rubocop:disable Style/AccessorMethodName
262
300
  def set_viewport_size(value)
263
- begin
264
- Applitools::Utils::EyesSeleniumUtils.set_viewport_size driver, value
265
- rescue => e
266
- logger.error e.class.to_s
267
- logger.error e.message
268
- raise Applitools::TestFailedError.new "#{e.class} - #{e.message}"
269
- end
301
+ Applitools::Utils::EyesSeleniumUtils.set_viewport_size driver, value
302
+ rescue => e
303
+ logger.error e.class.to_s
304
+ logger.error e.message
305
+ raise Applitools::TestFailedError.new "#{e.class} - #{e.message}"
270
306
  end
307
+ # rubocop:enable Style/AccessorMethodName
271
308
 
272
309
  def new_test_error_message(result)
273
310
  original_results = result.original_results
@@ -298,106 +335,15 @@ module Applitools
298
335
 
299
336
  private :new_test_error_message, :diffs_found_error_message, :test_failed_error_message
300
337
 
301
- # Takes a snapshot of the application under test and matches it with the expected output.
302
- #
303
- # @param [String] tag An optional tag to be assosiated with the snapshot.
304
- # @param [Fixnum] match_timeout The amount of time to retry matching (seconds)
305
- def check_window(tag = nil, match_timeout = USE_DEFAULT_MATCH_TIMEOUT)
306
- target = Applitools::Selenium::Target.window.tap do |t|
307
- t.timeout(match_timeout)
308
- t.fully if force_full_page_screenshot
309
- end
310
- check(tag, target)
311
- end
338
+ private
312
339
 
313
- # Takes a snapshot of the application under test and matches a region of
314
- # a specific element with the expected region output.
315
- #
316
- # @param [Applitools::Selenium::Element] element Represents a region to check.
317
- # @param [Symbol] how a finder, such :css or :id. Selects a finder will be used to find an element
318
- # See Selenium::Webdriver::Element#find_element documentation for full list of possible finders.
319
- # @param [String] what The value will be passed to a specified finder. If finder is :css it must be a css selector.
320
- # @param [Hash] options
321
- # @option options [String] :tag An optional tag to be associated with the snapshot.
322
- # @option options [Fixnum] :match_timeout The amount of time to retry matching. (Seconds)
323
- # @option options [Boolean] :stitch_content If set to true, will try to get full content of the element
324
- # (including hidden content due overflow settings) by scrolling the element,
325
- # taking and stitching partial screenshots.
326
- # @example Check region by element
327
- # check_region(element, tag: 'Check a region by element', match_timeout: 3, stitch_content: false)
328
- # @example Check region by css selector
329
- # check_region(:css, '.form-row .input#e_mail', tag: 'Check a region by element', match_timeout: 3,
330
- # stitch_content: false)
331
- # @!parse def check_region(element, how=nil, what=nil, options = {}); end
332
- def check_region(*args)
333
- options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil }.merge! Applitools::Utils.extract_options!(args)
334
- target = Applitools::Selenium::Target.new.region(*args).timeout(options[:match_timeout])
335
- target.fully if options[:stitch_content]
336
- check(options[:tag], target)
337
- end
340
+ def add_mouse_trigger(_mouse_action, _element); end
338
341
 
339
- # Validates the contents of an iframe and matches it with the expected output.
340
- #
341
- # @param [Hash] options The specific parameters of the desired screenshot.
342
- # @option options [Fixnum] :timeout The amount of time to retry matching. (Seconds)
343
- # @option options [String] :tag An optional tag to be associated with the snapshot.
344
- # @option options [String] :frame Frame element or frame name or frame id.
345
- # @option options [String] :name_or_id The name or id of the target frame (deprecated. use :frame instead).
346
- # @option options [String] :frame_element The frame element (deprecated. use :frame instead).
347
- # @return [Applitools::MatchResult] The match results.
348
-
349
- def check_frame(options = {})
350
- options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil }.merge!(options)
351
- frame = options[:frame] || options[:frame_element] || options[:name_or_id]
352
- target = Applitools::Selenium::Target.frame(frame).timeout(options[:timeout]).fully
353
- check(options[:tag], target)
354
- end
342
+ def add_text_trigger(_control, _text); end
355
343
 
356
- # Validates the contents of a region in an iframe and matches it with the expected output.
357
- #
358
- # @param [Hash] options The specific parameters of the desired screenshot.
359
- # @option options [String] :name_or_id The name or id of the target frame (deprecated. use :frame instead).
360
- # @option options [String] :frame_element The frame element (deprecated. use :frame instead).
361
- # @option options [String] :frame Frame element or frame name or frame id.
362
- # @option options [String] :tag An optional tag to be associated with the snapshot.
363
- # @option options [Symbol] :by By which identifier to find the region (e.g :css, :id).
364
- # @option options [Fixnum] :timeout The amount of time to retry matching. (Seconds)
365
- # @option options [Boolean] :stitch_content Whether to stitch the content or not.
366
- # @return [Applitools::MatchResult] The match results.
367
- def check_region_in_frame(options = {})
368
- options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil, stitch_content: false }.merge!(options)
369
- Applitools::ArgumentGuard.not_nil options[:by], 'options[:by]'
370
- Applitools::ArgumentGuard.is_a? options[:by], 'options[:by]', Array
371
-
372
- how_what = options.delete(:by)
373
- frame = options[:frame] || options[:frame_element] || options[:name_or_id]
374
-
375
- target = Applitools::Selenium::Target.new.timeout(options[:timeout])
376
- target.frame(frame) if frame
377
- target.fully if options[:stitch_content]
378
- target.region(*how_what)
379
-
380
- check(options[:tag], target)
381
- end
344
+ def ensure_frame_visible(*_args); end
382
345
 
383
- # Use this method to perform seamless testing with selenium through eyes driver.
384
- # It yields a block and passes to it an Applitools::Selenium::Driver instance, which wraps standard driver.
385
- # Using Selenium methods inside the 'test' block will send the messages to Selenium
386
- # after creating the Eyes triggers for them. Options are similar to {open}
387
- # @yieldparam driver [Applitools::Selenium::Driver] Gives a driver to a block, which translates calls to a native
388
- # Selemium::Driver instance
389
- # @example
390
- # eyes.test(app_name: 'my app', test_name: 'my test') do |driver|
391
- # driver.get "http://www.google.com"
392
- # driver.check_window("initial")
393
- # end
394
- def test(options = {}, &_block)
395
- open(options)
396
- yield(driver)
397
- close
398
- ensure
399
- abort_if_not_closed
400
- end
346
+ def reset_frames_scroll_position(*_args); end
401
347
  end
402
348
  end
403
349
  end