eyes_selenium 3.1.1 → 3.2.1

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: 6896d25d23d811f8aca85bf603c0603bb0990ee3
4
- data.tar.gz: f0f99ac4def013f90e8a3efa66540f67f096bf4a
3
+ metadata.gz: e037337acd0f2a41bc0e035c240f932356872ec6
4
+ data.tar.gz: d0c6c9b63cd2deda518b9de3f692c1e7fdf2e0d9
5
5
  SHA512:
6
- metadata.gz: 621992921ad99724a5dce1ea5883dd071e2d3cd139486c6891434861e7afaab8a1043f293db0ad46ebed57ae7229bcbe58add4db8abb86bbed6e919e4cf545fd
7
- data.tar.gz: 540099b4c7dee3fabc8745615103519e008013154c7810880f4cdb55ba1613c9d1b75fe21f0196f9ab810497e5de6ea1cd885e4dab0eb9c949451284d060eaf6
6
+ metadata.gz: 68472b7e43372a9cd06239024ea150d7929a043352e9b02e2da663fafca71c1b45238766fc323cedf48a8b3917eeb8cf79ca674eb17cccb09347337384a72b7a
7
+ data.tar.gz: c9289c73be9483f507079909d3154fa160e1eb4be0683ce88b9ef83c4b1b40362f312dbcda3a593f3e6811077a7e0c5a24fb3a088bf1e0f54202b264a5880ccd
@@ -6,8 +6,10 @@ module Applitools::Selenium
6
6
 
7
7
  attr_accessor :last_state_position
8
8
 
9
- def initialize(executor)
9
+ def initialize(executor, disable_horizontal = false, disable_vertical = false)
10
10
  self.executor = executor
11
+ self.disable_horizontal = disable_horizontal
12
+ self.disable_vertical = disable_vertical
11
13
  end
12
14
 
13
15
  def current_position
@@ -45,14 +47,17 @@ module Applitools::Selenium
45
47
  alias scroll_to position=
46
48
 
47
49
  def entire_size
50
+ viewport_size = Applitools::Utils::EyesSeleniumUtils.extract_viewport_size(executor)
48
51
  e_size = Applitools::Utils::EyesSeleniumUtils.current_frame_content_entire_size(executor)
49
52
  logger.info "Entire size: #{e_size}"
53
+ e_size.width = viewport_size.width if disable_horizontal
54
+ e_size.height = viewport_size.height if disable_vertical
50
55
  e_size
51
56
  end
52
57
 
53
58
  private
54
59
 
55
- attr_accessor :executor
60
+ attr_accessor :executor, :disable_horizontal, :disable_vertical
56
61
 
57
62
  def get_position_from_transform(transform)
58
63
  regexp = /^translate\(\s*(\-?)(\d+)px,\s*(\-?)(\d+)px\s*\)/
@@ -73,7 +73,8 @@ module Applitools::Selenium
73
73
  # @return [boolean] stitch_mode (:CSS or :SCROLL)
74
74
 
75
75
  attr_accessor :base_agent_id, :screenshot, :force_full_page_screenshot, :hide_scrollbars,
76
- :wait_before_screenshots, :debug_screenshot, :stitch_mode
76
+ :wait_before_screenshots, :debug_screenshot, :stitch_mode, :disable_horizontal_scrolling,
77
+ :disable_vertical_scrolling
77
78
  attr_reader :driver
78
79
 
79
80
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
@@ -94,6 +95,8 @@ module Applitools::Selenium
94
95
  self.wait_before_screenshots = DEFAULT_WAIT_BEFORE_SCREENSHOTS
95
96
  self.region_visibility_strategy = MoveToRegionVisibilityStrategy.new
96
97
  self.debug_screenshot = false
98
+ self.disable_horizontal_scrolling = false
99
+ self.disable_vertical_scrolling = false
97
100
  end
98
101
 
99
102
  # Starts a test
@@ -136,7 +139,9 @@ module Applitools::Selenium
136
139
 
137
140
  self.device_pixel_ratio = UNKNOWN_DEVICE_PIXEL_RATIO
138
141
 
139
- self.position_provider = self.class.position_provider(stitch_mode, driver)
142
+ self.position_provider = self.class.position_provider(
143
+ stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling
144
+ )
140
145
 
141
146
  self.eyes_screenshot_factory = lambda do |image|
142
147
  Applitools::Selenium::EyesWebDriverScreenshot.new(
@@ -150,7 +155,11 @@ module Applitools::Selenium
150
155
 
151
156
  def stitch_mode=(value)
152
157
  @stitch_mode = value.to_s.upcase == STICH_MODE[:css].to_s ? STICH_MODE[:css] : STICH_MODE[:scroll]
153
- self.position_provider = self.class.position_provider(stitch_mode, driver) unless driver.nil?
158
+ unless driver.nil?
159
+ self.position_provider = self.class.position_provider(
160
+ stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling
161
+ )
162
+ end
154
163
  if stitch_mode == STICH_MODE[:css]
155
164
  @css_transition_original_hide_scrollbars = hide_scrollbars
156
165
  self.hide_scrollbars = true
@@ -909,12 +918,12 @@ module Applitools::Selenium
909
918
  end
910
919
 
911
920
  class << self
912
- def position_provider(stitch_mode, driver)
921
+ def position_provider(stitch_mode, driver, disable_horizontal = false, disable_vertical = false)
913
922
  case stitch_mode
914
923
  when :SCROLL
915
- Applitools::Selenium::ScrollPositionProvider.new(driver)
924
+ Applitools::Selenium::ScrollPositionProvider.new(driver, disable_horizontal, disable_vertical)
916
925
  when :CSS
917
- Applitools::Selenium::CssTranslatePositionProvider.new(driver)
926
+ Applitools::Selenium::CssTranslatePositionProvider.new(driver, disable_horizontal, disable_vertical)
918
927
  end
919
928
  end
920
929
  end
@@ -5,8 +5,10 @@ module Applitools::Selenium
5
5
 
6
6
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
7
7
 
8
- def initialize(executor)
8
+ def initialize(executor, disable_horizontal = false, disable_vertical = false)
9
9
  self.executor = executor
10
+ self.disable_horizontal = disable_horizontal
11
+ self.disable_vertical = disable_vertical
10
12
  end
11
13
 
12
14
  # The scroll position of the current frame
@@ -36,8 +38,11 @@ module Applitools::Selenium
36
38
  alias scroll_to position=
37
39
 
38
40
  def entire_size
41
+ viewport_size = Applitools::Utils::EyesSeleniumUtils.extract_viewport_size(executor)
39
42
  result = Applitools::Utils::EyesSeleniumUtils.entire_page_size(executor)
40
43
  logger.info "Entire size: #{result}"
44
+ result.width = viewport_size.width if disable_horizontal
45
+ result.height = viewport_size.height if disable_vertical
41
46
  result
42
47
  end
43
48
 
@@ -47,6 +52,6 @@ module Applitools::Selenium
47
52
 
48
53
  private
49
54
 
50
- attr_accessor :executor
55
+ attr_accessor :executor, :disable_horizontal, :disable_vertical
51
56
  end
52
57
  end
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.1.1'.freeze
2
+ VERSION = '3.2.1'.freeze
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: 3.1.1
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2017-04-13 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.1.1
19
+ version: 3.2.1
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.1.1
26
+ version: 3.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement