eyes_selenium 1.21.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjJjMzY0ZjBhZDViOGY0ZDExODA1Nzg5ZjBlZmJjMjNkM2ZkYjg2OQ==
4
+ M2JiODEyMDY5YjIyZTdhOGQ1MGE1NTdhOTU1MTQ5YjBkY2UyYzUyOQ==
5
5
  data.tar.gz: !binary |-
6
- MGQ5M2JmZjI0MWM2MWRmNGFmYzAzZWIxOTIzNzAyMmQzZGQxOWYxMg==
6
+ NmNhYWJiMzQ1ODhkZGY4ZDUzMGZmOGMxN2RhNWJjMDIxNGI1ZTkzYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzgwN2YyZDI2NzFkYWYwNWExMWNhODVlYTYxYTVmZDhmYjU0ZTJkM2M1YTkx
10
- ZWIzZWRlYzJiY2ZjM2UxMjExNGMyNTU5NDU4YWU3NmE3ZThiMTY0NmQyZDE1
11
- NzY3MTk1N2FiN2E0OWFiY2IyY2UxNzEyZDhlNjRkYTQyNTVjNzA=
9
+ YjYxZTY2NGM2ZThkNWQ3ODlkOWM3MjgxMzdmYzE2NDkyNzA5YjQ4ZGIwNzI3
10
+ NDA5MWFmZTUxZWZjMjM2NTM0ZDlhNWYzZWI5MDA2YTI2ZmIxNDdkNTNjZWMw
11
+ ZGY1NGQ0NzQwYWZlNDRkYjQzOGViMWZhYTM1ZmQzM2RmYTlkZTI=
12
12
  data.tar.gz: !binary |-
13
- OTU3YTNmMzE5YjhiMGE2ZjA3Y2Y0YjZjNDExNTY0NTk4MzMxNzdlZWQyNjJm
14
- YzNjZTJkNDZmYzcxNGExZmMxZjcyMmQ2NWJlYThlMGU4ODljNmQzODA5M2Nj
15
- ZmM5MDFkZjU5MTE2MWQwNDZjYzM1NzIxOTdhM2E4NGFjY2Q2ZmQ=
13
+ MWI1ZTc5ZTA2NDI3MWU1NjMwYTJhOGQ2MjEyNWYyZGQ5YjM5ODdlYWUwMjY5
14
+ ZDczOWUxOTA3NjMyNTFjNzkxYmFlYTNiOWY2MmU5MDMxMzMwMjFmNDM2YjQ3
15
+ OWZmMzdiOTI4MTE5NTRjODYyMzk5OWIwN2JiNWNkMjY0YmU2ODQ=
@@ -21,6 +21,7 @@ class Applitools::Driver
21
21
  @remote_server_url = address_of_remote_server
22
22
  @remote_session_id = remote_session_id
23
23
  begin
24
+ #noinspection RubyResolve
24
25
  if driver.capabilities.takes_screenshot?
25
26
  @screenshot_taker = false
26
27
  else
@@ -71,7 +72,7 @@ class Applitools::Driver
71
72
  end
72
73
 
73
74
  def user_agent
74
- execute_script "return navigator.userAgent"
75
+ execute_script 'return navigator.userAgent'
75
76
  rescue => e
76
77
  puts "getUserAgent(): Failed to obtain user-agent string (#{e.message})"
77
78
  end
@@ -79,11 +80,13 @@ class Applitools::Driver
79
80
  private
80
81
 
81
82
  def address_of_remote_server
82
- uri = URI(driver.current_url)
83
- raise Applitools::EyesError.new("Failed to get remote web driver url") if uri.to_s.empty?
83
+ # The driver's url is not available using a standard interface, so we use reflection to get it.
84
+ #noinspection RubyResolve
85
+ uri = URI(driver.instance_eval{@bridge}.instance_eval{@http}.instance_eval{@server_url})
86
+ raise Applitools::EyesError.new('Failed to get remote web driver url') if uri.to_s.empty?
84
87
 
85
88
  webdriver_host = uri.host
86
- if ['127.0.0.1', 'localhost'].include?(webdriver_host) && !firefox? && !ie?
89
+ if %w[127.0.0.1 localhost].include?(webdriver_host) && !firefox? && !ie?
87
90
  uri.host = get_local_ip || 'localhost'
88
91
  end
89
92
 
@@ -18,7 +18,8 @@ class Applitools::Eyes
18
18
 
19
19
  private
20
20
  attr_reader :agent_connector
21
- attr_accessor :session, :session_start_info, :match_window_task, :should_match_window_run_once_on_timeout
21
+ attr_accessor :session, :session_start_info, :match_window_task, :should_match_window_run_once_on_timeout,
22
+ :dont_get_title
22
23
 
23
24
  public
24
25
  attr_reader :disabled, :app_name, :test_name, :is_open, :viewport_size, :failure_reports, :match_level, :driver
@@ -33,6 +34,17 @@ class Applitools::Eyes
33
34
  self.class.api_key
34
35
  end
35
36
 
37
+ def title
38
+ unless dont_get_title
39
+ begin
40
+ return driver.title
41
+ rescue
42
+ self.dont_get_title = true
43
+ end
44
+ end
45
+ ''
46
+ end
47
+
36
48
  def initialize(params={})
37
49
 
38
50
  @disabled = params[:disabled]
@@ -51,6 +63,7 @@ class Applitools::Eyes
51
63
  @failure_reports = Applitools::FailureReports::ON_CLOSE
52
64
  @save_new_tests = true
53
65
  @save_failed_tests = false
66
+ @dont_get_title = false
54
67
  end
55
68
 
56
69
  def open(params={})
@@ -87,12 +100,12 @@ class Applitools::Eyes
87
100
  user_inputs.clear
88
101
  end
89
102
 
90
- def check_window(tag)
103
+ def check_window(tag=nil)
91
104
  return if disabled?
92
105
  raise Applitools::EyesError.new('Eyes not open') if !open?
93
106
  unless session
94
107
  start_session
95
- self.match_window_task = Applitools::MatchWindowTask.new(agent_connector, session, driver, match_timeout)
108
+ self.match_window_task = Applitools::MatchWindowTask.new(self, agent_connector, session, driver, match_timeout)
96
109
  end
97
110
 
98
111
  as_expected = match_window_task.match_window(tag, should_match_window_run_once_on_timeout)
@@ -154,7 +167,8 @@ class Applitools::Eyes
154
167
  # get "http://www.google.com"
155
168
  # check_window("initial")
156
169
  # end
157
- def test(params={})
170
+ #noinspection RubyUnusedLocalVariable
171
+ def test(params={}, &block)
158
172
  begin
159
173
  open(params)
160
174
  yield(driver)
@@ -3,13 +3,16 @@ require 'base64'
3
3
 
4
4
  class Applitools::MatchWindowTask
5
5
 
6
+ private
6
7
  MATCH_INTERVAL = 0.5
7
8
  AppOutput = Struct.new(:title, :screenshot64)
8
9
 
9
- attr_reader :agent_connector, :session, :driver, :max_window_load_time
10
+ attr_reader :eyes, :agent_connector, :session, :driver, :max_window_load_time
10
11
 
12
+ public
11
13
  ## max_load_time: maximum wait time for check window, in seconds
12
- def initialize(agent_connector, session, driver, max_window_load_time)
14
+ def initialize(eyes, agent_connector, session, driver, max_window_load_time)
15
+ @eyes = eyes
13
16
  @agent_connector = agent_connector
14
17
  @session = session
15
18
  @driver = driver
@@ -26,7 +29,7 @@ class Applitools::MatchWindowTask
26
29
  else
27
30
  run_with_intervals(tag, max_window_load_time)
28
31
  end
29
-
32
+ #noinspection RubyUnnecessaryReturnStatement
30
33
  driver.eyes.clear_user_inputs and return res
31
34
  end
32
35
 
@@ -51,7 +54,7 @@ class Applitools::MatchWindowTask
51
54
  private
52
55
 
53
56
  def prep_match_data(tag, ignore_mismatch)
54
- title = driver.title
57
+ title = eyes.title
55
58
  current_screenshot_encoded = Base64.decode64(driver.screenshot_as(:base64))
56
59
  @current_screenshot = ChunkyPNG::Image.from_blob(current_screenshot_encoded)
57
60
  compressed_screenshot = Applitools::Utils::ImageDeltaCompressor.compress_by_raw_blocks(@current_screenshot,
@@ -83,7 +86,6 @@ class Applitools::MatchWindowTask
83
86
  end
84
87
  end
85
88
  end
86
-
87
89
  Applitools::MatchWindowData.new(app_output, user_inputs, tag, ignore_mismatch, compressed_screenshot)
88
90
  end
89
91
 
@@ -91,9 +93,9 @@ class Applitools::MatchWindowTask
91
93
  data = prep_match_data(tag, ignore_mismatch)
92
94
  as_expected = agent_connector.match_window(session, data)
93
95
  # If the server stored this image, it will be used as a base for our next screenshot compression
94
- if !ignore_mismatch
96
+ unless ignore_mismatch
95
97
  @last_checked_window = @current_screenshot
96
98
  end
97
- return as_expected
99
+ as_expected
98
100
  end
99
101
  end
@@ -12,7 +12,7 @@ class Applitools::ScreenshotTaker
12
12
  end
13
13
 
14
14
  def screenshot
15
- res = self.class.get(driver_server_uri.gsub(/\/$/,"") + "/session/#{driver_session_id}/screenshot").to_s
15
+ res = self.class.get(driver_server_uri.to_s.gsub(/\/$/,"") + "/session/#{driver_session_id}/screenshot")
16
16
  res.parsed_response['value']
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '1.21.0'
2
+ VERSION = '1.22.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_selenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-08 00:00:00.000000000 Z
11
+ date: 2013-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver