capybara-box 1.2.0 → 2.0.0

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: fe208d8f8fb951f498d76fe53640da096df8c4d4e32c44e065b3e6eb240d1265
4
- data.tar.gz: 99fcc0e8620c7d44f11783a36509781bd4ebb08da0565948dcd3972fab0af89b
3
+ metadata.gz: 36511931656f10de7c80d90cbe83b522c6ed25f3bfaace63b9c6b60bc5e7410b
4
+ data.tar.gz: 338ed081d496d5507b551cca46143478171374d31bf22bdbc89a341d481ec908
5
5
  SHA512:
6
- metadata.gz: 05dc1e17050c6d4790914138d39cf0199824ca854ab8efbebf7f48a34206dd7c61894d2a5a94989605fe8e8172ac9f61519ce050b3791e34eb5cc8fb4ed6cadb
7
- data.tar.gz: 82ee9c9d6a1a7cef8d80c9a3711c187d09365bf3c20e2039660c31fc79411c8070e933a984942932471cf8834fac816fee6e11b0608f755c93983a601ece4f33
6
+ metadata.gz: 66ae7025a66c1fbbde2f59bd73ba2e421c62e2a61fdce2d759cdb3c8d84492ee96752f616158eb3d6bd02b7ebc7684c64c8d10e359dc23c1281dbe1201d43f53
7
+ data.tar.gz: d5dbb4ad547f2511c9989f41e87153e20d28e3014c23de4f0081f8c4fcc6851d7a46e1c40fc8a079db61ebd5b92cee9704d2bd7af52fc8a7cb650b40dafda20f
data/CHANGELOG.md CHANGED
@@ -1,80 +1,90 @@
1
- # v1.2.0
1
+ ## v2.0.0
2
2
 
3
- ## Updates
3
+ ### Break Change
4
+
5
+ - The option `log: Boolean` was replaced by `logger: Hash` wher you can configure the `level` and the `output` path.
6
+
7
+ ### Update
8
+
9
+ - Adds support to Ruby 3;
10
+
11
+ ## v1.2.0
12
+
13
+ ### Update
4
14
 
5
15
  - Avoids deprecated Selenium `:options`;
6
16
 
7
- # v1.1.2
17
+ ## v1.1.2
8
18
 
9
- ## Fixes
19
+ ### Bugfix
10
20
 
11
21
  - Avoid apply blank bin path;
12
22
  - Avoid apply blank version;
13
23
 
14
- # v1.1.1
24
+ ## v1.1.1
15
25
 
16
- ## Fixes
26
+ ### Bugfix
17
27
 
18
28
  - Removes default args that was avoiding screen render.
19
29
 
20
- # v1.1.0
30
+ ## v1.1.0
21
31
 
22
- ## Fixes
32
+ ### Bugfix
23
33
 
24
34
  - S3 config activation;
25
35
 
26
- ## Updates
36
+ ### Update
27
37
 
28
38
  - Adds more default arguments;
29
39
 
30
- # v1.0.1
40
+ ## v1.0.1
31
41
 
32
- ## Fixes
42
+ ### Bugfix
33
43
 
34
44
  - Registers driver name as symbol;
35
45
 
36
- # v1.0.0
46
+ ## v1.0.0
37
47
 
38
- ## Updates
48
+ ### Update
39
49
 
40
50
  - Updated default arguments;
41
51
  - Spec files now is excluded from gem pack;
42
52
 
43
- ## Features
53
+ ### Features
44
54
 
45
55
  - Capybara `load_selenium` is called before startup;
46
56
  - Screenshot S3 feature now is configure only via ENV;
47
57
  - Using new gem `webdrivers`;
48
58
 
49
- ## Fixes
59
+ ### Bugfix
50
60
 
51
61
  - Fix screenshot upload;
52
62
 
53
- # v0.4.0
63
+ ## v0.4.0
54
64
 
55
- ## Updates
65
+ ### Update
56
66
 
57
67
  - Selenium WebDriver deprecated message;
58
68
 
59
- # v0.3.0
69
+ ## v0.3.0
60
70
 
61
- ## Updates
71
+ ### Update
62
72
 
63
73
  - Drops Rack Session Access internal require;
64
74
  - Makes `chromedriver-helper` optional.
65
75
 
66
- # v0.2.1
76
+ ## v0.2.1
67
77
 
68
- ## Fixes
78
+ ### Bugfix
69
79
 
70
80
  - `chrome_headless` was being registered with wrong name.
71
81
 
72
- # v0.2.0
82
+ ## v0.2.0
73
83
 
74
- ## Features
84
+ ### Features
75
85
 
76
86
  - Add log feature for Chrome and Chrome Headless.
77
87
 
78
- # v0.1.0
88
+ ## v0.1.0
79
89
 
80
90
  - First release.
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/capybara-box.svg)](https://badge.fury.io/rb/capybara-box)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/f312587b4f126bb13e85/maintainability)](https://codeclimate.com/github/wbotelhos/capybara-box/maintainability)
6
6
  [![Coverage](https://codecov.io/gh/wbotelhos/capybara-box/branch/main/graph/badge.svg)](https://codecov.io/gh/wbotelhos/capybara-box)
7
- [![Sponsor](https://img.shields.io/badge/sponsor-%3C3-green)](https://www.patreon.com/wbotelhos)
7
+ [![Sponsor](https://img.shields.io/badge/sponsor-%3C3-green)](https://github.com/sponsors/wbotelhos)
8
8
 
9
9
  Configure Capybara with **Chrome**, **Chrome Headless**, **Firefox** and **Firefox Headless** with *Screenshot* feature without losing your mind.
10
10
 
@@ -124,21 +124,10 @@ You can override all driver options:
124
124
  CapybaraBox.configure(driver_options: { clear_local_storage: true })
125
125
  ```
126
126
 
127
- ## Log
127
+ ## Logger
128
128
 
129
- Log is writen at `log/capybara-box.log` as default.
130
- You can see each command executed. Time spent between them and debug some hanging command. :tada:
129
+ Logs are writen as WARN on the `STDOUT` by default. You can change it:
131
130
 
132
131
  ```ruby
133
- CapybaraBox.configure(log: true)
134
- ```
135
-
136
- ```
137
- [15.479][INFO]: RESPONSE Navigate
138
- [15.482][INFO]: COMMAND ExecuteScript {
139
- "args": [ ],
140
- "script": "return $(\".gridy\").data(\"ready\")"
141
- }
142
- [15.483][INFO]: Waiting for pending navigations...
143
- [15.545][INFO]: Done waiting for pending navigations. Status: ok
132
+ CapybaraBox.configure(logger: { level: :debug, output: 'log/selenium.log' })
144
133
  ```
@@ -9,11 +9,11 @@ module CapybaraBox
9
9
  end
10
10
 
11
11
  def add_argument(value)
12
- capabilities&.add_argument(value)
12
+ options&.add_argument(value)
13
13
  end
14
14
 
15
15
  def add_preference(key, value)
16
- capabilities&.add_preference(key, value)
16
+ options&.add_preference(key, value)
17
17
  end
18
18
 
19
19
  def apply_arguments
@@ -94,10 +94,6 @@ module CapybaraBox
94
94
  Capybara.default_max_wait_time = @max_wait_time if @max_wait_time
95
95
  end
96
96
 
97
- def capabilities
98
- @capabilities ||= ::Selenium::WebDriver::Chrome::Options.new if chrome_family?
99
- end
100
-
101
97
  def create
102
98
  apply_arguments
103
99
  apply_preferences
@@ -110,17 +106,18 @@ module CapybaraBox
110
106
  register(@browser)
111
107
 
112
108
  configure_capybara
109
+ configure_logger(@parameters[:logger]) if logger?
113
110
  end
114
111
 
115
112
  def driver(app)
116
113
  opts = {}
117
- opts[:capabilities] = capabilities if chrome_family?
114
+ opts[:options] = options if chrome_family?
118
115
 
119
116
  Capybara::Selenium::Driver.load_selenium
120
117
 
121
118
  opts[:http_client] = http_client if ::CapybaraBox::Helper.true?(ENV['CI'])
122
119
 
123
- Capybara::Selenium::Driver.new(app, opts.merge(driver_options))
120
+ Capybara::Selenium::Driver.new(app, **opts.merge(driver_options))
124
121
  end
125
122
 
126
123
  def driver_options
@@ -132,12 +129,6 @@ module CapybaraBox
132
129
  clear_session_storage: true,
133
130
  }
134
131
 
135
- if log? && chrome_family?
136
- opts[:service] = ::Selenium::WebDriver::Service.chrome(
137
- args: { log_path: 'log/capybara-box.log', verbose: true }
138
- )
139
- end
140
-
141
132
  opts
142
133
  end
143
134
 
@@ -158,6 +149,10 @@ module CapybaraBox
158
149
  @http_client ||= ::Selenium::WebDriver::Remote::Http::Default.new(**http_client_options)
159
150
  end
160
151
 
152
+ def options
153
+ @options ||= ::Selenium::WebDriver::Chrome::Options.new if chrome_family?
154
+ end
155
+
161
156
  def preferences
162
157
  return @parameters[:preferences] if @parameters[:preferences]
163
158
  return {} unless chrome_family?
@@ -181,10 +176,14 @@ module CapybaraBox
181
176
 
182
177
  private
183
178
 
184
- def log?
185
- return true if @parameters[:log].nil?
179
+ # https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/#ruby
180
+ def configure_logger(options)
181
+ Selenium::WebDriver.logger.level = options.fetch(:level, :warn)
182
+ Selenium::WebDriver.logger.output = options.fetch(:output, 'selenium.log')
183
+ end
186
184
 
187
- ::CapybaraBox::Helper.true?(@parameters[:log])
185
+ def logger?
186
+ @parameters.key?(:logger)
188
187
  end
189
188
  end
190
189
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CapybaraBox
4
- VERSION = '1.2.0'
4
+ VERSION = '2.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-box
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-07 00:00:00.000000000 Z
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara-screenshot
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  requirements: []
189
- rubygems_version: 3.2.22
189
+ rubygems_version: 3.4.6
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: A Tool Box for Capybara.