puppeteer-ruby 0.36.0 → 0.37.3

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: 1d4af926ca9ad39046dcc4ce9507622bf72c3263b747516ee1ba642c02e8e38d
4
- data.tar.gz: 3eff89952883a47270dee6a9ee7281609dbbe7bac197eada9e6b6dcabbaa1f78
3
+ metadata.gz: 84ede7b4fc083303903e960a08d2a21b44866b2b47662489005e09e6e955df01
4
+ data.tar.gz: aba2c71b916d6779560a200fff6685cb9f4ba83dc2b04e092926fb121add3155
5
5
  SHA512:
6
- metadata.gz: d83085eb31bb6d0d9f125e4c82fe172f46676bc373bd7652b2be430984570f7facff20bd3b1da20dbcb41beca52a740064b9b6d5cb6f51a69bf8f4f97e699947
7
- data.tar.gz: 141bed0475d5e40a0ddb9ec0cb2a82f44313a14e835a7d5cc271a413dad0c9881658a81f0ec0567d7896a7658539fc131bb5069c1c07c6573f6b633c99a53f8e
6
+ metadata.gz: 3b6a5cc66476c8954ab1ae942df3be6ad161ffe3aeb9b1ea51bde681f6cd9cf32d61d251980ab5d7f0907923b5ac42871cd7e99fbb55f0c00205ee231190f595
7
+ data.tar.gz: 7329fc6a4f8d1933efee34180c6d051e73613da2189b2af5226629d681c9f4b52abadf5eb548f45cb3af37d3ab1f093067b5e67e10e8c3cde09815a4fa3a0e4c
data/CHANGELOG.md CHANGED
@@ -1,51 +1,75 @@
1
- ### master [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.36.0...master)]
1
+ ### master [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.3...master)]
2
2
 
3
- * xxx
3
+ - xxx
4
+
5
+ ### 0.37.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.2...0.37.3)]
6
+
7
+ Improvement:
8
+
9
+ - Improve the logic of detection of Chrome/Firefox executable path on Linux.
10
+
11
+ ### 0.37.2 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.1...0.37.2)]
12
+
13
+ Bugfix:
14
+
15
+ - `timeout: 0` did set the timeout value to zero. Now it disables the timeout as expected.
16
+
17
+ ### 0.37.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.0...0.37.1)]
18
+
19
+ Bugfix:
20
+
21
+ - Fix handle_SIGINT, handle_SIGTERM, handle_SIGHUP options to work with `false` value specified.
22
+
23
+ ### 0.37.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.36.0...0.37.0)]
24
+
25
+ New features:
26
+
27
+ - Some features introduced in Puppeteer 10.4
4
28
 
5
29
  ### 0.36.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.35.1...0.36.0)]
6
30
 
7
31
  New features:
8
32
 
9
- * Drag and Drop feature introduced in Puppeteer 10.1
10
- * `Page#emulateNetworkConditions`, `Page#emulateCPUThrottling`
11
- * `Page#exposeFunction`
12
- * Metrics
33
+ - Drag and Drop feature introduced in Puppeteer 10.1
34
+ - `Page#emulateNetworkConditions`, `Page#emulateCPUThrottling`
35
+ - `Page#exposeFunction`
36
+ - Metrics
13
37
 
14
38
  ### 0.35.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.35.0...0.35.1)]
15
39
 
16
40
  New features:
17
41
 
18
- * Allow Rails users to use this library without `require 'puppeteer'`.
42
+ - Allow Rails users to use this library without `require 'puppeteer'`.
19
43
 
20
44
  ### 0.35.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.3...0.35.0)]
21
45
 
22
46
  New features:
23
47
 
24
- * Add `channel` parameter for Puppeteer.launch. Now `channel: chrome` or `channel: chrome-canary` (chrome-beta, chrome-dev is also available) automatically detects the executablePath of Google Chrome. Windows/macOS users can also use `channel: msedge`.
48
+ - Add `channel` parameter for Puppeteer.launch. Now `channel: chrome` or `channel: chrome-canary` (chrome-beta, chrome-dev is also available) automatically detects the executablePath of Google Chrome. Windows/macOS users can also use `channel: msedge`.
25
49
 
26
50
  ### 0.34.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.2...0.34.3)]
27
51
 
28
52
  Bugfix:
29
53
 
30
- * Fix wait_for_xxx's timeout error type.
54
+ - Fix wait_for_xxx's timeout error type.
31
55
 
32
56
  ### 0.34.2 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.1...0.34.2)]
33
57
 
34
58
  New features:
35
59
 
36
- * Add `Page#bring_to_front`.
60
+ - Add `Page#bring_to_front`.
37
61
 
38
62
  ### 0.34.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.0...0.34.1)]
39
63
 
40
64
  Bugfix:
41
65
 
42
- * Fix `Page#pdf` to work without `path` parameter.
66
+ - Fix `Page#pdf` to work without `path` parameter.
43
67
 
44
68
  ### 0.34.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.33.0...0.34.0)]
45
69
 
46
70
  New features:
47
71
 
48
- * Sync API with block
72
+ - Sync API with block
49
73
 
50
74
  ### 0.33.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.4...0.33.0)]
51
75
 
@@ -53,170 +77,169 @@ NOTE: Requires Ruby version >= 2.6 explicitly since this version.
53
77
 
54
78
  Bugfix:
55
79
 
56
- * Fix PDF options to work correctly on decimal numbers specified.
80
+ - Fix PDF options to work correctly on decimal numbers specified.
57
81
 
58
82
  ### 0.32.4 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.3...0.32.4)]
59
83
 
60
84
  Bugfix:
61
85
 
62
- * Fix `#type_text` to input '<' correctly.
86
+ - Fix `#type_text` to input '<' correctly.
63
87
 
64
88
  ### 0.32.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.2...0.32.3)]
65
89
 
66
90
  Bugfix:
67
91
 
68
- * Fix puppeteer-ruby to work on Rails in development mode.
69
-
92
+ - Fix puppeteer-ruby to work on Rails in development mode.
70
93
 
71
94
  ### 0.32.2 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.1...0.32.2)]
72
95
 
73
96
  Bugfix:
74
97
 
75
- * Fix full_page option in screenshot.
98
+ - Fix full_page option in screenshot.
76
99
 
77
100
  ### 0.32.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.0...0.32.1)]
78
101
 
79
102
  Bugfix:
80
103
 
81
- * Fix WebSocket to work with `wss://...` endpoint (ex. browserless.io)
104
+ - Fix WebSocket to work with `wss://...` endpoint (ex. browserless.io)
82
105
 
83
106
  ### 0.32.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.6...0.32.0)]
84
107
 
85
108
  New features:
86
109
 
87
- * Tracing
88
- * JS/CSS coverages
110
+ - Tracing
111
+ - JS/CSS coverages
89
112
 
90
113
  Improvement:
91
114
 
92
- * Increase stability [#92](https://github.com/YusukeIwaki/puppeteer-ruby/pull/92)
115
+ - Increase stability [#92](https://github.com/YusukeIwaki/puppeteer-ruby/pull/92)
93
116
 
94
117
  ### 0.31.6 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.5...0.31.6)]
95
118
 
96
119
  Improvement:
97
120
 
98
- * Increase stability [#87](https://github.com/YusukeIwaki/puppeteer-ruby/pull/87)
121
+ - Increase stability [#87](https://github.com/YusukeIwaki/puppeteer-ruby/pull/87)
99
122
 
100
123
  ### 0.31.5 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.4...0.31.5)]
101
124
 
102
125
  Bugfix:
103
126
 
104
- * Fix file uploading to work without crash.
127
+ - Fix file uploading to work without crash.
105
128
 
106
129
  ### 0.31.4 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.3...0.31.4)]
107
130
 
108
131
  Bugfix:
109
132
 
110
- * Fix PDF options (format, margin, omit_background) to work.
133
+ - Fix PDF options (format, margin, omit_background) to work.
111
134
 
112
135
  ### 0.31.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.1...0.31.3)]
113
136
 
114
137
  Bugfix:
115
138
 
116
- * Fix `wait_for_selector` to work. *It is strongly recommended to update for 0.29.0-0.31.x users.*
139
+ - Fix `wait_for_selector` to work. _It is strongly recommended to update for 0.29.0-0.31.x users._
117
140
 
118
141
  ### 0.31.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.0...0.31.1)]
119
142
 
120
143
  Bugfix:
121
144
 
122
- * Fix `Page#pdf` to work on Windows.
145
+ - Fix `Page#pdf` to work on Windows.
123
146
 
124
147
  ### 0.31.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.30.0...0.31.0)]
125
148
 
126
149
  New features:
127
150
 
128
- * Now puppeteer-ruby is compatible with Windows
151
+ - Now puppeteer-ruby is compatible with Windows
129
152
 
130
153
  Bugfix:
131
154
 
132
- * Fix `Page#add_script_tag` and `Page#add_style_tag` to work
155
+ - Fix `Page#add_script_tag` and `Page#add_style_tag` to work
133
156
 
134
157
  ### 0.30.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.29.0...0.30.0)]
135
158
 
136
159
  New features:
137
160
 
138
- * S, SS, Seval, SSeval is renamed to query_selector, query_selector_all, eval_on_selector, eval_on_selector_all
161
+ - S, SS, Seval, SSeval is renamed to query_selector, query_selector_all, eval_on_selector, eval_on_selector_all
139
162
 
140
163
  ### 0.29.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.28.1...0.29.0)]
141
164
 
142
165
  New features:
143
166
 
144
- * Add `AriaQueryHandler`. Now we can use "aria/...." for selectors.
167
+ - Add `AriaQueryHandler`. Now we can use "aria/...." for selectors.
145
168
 
146
169
  ### 0.28.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.27...0.28.1)]
147
170
 
148
171
  New features:
149
172
 
150
- * Add `Page#emulate_idle_state`
151
- * Change versioning rule.
173
+ - Add `Page#emulate_idle_state`
174
+ - Change versioning rule.
152
175
 
153
176
  ### 0.0.27 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.26...0.0.27)]
154
177
 
155
178
  New features:
156
179
 
157
- * Now puppeteer-ruby is Ruby 3.0 compatible!
180
+ - Now puppeteer-ruby is Ruby 3.0 compatible!
158
181
 
159
182
  ### 0.0.26 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.25...0.0.26)]
160
183
 
161
184
  Bugfix:
162
185
 
163
- * Fix `Page#screenshot` working correctly with `quality` parameter.
186
+ - Fix `Page#screenshot` working correctly with `quality` parameter.
164
187
 
165
188
  ### 0.0.25 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.23...0.0.25)]
166
189
 
167
190
  New feature:
168
191
 
169
- * **Cookie** feature: `Page#set_cookie`, `Page#cookies`
192
+ - **Cookie** feature: `Page#set_cookie`, `Page#cookies`
170
193
 
171
194
  ### 0.0.23 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.22...0.0.23)]
172
195
 
173
196
  New feature:
174
197
 
175
- * **GeoLocation** feature
176
- * grant/clear permission
198
+ - **GeoLocation** feature
199
+ - grant/clear permission
177
200
 
178
201
  Bugfix/Improvement:
179
202
 
180
- * Refactoring for events ([#31](https://github.com/YusukeIwaki/puppeteer-ruby/pull/31))
181
- * Improve SEND/RECV handling in CDPSession ([#34](https://github.com/YusukeIwaki/puppeteer-ruby/pull/34))
203
+ - Refactoring for events ([#31](https://github.com/YusukeIwaki/puppeteer-ruby/pull/31))
204
+ - Improve SEND/RECV handling in CDPSession ([#34](https://github.com/YusukeIwaki/puppeteer-ruby/pull/34))
182
205
 
183
206
  ### 0.0.22 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.21...0.0.22)]
184
207
 
185
208
  Bugfix
186
209
 
187
- * Make `Puppeteer#default_args` to work
188
- * Respect Firefox launch options
189
- * Respect `default_viewport: nil`
210
+ - Make `Puppeteer#default_args` to work
211
+ - Respect Firefox launch options
212
+ - Respect `default_viewport: nil`
190
213
 
191
214
  ### 0.0.21 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.20...0.0.21)]
192
215
 
193
216
  Bugfix/Improvement:
194
217
 
195
- * Update DeviceDescriptors (list of emulatable devices)
196
- * Fix bug on inputing "(" ([#25](https://github.com/YusukeIwaki/puppeteer-ruby/pull/25))
218
+ - Update DeviceDescriptors (list of emulatable devices)
219
+ - Fix bug on inputing "(" ([#25](https://github.com/YusukeIwaki/puppeteer-ruby/pull/25))
197
220
 
198
221
  ### 0.0.20 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.19...0.0.20)]
199
222
 
200
223
  New feature
201
224
 
202
- * Dialog-handling feature
225
+ - Dialog-handling feature
203
226
 
204
227
  ### 0.0.19 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.18...0.0.19)]
205
228
 
206
229
  New feature
207
230
 
208
- * **Firefox support**
231
+ - **Firefox support**
209
232
 
210
233
  Bugfix/Improvement
211
234
 
212
- * Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
235
+ - Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
213
236
 
214
237
  ### 0.0.18 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.17...0.0.18)]
215
238
 
216
239
  New feature
217
240
 
218
- * **Firefox support**
241
+ - **Firefox support**
219
242
 
220
243
  Bugfix/Improvement
221
244
 
222
- * Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
245
+ - Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
data/README.md CHANGED
@@ -41,7 +41,7 @@ NOTE: `require 'puppeteer-ruby'` is not necessary in Rails.
41
41
  ```ruby
42
42
  require 'puppeteer-ruby'
43
43
 
44
- Puppeteer.launch(headless: false, slow_mo: 50, args: ['--guest', '--window-size=1280,800']) do |browser|
44
+ Puppeteer.launch(headless: false, slow_mo: 50, args: ['--window-size=1280,800']) do |browser|
45
45
  page = browser.new_page
46
46
  page.viewport = Puppeteer::Viewport.new(width: 1280, height: 800)
47
47
  page.goto("https://github.com/", wait_until: 'domcontentloaded')
@@ -156,6 +156,75 @@ RSpec.describe 'hotel.testplanisphere.dev', type: :feature do
156
156
 
157
157
  The detailed step of configuration can be found [here](https://github.com/YusukeIwaki/puppeteer-ruby-example/tree/master/_with_capybara-rspec).
158
158
 
159
+ ## :bulb: Use Puppeteer methods simply without Capybara::DSL
160
+
161
+ We can also use puppeteer-ruby as it is without Capybara DSL. When you want to just test a Rails application simply with Puppeteer, refer this section.
162
+
163
+ Also, if you have trouble with handling flaky/unstable testcases in existing feature/system specs, consider replacing Capybara::DSL with raw puppeteer-ruby codes like `page.wait_for_selector(...)` or `page.wait_for_navigation { ... }`.
164
+
165
+ Capybara prepares test server even when Capybara DSL is not used.
166
+
167
+ Sample configuration is shown below. You can use it by putting the file at `spec/support/puppeteer_ruby.rb` or another location where RSpec loads on initialization.
168
+
169
+ ```ruby
170
+ RSpec.configure do |config|
171
+ require 'capybara'
172
+
173
+ # This driver only requests Capybara to launch test server.
174
+ # Remark that no Capybara::DSL is available with this driver.
175
+ class CapybaraNullDriver < Capybara::Driver::Base
176
+ def needs_server?
177
+ true
178
+ end
179
+ end
180
+
181
+ Capybara.register_driver(:null) { CapybaraNullDriver.new }
182
+
183
+ config.around(driver: :null) do |example|
184
+ Capybara.current_driver = :null
185
+
186
+ # Rails server is launched here,
187
+ # (at the first time of accessing Capybara.current_session.server)
188
+ @base_url = Capybara.current_session.server.base_url
189
+
190
+ require 'puppeteer'
191
+ launch_options = {
192
+ # Use launch options as you like.
193
+ channel: :chrome,
194
+ headless: false,
195
+ }
196
+ Puppeteer.launch(**launch_options) do |browser|
197
+ @puppeteer_page = browser.new_page
198
+ example.run
199
+ end
200
+
201
+ Capybara.reset_sessions!
202
+ Capybara.use_default_driver
203
+ end
204
+ end
205
+ ```
206
+
207
+ Now, we can work with integration test using `Puppeteer::Page` in puppeteer-ruby.
208
+
209
+ ```ruby
210
+ RSpec.describe 'Sample integration tests', driver: :null do
211
+ let(:page) { @puppeteer_page }
212
+ let(:base_url) { @base_url }
213
+
214
+ it 'should work with Puppeteer' do
215
+ # null driver only launches server, and Capybara::DSL is unavailable.
216
+ expect { visit '/' }.to raise_error(/NotImplementedError/)
217
+
218
+ page.goto("#{base_url}/")
219
+
220
+ # Automation with Puppeteer
221
+ h1_text = page.eval_on_selector('h1', '(el) => el.textContent')
222
+ expect(h1_text).to eq('It works!')
223
+ end
224
+ end
225
+ ```
226
+
227
+
159
228
  ## API
160
229
 
161
230
  https://yusukeiwaki.github.io/puppeteer-ruby-docs/
data/docs/api_coverage.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # API coverages
2
- - Puppeteer version: v10.2.0
3
- - puppeteer-ruby version: 0.36.0
2
+ - Puppeteer version: v12.0.0
3
+ - puppeteer-ruby version: 0.37.3
4
4
 
5
5
  ## Puppeteer
6
6
 
@@ -134,8 +134,10 @@
134
134
  * viewport
135
135
  * ~~waitFor~~
136
136
  * waitForFileChooser => `#wait_for_file_chooser`
137
+ * ~~waitForFrame~~
137
138
  * waitForFunction => `#wait_for_function`
138
139
  * waitForNavigation => `#wait_for_navigation`
140
+ * ~~waitForNetworkIdle~~
139
141
  * waitForRequest => `#wait_for_request`
140
142
  * waitForResponse => `#wait_for_response`
141
143
  * waitForSelector => `#wait_for_selector`
@@ -225,6 +227,7 @@
225
227
  * goto
226
228
  * hover
227
229
  * isDetached => `#detached?`
230
+ * ~~isOOPFrame~~
228
231
  * name
229
232
  * parentFrame => `#parent_frame`
230
233
  * select
@@ -294,43 +297,44 @@
294
297
  * type => `#type_text`
295
298
  * uploadFile => `#upload_file`
296
299
 
297
- ## ~~HTTPRequest~~
298
-
299
- * ~~abort~~
300
- * ~~abortErrorReason~~
301
- * ~~continue~~
302
- * ~~continueRequestOverrides~~
303
- * ~~enqueueInterceptAction~~
304
- * ~~failure~~
305
- * ~~finalizeInterceptions~~
306
- * ~~frame~~
307
- * ~~headers~~
308
- * ~~isNavigationRequest~~
309
- * ~~method~~
310
- * ~~postData~~
311
- * ~~redirectChain~~
312
- * ~~resourceType~~
313
- * ~~respond~~
314
- * ~~response~~
315
- * ~~responseForRequest~~
316
- * ~~url~~
300
+ ## HTTPRequest
301
+
302
+ * abort
303
+ * abortErrorReason => `#abort_error_reason`
304
+ * continue
305
+ * continueRequestOverrides => `#continue_request_overrides`
306
+ * enqueueInterceptAction => `#enqueue_intercept_action`
307
+ * failure
308
+ * finalizeInterceptions => `#finalize_interceptions`
309
+ * frame
310
+ * headers
311
+ * ~~initiator~~
312
+ * isNavigationRequest => `#navigation_request?`
313
+ * method
314
+ * postData => `#post_data`
315
+ * redirectChain => `#redirect_chain`
316
+ * resourceType => `#resource_type`
317
+ * respond
318
+ * response
319
+ * responseForRequest => `#response_for_request`
320
+ * url
317
321
 
318
- ## ~~HTTPResponse~~
322
+ ## HTTPResponse
319
323
 
320
- * ~~buffer~~
321
- * ~~frame~~
324
+ * buffer
325
+ * frame
322
326
  * ~~fromCache~~
323
327
  * ~~fromServiceWorker~~
324
- * ~~headers~~
325
- * ~~json~~
328
+ * headers
329
+ * json
326
330
  * ~~ok~~
327
- * ~~remoteAddress~~
328
- * ~~request~~
329
- * ~~securityDetails~~
330
- * ~~status~~
331
- * ~~statusText~~
332
- * ~~text~~
333
- * ~~url~~
331
+ * remoteAddress => `#remote_address`
332
+ * request
333
+ * securityDetails => `#security_details`
334
+ * status
335
+ * statusText => `#status_text`
336
+ * text
337
+ * url
334
338
 
335
339
  ## ~~SecurityDetails~~
336
340
 
@@ -356,6 +360,7 @@
356
360
 
357
361
  * connection
358
362
  * detach
363
+ * ~~id~~
359
364
  * send
360
365
 
361
366
  ## Coverage
@@ -223,7 +223,7 @@ class Puppeteer::Browser
223
223
  # @param predicate [Proc(Puppeteer::Target -> Boolean)]
224
224
  # @return [Puppeteer::Target]
225
225
  def wait_for_target(predicate:, timeout: nil)
226
- timeout_in_sec = (timeout || 30000).to_i / 1000.0
226
+ timeout_helper = Puppeteer::TimeoutHelper.new('target', timeout_ms: timeout, default_timeout_ms: 30000)
227
227
  existing_target = targets.find { |target| predicate.call(target) }
228
228
  return existing_target if existing_target
229
229
 
@@ -241,15 +241,9 @@ class Puppeteer::Browser
241
241
  end
242
242
 
243
243
  begin
244
- if timeout_in_sec > 0
245
- Timeout.timeout(timeout_in_sec) do
246
- target_promise.value!
247
- end
248
- else
244
+ timeout_helper.with_timeout do
249
245
  target_promise.value!
250
246
  end
251
- rescue Timeout::Error
252
- raise Puppeteer::TimeoutError.new("waiting for target failed: timeout #{timeout}ms exceeded")
253
247
  ensure
254
248
  remove_event_listener(*event_listening_ids)
255
249
  end
@@ -74,6 +74,7 @@ class Puppeteer::BrowserContext
74
74
  'clipboard-read' => 'clipboardReadWrite',
75
75
  'clipboard-write' => 'clipboardReadWrite',
76
76
  'payment-handler' => 'paymentHandler',
77
+ 'persistent-storage' => 'durableStorage',
77
78
  'idle-detection' => 'idleDetection',
78
79
  # chrome-specific permissions we have.
79
80
  'midi-sysex' => 'midiSysex',
@@ -94,7 +94,7 @@ class Puppeteer::BrowserRunner
94
94
  FileUtils.rm_rf(@temp_directory)
95
95
  end
96
96
  }
97
- trap(:EXIT) do
97
+ at_exit do
98
98
  kill
99
99
  end
100
100
 
@@ -5,10 +5,14 @@ class Puppeteer::Coverage
5
5
  @css = Puppeteer::CSSCoverage.new(client)
6
6
  end
7
7
 
8
- def start_js_coverage(reset_on_navigation: nil, report_anonymous_scripts: nil)
8
+ def start_js_coverage(
9
+ reset_on_navigation: nil,
10
+ report_anonymous_scripts: nil,
11
+ include_raw_script_coverage: nil)
9
12
  @js.start(
10
13
  reset_on_navigation: reset_on_navigation,
11
14
  report_anonymous_scripts: report_anonymous_scripts,
15
+ include_raw_script_coverage: include_raw_script_coverage,
12
16
  )
13
17
  end
14
18
 
@@ -16,7 +20,11 @@ class Puppeteer::Coverage
16
20
  @js.stop
17
21
  end
18
22
 
19
- def js_coverage(reset_on_navigation: nil, report_anonymous_scripts: nil, &block)
23
+ def js_coverage(
24
+ reset_on_navigation: nil,
25
+ report_anonymous_scripts: nil,
26
+ include_raw_script_coverage: nil,
27
+ &block)
20
28
  unless block
21
29
  raise ArgumentError.new('Block must be given')
22
30
  end
@@ -24,6 +32,7 @@ class Puppeteer::Coverage
24
32
  start_js_coverage(
25
33
  reset_on_navigation: reset_on_navigation,
26
34
  report_anonymous_scripts: report_anonymous_scripts,
35
+ include_raw_script_coverage: include_raw_script_coverage,
27
36
  )
28
37
  block.call
29
38
  stop_js_coverage