playwright-ruby-client 1.28.1 → 1.29.1.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/accessibility.md +9 -14
  3. data/documentation/docs/api/api_request_context.md +44 -41
  4. data/documentation/docs/api/api_response.md +13 -3
  5. data/documentation/docs/api/browser.md +24 -23
  6. data/documentation/docs/api/browser_context.md +71 -45
  7. data/documentation/docs/api/browser_type.md +21 -14
  8. data/documentation/docs/api/cdp_session.md +3 -5
  9. data/documentation/docs/api/console_message.md +7 -4
  10. data/documentation/docs/api/dialog.md +9 -5
  11. data/documentation/docs/api/download.md +19 -11
  12. data/documentation/docs/api/element_handle.md +125 -116
  13. data/documentation/docs/api/experimental/android.md +4 -5
  14. data/documentation/docs/api/experimental/android_device.md +11 -2
  15. data/documentation/docs/api/experimental/android_input.md +5 -0
  16. data/documentation/docs/api/file_chooser.md +6 -3
  17. data/documentation/docs/api/frame.md +182 -171
  18. data/documentation/docs/api/frame_locator.md +27 -38
  19. data/documentation/docs/api/js_handle.md +16 -10
  20. data/documentation/docs/api/keyboard.md +29 -16
  21. data/documentation/docs/api/locator.md +189 -140
  22. data/documentation/docs/api/mouse.md +9 -4
  23. data/documentation/docs/api/page.md +304 -289
  24. data/documentation/docs/api/playwright.md +8 -5
  25. data/documentation/docs/api/request.md +34 -15
  26. data/documentation/docs/api/response.md +27 -10
  27. data/documentation/docs/api/route.md +44 -12
  28. data/documentation/docs/api/selectors.md +5 -3
  29. data/documentation/docs/api/touchscreen.md +2 -0
  30. data/documentation/docs/api/tracing.md +11 -11
  31. data/documentation/docs/api/web_socket.md +9 -4
  32. data/documentation/docs/api/worker.md +12 -11
  33. data/documentation/docs/include/api_coverage.md +2 -0
  34. data/lib/playwright/channel_owners/api_request_context.rb +37 -2
  35. data/lib/playwright/channel_owners/browser_context.rb +22 -26
  36. data/lib/playwright/channel_owners/page.rb +35 -25
  37. data/lib/playwright/channel_owners/route.rb +28 -8
  38. data/lib/playwright/event_emitter.rb +6 -1
  39. data/lib/playwright/locator_impl.rb +8 -0
  40. data/lib/playwright/select_option_values.rb +2 -0
  41. data/lib/playwright/version.rb +2 -2
  42. data/lib/playwright_api/accessibility.rb +9 -13
  43. data/lib/playwright_api/android.rb +14 -12
  44. data/lib/playwright_api/android_device.rb +38 -13
  45. data/lib/playwright_api/android_input.rb +5 -0
  46. data/lib/playwright_api/android_socket.rb +4 -2
  47. data/lib/playwright_api/android_web_view.rb +5 -2
  48. data/lib/playwright_api/api_request.rb +6 -3
  49. data/lib/playwright_api/api_request_context.rb +52 -42
  50. data/lib/playwright_api/api_response.rb +13 -2
  51. data/lib/playwright_api/browser.rb +30 -22
  52. data/lib/playwright_api/browser_context.rb +82 -45
  53. data/lib/playwright_api/browser_type.rb +29 -19
  54. data/lib/playwright_api/cdp_session.rb +9 -10
  55. data/lib/playwright_api/console_message.rb +13 -8
  56. data/lib/playwright_api/dialog.rb +14 -10
  57. data/lib/playwright_api/download.rb +19 -9
  58. data/lib/playwright_api/element_handle.rb +122 -99
  59. data/lib/playwright_api/file_chooser.rb +6 -1
  60. data/lib/playwright_api/frame.rb +186 -141
  61. data/lib/playwright_api/frame_locator.rb +29 -32
  62. data/lib/playwright_api/js_handle.rb +22 -12
  63. data/lib/playwright_api/keyboard.rb +29 -14
  64. data/lib/playwright_api/locator.rb +183 -112
  65. data/lib/playwright_api/mouse.rb +9 -2
  66. data/lib/playwright_api/page.rb +307 -259
  67. data/lib/playwright_api/playwright.rb +17 -10
  68. data/lib/playwright_api/request.rb +40 -13
  69. data/lib/playwright_api/response.rb +33 -16
  70. data/lib/playwright_api/route.rb +50 -17
  71. data/lib/playwright_api/selectors.rb +12 -7
  72. data/lib/playwright_api/touchscreen.rb +2 -0
  73. data/lib/playwright_api/tracing.rb +17 -11
  74. data/lib/playwright_api/web_socket.rb +15 -10
  75. data/lib/playwright_api/worker.rb +20 -17
  76. data/playwright.gemspec +2 -2
  77. data/sig/playwright.rbs +559 -0
  78. metadata +10 -9
@@ -1,6 +1,6 @@
1
1
  module Playwright
2
- # API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.md)
3
- # after Playwright script runs.
2
+ #
3
+ # API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.md) after Playwright script runs.
4
4
  #
5
5
  # Start recording a trace before performing actions. At the end, stop tracing and save it to a file.
6
6
  #
@@ -14,8 +14,11 @@ module Playwright
14
14
  # ```
15
15
  class Tracing < PlaywrightApi
16
16
 
17
+ #
17
18
  # Start tracing.
18
19
  #
20
+ # **Usage**
21
+ #
19
22
  # ```python sync
20
23
  # context.tracing.start(name="trace", screenshots=True, snapshots=True)
21
24
  # page = context.new_page()
@@ -31,9 +34,10 @@ module Playwright
31
34
  wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots), sources: unwrap_impl(sources), title: unwrap_impl(title)))
32
35
  end
33
36
 
34
- # Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use
35
- # [`method: Tracing.start`] once, and then create multiple trace chunks with [`method: Tracing.startChunk`] and
36
- # [`method: Tracing.stopChunk`].
37
+ #
38
+ # Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use [`method: Tracing.start`] once, and then create multiple trace chunks with [`method: Tracing.startChunk`] and [`method: Tracing.stopChunk`].
39
+ #
40
+ # **Usage**
37
41
  #
38
42
  # ```python sync
39
43
  # context.tracing.start(name="trace", screenshots=True, snapshots=True)
@@ -54,11 +58,13 @@ module Playwright
54
58
  wrap_impl(@impl.start_chunk(title: unwrap_impl(title)))
55
59
  end
56
60
 
61
+ #
57
62
  # Stop tracing.
58
63
  def stop(path: nil)
59
64
  wrap_impl(@impl.stop(path: unwrap_impl(path)))
60
65
  end
61
66
 
67
+ #
62
68
  # Stop the trace chunk. See [`method: Tracing.startChunk`] for more details about multiple trace chunks.
63
69
  def stop_chunk(path: nil)
64
70
  wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
@@ -66,20 +72,20 @@ module Playwright
66
72
 
67
73
  # -- inherited from EventEmitter --
68
74
  # @nodoc
69
- def once(event, callback)
70
- event_emitter_proxy.once(event, callback)
75
+ def off(event, callback)
76
+ event_emitter_proxy.off(event, callback)
71
77
  end
72
78
 
73
79
  # -- inherited from EventEmitter --
74
80
  # @nodoc
75
- def on(event, callback)
76
- event_emitter_proxy.on(event, callback)
81
+ def once(event, callback)
82
+ event_emitter_proxy.once(event, callback)
77
83
  end
78
84
 
79
85
  # -- inherited from EventEmitter --
80
86
  # @nodoc
81
- def off(event, callback)
82
- event_emitter_proxy.off(event, callback)
87
+ def on(event, callback)
88
+ event_emitter_proxy.on(event, callback)
83
89
  end
84
90
 
85
91
  private def event_emitter_proxy
@@ -1,48 +1,53 @@
1
1
  module Playwright
2
+ #
2
3
  # The `WebSocket` class represents websocket connections in the page.
3
4
  class WebSocket < PlaywrightApi
4
5
 
6
+ #
5
7
  # Indicates that the web socket has been closed.
6
8
  def closed?
7
9
  wrap_impl(@impl.closed?)
8
10
  end
9
11
 
12
+ #
10
13
  # Contains the URL of the WebSocket.
11
14
  def url
12
15
  wrap_impl(@impl.url)
13
16
  end
14
17
 
18
+ #
15
19
  # Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
16
20
  # value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.
17
21
  def expect_event(event, predicate: nil, timeout: nil, &block)
18
22
  wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
19
23
  end
20
24
 
21
- # > NOTE: In most cases, you should use [`method: WebSocket.waitForEvent`].
22
25
  #
23
- # Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and
24
- # waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is
25
- # fired.
26
+ # **NOTE**: In most cases, you should use [`method: WebSocket.waitForEvent`].
27
+ #
28
+ # Waits for given `event` to fire. If predicate is provided, it passes
29
+ # event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value.
30
+ # Will throw an error if the socket is closed before the `event` is fired.
26
31
  def wait_for_event(event, predicate: nil, timeout: nil, &block)
27
32
  wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
28
33
  end
29
34
 
30
35
  # -- inherited from EventEmitter --
31
36
  # @nodoc
32
- def once(event, callback)
33
- event_emitter_proxy.once(event, callback)
37
+ def off(event, callback)
38
+ event_emitter_proxy.off(event, callback)
34
39
  end
35
40
 
36
41
  # -- inherited from EventEmitter --
37
42
  # @nodoc
38
- def on(event, callback)
39
- event_emitter_proxy.on(event, callback)
43
+ def once(event, callback)
44
+ event_emitter_proxy.once(event, callback)
40
45
  end
41
46
 
42
47
  # -- inherited from EventEmitter --
43
48
  # @nodoc
44
- def off(event, callback)
45
- event_emitter_proxy.off(event, callback)
49
+ def on(event, callback)
50
+ event_emitter_proxy.on(event, callback)
46
51
  end
47
52
 
48
53
  private def event_emitter_proxy
@@ -1,4 +1,5 @@
1
1
  module Playwright
2
+ #
2
3
  # The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker`
3
4
  # event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the
4
5
  # worker is gone.
@@ -16,25 +17,27 @@ module Playwright
16
17
  # ```
17
18
  class Worker < PlaywrightApi
18
19
 
20
+ #
19
21
  # Returns the return value of `expression`.
20
22
  #
21
- # If the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would
22
- # wait for the promise to resolve and return its value.
23
+ # If the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would wait for the promise
24
+ # to resolve and return its value.
23
25
  #
24
- # If the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then
25
- # [`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are
26
- # not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
26
+ # If the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then [`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some
27
+ # additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
27
28
  def evaluate(expression, arg: nil)
28
29
  wrap_impl(@impl.evaluate(unwrap_impl(expression), arg: unwrap_impl(arg)))
29
30
  end
30
31
 
32
+ #
31
33
  # Returns the return value of `expression` as a `JSHandle`.
32
34
  #
33
- # The only difference between [`method: Worker.evaluate`] and [`method: Worker.evaluateHandle`] is that
34
- # [`method: Worker.evaluateHandle`] returns `JSHandle`.
35
+ # The only difference between [`method: Worker.evaluate`] and
36
+ # [`method: Worker.evaluateHandle`] is that [`method: Worker.evaluateHandle`]
37
+ # returns `JSHandle`.
35
38
  #
36
- # If the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then
37
- # [`method: Worker.evaluateHandle`] would wait for the promise to resolve and return its value.
39
+ # If the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then [`method: Worker.evaluateHandle`] would wait for
40
+ # the promise to resolve and return its value.
38
41
  def evaluate_handle(expression, arg: nil)
39
42
  wrap_impl(@impl.evaluate_handle(unwrap_impl(expression), arg: unwrap_impl(arg)))
40
43
  end
@@ -43,14 +46,20 @@ module Playwright
43
46
  wrap_impl(@impl.url)
44
47
  end
45
48
 
49
+ # @nodoc
50
+ def page=(req)
51
+ wrap_impl(@impl.page=(unwrap_impl(req)))
52
+ end
53
+
46
54
  # @nodoc
47
55
  def context=(req)
48
56
  wrap_impl(@impl.context=(unwrap_impl(req)))
49
57
  end
50
58
 
59
+ # -- inherited from EventEmitter --
51
60
  # @nodoc
52
- def page=(req)
53
- wrap_impl(@impl.page=(unwrap_impl(req)))
61
+ def off(event, callback)
62
+ event_emitter_proxy.off(event, callback)
54
63
  end
55
64
 
56
65
  # -- inherited from EventEmitter --
@@ -65,12 +74,6 @@ module Playwright
65
74
  event_emitter_proxy.on(event, callback)
66
75
  end
67
76
 
68
- # -- inherited from EventEmitter --
69
- # @nodoc
70
- def off(event, callback)
71
- event_emitter_proxy.off(event, callback)
72
- end
73
-
74
77
  private def event_emitter_proxy
75
78
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
76
79
  end
data/playwright.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  `git ls-files -z`.split("\x0").reject do |f|
20
20
  f.match(%r{^(test|spec|features)/}) || f.include?(".git") || f.include?(".circleci") || f.start_with?("development/")
21
21
  end
22
- end + `find lib/playwright_api -name *.rb -type f`.split("\n")
22
+ end + `find lib/playwright_api -name *.rb -type f`.split("\n") + `find sig -name *.rbs -type f`.split("\n")
23
23
  spec.bindir = 'exe'
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = '>= 2.4'
28
28
  spec.add_dependency 'concurrent-ruby', '>= 1.1.6'
29
29
  spec.add_dependency 'mime-types', '>= 3.0'
30
- spec.add_development_dependency 'bundler', '~> 2.3.0'
30
+ spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'chunky_png'
32
32
  spec.add_development_dependency 'dry-inflector'
33
33
  spec.add_development_dependency 'faye-websocket'