cuprite 0.13 → 0.14

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: e515ee98354d04170f435ea87fc5d9256a21f2ca7484a83b8078c76478bfeb73
4
- data.tar.gz: 4a08d6b9957090cad3bb732199a9706bf0aa7e6dfe152cf41b1364d4f11a95d0
3
+ metadata.gz: c42bace1622150dbda68aa405b21ffb3f4e94acc5c5dc0320b639b203e740d9d
4
+ data.tar.gz: 253067db73c217d55db4c5d53571b344476df323610fd396ab0fde923b925cac
5
5
  SHA512:
6
- metadata.gz: '049bfdaf42c6bd78fdc40fcd6cc059ef6b38b5b3e0a7e03e4ee871fcb8c072cd5ec6215f5b5640f2e289505d582ffe9c3b9e84f688af9afc4e48616bfa5f7473'
7
- data.tar.gz: 9b6c78303752248b85c6ca1dc2068dcc57687d94c141e2b10c75a54e9a6a8e767de3a804d98fe788580be0ec36d1230006ec784eb4b675c48752efee61e2a1fd
6
+ metadata.gz: 5d9e673193f375857e76642524c718ee09112eb1f87e8768c3c65f29b47c932f09a43f6f195d8672d3720441d1326828e04711fb1ef0596b758be3fe387b793a
7
+ data.tar.gz: e53dbb777e6b0da3459d2d8947305de841926be2bfebf7acc93b73948ed7133961223a1c17e5275a80d46037f36220ed770e40a469896f83f49e2201fd77fa27
metadata CHANGED
@@ -1,175 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuprite
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.13'
4
+ version: '0.14'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Vorotilin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '2.1'
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '4'
19
+ version: '3.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '2.1'
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '4'
26
+ version: '3.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: ferrum
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 0.11.0
33
+ version: 0.12.0
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: 0.11.0
40
+ version: 0.12.0
47
41
  - !ruby/object:Gem::Dependency
48
- name: image_size
42
+ name: byebug
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '2.0'
47
+ version: '11.1'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '2.0'
54
+ version: '11.1'
61
55
  - !ruby/object:Gem::Dependency
62
- name: pdf-reader
56
+ name: chunky_png
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: '2.1'
61
+ version: '1.4'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '2.1'
68
+ version: '1.4'
75
69
  - !ruby/object:Gem::Dependency
76
- name: rake
70
+ name: image_size
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '12.3'
75
+ version: '3.0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '12.3'
82
+ version: '3.0'
89
83
  - !ruby/object:Gem::Dependency
90
- name: rspec
84
+ name: launchy
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: '3.7'
89
+ version: '2.5'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: '3.7'
96
+ version: '2.5'
103
97
  - !ruby/object:Gem::Dependency
104
- name: sinatra
98
+ name: pdf-reader
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: '2.0'
103
+ version: '2.5'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: '2.0'
110
+ version: '2.5'
117
111
  - !ruby/object:Gem::Dependency
118
- name: launchy
112
+ name: puma
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: '2.4'
117
+ version: '4.3'
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: '2.4'
124
+ version: '4.3'
131
125
  - !ruby/object:Gem::Dependency
132
- name: byebug
126
+ name: rake
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - "~>"
136
130
  - !ruby/object:Gem::Version
137
- version: '10.0'
131
+ version: '13.0'
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - "~>"
143
137
  - !ruby/object:Gem::Version
144
- version: '10.0'
138
+ version: '13.0'
145
139
  - !ruby/object:Gem::Dependency
146
- name: puma
140
+ name: rspec
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
143
  - - "~>"
150
144
  - !ruby/object:Gem::Version
151
- version: '3.0'
145
+ version: '3.10'
152
146
  type: :development
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
150
  - - "~>"
157
151
  - !ruby/object:Gem::Version
158
- version: '3.0'
152
+ version: '3.10'
159
153
  - !ruby/object:Gem::Dependency
160
- name: chunky_png
154
+ name: sinatra
161
155
  requirement: !ruby/object:Gem::Requirement
162
156
  requirements:
163
157
  - - "~>"
164
158
  - !ruby/object:Gem::Version
165
- version: '1.3'
159
+ version: '2.1'
166
160
  type: :development
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
163
  requirements:
170
164
  - - "~>"
171
165
  - !ruby/object:Gem::Version
172
- version: '1.3'
166
+ version: '2.1'
173
167
  description: Cuprite is a driver for Capybara that allows you to run your tests on
174
168
  a headless Chrome browser
175
169
  email:
@@ -177,18 +171,7 @@ email:
177
171
  executables: []
178
172
  extensions: []
179
173
  extra_rdoc_files: []
180
- files:
181
- - LICENSE
182
- - README.md
183
- - lib/capybara/cuprite.rb
184
- - lib/capybara/cuprite/browser.rb
185
- - lib/capybara/cuprite/cookie.rb
186
- - lib/capybara/cuprite/driver.rb
187
- - lib/capybara/cuprite/errors.rb
188
- - lib/capybara/cuprite/javascripts/index.js
189
- - lib/capybara/cuprite/node.rb
190
- - lib/capybara/cuprite/page.rb
191
- - lib/capybara/cuprite/version.rb
174
+ files: []
192
175
  homepage: https://github.com/rubycdp/cuprite
193
176
  licenses:
194
177
  - MIT
@@ -197,6 +180,7 @@ metadata:
197
180
  bug_tracker_uri: https://github.com/rubycdp/cuprite/issues
198
181
  documentation_uri: https://github.com/rubycdp/cuprite/blob/master/README.md
199
182
  source_code_uri: https://github.com/rubycdp/cuprite
183
+ rubygems_mfa_required: 'true'
200
184
  post_install_message:
201
185
  rdoc_options: []
202
186
  require_paths:
@@ -205,14 +189,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
189
  requirements:
206
190
  - - ">="
207
191
  - !ruby/object:Gem::Version
208
- version: 2.3.0
192
+ version: 2.6.0
209
193
  required_rubygems_version: !ruby/object:Gem::Requirement
210
194
  requirements:
211
195
  - - ">="
212
196
  - !ruby/object:Gem::Version
213
197
  version: '0'
214
198
  requirements: []
215
- rubygems_version: 3.1.2
199
+ rubygems_version: 3.1.6
216
200
  signing_key:
217
201
  specification_version: 4
218
202
  summary: Headless Chrome driver for Capybara
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018-2021 Dmitry Vorotilin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/README.md DELETED
@@ -1,215 +0,0 @@
1
- # Cuprite - Headless Chrome driver for Capybara
2
-
3
- Cuprite is a pure Ruby driver (read as _no_ Selenium/WebDriver/ChromeDriver
4
- dependency) for [Capybara](https://github.com/teamcapybara/capybara). It allows
5
- you to run Capybara tests on a headless Chrome or Chromium. Under the hood it
6
- uses [Ferrum](https://github.com/rubycdp/ferrum#index) which is high-level API
7
- to the browser by CDP protocol. The design of the driver is as close to
8
- [Poltergeist](https://github.com/teampoltergeist/poltergeist) as possible though
9
- it's not a goal.
10
-
11
- [Cuprite](https://evrone.com/cuprite) website is designed & supported by [Evrone](https://evrone.com/)
12
- What else we build [with Ruby](https://evrone.com/ruby)
13
-
14
-
15
- ## Install
16
-
17
- Add this to your `Gemfile` and run `bundle install`.
18
-
19
- ``` ruby
20
- group :test do
21
- gem "cuprite"
22
- end
23
- ```
24
-
25
- In your test setup add:
26
-
27
- ``` ruby
28
- require "capybara/cuprite"
29
- Capybara.javascript_driver = :cuprite
30
- Capybara.register_driver(:cuprite) do |app|
31
- Capybara::Cuprite::Driver.new(app, window_size: [1200, 800])
32
- end
33
- ```
34
-
35
- if you use `Docker` don't forget to pass `no-sandbox` option:
36
-
37
- ```ruby
38
- Capybara::Cuprite::Driver.new(app, browser_options: { 'no-sandbox': nil })
39
- ```
40
-
41
- Since Cuprite uses [Ferrum](https://github.com/rubycdp/ferrum#examples) there
42
- are many useful methods you can call even using this driver:
43
-
44
- ```ruby
45
- browser = page.driver.browser
46
- browser.mouse.move(x: 123, y: 456).down.up
47
- ```
48
-
49
- If you already have tests on Poltergeist then it should simply work, for
50
- Selenium you better check your code for `manage` calls because it works
51
- differently in Cuprite, see the documentation below.
52
-
53
-
54
- ## Customization
55
-
56
- See the full list of options for
57
- [Ferrum](https://github.com/rubycdp/ferrum#customization).
58
-
59
- You can pass options with the following code in your test setup:
60
-
61
- ``` ruby
62
- Capybara.register_driver(:cuprite) do |app|
63
- Capybara::Cuprite::Driver.new(app, options)
64
- end
65
- ```
66
-
67
- `Cuprite`-specific options are:
68
-
69
- * options `Hash`
70
- * `:url_blacklist` (Array) - array of strings to match against requested URLs
71
- * `:url_whitelist` (Array) - array of strings to match against requested URLs
72
-
73
-
74
- ## Debugging
75
-
76
- If you pass `inspector` option, remote debugging will be enabled if you run
77
- tests with `INSPECTOR=true`. Then you can put `page.driver.debug` or
78
- `page.driver.debug(binding)` in your test to pause it. This will launch the
79
- browser where you can inspect the content.
80
-
81
- ```ruby
82
- Capybara.register_driver :cuprite do |app|
83
- Capybara::Cuprite::Driver.new(app, inspector: ENV['INSPECTOR'])
84
- end
85
- ```
86
-
87
- then somewhere in the test:
88
-
89
- ```ruby
90
- it "does something useful" do
91
- visit root_path
92
-
93
- fill_in "field", with: "value"
94
- page.driver.debug(binding)
95
-
96
- expect(page).to have_content("value")
97
- end
98
- ```
99
-
100
- In the middle of the execution Chrome will open a new tab where you can inspect
101
- the content and also if you passed `binding` an `irb` or `pry` console will be
102
- opened where you can further experiment with the test.
103
-
104
-
105
- ## Clicking/Scrolling
106
-
107
- * `page.driver.click(x, y)` Click a very specific area of the screen.
108
- * `page.driver.scroll_to(left, top)` Scroll to a given position.
109
- * `element.send_keys(*keys)` Send keys to a given node.
110
-
111
-
112
- ## Request headers
113
-
114
- Manipulate HTTP request headers like a boss:
115
-
116
- ``` ruby
117
- page.driver.headers # => {}
118
- page.driver.headers = { "User-Agent" => "Cuprite" }
119
- page.driver.add_headers("Referer" => "https://example.com")
120
- page.driver.headers # => { "User-Agent" => "Cuprite", "Referer" => "https://example.com" }
121
- ```
122
-
123
- Notice that `headers=` will overwrite already set headers. You should use
124
- `add_headers` if you want to add a few more. These headers will apply to all
125
- subsequent HTTP requests (including requests for assets, AJAX, etc). They will
126
- be automatically cleared at the end of the test.
127
-
128
-
129
- ## Network traffic
130
-
131
- * `page.driver.network_traffic` Inspect network traffic (loaded resources) on
132
- the current page. This returns an array of request objects.
133
-
134
- ```ruby
135
- page.driver.network_traffic # => [Request, ...]
136
- request = page.driver.network_traffic.first
137
- request.response
138
- ```
139
-
140
- * `page.driver.wait_for_network_idle` Natively waits for network idle and if
141
- there are no active connections returns or raises `TimeoutError` error. Accepts
142
- the same options as
143
- [`wait_for_idle`](https://github.com/rubycdp/ferrum#wait_for_idleoptions)
144
-
145
- ```ruby
146
- page.driver.wait_for_network_idle
147
- page.driver.refresh
148
- ```
149
-
150
- Please note that network traffic is not cleared when you visit new page. You can
151
- manually clear the network traffic by calling `page.driver.clear_network_traffic`
152
- or `page.driver.reset`
153
-
154
- * `page.driver.wait_for_reload` unlike `wait_for_network_idle` will wait until
155
- the whole page is reloaded or raise a timeout error. It's useful when you know
156
- that for example after clicking autocomplete suggestion you expect page to be
157
- reloaded, you have a few choices - put sleep or wait for network idle, but both
158
- are bad. Sleep makes you wait longer or less than needed, network idle can
159
- return earlier even before the whole page is started to reload. Here's the
160
- rescue.
161
-
162
-
163
- ## Manipulating cookies
164
-
165
- The following methods are used to inspect and manipulate cookies:
166
-
167
- * `page.driver.cookies` - a hash of cookies accessible to the current
168
- page. The keys are cookie names. The values are `Cookie` objects, with
169
- the following methods: `name`, `value`, `domain`, `path`, `size`, `secure?`,
170
- `httponly?`, `session?`, `expires`.
171
- * `page.driver.set_cookie(name, value, options = {})` - set a cookie.
172
- The options hash can take the following keys: `:domain`, `:path`,
173
- `:secure`, `:httponly`, `:expires`. `:expires` should be a
174
- `Time` object.
175
- * `page.driver.remove_cookie(name)` - remove a cookie
176
- * `page.driver.clear_cookies` - clear all cookies
177
-
178
-
179
- ## Screenshot
180
-
181
- Besides capybara screenshot method you can get image as Base64:
182
-
183
- * `page.driver.render_base64(format, options)`
184
-
185
-
186
- ## Authorization
187
-
188
- * `page.driver.basic_authorize(user, password)`
189
- * `page.driver.set_proxy(ip, port, type, user, password)`
190
-
191
-
192
- ## URL Blacklisting & Whitelisting
193
-
194
- Cuprite supports URL blacklisting, which allows you to prevent scripts from
195
- running on designated domains:
196
-
197
- ```ruby
198
- page.driver.browser.url_blacklist = ["http://www.example.com"]
199
- ```
200
-
201
- and also URL whitelisting, which allows scripts to only run on designated
202
- domains:
203
-
204
- ```ruby
205
- page.driver.browser.url_whitelist = ["http://www.example.com"]
206
- ```
207
-
208
- If you are experiencing slower run times, consider creating a URL whitelist of
209
- domains that are essential or a blacklist of domains that are not essential,
210
- such as ad networks or analytics, to your testing environment.
211
-
212
- ## License
213
-
214
- The gem is available as open source under the terms of the
215
- [MIT License](https://opensource.org/licenses/MIT).