capybara-box 1.2.0 → 2.0.0
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 +4 -4
- data/CHANGELOG.md +34 -24
- data/README.md +4 -15
- data/lib/capybara-box/base.rb +16 -17
- data/lib/capybara-box/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36511931656f10de7c80d90cbe83b522c6ed25f3bfaace63b9c6b60bc5e7410b
|
4
|
+
data.tar.gz: 338ed081d496d5507b551cca46143478171374d31bf22bdbc89a341d481ec908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ae7025a66c1fbbde2f59bd73ba2e421c62e2a61fdce2d759cdb3c8d84492ee96752f616158eb3d6bd02b7ebc7684c64c8d10e359dc23c1281dbe1201d43f53
|
7
|
+
data.tar.gz: d5dbb4ad547f2511c9989f41e87153e20d28e3014c23de4f0081f8c4fcc6851d7a46e1c40fc8a079db61ebd5b92cee9704d2bd7af52fc8a7cb650b40dafda20f
|
data/CHANGELOG.md
CHANGED
@@ -1,80 +1,90 @@
|
|
1
|
-
|
1
|
+
## v2.0.0
|
2
2
|
|
3
|
-
|
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
|
-
|
17
|
+
## v1.1.2
|
8
18
|
|
9
|
-
|
19
|
+
### Bugfix
|
10
20
|
|
11
21
|
- Avoid apply blank bin path;
|
12
22
|
- Avoid apply blank version;
|
13
23
|
|
14
|
-
|
24
|
+
## v1.1.1
|
15
25
|
|
16
|
-
|
26
|
+
### Bugfix
|
17
27
|
|
18
28
|
- Removes default args that was avoiding screen render.
|
19
29
|
|
20
|
-
|
30
|
+
## v1.1.0
|
21
31
|
|
22
|
-
|
32
|
+
### Bugfix
|
23
33
|
|
24
34
|
- S3 config activation;
|
25
35
|
|
26
|
-
|
36
|
+
### Update
|
27
37
|
|
28
38
|
- Adds more default arguments;
|
29
39
|
|
30
|
-
|
40
|
+
## v1.0.1
|
31
41
|
|
32
|
-
|
42
|
+
### Bugfix
|
33
43
|
|
34
44
|
- Registers driver name as symbol;
|
35
45
|
|
36
|
-
|
46
|
+
## v1.0.0
|
37
47
|
|
38
|
-
|
48
|
+
### Update
|
39
49
|
|
40
50
|
- Updated default arguments;
|
41
51
|
- Spec files now is excluded from gem pack;
|
42
52
|
|
43
|
-
|
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
|
-
|
59
|
+
### Bugfix
|
50
60
|
|
51
61
|
- Fix screenshot upload;
|
52
62
|
|
53
|
-
|
63
|
+
## v0.4.0
|
54
64
|
|
55
|
-
|
65
|
+
### Update
|
56
66
|
|
57
67
|
- Selenium WebDriver deprecated message;
|
58
68
|
|
59
|
-
|
69
|
+
## v0.3.0
|
60
70
|
|
61
|
-
|
71
|
+
### Update
|
62
72
|
|
63
73
|
- Drops Rack Session Access internal require;
|
64
74
|
- Makes `chromedriver-helper` optional.
|
65
75
|
|
66
|
-
|
76
|
+
## v0.2.1
|
67
77
|
|
68
|
-
|
78
|
+
### Bugfix
|
69
79
|
|
70
80
|
- `chrome_headless` was being registered with wrong name.
|
71
81
|
|
72
|
-
|
82
|
+
## v0.2.0
|
73
83
|
|
74
|
-
|
84
|
+
### Features
|
75
85
|
|
76
86
|
- Add log feature for Chrome and Chrome Headless.
|
77
87
|
|
78
|
-
|
88
|
+
## v0.1.0
|
79
89
|
|
80
90
|
- First release.
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://badge.fury.io/rb/capybara-box)
|
5
5
|
[](https://codeclimate.com/github/wbotelhos/capybara-box/maintainability)
|
6
6
|
[](https://codecov.io/gh/wbotelhos/capybara-box)
|
7
|
-
[](https://
|
7
|
+
[](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
|
-
##
|
127
|
+
## Logger
|
128
128
|
|
129
|
-
|
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(
|
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
|
```
|
data/lib/capybara-box/base.rb
CHANGED
@@ -9,11 +9,11 @@ module CapybaraBox
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def add_argument(value)
|
12
|
-
|
12
|
+
options&.add_argument(value)
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_preference(key, value)
|
16
|
-
|
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[:
|
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
|
-
|
185
|
-
|
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
|
-
|
185
|
+
def logger?
|
186
|
+
@parameters.key?(:logger)
|
188
187
|
end
|
189
188
|
end
|
190
189
|
end
|
data/lib/capybara-box/version.rb
CHANGED
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:
|
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:
|
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.
|
189
|
+
rubygems_version: 3.4.6
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: A Tool Box for Capybara.
|