playwright-ruby-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api_coverage.md +102 -49
  3. data/lib/playwright.rb +1 -0
  4. data/lib/playwright/channel.rb +10 -10
  5. data/lib/playwright/channel_owners/binding_call.rb +3 -0
  6. data/lib/playwright/channel_owners/browser_context.rb +149 -3
  7. data/lib/playwright/channel_owners/dialog.rb +28 -0
  8. data/lib/playwright/channel_owners/page.rb +47 -10
  9. data/lib/playwright/channel_owners/playwright.rb +4 -0
  10. data/lib/playwright/channel_owners/request.rb +26 -2
  11. data/lib/playwright/channel_owners/response.rb +60 -0
  12. data/lib/playwright/channel_owners/route.rb +78 -0
  13. data/lib/playwright/channel_owners/selectors.rb +19 -1
  14. data/lib/playwright/route_handler_entry.rb +36 -0
  15. data/lib/playwright/utils.rb +1 -0
  16. data/lib/playwright/version.rb +1 -1
  17. data/lib/playwright_api/android.rb +80 -8
  18. data/lib/playwright_api/android_device.rb +145 -28
  19. data/lib/playwright_api/android_input.rb +17 -13
  20. data/lib/playwright_api/android_socket.rb +16 -0
  21. data/lib/playwright_api/android_web_view.rb +21 -0
  22. data/lib/playwright_api/binding_call.rb +11 -6
  23. data/lib/playwright_api/browser.rb +6 -6
  24. data/lib/playwright_api/browser_context.rb +33 -28
  25. data/lib/playwright_api/browser_type.rb +14 -14
  26. data/lib/playwright_api/chromium_browser_context.rb +6 -6
  27. data/lib/playwright_api/console_message.rb +6 -6
  28. data/lib/playwright_api/dialog.rb +32 -5
  29. data/lib/playwright_api/download.rb +6 -6
  30. data/lib/playwright_api/element_handle.rb +6 -6
  31. data/lib/playwright_api/file_chooser.rb +1 -1
  32. data/lib/playwright_api/frame.rb +13 -11
  33. data/lib/playwright_api/js_handle.rb +6 -6
  34. data/lib/playwright_api/page.rb +48 -46
  35. data/lib/playwright_api/playwright.rb +7 -7
  36. data/lib/playwright_api/request.rb +8 -8
  37. data/lib/playwright_api/response.rb +27 -17
  38. data/lib/playwright_api/route.rb +27 -5
  39. data/lib/playwright_api/selectors.rb +7 -7
  40. metadata +7 -2
@@ -121,7 +121,7 @@ module Playwright
121
121
  # Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more
122
122
  # information.
123
123
  def selectors # property
124
- raise NotImplementedError.new('selectors is not implemented yet.')
124
+ wrap_impl(@impl.selectors)
125
125
  end
126
126
 
127
127
  # This object can be used to launch or connect to WebKit, returning instances of `WebKitBrowser`.
@@ -161,20 +161,20 @@ module Playwright
161
161
 
162
162
  # -- inherited from EventEmitter --
163
163
  # @nodoc
164
- def once(event, callback)
165
- event_emitter_proxy.once(event, callback)
164
+ def off(event, callback)
165
+ event_emitter_proxy.off(event, callback)
166
166
  end
167
167
 
168
168
  # -- inherited from EventEmitter --
169
169
  # @nodoc
170
- def on(event, callback)
171
- event_emitter_proxy.on(event, callback)
170
+ def once(event, callback)
171
+ event_emitter_proxy.once(event, callback)
172
172
  end
173
173
 
174
174
  # -- inherited from EventEmitter --
175
175
  # @nodoc
176
- def off(event, callback)
177
- event_emitter_proxy.off(event, callback)
176
+ def on(event, callback)
177
+ event_emitter_proxy.on(event, callback)
178
178
  end
179
179
 
180
180
  private def event_emitter_proxy
@@ -2,10 +2,10 @@ module Playwright
2
2
  # Whenever the page sends a request for a network resource the following sequence of events are emitted by `Page`:
3
3
  # - [`event: Page.request`] emitted when the request is issued by the page.
4
4
  # - [`event: Page.response`] emitted when/if the response status and headers are received for the request.
5
- # - [`event: Page.requestfinished`] emitted when the response body is downloaded and the request is complete.
5
+ # - [`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete.
6
6
  #
7
7
  # If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event),
8
- # the [`event: Page.requestfailed`] event is emitted.
8
+ # the [`event: Page.requestFailed`] event is emitted.
9
9
  #
10
10
  # > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will
11
11
  # complete with `'requestfinished'` event.
@@ -180,20 +180,20 @@ module Playwright
180
180
 
181
181
  # -- inherited from EventEmitter --
182
182
  # @nodoc
183
- def once(event, callback)
184
- event_emitter_proxy.once(event, callback)
183
+ def off(event, callback)
184
+ event_emitter_proxy.off(event, callback)
185
185
  end
186
186
 
187
187
  # -- inherited from EventEmitter --
188
188
  # @nodoc
189
- def on(event, callback)
190
- event_emitter_proxy.on(event, callback)
189
+ def once(event, callback)
190
+ event_emitter_proxy.once(event, callback)
191
191
  end
192
192
 
193
193
  # -- inherited from EventEmitter --
194
194
  # @nodoc
195
- def off(event, callback)
196
- event_emitter_proxy.off(event, callback)
195
+ def on(event, callback)
196
+ event_emitter_proxy.on(event, callback)
197
197
  end
198
198
 
199
199
  private def event_emitter_proxy
@@ -4,71 +4,69 @@ module Playwright
4
4
 
5
5
  # Returns the buffer with response body.
6
6
  def body
7
- raise NotImplementedError.new('body is not implemented yet.')
7
+ wrap_impl(@impl.body)
8
8
  end
9
9
 
10
10
  # Waits for this response to finish, returns failure error if request failed.
11
11
  def finished
12
- raise NotImplementedError.new('finished is not implemented yet.')
12
+ wrap_impl(@impl.finished)
13
13
  end
14
14
 
15
15
  # Returns the `Frame` that initiated this response.
16
16
  def frame
17
- raise NotImplementedError.new('frame is not implemented yet.')
17
+ wrap_impl(@impl.frame)
18
18
  end
19
19
 
20
20
  # Returns the object with HTTP headers associated with the response. All header names are lower-case.
21
21
  def headers
22
- raise NotImplementedError.new('headers is not implemented yet.')
22
+ wrap_impl(@impl.headers)
23
23
  end
24
24
 
25
25
  # Returns the JSON representation of response body.
26
26
  #
27
27
  # This method will throw if the response body is not parsable via `JSON.parse`.
28
28
  def json
29
- raise NotImplementedError.new('json is not implemented yet.')
29
+ wrap_impl(@impl.json)
30
30
  end
31
31
 
32
32
  # Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
33
33
  def ok
34
- raise NotImplementedError.new('ok is not implemented yet.')
34
+ wrap_impl(@impl.ok)
35
35
  end
36
36
 
37
37
  # Returns the matching `Request` object.
38
38
  def request
39
- raise NotImplementedError.new('request is not implemented yet.')
39
+ wrap_impl(@impl.request)
40
40
  end
41
41
 
42
42
  # Contains the status code of the response (e.g., 200 for a success).
43
43
  def status
44
- raise NotImplementedError.new('status is not implemented yet.')
44
+ wrap_impl(@impl.status)
45
45
  end
46
46
 
47
47
  # Contains the status text of the response (e.g. usually an "OK" for a success).
48
48
  def status_text
49
- raise NotImplementedError.new('status_text is not implemented yet.')
49
+ wrap_impl(@impl.status_text)
50
50
  end
51
51
 
52
52
  # Returns the text representation of response body.
53
53
  def text
54
- raise NotImplementedError.new('text is not implemented yet.')
54
+ wrap_impl(@impl.text)
55
55
  end
56
56
 
57
57
  # Contains the URL of the response.
58
58
  def url
59
- raise NotImplementedError.new('url is not implemented yet.')
59
+ wrap_impl(@impl.url)
60
60
  end
61
61
 
62
- # -- inherited from EventEmitter --
63
62
  # @nodoc
64
- def once(event, callback)
65
- event_emitter_proxy.once(event, callback)
63
+ def ok?
64
+ wrap_impl(@impl.ok?)
66
65
  end
67
66
 
68
- # -- inherited from EventEmitter --
69
67
  # @nodoc
70
- def on(event, callback)
71
- event_emitter_proxy.on(event, callback)
68
+ def after_initialize
69
+ wrap_impl(@impl.after_initialize)
72
70
  end
73
71
 
74
72
  # -- inherited from EventEmitter --
@@ -77,6 +75,18 @@ module Playwright
77
75
  event_emitter_proxy.off(event, callback)
78
76
  end
79
77
 
78
+ # -- inherited from EventEmitter --
79
+ # @nodoc
80
+ def once(event, callback)
81
+ event_emitter_proxy.once(event, callback)
82
+ end
83
+
84
+ # -- inherited from EventEmitter --
85
+ # @nodoc
86
+ def on(event, callback)
87
+ event_emitter_proxy.on(event, callback)
88
+ end
89
+
80
90
  private def event_emitter_proxy
81
91
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
82
92
  end
@@ -5,7 +5,7 @@ module Playwright
5
5
 
6
6
  # Aborts the route's request.
7
7
  def abort(errorCode: nil)
8
- raise NotImplementedError.new('abort is not implemented yet.')
8
+ wrap_impl(@impl.abort(errorCode: unwrap_impl(errorCode)))
9
9
  end
10
10
 
11
11
  # Continues route's request with optional overrides.
@@ -48,8 +48,8 @@ module Playwright
48
48
  # }
49
49
  # page.route("**/*", handle)
50
50
  # ```
51
- def continue_(headers: nil, method: nil, postData: nil, url: nil)
52
- raise NotImplementedError.new('continue_ is not implemented yet.')
51
+ def continue(headers: nil, method: nil, postData: nil, url: nil)
52
+ wrap_impl(@impl.continue(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
53
53
  end
54
54
 
55
55
  # Fulfills route's request with given response.
@@ -101,12 +101,34 @@ module Playwright
101
101
  headers: nil,
102
102
  path: nil,
103
103
  status: nil)
104
- raise NotImplementedError.new('fulfill is not implemented yet.')
104
+ wrap_impl(@impl.fulfill(body: unwrap_impl(body), contentType: unwrap_impl(contentType), headers: unwrap_impl(headers), path: unwrap_impl(path), status: unwrap_impl(status)))
105
105
  end
106
106
 
107
107
  # A request to be routed.
108
108
  def request
109
- raise NotImplementedError.new('request is not implemented yet.')
109
+ wrap_impl(@impl.request)
110
+ end
111
+
112
+ # -- inherited from EventEmitter --
113
+ # @nodoc
114
+ def off(event, callback)
115
+ event_emitter_proxy.off(event, callback)
116
+ end
117
+
118
+ # -- inherited from EventEmitter --
119
+ # @nodoc
120
+ def once(event, callback)
121
+ event_emitter_proxy.once(event, callback)
122
+ end
123
+
124
+ # -- inherited from EventEmitter --
125
+ # @nodoc
126
+ def on(event, callback)
127
+ event_emitter_proxy.on(event, callback)
128
+ end
129
+
130
+ private def event_emitter_proxy
131
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
110
132
  end
111
133
  end
112
134
  end
@@ -49,25 +49,25 @@ module Playwright
49
49
  # # FIXME: add snippet
50
50
  # ```
51
51
  def register(name, contentScript: nil, path: nil, script: nil)
52
- raise NotImplementedError.new('register is not implemented yet.')
52
+ wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
53
53
  end
54
54
 
55
55
  # -- inherited from EventEmitter --
56
56
  # @nodoc
57
- def once(event, callback)
58
- event_emitter_proxy.once(event, callback)
57
+ def off(event, callback)
58
+ event_emitter_proxy.off(event, callback)
59
59
  end
60
60
 
61
61
  # -- inherited from EventEmitter --
62
62
  # @nodoc
63
- def on(event, callback)
64
- event_emitter_proxy.on(event, callback)
63
+ def once(event, callback)
64
+ event_emitter_proxy.once(event, callback)
65
65
  end
66
66
 
67
67
  # -- inherited from EventEmitter --
68
68
  # @nodoc
69
- def off(event, callback)
70
- event_emitter_proxy.off(event, callback)
69
+ def on(event, callback)
70
+ event_emitter_proxy.on(event, callback)
71
71
  end
72
72
 
73
73
  private def event_emitter_proxy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-21 00:00:00.000000000 Z
11
+ date: 2021-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -194,6 +194,7 @@ files:
194
194
  - lib/playwright/channel_owners/chromium_browser.rb
195
195
  - lib/playwright/channel_owners/chromium_browser_context.rb
196
196
  - lib/playwright/channel_owners/console_message.rb
197
+ - lib/playwright/channel_owners/dialog.rb
197
198
  - lib/playwright/channel_owners/download.rb
198
199
  - lib/playwright/channel_owners/electron.rb
199
200
  - lib/playwright/channel_owners/element_handle.rb
@@ -204,6 +205,7 @@ files:
204
205
  - lib/playwright/channel_owners/playwright.rb
205
206
  - lib/playwright/channel_owners/request.rb
206
207
  - lib/playwright/channel_owners/response.rb
208
+ - lib/playwright/channel_owners/route.rb
207
209
  - lib/playwright/channel_owners/selectors.rb
208
210
  - lib/playwright/channel_owners/webkit_browser.rb
209
211
  - lib/playwright/connection.rb
@@ -222,6 +224,7 @@ files:
222
224
  - lib/playwright/keyboard_impl.rb
223
225
  - lib/playwright/mouse_impl.rb
224
226
  - lib/playwright/playwright_api.rb
227
+ - lib/playwright/route_handler_entry.rb
225
228
  - lib/playwright/select_option_values.rb
226
229
  - lib/playwright/timeout_settings.rb
227
230
  - lib/playwright/touchscreen_impl.rb
@@ -234,6 +237,8 @@ files:
234
237
  - lib/playwright_api/android.rb
235
238
  - lib/playwright_api/android_device.rb
236
239
  - lib/playwright_api/android_input.rb
240
+ - lib/playwright_api/android_socket.rb
241
+ - lib/playwright_api/android_web_view.rb
237
242
  - lib/playwright_api/binding_call.rb
238
243
  - lib/playwright_api/browser.rb
239
244
  - lib/playwright_api/browser_context.rb