automation_helpers 7.0 → 7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de65c70c0d33f66469440532cf8a4d49840e8b4e48cc653dca9fc2d20280c9ee
4
- data.tar.gz: b79dfae24f4df076559ddb46270b32ef2ab5168f3e12b1f3565a060d5673fc3a
3
+ metadata.gz: 0ad027de7b1fd9a155b469103b22ce22b4f5e530350eb36da72647f18ec12bde
4
+ data.tar.gz: 1d86d8568cc4d0ce42364a94325480ee4ae4cb714e211041d58a52f01e6fd5fd
5
5
  SHA512:
6
- metadata.gz: 0febf6c2eaba22e6bda884a435388e57967aea3f8556f68a7f445be96a1a9534ee980cf4e80fc0731694185e716f9734c714b9d6747f31e516ae2236446e196e
7
- data.tar.gz: eda61bc6fb061175fa91d996661748143fa0ae962257b1bc9ead36827e0a469b75285bf77257c48e8f69e1779c01dee0776276acac51496e464f9a9b2cca0557
6
+ metadata.gz: a0536aea7a3a41266b35adb04f4cac2a4e56015b0a44ffd0a6fd50ea93c383f86b75f5545f15411843eb467bc0bf9d2c021ddf06d2ccad781632aa7953b10b4c
7
+ data.tar.gz: b75b94ef7d572d74bacb8c9e0386aa549b8af3101a079b1eb059b829f439e31082e0f16bd1655a7afa4342ec162abc8104c20bf53b1a4be8b70e9e637a329514
@@ -20,6 +20,17 @@ module Capybara
20
20
  native.rect.y.to_i
21
21
  end
22
22
 
23
+ # @return [Capybara::Node::Element]
24
+ #
25
+ # Scrolls the element directly into view. Useful to mitigate vs stale element errors
26
+ def scroll_into_view
27
+ session.driver.browser.execute_script(
28
+ "arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});",
29
+ native
30
+ )
31
+ self
32
+ end
33
+
23
34
  # @return [Boolean]
24
35
  #
25
36
  # Whether the element is in a stale state or not
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HTTP
4
+ #
5
+ # Additional useful methods to extend the HTTP::Cookie class with
6
+ #
7
+ class Cookie
8
+ # @return [Hash]
9
+ #
10
+ # A hashified representation of the cookie that will enable you to push it into Selenium Manager
11
+ def to_h
12
+ {
13
+ name: name,
14
+ value: value,
15
+ path: path,
16
+ secure: secure,
17
+ expires: expires
18
+ }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HTTP
4
+ #
5
+ # Additional useful methods to extend the HTTP::CookieJar class with
6
+ #
7
+ class CookieJar
8
+ # @return [HTTP::Cookie, nil]
9
+ #
10
+ # The cookie that has the supplied name
11
+ def cookie_named(name)
12
+ cookies.detect { |cookie| cookie.name == name }
13
+ end
14
+
15
+ # @return [Boolean]
16
+ #
17
+ # Whether the cookie jar contains the cookie with the supplied name
18
+ def include?(cookie_name)
19
+ cookies.any? { |cookie| cookie.name == cookie_name }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Selenium
4
+ module WebDriver
5
+ #
6
+ # Additional useful methods to extend the Selenium::WebDriver::Element class with
7
+ #
8
+ class Element
9
+ # @return [Selenium::WebDriver::Element]
10
+ #
11
+ # Scrolls the element directly into view. Useful to mitigate vs stale element errors
12
+ def scroll_into_view
13
+ @bridge.execute_script(
14
+ "arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});",
15
+ self
16
+ )
17
+ self
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'automation_helpers/extensions/capybara/node/element'
4
4
  require 'automation_helpers/extensions/cucumber/core/test/case'
5
+ require 'automation_helpers/extensions/http-cookie/cookie'
6
+ require 'automation_helpers/extensions/http-cookie/cookie_jar'
7
+ require 'automation_helpers/extensions/selenium/webdriver/element'
5
8
  require 'automation_helpers/extensions/selenium/webdriver/logs'
6
9
  require 'automation_helpers/extensions/array'
7
10
  require 'automation_helpers/extensions/string'
@@ -15,6 +15,8 @@ module AutomationHelpers
15
15
  This was introduced over a decade ago and given the propensity for new windows to be opened in the course of testing,
16
16
  this is a significant issue for users of Capybara and Selenium.
17
17
 
18
+ NB: WHEN USING THIS PATCH, NETWORK INTERCEPTION IS AFFECTED. DO NOT USE THIS PATCH IF YOU RELY ON NETWORK INTERCEPTION IN YOUR TESTS.
19
+
18
20
  See https://github.com/teamcapybara/capybara/issues/2834 for more details.
19
21
  DESCRIPTION
20
22
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AutomationHelpers
4
+ module Patches
5
+ #
6
+ # Fix the issue where the `#expires=` writer method doesn't permit DateTime objects
7
+ #
8
+ class HTTPCookie < Base
9
+ private
10
+
11
+ def description
12
+ <<~DESCRIPTION
13
+ There is a bug/missing piece of functionality in the #expires= writer in HTTP::Cookie
14
+ Selenium cookies (And by default w3c cookies), come with a DateTime class for the expiry
15
+
16
+ See https://github.com/sparklemotion/http-cookie/pull/52 for more details about a potential extension.
17
+ DESCRIPTION
18
+ end
19
+
20
+ def perform
21
+ ::HTTP::Cookie.prepend HTTPCookiePatch
22
+ end
23
+ end
24
+
25
+ #
26
+ # @api private
27
+ #
28
+ module HTTPCookiePatch
29
+ # Permit DateTime objects to be cast in HTTP::Cookie
30
+ def expires=(datetime)
31
+ datetime = datetime.to_time if datetime.is_a?(DateTime)
32
+ super
33
+ end
34
+ end
35
+ end
36
+ end
@@ -3,4 +3,5 @@
3
3
  require 'automation_helpers/patches/base'
4
4
  require 'automation_helpers/patches/capybara_safari'
5
5
  require 'automation_helpers/patches/capybara_window'
6
+ require 'automation_helpers/patches/http_cookie'
6
7
  require 'automation_helpers/patches/selenium_logger'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutomationHelpers
4
- VERSION = '7.0'
4
+ VERSION = '7.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automation_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: '7.0'
4
+ version: '7.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Hill
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-03-06 00:00:00.000000000 Z
12
+ date: 2026-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '7.0'
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
- version: '11'
43
+ version: '13'
44
44
  type: :development
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: '7.0'
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '11'
53
+ version: '13'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: faraday
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -65,34 +65,48 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '2.8'
68
+ - !ruby/object:Gem::Dependency
69
+ name: http-cookie
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: rspec
70
84
  requirement: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '3.12'
88
+ version: '3.13'
75
89
  type: :development
76
90
  prerelease: false
77
91
  version_requirements: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '3.12'
95
+ version: '3.13'
82
96
  - !ruby/object:Gem::Dependency
83
97
  name: rubocop
84
98
  requirement: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: 1.85.1
102
+ version: 1.88.0
89
103
  type: :development
90
104
  prerelease: false
91
105
  version_requirements: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: 1.85.1
109
+ version: 1.88.0
96
110
  - !ruby/object:Gem::Dependency
97
111
  name: rubocop-performance
98
112
  requirement: !ruby/object:Gem::Requirement
@@ -113,28 +127,28 @@ dependencies:
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: 3.9.0
130
+ version: 3.10.2
117
131
  type: :development
118
132
  prerelease: false
119
133
  version_requirements: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: 3.9.0
137
+ version: 3.10.2
124
138
  - !ruby/object:Gem::Dependency
125
139
  name: selenium-webdriver
126
140
  requirement: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: '4.18'
144
+ version: '4.22'
131
145
  type: :development
132
146
  prerelease: false
133
147
  version_requirements: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '4.18'
151
+ version: '4.22'
138
152
  description: Automation Patches / Extensions that allow you to extend your Ruby-based
139
153
  testing frameworks
140
154
  email:
@@ -161,12 +175,16 @@ files:
161
175
  - lib/automation_helpers/extensions/array.rb
162
176
  - lib/automation_helpers/extensions/capybara/node/element.rb
163
177
  - lib/automation_helpers/extensions/cucumber/core/test/case.rb
178
+ - lib/automation_helpers/extensions/http-cookie/cookie.rb
179
+ - lib/automation_helpers/extensions/http-cookie/cookie_jar.rb
180
+ - lib/automation_helpers/extensions/selenium/webdriver/element.rb
164
181
  - lib/automation_helpers/extensions/selenium/webdriver/logs.rb
165
182
  - lib/automation_helpers/extensions/string.rb
166
183
  - lib/automation_helpers/patches.rb
167
184
  - lib/automation_helpers/patches/base.rb
168
185
  - lib/automation_helpers/patches/capybara_safari.rb
169
186
  - lib/automation_helpers/patches/capybara_window.rb
187
+ - lib/automation_helpers/patches/http_cookie.rb
170
188
  - lib/automation_helpers/patches/selenium_logger.rb
171
189
  - lib/automation_helpers/version.rb
172
190
  homepage: https://www.github.com/site-prism/automation_helpers