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
@@ -0,0 +1,7 @@
1
+ module Playwright
2
+ define_api_implementation :TouchscreenImpl do
3
+ def initialize(channel)
4
+ @channel = channel
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '0.0.9'
4
+ VERSION = '0.1.0'
5
5
  end
@@ -23,7 +23,7 @@ module Playwright
23
23
  return if timeout_ms <= 0
24
24
 
25
25
  Concurrent::Promises.schedule(timeout_ms / 1000.0) {
26
- reject(TimeoutError.new(message))
26
+ reject(TimeoutError.new(message: message))
27
27
  }
28
28
 
29
29
  self
@@ -2,32 +2,36 @@ module Playwright
2
2
  # @nodoc
3
3
  class Android < PlaywrightApi
4
4
 
5
+ # @nodoc
6
+ def devices
7
+ wrap_impl(@impl.devices)
8
+ end
9
+
5
10
  # @nodoc
6
11
  def after_initialize
7
12
  wrap_impl(@impl.after_initialize)
8
13
  end
9
14
 
15
+ # -- inherited from EventEmitter --
10
16
  # @nodoc
11
- def devices
12
- wrap_impl(@impl.devices)
17
+ def once(event, callback)
18
+ event_emitter_proxy.once(event, callback)
13
19
  end
14
20
 
15
21
  # -- inherited from EventEmitter --
16
22
  # @nodoc
17
23
  def on(event, callback)
18
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
24
+ event_emitter_proxy.on(event, callback)
19
25
  end
20
26
 
21
27
  # -- inherited from EventEmitter --
22
28
  # @nodoc
23
29
  def off(event, callback)
24
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
30
+ event_emitter_proxy.off(event, callback)
25
31
  end
26
32
 
27
- # -- inherited from EventEmitter --
28
- # @nodoc
29
- def once(event, callback)
30
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
33
+ private def event_emitter_proxy
34
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
31
35
  end
32
36
  end
33
37
  end
@@ -12,11 +12,6 @@ module Playwright
12
12
  wrap_impl(@impl.close)
13
13
  end
14
14
 
15
- # @nodoc
16
- def shell(command)
17
- wrap_impl(@impl.shell(unwrap_impl(command)))
18
- end
19
-
20
15
  # @nodoc
21
16
  def after_initialize
22
17
  wrap_impl(@impl.after_initialize)
@@ -32,6 +27,11 @@ module Playwright
32
27
  wrap_impl(@impl.screenshot(path: unwrap_impl(path)))
33
28
  end
34
29
 
30
+ # @nodoc
31
+ def shell(command)
32
+ wrap_impl(@impl.shell(unwrap_impl(command)))
33
+ end
34
+
35
35
  # @nodoc
36
36
  def input
37
37
  wrap_impl(@impl.input)
@@ -59,20 +59,24 @@ module Playwright
59
59
 
60
60
  # -- inherited from EventEmitter --
61
61
  # @nodoc
62
- def on(event, callback)
63
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
62
+ def once(event, callback)
63
+ event_emitter_proxy.once(event, callback)
64
64
  end
65
65
 
66
66
  # -- inherited from EventEmitter --
67
67
  # @nodoc
68
- def off(event, callback)
69
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
68
+ def on(event, callback)
69
+ event_emitter_proxy.on(event, callback)
70
70
  end
71
71
 
72
72
  # -- inherited from EventEmitter --
73
73
  # @nodoc
74
- def once(event, callback)
75
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
74
+ def off(event, callback)
75
+ event_emitter_proxy.off(event, callback)
76
+ end
77
+
78
+ private def event_emitter_proxy
79
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
76
80
  end
77
81
  end
78
82
  end
@@ -7,6 +7,11 @@ module Playwright
7
7
  wrap_impl(@impl.type(unwrap_impl(text)))
8
8
  end
9
9
 
10
+ # @nodoc
11
+ def tap_point(point)
12
+ wrap_impl(@impl.tap_point(unwrap_impl(point)))
13
+ end
14
+
10
15
  # @nodoc
11
16
  def drag(from, to, steps)
12
17
  wrap_impl(@impl.drag(unwrap_impl(from), unwrap_impl(to), unwrap_impl(steps)))
@@ -16,10 +21,5 @@ module Playwright
16
21
  def press(key)
17
22
  wrap_impl(@impl.press(unwrap_impl(key)))
18
23
  end
19
-
20
- # @nodoc
21
- def tap_point(point)
22
- wrap_impl(@impl.tap_point(unwrap_impl(point)))
23
- end
24
24
  end
25
25
  end
@@ -4,20 +4,24 @@ module Playwright
4
4
 
5
5
  # -- inherited from EventEmitter --
6
6
  # @nodoc
7
- def on(event, callback)
8
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
7
+ def once(event, callback)
8
+ event_emitter_proxy.once(event, callback)
9
9
  end
10
10
 
11
11
  # -- inherited from EventEmitter --
12
12
  # @nodoc
13
- def off(event, callback)
14
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
13
+ def on(event, callback)
14
+ event_emitter_proxy.on(event, callback)
15
15
  end
16
16
 
17
17
  # -- inherited from EventEmitter --
18
18
  # @nodoc
19
- def once(event, callback)
20
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
19
+ def off(event, callback)
20
+ event_emitter_proxy.off(event, callback)
21
+ end
22
+
23
+ private def event_emitter_proxy
24
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
21
25
  end
22
26
  end
23
27
  end
@@ -198,20 +198,24 @@ module Playwright
198
198
 
199
199
  # -- inherited from EventEmitter --
200
200
  # @nodoc
201
- def on(event, callback)
202
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
201
+ def once(event, callback)
202
+ event_emitter_proxy.once(event, callback)
203
203
  end
204
204
 
205
205
  # -- inherited from EventEmitter --
206
206
  # @nodoc
207
- def off(event, callback)
208
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
207
+ def on(event, callback)
208
+ event_emitter_proxy.on(event, callback)
209
209
  end
210
210
 
211
211
  # -- inherited from EventEmitter --
212
212
  # @nodoc
213
- def once(event, callback)
214
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
213
+ def off(event, callback)
214
+ event_emitter_proxy.off(event, callback)
215
+ end
216
+
217
+ private def event_emitter_proxy
218
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
215
219
  end
216
220
  end
217
221
  end
@@ -567,20 +567,24 @@ module Playwright
567
567
 
568
568
  # -- inherited from EventEmitter --
569
569
  # @nodoc
570
- def on(event, callback)
571
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
570
+ def once(event, callback)
571
+ event_emitter_proxy.once(event, callback)
572
572
  end
573
573
 
574
574
  # -- inherited from EventEmitter --
575
575
  # @nodoc
576
- def off(event, callback)
577
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
576
+ def on(event, callback)
577
+ event_emitter_proxy.on(event, callback)
578
578
  end
579
579
 
580
580
  # -- inherited from EventEmitter --
581
581
  # @nodoc
582
- def once(event, callback)
583
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
582
+ def off(event, callback)
583
+ event_emitter_proxy.off(event, callback)
584
+ end
585
+
586
+ private def event_emitter_proxy
587
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
584
588
  end
585
589
  end
586
590
  end
@@ -207,20 +207,24 @@ module Playwright
207
207
 
208
208
  # -- inherited from EventEmitter --
209
209
  # @nodoc
210
- def on(event, callback)
211
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
210
+ def once(event, callback)
211
+ event_emitter_proxy.once(event, callback)
212
212
  end
213
213
 
214
214
  # -- inherited from EventEmitter --
215
215
  # @nodoc
216
- def off(event, callback)
217
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
216
+ def on(event, callback)
217
+ event_emitter_proxy.on(event, callback)
218
218
  end
219
219
 
220
220
  # -- inherited from EventEmitter --
221
221
  # @nodoc
222
- def once(event, callback)
223
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
222
+ def off(event, callback)
223
+ event_emitter_proxy.off(event, callback)
224
+ end
225
+
226
+ private def event_emitter_proxy
227
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
224
228
  end
225
229
  end
226
230
  end
@@ -36,20 +36,24 @@ module Playwright
36
36
 
37
37
  # -- inherited from EventEmitter --
38
38
  # @nodoc
39
- def on(event, callback)
40
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
39
+ def once(event, callback)
40
+ event_emitter_proxy.once(event, callback)
41
41
  end
42
42
 
43
43
  # -- inherited from EventEmitter --
44
44
  # @nodoc
45
- def off(event, callback)
46
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
45
+ def on(event, callback)
46
+ event_emitter_proxy.on(event, callback)
47
47
  end
48
48
 
49
49
  # -- inherited from EventEmitter --
50
50
  # @nodoc
51
- def once(event, callback)
52
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
51
+ def off(event, callback)
52
+ event_emitter_proxy.off(event, callback)
53
+ end
54
+
55
+ private def event_emitter_proxy
56
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
53
57
  end
54
58
  end
55
59
  end
@@ -23,20 +23,24 @@ module Playwright
23
23
 
24
24
  # -- inherited from EventEmitter --
25
25
  # @nodoc
26
- def on(event, callback)
27
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
26
+ def once(event, callback)
27
+ event_emitter_proxy.once(event, callback)
28
28
  end
29
29
 
30
30
  # -- inherited from EventEmitter --
31
31
  # @nodoc
32
- def off(event, callback)
33
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
32
+ def on(event, callback)
33
+ event_emitter_proxy.on(event, callback)
34
34
  end
35
35
 
36
36
  # -- inherited from EventEmitter --
37
37
  # @nodoc
38
- def once(event, callback)
39
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
38
+ def off(event, callback)
39
+ event_emitter_proxy.off(event, callback)
40
+ end
41
+
42
+ private def event_emitter_proxy
43
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
40
44
  end
41
45
  end
42
46
  end
@@ -44,22 +44,22 @@ module Playwright
44
44
 
45
45
  # Deletes the downloaded file.
46
46
  def delete
47
- raise NotImplementedError.new('delete is not implemented yet.')
47
+ wrap_impl(@impl.delete)
48
48
  end
49
49
 
50
50
  # Returns download error if any.
51
51
  def failure
52
- raise NotImplementedError.new('failure is not implemented yet.')
52
+ wrap_impl(@impl.failure)
53
53
  end
54
54
 
55
55
  # Returns path to the downloaded file in case of successful download.
56
56
  def path
57
- raise NotImplementedError.new('path is not implemented yet.')
57
+ wrap_impl(@impl.path)
58
58
  end
59
59
 
60
60
  # Saves the download to a user-specified path.
61
61
  def save_as(path)
62
- raise NotImplementedError.new('save_as is not implemented yet.')
62
+ wrap_impl(@impl.save_as(unwrap_impl(path)))
63
63
  end
64
64
 
65
65
  # Returns suggested filename for this download. It is typically computed by the browser from the
@@ -67,12 +67,34 @@ module Playwright
67
67
  # or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
68
68
  # browsers can use different logic for computing it.
69
69
  def suggested_filename
70
- raise NotImplementedError.new('suggested_filename is not implemented yet.')
70
+ wrap_impl(@impl.suggested_filename)
71
71
  end
72
72
 
73
73
  # Returns downloaded url.
74
74
  def url
75
- raise NotImplementedError.new('url is not implemented yet.')
75
+ wrap_impl(@impl.url)
76
+ end
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
+
90
+ # -- inherited from EventEmitter --
91
+ # @nodoc
92
+ def off(event, callback)
93
+ event_emitter_proxy.off(event, callback)
94
+ end
95
+
96
+ private def event_emitter_proxy
97
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
76
98
  end
77
99
  end
78
100
  end
@@ -629,20 +629,24 @@ module Playwright
629
629
 
630
630
  # -- inherited from EventEmitter --
631
631
  # @nodoc
632
- def on(event, callback)
633
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
632
+ def once(event, callback)
633
+ event_emitter_proxy.once(event, callback)
634
634
  end
635
635
 
636
636
  # -- inherited from EventEmitter --
637
637
  # @nodoc
638
- def off(event, callback)
639
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
638
+ def on(event, callback)
639
+ event_emitter_proxy.on(event, callback)
640
640
  end
641
641
 
642
642
  # -- inherited from EventEmitter --
643
643
  # @nodoc
644
- def once(event, callback)
645
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
644
+ def off(event, callback)
645
+ event_emitter_proxy.off(event, callback)
646
+ end
647
+
648
+ private def event_emitter_proxy
649
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
646
650
  end
647
651
  end
648
652
  end
@@ -27,23 +27,23 @@ module Playwright
27
27
 
28
28
  # Returns input element associated with this file chooser.
29
29
  def element
30
- raise NotImplementedError.new('element is not implemented yet.')
30
+ wrap_impl(@impl.element)
31
31
  end
32
32
 
33
33
  # Returns whether this file chooser accepts multiple files.
34
34
  def multiple?
35
- raise NotImplementedError.new('multiple? is not implemented yet.')
35
+ wrap_impl(@impl.multiple?)
36
36
  end
37
37
 
38
38
  # Returns page this file chooser belongs to.
39
39
  def page
40
- raise NotImplementedError.new('page is not implemented yet.')
40
+ wrap_impl(@impl.page)
41
41
  end
42
42
 
43
43
  # Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then
44
44
  # they are resolved relative to the the current working directory. For empty array, clears the selected files.
45
45
  def set_files(files, noWaitAfter: nil, timeout: nil)
46
- raise NotImplementedError.new('set_files is not implemented yet.')
46
+ wrap_impl(@impl.set_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
47
47
  end
48
48
  alias_method :files=, :set_files
49
49
  end