eyes_selenium 3.17.1 → 3.17.2

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
  SHA256:
3
- metadata.gz: a68618962f93a2f434448a9e22666248db5007280c5fc3393694456561a4852d
4
- data.tar.gz: 0ccafcaf697695aa88b96797724d5bf55e0a39ae85a9b89add2b91ca45f442d5
3
+ metadata.gz: 8bbe944af9ea20d3d0afde5ae4e96b6b33d42e4e171e4bfb1d4dc0a4866e1056
4
+ data.tar.gz: 1cfc9ec471f9f02944189c0e442c59530e8ea37e8a586e04128191ef401316ed
5
5
  SHA512:
6
- metadata.gz: 45eb18dbb440f090a57ee7c1de358205e8d18998c368335240ff5f677072e2f6045e4643e596a3b99b811aff88cd6b4572c55f7125dc0c0453b92193104fec0b
7
- data.tar.gz: dc91239a1144ef2f0eb751a58f1977f41e23e7c5e6aa389af760fded8f0bb9f822bc1bdb7ea64c4cac93b93831f70b677b6526f6f3be7fffd5af9010cb964951
6
+ metadata.gz: d6e40409125ded5b69be42f291a23a7dc61b61c54420eaaa5ca397b279e8d4b33931b446ffdd2f03c20a28ebd73dfc2d9d9c21dd6fd8e65e81707f649d574c50
7
+ data.tar.gz: abd633ddeaef17adf5f937c00a149956b4b5587356bc2ec5467e88e4374f99716b47f7e964f35a1553776a5ac0e36267e51df947f7c8c05c365b874c31f496e1
@@ -12,6 +12,7 @@ module BrowserTypes
12
12
  SAFARI = :'safari-0'
13
13
  SAFARI_ONE_VERSION_BACK = :'safari-1'
14
14
  SAFARI_TWO_VERSIONS_BACK = :'safari-2'
15
+ IOS_SAFARI = :safari
15
16
 
16
17
  EDGE_CHROMIUM = :'edgechromium'
17
18
  EDGE_CHROMIUM_ONE_VERSION_BACK = :'edgechromium-1'
@@ -52,7 +53,8 @@ module BrowserTypes
52
53
  EDGE_LEGACY,
53
54
  IE_10,
54
55
  EDGE_CHROMIUM,
55
- EDGE_CHROMIUM_ONE_VERSION_BACK
56
+ EDGE_CHROMIUM_ONE_VERSION_BACK,
57
+ IOS_SAFARI
56
58
  ]
57
59
  end
58
60
  end
@@ -4,7 +4,7 @@ module Applitools
4
4
  module Selenium
5
5
  class BrowsersInfo < Set
6
6
  def add(obj)
7
- return super if obj.is_a? Applitools::Selenium::RenderBrowserInfo
7
+ return super if obj.is_a? Applitools::Selenium::IRenderBrowserInfo
8
8
  raise(
9
9
  Applitools::EyesIllegalArgument,
10
10
  'It is expected the value to be an Applitools::Selenium::RenderBrowserInfo instance,' \
@@ -15,7 +15,7 @@ module Applitools
15
15
  def each(viewport_size = nil)
16
16
  return super() unless empty?
17
17
  return unless viewport_size
18
- default = Applitools::Selenium::RenderBrowserInfo.new.tap do |bi|
18
+ default = Applitools::Selenium::DesktopBrowserInfo.new.tap do |bi|
19
19
  bi.viewport_size = viewport_size
20
20
  bi.browser_type = BrowserTypes::CHROME
21
21
  end
@@ -36,11 +36,17 @@ module Applitools
36
36
 
37
37
  def add_browser(*args)
38
38
  case args.size
39
- when 0, 1
39
+ when 0
40
+ browser = Applitools::Selenium::DesktopBrowserInfo.new
41
+ when 1
40
42
  b = args[0]
41
- browser = b || Applitools::Selenium::RenderBrowserInfo.new
43
+ raise(
44
+ Applitools::EyesIllegalArgument,
45
+ 'Expected :browser to be an IRenderBrowserInfo instance!'
46
+ ) unless b.is_a? IRenderBrowserInfo
47
+ browser = b
42
48
  when 3
43
- browser = Applitools::Selenium::RenderBrowserInfo.new.tap do |bi|
49
+ browser = Applitools::Selenium::DesktopBrowserInfo.new.tap do |bi|
44
50
  bi.viewport_size = Applitools::RectangleSize.new(args[0], args[1])
45
51
  bi.browser_type = args[2]
46
52
  end
@@ -51,11 +57,18 @@ module Applitools
51
57
  self
52
58
  end
53
59
 
60
+ def add_browsers(browsers)
61
+ browsers.each do |browser|
62
+ add_browser(browser)
63
+ end
64
+ self
65
+ end
66
+
54
67
  def add_device_emulation(device_name, orientation = Orientations::PORTRAIT)
55
68
  Applitools::ArgumentGuard.not_nil device_name, 'device_name'
56
69
  raise Applitools::EyesIllegalArgument, 'Wrong device name!' unless Devices.enum_values.include? device_name
57
70
  emu = Applitools::Selenium::ChromeEmulationInfo.new(device_name, orientation)
58
- add_browser { |b| b.emulation_info(emu) }
71
+ add_browser emu
59
72
  end
60
73
 
61
74
  def viewport_size
@@ -66,6 +79,7 @@ module Applitools
66
79
  return from_browsers_info.viewport_size if from_browsers_info
67
80
  nil
68
81
  end
82
+
69
83
  end
70
84
  end
71
85
  end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  module Orientations
3
+ extend self
3
4
  PORTRAIT = 'portrait'
4
5
  LANDSCAPE = 'landscape'
6
+
7
+ def enum_values
8
+ [PORTRAIT, LANDSCAPE]
9
+ end
5
10
  end
@@ -1,20 +1,51 @@
1
1
  # frozen_string_literal: true
2
- require 'applitools/selenium/visual_grid/emulation_base_info'
2
+ require_relative 'emulation_base_info'
3
+ require_relative 'i_render_browser_info'
3
4
  module Applitools
4
5
  module Selenium
5
- class ChromeEmulationInfo < EmulationBaseInfo
6
- attr_accessor :device_name
6
+ class ChromeEmulationInfo < IRenderBrowserInfo
7
+ DEFAULT_CONFIG = proc do
8
+ {
9
+ platform: 'linux',
10
+ browser_type: BrowserTypes::CHROME,
11
+ # size_mode: 'full-page',
12
+ viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
13
+ }
14
+ end
15
+ class << self
16
+ def default_config
17
+ DEFAULT_CONFIG.call
18
+ end
19
+ end
7
20
 
8
- def initialize(device_name, screen_orientation)
9
- super(screen_orientation)
10
- self.device_name = device_name
21
+ def initialize(*args)
22
+ super()
23
+ case args[0]
24
+ when String
25
+ self.emulation_info = EmulationInfo.new.tap do |ei|
26
+ ei.device_name = args[0]
27
+ ei.screen_orientation = args[1] || Orientations::PORTRAIT
28
+ end
29
+ when Hash
30
+ self.emulation_info = EmulationInfo.new.tap do |ei|
31
+ ei.device_name = args[0][:device_name]
32
+ ei.screen_orientation = args[0][:screen_orientation] || Orientations::PORTRAIT
33
+ end
34
+ end
11
35
  end
12
36
 
13
- def json_data
14
- {
15
- deviceName: device_name,
16
- screenOrientation: screen_orientation
17
- }
37
+ private
38
+
39
+ class EmulationInfo < Applitools::Selenium::EmulationBaseInfo
40
+ enum_field :device_name, Devices.enum_values
41
+ enum_field :screen_orientation, Orientations.enum_values
42
+
43
+ def json_data
44
+ {
45
+ :'deviceName' => device_name,
46
+ :'screenOrientation' => screen_orientation
47
+ }
48
+ end
18
49
  end
19
50
  end
20
51
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+ require 'applitools/selenium/browser_types'
3
+
4
+ module Applitools
5
+ module Selenium
6
+ class DesktopBrowserInfo < IRenderBrowserInfo
7
+ DEFAULT_CONFIG = proc do
8
+ {
9
+ platform: 'linux',
10
+ browser_type: BrowserTypes::CHROME,
11
+ # size_mode: 'full-page',
12
+ viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
13
+ }
14
+ end
15
+
16
+ class << self
17
+ def default_config
18
+ DEFAULT_CONFIG.call
19
+ end
20
+ end
21
+
22
+ def initialize(options = {})
23
+ super()
24
+ if options[:width] && options[:height]
25
+ self.viewport_size = Applitools::RectangleSize.from_any_argument(width: options[:width], height: options[:height])
26
+ end
27
+ self.browser_type = options[:browser_type] if options[:browser_type]
28
+ end
29
+
30
+ def platform
31
+ case browser_type
32
+ when BrowserTypes::EDGE_LEGACY, BrowserTypes::EDGE_CHROMIUM, BrowserTypes::EDGE_CHROMIUM_ONE_VERSION_BACK
33
+ 'windows'
34
+ else
35
+ 'linux'
36
+ end
37
+ end
38
+
39
+ end
40
+ end
41
+ end
42
+
43
+ Applitools::Selenium::RenderBrowserInfo = Applitools::Selenium::DesktopBrowserInfo
@@ -1,14 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Applitools
3
3
  module Selenium
4
- class EmulationBaseInfo
5
- extend Applitools::Helpers
6
- attr_accessor :screen_orientation
7
- abstract_attr_accessor :device_name
8
-
9
- def initialize(screen_orientation)
10
- self.screen_orientation = screen_orientation
11
- end
4
+ class EmulationBaseInfo < Applitools::AbstractConfiguration
12
5
  end
13
6
  end
14
7
  end
@@ -0,0 +1,19 @@
1
+ module Applitools
2
+ module Selenium
3
+ class IRenderBrowserInfo < ::Applitools::AbstractConfiguration
4
+
5
+ object_field :viewport_size, Applitools::RectangleSize
6
+ enum_field :browser_type, BrowserTypes.enum_values
7
+ string_field :platform
8
+ string_field :size_mode
9
+ string_field :baseline_env_name
10
+ object_field :emulation_info, Applitools::Selenium::EmulationBaseInfo
11
+ object_field :ios_device_info, Applitools::Selenium::EmulationBaseInfo
12
+
13
+ def to_s
14
+ return "#{viewport_size} (#{browser_type})" unless emulation_info
15
+ "#{emulation_info.device_name} - #{emulation_info.screen_orientation}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ require_relative 'ios_device_name'
2
+ require_relative 'ios_screen_orientation'
3
+ module Applitools
4
+ module Selenium
5
+ class IosDeviceInfo < IRenderBrowserInfo
6
+ DEFAULT_CONFIG = proc do
7
+ {
8
+ platform: 'ios',
9
+ browser_type: BrowserTypes::IOS_SAFARI,
10
+ # size_mode: 'full-page',
11
+ viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
12
+ }
13
+ end
14
+ class << self
15
+ def default_config
16
+ DEFAULT_CONFIG.call
17
+ end
18
+ end
19
+
20
+
21
+ def initialize(options = {})
22
+ super()
23
+ self.ios_device_info = EmulationInfo.new.tap do |ei|
24
+ ei.device_name = options[:device_name]
25
+ ei.screen_orientation = options[:screen_orientation] || IosScreenshotOrientations::PORTRAIT
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ class EmulationInfo < EmulationBaseInfo
32
+ enum_field :device_name, IosDeviceName.enum_values
33
+ enum_field :screen_orientation, IosScreenshotOrientations.enum_values
34
+
35
+ def json_data
36
+ {
37
+ name: device_name,
38
+ screenOrientation: screen_orientation,
39
+ version: 'latest'
40
+ }
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,30 @@
1
+ module IosDeviceName
2
+ extend self
3
+ IPhone_11_Pro = 'iPhone 11 Pro'
4
+ IPhone_11_Pro_Max = 'iPhone 11 Pro Max'
5
+ IPhone_11 = 'iPhone 11'
6
+ IPhone_XR = 'iPhone XR'
7
+ IPhone_XS = 'iPhone Xs'
8
+ IPhone_X = 'iPhone X'
9
+ IPhone_8 = 'iPhone 8'
10
+ IPhone_7 = 'iPhone 7'
11
+ IPad_Pro_3 = 'iPad Pro (12.9-inch) (3rd generation)'
12
+ IPad_7 = 'iPad (7th generation)'
13
+ IPad_Air_2 = 'iPad Air (2nd generation)'
14
+
15
+ def enum_values
16
+ [
17
+ IPhone_11_Pro,
18
+ IPhone_11_Pro_Max,
19
+ IPhone_11,
20
+ IPhone_XR,
21
+ IPhone_XS,
22
+ IPhone_X,
23
+ IPhone_8,
24
+ IPhone_7,
25
+ IPad_Pro_3,
26
+ IPad_7,
27
+ IPad_Air_2
28
+ ]
29
+ end
30
+ end
@@ -0,0 +1,14 @@
1
+ module IosScreenshotOrientations
2
+ extend self
3
+ PORTRAIT ='portrait'
4
+ LANDSCAPE_LEFT = 'landscapeLeft'
5
+ LANDSCAPE_RIGHT = 'landscapeRight'
6
+
7
+ def enum_values
8
+ [
9
+ PORTRAIT,
10
+ LANDSCAPE_LEFT,
11
+ LANDSCAPE_RIGHT
12
+ ]
13
+ end
14
+ end
@@ -3,7 +3,7 @@ module Applitools
3
3
  module Selenium
4
4
  class RenderInfo
5
5
  include Applitools::Jsonable
6
- json_fields :width, :height, :sizeMode, :emulationInfo, :region, :selector
6
+ json_fields :width, :height, :sizeMode, :emulationInfo, :region, :selector, :IosDeviceInfo
7
7
  # , :region, :emulationInfo
8
8
 
9
9
  def json_data
@@ -13,6 +13,7 @@ module Applitools
13
13
  sizeMode: size_mode
14
14
  }
15
15
  result['emulationInfo'] = json_value(emulation_info) if emulation_info
16
+ result['iosDeviceInfo'] = json_value(ios_device_info) if ios_device_info
16
17
  result['region'] = json_value(region) if size_mode == 'region'
17
18
  result['selector'] = json_value(region) if size_mode == 'selector'
18
19
  result
@@ -8,7 +8,7 @@ module Applitools
8
8
  json_fields :renderId, :webhook, :url, :dom, :resources, :scriptHooks,
9
9
  :selectorsToFindRegionsFor, :sendDom, :agentId
10
10
 
11
- json_fields :renderInfo, :browser
11
+ json_fields :renderInfo, :browser, :platform
12
12
 
13
13
  def initialize(*args)
14
14
  options = Applitools::Utils.extract_options! args
@@ -249,6 +249,7 @@ module Applitools
249
249
  r.size_mode = size_mode
250
250
  r.region = region_to_check
251
251
  r.emulation_info = running_test.browser_info.emulation_info if running_test.browser_info.emulation_info
252
+ r.ios_device_info = running_test.browser_info.ios_device_info if running_test.browser_info.ios_device_info
252
253
  end
253
254
 
254
255
  requests << Applitools::Selenium::RenderRequest.new(
@@ -257,7 +258,8 @@ module Applitools
257
258
  dom: dom,
258
259
  resources: request_resources,
259
260
  render_info: r_info,
260
- browser: { name: running_test.browser_info.browser_type, platform: running_test.browser_info.platform },
261
+ browser: { name: running_test.browser_info.browser_type },
262
+ platform: { name: running_test.browser_info.platform },
261
263
  script_hooks: script_hooks,
262
264
  selectors_to_find_regions_for: region_selectors,
263
265
  send_dom: if running_test.eyes.configuration.send_dom.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.17.1'.freeze
4
+ VERSION = '3.17.2'.freeze
5
5
  end
@@ -20,8 +20,8 @@ end
20
20
 
21
21
  Applitools::Selenium.require_dir 'selenium/concerns'
22
22
  Applitools::Selenium.require_dir 'selenium/scripts'
23
- Applitools::Selenium.require_dir 'selenium/visual_grid'
24
23
  Applitools::Selenium.require_dir 'selenium'
24
+ Applitools::Selenium.require_dir 'selenium/visual_grid'
25
25
  Applitools::Selenium.require_dir 'selenium/dom_capture'
26
26
  Applitools::Selenium.require_dir 'selenium/css_parser'
27
27
 
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: 3.17.1
4
+ version: 3.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eyes_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.17.1
19
+ version: 3.17.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.17.1
26
+ version: 3.17.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -150,9 +150,13 @@ files:
150
150
  - lib/applitools/selenium/viewport_screenshot.rb
151
151
  - lib/applitools/selenium/viewport_size.rb
152
152
  - lib/applitools/selenium/visual_grid/chrome_emulation_info.rb
153
+ - lib/applitools/selenium/visual_grid/desktop_browser_info.rb
153
154
  - lib/applitools/selenium/visual_grid/emulation_base_info.rb
154
155
  - lib/applitools/selenium/visual_grid/eyes_connector.rb
155
- - lib/applitools/selenium/visual_grid/render_browser_info.rb
156
+ - lib/applitools/selenium/visual_grid/i_render_browser_info.rb
157
+ - lib/applitools/selenium/visual_grid/ios_device_info.rb
158
+ - lib/applitools/selenium/visual_grid/ios_device_name.rb
159
+ - lib/applitools/selenium/visual_grid/ios_screen_orientation.rb
156
160
  - lib/applitools/selenium/visual_grid/render_info.rb
157
161
  - lib/applitools/selenium/visual_grid/render_request.rb
158
162
  - lib/applitools/selenium/visual_grid/render_requests.rb
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'applitools/selenium/browser_types'
3
-
4
- module Applitools
5
- module Selenium
6
- class RenderBrowserInfo < ::Applitools::AbstractConfiguration
7
- DEFAULT_CONFIG = proc do
8
- {
9
- platform: 'linux',
10
- browser_type: BrowserTypes::CHROME,
11
- # size_mode: 'full-page',
12
- viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
13
- }
14
- end
15
- class << self
16
- def default_config
17
- DEFAULT_CONFIG.call
18
- end
19
- end
20
-
21
- object_field :viewport_size, Applitools::RectangleSize
22
- enum_field :browser_type, BrowserTypes.enum_values
23
- string_field :platform
24
- string_field :size_mode
25
- string_field :baseline_env_name
26
- object_field :emulation_info, Applitools::Selenium::EmulationBaseInfo
27
-
28
- def platform
29
- case browser_type
30
- when BrowserTypes::EDGE_LEGACY, BrowserTypes::EDGE_CHROMIUM, BrowserTypes::EDGE_CHROMIUM_ONE_VERSION_BACK
31
- 'windows'
32
- else
33
- 'linux'
34
- end
35
- end
36
-
37
- def to_s
38
- return "#{viewport_size} (#{browser_type})" unless emulation_info
39
- "#{emulation_info.device_name} - #{emulation_info.screen_orientation}"
40
- end
41
- end
42
- end
43
- end