puppeteer-ruby 0.0.22 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,14 +32,14 @@ class Puppeteer::Page
32
32
  @type ||= 'png'
33
33
 
34
34
  if options[:quality]
35
- unless @type == 'png'
35
+ unless @type == 'jpeg'
36
36
  raise ArgumentError.new("options.quality is unsupported for the #{@type} screenshots")
37
37
  end
38
38
  unless options[:quality].is_a?(Numeric)
39
39
  raise ArgumentError.new("Expected options.quality to be a number but found #{options[:quality].class}")
40
40
  end
41
41
  quality = options[:quality].to_i
42
- unless (0..100).include?(qualizy)
42
+ unless (0..100).include?(quality)
43
43
  raise ArgumentError.new("Expected options.quality to be between 0 and 100 (inclusive), got #{quality}")
44
44
  end
45
45
  @quality = quality
@@ -0,0 +1,13 @@
1
+ class Puppeteer::Page
2
+ class ScreenshotTaskQueue
3
+ def initialize
4
+ @chain = Concurrent::Promises.fulfilled_future(nil)
5
+ end
6
+
7
+ def post_task(&block)
8
+ result = @chain.then { block.call }
9
+ @chain = result.rescue { nil }
10
+ result.value!
11
+ end
12
+ end
13
+ end
@@ -18,15 +18,13 @@ class Puppeteer::Target
18
18
  # @param {!function():!Promise<!Puppeteer.CDPSession>} sessionFactory
19
19
  # @param {boolean} ignoreHTTPSErrors
20
20
  # @param {?Puppeteer.Viewport} defaultViewport
21
- # @param {!Puppeteer.TaskQueue} screenshotTaskQueue
22
- def initialize(target_info:, browser_context:, session_factory:, ignore_https_errors:, default_viewport:, screenshot_task_queue:)
21
+ def initialize(target_info:, browser_context:, session_factory:, ignore_https_errors:, default_viewport:)
23
22
  @target_info = target_info
24
23
  @browser_context = browser_context
25
24
  @target_id = target_info.target_id
26
25
  @session_factory = session_factory
27
26
  @ignore_https_errors = ignore_https_errors
28
27
  @default_viewport = default_viewport
29
- @screenshot_task_queue = screenshot_task_queue
30
28
 
31
29
 
32
30
  # /** @type {?Promise<!Puppeteer.Page>} */
@@ -68,10 +66,10 @@ class Puppeteer::Target
68
66
  if opener_page.nil? || type != 'page'
69
67
  return true
70
68
  end
71
- # if (!openerPage.listenerCount(Events.Page.Popup))
69
+ # if (!openerPage.listenerCount(PageEmittedEvents::Popup))
72
70
  # return true;
73
71
  popup_page = page
74
- opener_page.emit_event('Events.Page.Popup', popup_page)
72
+ opener_page.emit_event(PageEmittedEvents::Popup, popup_page)
75
73
 
76
74
  true
77
75
  end
@@ -87,7 +85,7 @@ class Puppeteer::Target
87
85
  def page
88
86
  if ['page', 'background_page', 'webview'].include?(@target_info.type) && @page.nil?
89
87
  client = @session_factory.call
90
- @page = Puppeteer::Page.create(client, self, @ignore_https_errors, @default_viewport, @screenshot_task_queue)
88
+ @page = Puppeteer::Page.create(client, self, @ignore_https_errors, @default_viewport)
91
89
  end
92
90
  @page
93
91
  end
@@ -1,3 +1,3 @@
1
1
  class Puppeteer
2
- VERSION = '0.0.22'
2
+ VERSION = '0.28.1'
3
3
  end
@@ -21,13 +21,15 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'concurrent-ruby', '~> 1.1.0'
22
22
  spec.add_dependency 'websocket-driver', '>= 0.6.0'
23
23
  spec.add_dependency 'mime-types', '>= 3.0'
24
- spec.add_development_dependency 'bundler', '~> 1.17'
24
+ spec.add_development_dependency 'bundler', '~> 2.2.3'
25
+ spec.add_development_dependency 'chunky_png'
25
26
  spec.add_development_dependency 'pry-byebug'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
- spec.add_development_dependency 'rspec', '~> 3.0'
27
+ spec.add_development_dependency 'rake', '~> 13.0.3'
28
+ spec.add_development_dependency 'rspec', '~> 3.10.0 '
28
29
  spec.add_development_dependency 'rspec_junit_formatter' # for CircleCI.
29
- spec.add_development_dependency 'rubocop', '~> 0.90.0'
30
+ spec.add_development_dependency 'rubocop', '~> 1.8.0'
30
31
  spec.add_development_dependency 'rubocop-rspec'
31
32
  spec.add_development_dependency 'sinatra'
33
+ spec.add_development_dependency 'webrick'
32
34
  spec.add_development_dependency 'yard'
33
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppeteer-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-15 00:00:00.000000000 Z
11
+ date: 2021-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -58,14 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.17'
61
+ version: 2.2.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.17'
68
+ version: 2.2.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: chunky_png
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
@@ -86,28 +100,28 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: 13.0.3
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: 13.0.3
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '3.0'
117
+ version: 3.10.0
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '3.0'
124
+ version: 3.10.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rspec_junit_formatter
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +142,14 @@ dependencies:
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 0.90.0
145
+ version: 1.8.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 0.90.0
152
+ version: 1.8.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-rspec
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +178,20 @@ dependencies:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: webrick
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: yard
169
197
  requirement: !ruby/object:Gem::Requirement
@@ -186,6 +214,7 @@ extensions: []
186
214
  extra_rdoc_files: []
187
215
  files:
188
216
  - ".circleci/config.yml"
217
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
189
218
  - ".github/stale.yml"
190
219
  - ".github/workflows/docs.yml"
191
220
  - ".github/workflows/reviewdog.yml"
@@ -193,6 +222,7 @@ files:
193
222
  - ".rspec"
194
223
  - ".rubocop.yml"
195
224
  - ".travis.yml"
225
+ - CHANGELOG.md
196
226
  - Dockerfile
197
227
  - Gemfile
198
228
  - README.md
@@ -223,10 +253,13 @@ files:
223
253
  - lib/puppeteer/env.rb
224
254
  - lib/puppeteer/errors.rb
225
255
  - lib/puppeteer/event_callbackable.rb
256
+ - lib/puppeteer/events.rb
257
+ - lib/puppeteer/exception_details.rb
226
258
  - lib/puppeteer/execution_context.rb
227
259
  - lib/puppeteer/file_chooser.rb
228
260
  - lib/puppeteer/frame.rb
229
261
  - lib/puppeteer/frame_manager.rb
262
+ - lib/puppeteer/geolocation.rb
230
263
  - lib/puppeteer/if_present.rb
231
264
  - lib/puppeteer/js_handle.rb
232
265
  - lib/puppeteer/keyboard.rb
@@ -245,6 +278,7 @@ files:
245
278
  - lib/puppeteer/page.rb
246
279
  - lib/puppeteer/page/pdf_options.rb
247
280
  - lib/puppeteer/page/screenshot_options.rb
281
+ - lib/puppeteer/page/screenshot_task_queue.rb
248
282
  - lib/puppeteer/remote_object.rb
249
283
  - lib/puppeteer/request.rb
250
284
  - lib/puppeteer/response.rb