capybara-box 1.1.2 → 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: 6eb43822ce3b518d701a86c67a72908953c0c49e699b3b29ba263e3b8b4f17f7
4
- data.tar.gz: e35c51b8daa7efc62aa182d2f3280227d59413d674921f9ce9fe0209b7a326a7
3
+ metadata.gz: 36511931656f10de7c80d90cbe83b522c6ed25f3bfaace63b9c6b60bc5e7410b
4
+ data.tar.gz: 338ed081d496d5507b551cca46143478171374d31bf22bdbc89a341d481ec908
5
5
  SHA512:
6
- metadata.gz: d2992956c71d654754f4c1098fe474cc8df6dcac9516926782f9c8a3876bdccabea3d860d59362451ffe17f08c09f8e40495137d6668c405002455cdf81e6e56
7
- data.tar.gz: c15d8442bce49d012f6e7f92094619c5afb3d59ae039745a991aeab7b18544778a3715dd5466c90de080fdf1d2f1196d8ab8e5bc1630f814c6b995da7269bc52
6
+ metadata.gz: 66ae7025a66c1fbbde2f59bd73ba2e421c62e2a61fdce2d759cdb3c8d84492ee96752f616158eb3d6bd02b7ebc7684c64c8d10e359dc23c1281dbe1201d43f53
7
+ data.tar.gz: d5dbb4ad547f2511c9989f41e87153e20d28e3014c23de4f0081f8c4fcc6851d7a46e1c40fc8a079db61ebd5b92cee9704d2bd7af52fc8a7cb650b40dafda20f
data/CHANGELOG.md CHANGED
@@ -1,60 +1,90 @@
1
+ ## v2.0.0
2
+
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
14
+
15
+ - Avoids deprecated Selenium `:options`;
16
+
1
17
  ## v1.1.2
2
18
 
3
- - Fixes
4
- - Avoid apply blank bin path;
5
- - Avoid apply blank version;
19
+ ### Bugfix
20
+
21
+ - Avoid apply blank bin path;
22
+ - Avoid apply blank version;
6
23
 
7
24
  ## v1.1.1
8
25
 
9
- - Fixes
10
- - Removes default args that was avoiding screen render.
26
+ ### Bugfix
27
+
28
+ - Removes default args that was avoiding screen render.
11
29
 
12
30
  ## v1.1.0
13
31
 
14
- - Fixes
15
- - S3 config activation;
32
+ ### Bugfix
16
33
 
17
- - Update
18
- - Adds more default arguments;
34
+ - S3 config activation;
35
+
36
+ ### Update
37
+
38
+ - Adds more default arguments;
19
39
 
20
40
  ## v1.0.1
21
41
 
22
- - Fixes
23
- - Registers driver name as symbol;
42
+ ### Bugfix
43
+
44
+ - Registers driver name as symbol;
24
45
 
25
46
  ## v1.0.0
26
47
 
27
- - Updates
28
- - Updated default arguments;
29
- - Spec files now is excluded from gem pack;
48
+ ### Update
49
+
50
+ - Updated default arguments;
51
+ - Spec files now is excluded from gem pack;
52
+
53
+ ### Features
30
54
 
31
- - Features
32
- - Capybara `load_selenium` is called before startup;
33
- - Screenshot S3 feature now is configure only via ENV;
34
- - Using new gem `webdrivers`;
55
+ - Capybara `load_selenium` is called before startup;
56
+ - Screenshot S3 feature now is configure only via ENV;
57
+ - Using new gem `webdrivers`;
35
58
 
36
- - Fixes
37
- - Fix screenshot upload;
59
+ ### Bugfix
60
+
61
+ - Fix screenshot upload;
38
62
 
39
63
  ## v0.4.0
40
64
 
41
- - Updates Selenium WebDriver deprecated message;
65
+ ### Update
66
+
67
+ - Selenium WebDriver deprecated message;
42
68
 
43
69
  ## v0.3.0
44
70
 
71
+ ### Update
72
+
45
73
  - Drops Rack Session Access internal require;
46
74
  - Makes `chromedriver-helper` optional.
47
75
 
48
76
  ## v0.2.1
49
77
 
50
- - Fixes
51
- - `chrome_headless` was being registered with wrong name.
78
+ ### Bugfix
79
+
80
+ - `chrome_headless` was being registered with wrong name.
52
81
 
53
82
  ## v0.2.0
54
83
 
55
- - Features
56
- - Add log feature for Chrome and Chrome Headless.
84
+ ### Features
85
+
86
+ - Add log feature for Chrome and Chrome Headless.
57
87
 
58
88
  ## v0.1.0
59
89
 
60
- First release.
90
+ - First release.
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Capybara Box
2
2
 
3
- [![Build Status](https://travis-ci.org/wbotelhos/capybara-box.svg?branch=master)](https://travis-ci.org/wbotelhos/capybara-box)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/1b13dc12b03be63baaed/maintainability)](https://codeclimate.com/github/wbotelhos/capybara-box/maintainability)
3
+ [![CI](https://github.com/wbotelhos/capybara-box/workflows/CI/badge.svg)](https://github.com/wbotelhos/capybara-box/actions)
5
4
  [![Gem Version](https://badge.fury.io/rb/capybara-box.svg)](https://badge.fury.io/rb/capybara-box)
6
- [![Patreon](https://img.shields.io/badge/donate-%3C3-brightgreen.svg)](https://www.patreon.com/wbotelhos)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/f312587b4f126bb13e85/maintainability)](https://codeclimate.com/github/wbotelhos/capybara-box/maintainability)
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://github.com/sponsors/wbotelhos)
7
8
 
8
9
  Configure Capybara with **Chrome**, **Chrome Headless**, **Firefox** and **Firefox Headless** with *Screenshot* feature without losing your mind.
9
10
 
@@ -30,6 +31,10 @@ CapybaraBox::Base.configure
30
31
 
31
32
  By default, `selenium_chrome` is the driver, but you can use `selenium_chrome_headless` and `selenium_firefox` or `selenium_firefox_headless` too.
32
33
 
34
+ ```ruby
35
+ CapybaraBox::Base.configure(browser: :selenium_firefox)
36
+ ```
37
+
33
38
  ## Version
34
39
 
35
40
  The version is setted via `webdrivers`. You can specify the version:
@@ -119,21 +124,10 @@ You can override all driver options:
119
124
  CapybaraBox.configure(driver_options: { clear_local_storage: true })
120
125
  ```
121
126
 
122
- ## Log
127
+ ## Logger
123
128
 
124
- Log is writen at `log/capybara-box.log` as default.
125
- 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:
126
130
 
127
131
  ```ruby
128
- CapybaraBox.configure(log: true)
129
- ```
130
-
131
- ```
132
- [15.479][INFO]: RESPONSE Navigate
133
- [15.482][INFO]: COMMAND ExecuteScript {
134
- "args": [ ],
135
- "script": "return $(\".gridy\").data(\"ready\")"
136
- }
137
- [15.483][INFO]: Waiting for pending navigations...
138
- [15.545][INFO]: Done waiting for pending navigations. Status: ok
132
+ CapybaraBox.configure(logger: { level: :debug, output: 'log/selenium.log' })
139
133
  ```
@@ -26,6 +26,14 @@ module CapybaraBox
26
26
  end
27
27
  end
28
28
 
29
+ def apply_bin_path(path)
30
+ if firefox?
31
+ ::Selenium::WebDriver::Firefox.path = path
32
+
33
+ ::Selenium::WebDriver::Firefox.path
34
+ end
35
+ end
36
+
29
37
  def apply_preferences
30
38
  preferences.each { |key, value| add_preference(key, value) }
31
39
  end
@@ -86,14 +94,6 @@ module CapybaraBox
86
94
  Capybara.default_max_wait_time = @max_wait_time if @max_wait_time
87
95
  end
88
96
 
89
- def apply_bin_path(path)
90
- if firefox?
91
- ::Selenium::WebDriver::Firefox::Binary.path = path
92
-
93
- ::Selenium::WebDriver::Firefox::Binary.path
94
- end
95
- end
96
-
97
97
  def create
98
98
  apply_arguments
99
99
  apply_preferences
@@ -106,17 +106,18 @@ module CapybaraBox
106
106
  register(@browser)
107
107
 
108
108
  configure_capybara
109
+ configure_logger(@parameters[:logger]) if logger?
109
110
  end
110
111
 
111
112
  def driver(app)
112
- opts = {}
113
+ opts = {}
113
114
  opts[:options] = options if chrome_family?
114
115
 
115
116
  Capybara::Selenium::Driver.load_selenium
116
117
 
117
118
  opts[:http_client] = http_client if ::CapybaraBox::Helper.true?(ENV['CI'])
118
119
 
119
- Capybara::Selenium::Driver.new(app, opts.merge(driver_options))
120
+ Capybara::Selenium::Driver.new(app, **opts.merge(driver_options))
120
121
  end
121
122
 
122
123
  def driver_options
@@ -128,12 +129,6 @@ module CapybaraBox
128
129
  clear_session_storage: true,
129
130
  }
130
131
 
131
- if log? && chrome_family?
132
- opts[:service] = ::Selenium::WebDriver::Service.chrome(
133
- args: { log_path: 'log/capybara-box.log', verbose: true }
134
- )
135
- end
136
-
137
132
  opts
138
133
  end
139
134
 
@@ -175,16 +170,20 @@ module CapybaraBox
175
170
  Capybara.register_driver(name.to_sym) { |app| driver(app) }
176
171
  end
177
172
 
178
- def self.configure(parameters)
173
+ def self.configure(parameters = {})
179
174
  new(parameters).tap(&:create)
180
175
  end
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.1.2'
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.1.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-28 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
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pry-byebug
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +171,7 @@ homepage: https://github.com/wbotelhos/capybara-box
157
171
  licenses:
158
172
  - MIT
159
173
  metadata: {}
160
- post_install_message:
174
+ post_install_message:
161
175
  rdoc_options: []
162
176
  require_paths:
163
177
  - lib
@@ -172,8 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  requirements: []
175
- rubygems_version: 3.1.2
176
- signing_key:
189
+ rubygems_version: 3.4.6
190
+ signing_key:
177
191
  specification_version: 4
178
192
  summary: A Tool Box for Capybara.
179
193
  test_files: []