playwright-ruby-client 0.0.9 → 0.1.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api_coverage.md +12 -12
  3. data/lib/playwright.rb +3 -2
  4. data/lib/playwright/{input_types/android_input.rb → android_input_impl.rb} +5 -1
  5. data/lib/playwright/api_implementation.rb +18 -0
  6. data/lib/playwright/channel.rb +7 -0
  7. data/lib/playwright/channel_owners/android_device.rb +1 -1
  8. data/lib/playwright/channel_owners/download.rb +27 -0
  9. data/lib/playwright/channel_owners/element_handle.rb +2 -2
  10. data/lib/playwright/channel_owners/frame.rb +2 -2
  11. data/lib/playwright/channel_owners/page.rb +33 -3
  12. data/lib/playwright/errors.rb +1 -1
  13. data/lib/playwright/event_emitter.rb +4 -0
  14. data/lib/playwright/event_emitter_proxy.rb +49 -0
  15. data/lib/playwright/file_chooser_impl.rb +23 -0
  16. data/lib/playwright/input_files.rb +1 -1
  17. data/lib/playwright/{input_types/keyboard.rb → keyboard_impl.rb} +5 -1
  18. data/lib/playwright/mouse_impl.rb +7 -0
  19. data/lib/playwright/playwright_api.rb +59 -20
  20. data/lib/playwright/touchscreen_impl.rb +7 -0
  21. data/lib/playwright/version.rb +1 -1
  22. data/lib/playwright/wait_helper.rb +1 -1
  23. data/lib/playwright_api/android.rb +12 -8
  24. data/lib/playwright_api/android_device.rb +15 -11
  25. data/lib/playwright_api/android_input.rb +5 -5
  26. data/lib/playwright_api/binding_call.rb +10 -6
  27. data/lib/playwright_api/browser.rb +10 -6
  28. data/lib/playwright_api/browser_context.rb +10 -6
  29. data/lib/playwright_api/browser_type.rb +10 -6
  30. data/lib/playwright_api/chromium_browser_context.rb +10 -6
  31. data/lib/playwright_api/console_message.rb +10 -6
  32. data/lib/playwright_api/download.rb +28 -6
  33. data/lib/playwright_api/element_handle.rb +10 -6
  34. data/lib/playwright_api/file_chooser.rb +4 -4
  35. data/lib/playwright_api/frame.rb +10 -6
  36. data/lib/playwright_api/js_handle.rb +10 -6
  37. data/lib/playwright_api/keyboard.rb +5 -5
  38. data/lib/playwright_api/page.rb +10 -6
  39. data/lib/playwright_api/playwright.rb +10 -6
  40. data/lib/playwright_api/request.rb +12 -8
  41. data/lib/playwright_api/response.rb +10 -6
  42. data/lib/playwright_api/selectors.rb +10 -6
  43. metadata +10 -7
  44. data/lib/playwright/input_type.rb +0 -19
  45. data/lib/playwright/input_types/mouse.rb +0 -4
  46. data/lib/playwright/input_types/touchscreen.rb +0 -4
@@ -960,20 +960,24 @@ module Playwright
960
960
 
961
961
  # -- inherited from EventEmitter --
962
962
  # @nodoc
963
- def on(event, callback)
964
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
963
+ def once(event, callback)
964
+ event_emitter_proxy.once(event, callback)
965
965
  end
966
966
 
967
967
  # -- inherited from EventEmitter --
968
968
  # @nodoc
969
- def off(event, callback)
970
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
969
+ def on(event, callback)
970
+ event_emitter_proxy.on(event, callback)
971
971
  end
972
972
 
973
973
  # -- inherited from EventEmitter --
974
974
  # @nodoc
975
- def once(event, callback)
976
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
975
+ def off(event, callback)
976
+ event_emitter_proxy.off(event, callback)
977
+ end
978
+
979
+ private def event_emitter_proxy
980
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
977
981
  end
978
982
  end
979
983
  end
@@ -129,20 +129,24 @@ module Playwright
129
129
 
130
130
  # -- inherited from EventEmitter --
131
131
  # @nodoc
132
- def on(event, callback)
133
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
132
+ def once(event, callback)
133
+ event_emitter_proxy.once(event, callback)
134
134
  end
135
135
 
136
136
  # -- inherited from EventEmitter --
137
137
  # @nodoc
138
- def off(event, callback)
139
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
138
+ def on(event, callback)
139
+ event_emitter_proxy.on(event, callback)
140
140
  end
141
141
 
142
142
  # -- inherited from EventEmitter --
143
143
  # @nodoc
144
- def once(event, callback)
145
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
144
+ def off(event, callback)
145
+ event_emitter_proxy.off(event, callback)
146
+ end
147
+
148
+ private def event_emitter_proxy
149
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
146
150
  end
147
151
  end
148
152
  end
@@ -114,7 +114,7 @@ module Playwright
114
114
  #
115
115
  # > NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
116
116
  def down(key)
117
- @impl.down(unwrap_impl(key))
117
+ wrap_impl(@impl.down(unwrap_impl(key)))
118
118
  end
119
119
 
120
120
  # Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.
@@ -134,7 +134,7 @@ module Playwright
134
134
  #
135
135
  # > NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
136
136
  def insert_text(text)
137
- @impl.insert_text(unwrap_impl(text))
137
+ wrap_impl(@impl.insert_text(unwrap_impl(text)))
138
138
  end
139
139
 
140
140
  # `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
@@ -193,7 +193,7 @@ module Playwright
193
193
  #
194
194
  # Shortcut for [`method: Keyboard.down`] and [`method: Keyboard.up`].
195
195
  def press(key, delay: nil)
196
- @impl.press(unwrap_impl(key), delay: unwrap_impl(delay))
196
+ wrap_impl(@impl.press(unwrap_impl(key), delay: unwrap_impl(delay)))
197
197
  end
198
198
 
199
199
  # Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
@@ -218,12 +218,12 @@ module Playwright
218
218
  #
219
219
  # > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
220
220
  def type(text, delay: nil)
221
- @impl.type(unwrap_impl(text), delay: unwrap_impl(delay))
221
+ wrap_impl(@impl.type(unwrap_impl(text), delay: unwrap_impl(delay)))
222
222
  end
223
223
 
224
224
  # Dispatches a `keyup` event.
225
225
  def up(key)
226
- @impl.up(unwrap_impl(key))
226
+ wrap_impl(@impl.up(unwrap_impl(key)))
227
227
  end
228
228
  end
229
229
  end
@@ -1824,20 +1824,24 @@ module Playwright
1824
1824
 
1825
1825
  # -- inherited from EventEmitter --
1826
1826
  # @nodoc
1827
- def on(event, callback)
1828
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
1827
+ def once(event, callback)
1828
+ event_emitter_proxy.once(event, callback)
1829
1829
  end
1830
1830
 
1831
1831
  # -- inherited from EventEmitter --
1832
1832
  # @nodoc
1833
- def off(event, callback)
1834
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
1833
+ def on(event, callback)
1834
+ event_emitter_proxy.on(event, callback)
1835
1835
  end
1836
1836
 
1837
1837
  # -- inherited from EventEmitter --
1838
1838
  # @nodoc
1839
- def once(event, callback)
1840
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
1839
+ def off(event, callback)
1840
+ event_emitter_proxy.off(event, callback)
1841
+ end
1842
+
1843
+ private def event_emitter_proxy
1844
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1841
1845
  end
1842
1846
  end
1843
1847
  end
@@ -182,20 +182,24 @@ module Playwright
182
182
 
183
183
  # -- inherited from EventEmitter --
184
184
  # @nodoc
185
- def on(event, callback)
186
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
185
+ def once(event, callback)
186
+ event_emitter_proxy.once(event, callback)
187
187
  end
188
188
 
189
189
  # -- inherited from EventEmitter --
190
190
  # @nodoc
191
- def off(event, callback)
192
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
191
+ def on(event, callback)
192
+ event_emitter_proxy.on(event, callback)
193
193
  end
194
194
 
195
195
  # -- inherited from EventEmitter --
196
196
  # @nodoc
197
- def once(event, callback)
198
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
197
+ def off(event, callback)
198
+ event_emitter_proxy.off(event, callback)
199
+ end
200
+
201
+ private def event_emitter_proxy
202
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
199
203
  end
200
204
  end
201
205
  end
@@ -170,32 +170,36 @@ module Playwright
170
170
  wrap_impl(@impl.url)
171
171
  end
172
172
 
173
+ # @nodoc
174
+ def post_data_json
175
+ wrap_impl(@impl.post_data_json)
176
+ end
177
+
173
178
  # @nodoc
174
179
  def after_initialize
175
180
  wrap_impl(@impl.after_initialize)
176
181
  end
177
182
 
183
+ # -- inherited from EventEmitter --
178
184
  # @nodoc
179
- def post_data_json
180
- wrap_impl(@impl.post_data_json)
185
+ def once(event, callback)
186
+ event_emitter_proxy.once(event, callback)
181
187
  end
182
188
 
183
189
  # -- inherited from EventEmitter --
184
190
  # @nodoc
185
191
  def on(event, callback)
186
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
192
+ event_emitter_proxy.on(event, callback)
187
193
  end
188
194
 
189
195
  # -- inherited from EventEmitter --
190
196
  # @nodoc
191
197
  def off(event, callback)
192
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
198
+ event_emitter_proxy.off(event, callback)
193
199
  end
194
200
 
195
- # -- inherited from EventEmitter --
196
- # @nodoc
197
- def once(event, callback)
198
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
201
+ private def event_emitter_proxy
202
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
199
203
  end
200
204
  end
201
205
  end
@@ -54,20 +54,24 @@ module Playwright
54
54
 
55
55
  # -- inherited from EventEmitter --
56
56
  # @nodoc
57
- def on(event, callback)
58
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
57
+ def once(event, callback)
58
+ event_emitter_proxy.once(event, callback)
59
59
  end
60
60
 
61
61
  # -- inherited from EventEmitter --
62
62
  # @nodoc
63
- def off(event, callback)
64
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
63
+ def on(event, callback)
64
+ event_emitter_proxy.on(event, callback)
65
65
  end
66
66
 
67
67
  # -- inherited from EventEmitter --
68
68
  # @nodoc
69
- def once(event, callback)
70
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
69
+ def off(event, callback)
70
+ event_emitter_proxy.off(event, callback)
71
+ end
72
+
73
+ private def event_emitter_proxy
74
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
71
75
  end
72
76
  end
73
77
  end
@@ -54,20 +54,24 @@ module Playwright
54
54
 
55
55
  # -- inherited from EventEmitter --
56
56
  # @nodoc
57
- def on(event, callback)
58
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
57
+ def once(event, callback)
58
+ event_emitter_proxy.once(event, callback)
59
59
  end
60
60
 
61
61
  # -- inherited from EventEmitter --
62
62
  # @nodoc
63
- def off(event, callback)
64
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
63
+ def on(event, callback)
64
+ event_emitter_proxy.on(event, callback)
65
65
  end
66
66
 
67
67
  # -- inherited from EventEmitter --
68
68
  # @nodoc
69
- def once(event, callback)
70
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
69
+ def off(event, callback)
70
+ event_emitter_proxy.off(event, callback)
71
+ end
72
+
73
+ private def event_emitter_proxy
74
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
71
75
  end
72
76
  end
73
77
  end
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.0.9
4
+ version: 0.1.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-12 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -181,6 +181,8 @@ files:
181
181
  - bin/setup
182
182
  - docs/api_coverage.md
183
183
  - lib/playwright.rb
184
+ - lib/playwright/android_input_impl.rb
185
+ - lib/playwright/api_implementation.rb
184
186
  - lib/playwright/channel.rb
185
187
  - lib/playwright/channel_owner.rb
186
188
  - lib/playwright/channel_owners/android.rb
@@ -192,6 +194,7 @@ files:
192
194
  - lib/playwright/channel_owners/chromium_browser.rb
193
195
  - lib/playwright/channel_owners/chromium_browser_context.rb
194
196
  - lib/playwright/channel_owners/console_message.rb
197
+ - lib/playwright/channel_owners/download.rb
195
198
  - lib/playwright/channel_owners/electron.rb
196
199
  - lib/playwright/channel_owners/element_handle.rb
197
200
  - lib/playwright/channel_owners/firefox_browser.rb
@@ -206,22 +209,22 @@ files:
206
209
  - lib/playwright/connection.rb
207
210
  - lib/playwright/errors.rb
208
211
  - lib/playwright/event_emitter.rb
212
+ - lib/playwright/event_emitter_proxy.rb
209
213
  - lib/playwright/events.rb
214
+ - lib/playwright/file_chooser_impl.rb
210
215
  - lib/playwright/http_headers.rb
211
216
  - lib/playwright/input_files.rb
212
- - lib/playwright/input_type.rb
213
- - lib/playwright/input_types/android_input.rb
214
- - lib/playwright/input_types/keyboard.rb
215
- - lib/playwright/input_types/mouse.rb
216
- - lib/playwright/input_types/touchscreen.rb
217
217
  - lib/playwright/javascript.rb
218
218
  - lib/playwright/javascript/expression.rb
219
219
  - lib/playwright/javascript/function.rb
220
220
  - lib/playwright/javascript/value_parser.rb
221
221
  - lib/playwright/javascript/value_serializer.rb
222
+ - lib/playwright/keyboard_impl.rb
223
+ - lib/playwright/mouse_impl.rb
222
224
  - lib/playwright/playwright_api.rb
223
225
  - lib/playwright/select_option_values.rb
224
226
  - lib/playwright/timeout_settings.rb
227
+ - lib/playwright/touchscreen_impl.rb
225
228
  - lib/playwright/transport.rb
226
229
  - lib/playwright/url_matcher.rb
227
230
  - lib/playwright/utils.rb
@@ -1,19 +0,0 @@
1
- module Playwright
2
- class InputType
3
- def initialize(channel)
4
- @channel = channel
5
- end
6
- end
7
-
8
- # namespace declaration
9
- module InputTypes ; end
10
-
11
- def self.define_input_type(class_name, &block)
12
- klass = Class.new(InputType)
13
- klass.class_eval(&block) if block
14
- InputTypes.const_set(class_name, klass)
15
- end
16
- end
17
-
18
- # load subclasses
19
- Dir[File.join(__dir__, 'input_types', '*.rb')].each { |f| require f }
@@ -1,4 +0,0 @@
1
- module Playwright
2
- define_input_type :Mouse do
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Playwright
2
- define_input_type :Touchscreen do
3
- end
4
- end