playwright-ruby-client 1.51.0 → 1.53.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/experimental/android.md +10 -0
  3. data/documentation/docs/api/locator.md +23 -0
  4. data/documentation/docs/api/locator_assertions.md +47 -1
  5. data/documentation/docs/api/page.md +1 -1
  6. data/documentation/docs/api/route.md +2 -0
  7. data/documentation/docs/api/selectors.md +10 -0
  8. data/documentation/docs/api/tracing.md +8 -0
  9. data/documentation/docs/include/api_coverage.md +5 -2
  10. data/lib/playwright/channel.rb +6 -3
  11. data/lib/playwright/channel_owners/android.rb +12 -0
  12. data/lib/playwright/channel_owners/android_device.rb +6 -5
  13. data/lib/playwright/channel_owners/api_request_context.rb +6 -1
  14. data/lib/playwright/channel_owners/browser.rb +37 -6
  15. data/lib/playwright/channel_owners/browser_context.rb +44 -23
  16. data/lib/playwright/channel_owners/browser_type.rb +45 -12
  17. data/lib/playwright/channel_owners/element_handle.rb +22 -17
  18. data/lib/playwright/channel_owners/frame.rb +40 -33
  19. data/lib/playwright/channel_owners/page.rb +19 -8
  20. data/lib/playwright/channel_owners/playwright.rb +10 -4
  21. data/lib/playwright/channel_owners/web_socket.rb +1 -1
  22. data/lib/playwright/connection.rb +3 -0
  23. data/lib/playwright/file_chooser_impl.rb +3 -2
  24. data/lib/playwright/frame_locator_impl.rb +5 -8
  25. data/lib/playwright/javascript/value_parser.rb +54 -2
  26. data/lib/playwright/locator_assertions_impl.rb +95 -32
  27. data/lib/playwright/locator_impl.rb +30 -18
  28. data/lib/playwright/page_assertions_impl.rb +10 -8
  29. data/lib/playwright/selectors_impl.rb +45 -0
  30. data/lib/playwright/test.rb +21 -3
  31. data/lib/playwright/timeout_settings.rb +5 -0
  32. data/lib/playwright/utils.rb +0 -33
  33. data/lib/playwright/version.rb +2 -2
  34. data/lib/playwright_api/android.rb +12 -7
  35. data/lib/playwright_api/android_device.rb +8 -8
  36. data/lib/playwright_api/api_request.rb +1 -0
  37. data/lib/playwright_api/api_request_context.rb +6 -6
  38. data/lib/playwright_api/browser.rb +6 -6
  39. data/lib/playwright_api/browser_context.rb +14 -14
  40. data/lib/playwright_api/browser_type.rb +6 -6
  41. data/lib/playwright_api/cdp_session.rb +6 -6
  42. data/lib/playwright_api/dialog.rb +6 -6
  43. data/lib/playwright_api/element_handle.rb +6 -6
  44. data/lib/playwright_api/frame.rb +6 -6
  45. data/lib/playwright_api/js_handle.rb +6 -6
  46. data/lib/playwright_api/locator.rb +28 -2
  47. data/lib/playwright_api/locator_assertions.rb +47 -3
  48. data/lib/playwright_api/page.rb +15 -10
  49. data/lib/playwright_api/playwright.rb +6 -6
  50. data/lib/playwright_api/request.rb +6 -6
  51. data/lib/playwright_api/response.rb +6 -6
  52. data/lib/playwright_api/route.rb +8 -6
  53. data/lib/playwright_api/selectors.rb +1 -28
  54. data/lib/playwright_api/tracing.rb +14 -6
  55. data/lib/playwright_api/web_socket.rb +6 -6
  56. data/lib/playwright_api/worker.rb +6 -6
  57. data/sig/playwright.rbs +7 -0
  58. metadata +5 -5
  59. data/lib/playwright/channel_owners/selectors.rb +0 -26
@@ -1793,13 +1793,13 @@ module Playwright
1793
1793
  end
1794
1794
 
1795
1795
  # @nodoc
1796
- def owned_context=(req)
1797
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1796
+ def guid
1797
+ wrap_impl(@impl.guid)
1798
1798
  end
1799
1799
 
1800
1800
  # @nodoc
1801
- def guid
1802
- wrap_impl(@impl.guid)
1801
+ def snapshot_for_ai
1802
+ wrap_impl(@impl.snapshot_for_ai)
1803
1803
  end
1804
1804
 
1805
1805
  # @nodoc
@@ -1822,22 +1822,27 @@ module Playwright
1822
1822
  wrap_impl(@impl.stop_css_coverage)
1823
1823
  end
1824
1824
 
1825
+ # @nodoc
1826
+ def owned_context=(req)
1827
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1828
+ end
1829
+
1825
1830
  # -- inherited from EventEmitter --
1826
1831
  # @nodoc
1827
- def on(event, callback)
1828
- event_emitter_proxy.on(event, callback)
1832
+ def once(event, callback)
1833
+ event_emitter_proxy.once(event, callback)
1829
1834
  end
1830
1835
 
1831
1836
  # -- inherited from EventEmitter --
1832
1837
  # @nodoc
1833
- def off(event, callback)
1834
- event_emitter_proxy.off(event, callback)
1838
+ def on(event, callback)
1839
+ event_emitter_proxy.on(event, callback)
1835
1840
  end
1836
1841
 
1837
1842
  # -- inherited from EventEmitter --
1838
1843
  # @nodoc
1839
- def once(event, callback)
1840
- event_emitter_proxy.once(event, callback)
1844
+ def off(event, callback)
1845
+ event_emitter_proxy.off(event, callback)
1841
1846
  end
1842
1847
 
1843
1848
  private def event_emitter_proxy
@@ -105,20 +105,20 @@ module Playwright
105
105
 
106
106
  # -- inherited from EventEmitter --
107
107
  # @nodoc
108
- def on(event, callback)
109
- event_emitter_proxy.on(event, callback)
108
+ def once(event, callback)
109
+ event_emitter_proxy.once(event, callback)
110
110
  end
111
111
 
112
112
  # -- inherited from EventEmitter --
113
113
  # @nodoc
114
- def off(event, callback)
115
- event_emitter_proxy.off(event, callback)
114
+ def on(event, callback)
115
+ event_emitter_proxy.on(event, callback)
116
116
  end
117
117
 
118
118
  # -- inherited from EventEmitter --
119
119
  # @nodoc
120
- def once(event, callback)
121
- event_emitter_proxy.once(event, callback)
120
+ def off(event, callback)
121
+ event_emitter_proxy.off(event, callback)
122
122
  end
123
123
 
124
124
  private def event_emitter_proxy
@@ -207,20 +207,20 @@ module Playwright
207
207
 
208
208
  # -- inherited from EventEmitter --
209
209
  # @nodoc
210
- def on(event, callback)
211
- event_emitter_proxy.on(event, 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
- event_emitter_proxy.off(event, 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
- event_emitter_proxy.once(event, callback)
222
+ def off(event, callback)
223
+ event_emitter_proxy.off(event, callback)
224
224
  end
225
225
 
226
226
  private def event_emitter_proxy
@@ -129,20 +129,20 @@ module Playwright
129
129
 
130
130
  # -- inherited from EventEmitter --
131
131
  # @nodoc
132
- def on(event, callback)
133
- event_emitter_proxy.on(event, 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
- event_emitter_proxy.off(event, 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
- event_emitter_proxy.once(event, callback)
144
+ def off(event, callback)
145
+ event_emitter_proxy.off(event, callback)
146
146
  end
147
147
 
148
148
  private def event_emitter_proxy
@@ -35,6 +35,8 @@ module Playwright
35
35
  # The `headers` option applies to both the routed request and any redirects it initiates. However, `url`, `method`, and `postData` only apply to the original request and are not carried over to redirected requests.
36
36
  #
37
37
  # [`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
38
+ #
39
+ # **NOTE**: The `Cookie` header cannot be overridden using this method. If a value is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use [`method: BrowserContext.addCookies`].
38
40
  def continue(headers: nil, method: nil, postData: nil, url: nil)
39
41
  wrap_impl(@impl.continue(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
40
42
  end
@@ -174,20 +176,20 @@ module Playwright
174
176
 
175
177
  # -- inherited from EventEmitter --
176
178
  # @nodoc
177
- def on(event, callback)
178
- event_emitter_proxy.on(event, callback)
179
+ def once(event, callback)
180
+ event_emitter_proxy.once(event, callback)
179
181
  end
180
182
 
181
183
  # -- inherited from EventEmitter --
182
184
  # @nodoc
183
- def off(event, callback)
184
- event_emitter_proxy.off(event, callback)
185
+ def on(event, callback)
186
+ event_emitter_proxy.on(event, callback)
185
187
  end
186
188
 
187
189
  # -- inherited from EventEmitter --
188
190
  # @nodoc
189
- def once(event, callback)
190
- event_emitter_proxy.once(event, callback)
191
+ def off(event, callback)
192
+ event_emitter_proxy.off(event, callback)
191
193
  end
192
194
 
193
195
  private def event_emitter_proxy
@@ -52,35 +52,8 @@ module Playwright
52
52
  #
53
53
  # Defines custom attribute name to be used in [`method: Page.getByTestId`]. `data-testid` is used by default.
54
54
  def set_test_id_attribute(attributeName)
55
- raise NotImplementedError.new('set_test_id_attribute is not implemented yet.')
55
+ wrap_impl(@impl.set_test_id_attribute(unwrap_impl(attributeName)))
56
56
  end
57
57
  alias_method :test_id_attribute=, :set_test_id_attribute
58
-
59
- # @nodoc
60
- def text_id_attribute=(attribute_name)
61
- wrap_impl(@impl.text_id_attribute=(unwrap_impl(attribute_name)))
62
- end
63
-
64
- # -- inherited from EventEmitter --
65
- # @nodoc
66
- def on(event, callback)
67
- event_emitter_proxy.on(event, callback)
68
- end
69
-
70
- # -- inherited from EventEmitter --
71
- # @nodoc
72
- def off(event, callback)
73
- event_emitter_proxy.off(event, callback)
74
- end
75
-
76
- # -- inherited from EventEmitter --
77
- # @nodoc
78
- def once(event, callback)
79
- event_emitter_proxy.once(event, callback)
80
- end
81
-
82
- private def event_emitter_proxy
83
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
84
- end
85
58
  end
86
59
  end
@@ -2,6 +2,10 @@ module Playwright
2
2
  #
3
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
+ # **NOTE**: You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `context.tracing`.
6
+ #
7
+ # The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures.
8
+ #
5
9
  # Start recording a trace before performing actions. At the end, stop tracing and save it to a file.
6
10
  #
7
11
  # ```python sync
@@ -17,6 +21,10 @@ module Playwright
17
21
  #
18
22
  # Start tracing.
19
23
  #
24
+ # **NOTE**: You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `Tracing.start`.
25
+ #
26
+ # The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures.
27
+ #
20
28
  # **Usage**
21
29
  #
22
30
  # ```python sync
@@ -97,20 +105,20 @@ module Playwright
97
105
 
98
106
  # -- inherited from EventEmitter --
99
107
  # @nodoc
100
- def on(event, callback)
101
- event_emitter_proxy.on(event, callback)
108
+ def once(event, callback)
109
+ event_emitter_proxy.once(event, callback)
102
110
  end
103
111
 
104
112
  # -- inherited from EventEmitter --
105
113
  # @nodoc
106
- def off(event, callback)
107
- event_emitter_proxy.off(event, callback)
114
+ def on(event, callback)
115
+ event_emitter_proxy.on(event, callback)
108
116
  end
109
117
 
110
118
  # -- inherited from EventEmitter --
111
119
  # @nodoc
112
- def once(event, callback)
113
- event_emitter_proxy.once(event, callback)
120
+ def off(event, callback)
121
+ event_emitter_proxy.off(event, callback)
114
122
  end
115
123
 
116
124
  private def event_emitter_proxy
@@ -36,20 +36,20 @@ module Playwright
36
36
 
37
37
  # -- inherited from EventEmitter --
38
38
  # @nodoc
39
- def on(event, callback)
40
- event_emitter_proxy.on(event, 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
- event_emitter_proxy.off(event, 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
- event_emitter_proxy.once(event, callback)
51
+ def off(event, callback)
52
+ event_emitter_proxy.off(event, callback)
53
53
  end
54
54
 
55
55
  private def event_emitter_proxy
@@ -58,20 +58,20 @@ module Playwright
58
58
 
59
59
  # -- inherited from EventEmitter --
60
60
  # @nodoc
61
- def on(event, callback)
62
- event_emitter_proxy.on(event, callback)
61
+ def once(event, callback)
62
+ event_emitter_proxy.once(event, callback)
63
63
  end
64
64
 
65
65
  # -- inherited from EventEmitter --
66
66
  # @nodoc
67
- def off(event, callback)
68
- event_emitter_proxy.off(event, callback)
67
+ def on(event, callback)
68
+ event_emitter_proxy.on(event, callback)
69
69
  end
70
70
 
71
71
  # -- inherited from EventEmitter --
72
72
  # @nodoc
73
- def once(event, callback)
74
- event_emitter_proxy.once(event, callback)
73
+ def off(event, callback)
74
+ event_emitter_proxy.off(event, callback)
75
75
  end
76
76
 
77
77
  private def event_emitter_proxy
data/sig/playwright.rbs CHANGED
@@ -218,6 +218,8 @@ module Playwright
218
218
 
219
219
  class Selectors
220
220
  def register: (String name, ?script: String, ?contentScript: bool, ?path: (String | File)) -> void
221
+ def set_test_id_attribute: (String attributeName) -> void
222
+ def test_id_attribute=: (String attributeName) -> void
221
223
  end
222
224
 
223
225
  class Clock
@@ -464,6 +466,7 @@ module Playwright
464
466
  def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
465
467
  def count: -> Integer
466
468
  def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
469
+ def describe: (String description) -> Locator
467
470
  def dispatch_event: (String type_, ?eventInit: untyped, ?timeout: Float) -> void
468
471
  def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
469
472
  def element_handle: (?timeout: Float) -> ElementHandle
@@ -570,6 +573,7 @@ module Playwright
570
573
  def not_to_be_hidden: (?timeout: Float) -> void
571
574
  def not_to_be_in_viewport: (?ratio: Float, ?timeout: Float) -> void
572
575
  def not_to_be_visible: (?timeout: Float, ?visible: bool) -> void
576
+ def not_to_contain_class: ((String | Array[untyped]) expected, ?timeout: Float) -> void
573
577
  def not_to_contain_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
574
578
  def not_to_have_accessible_description: ((String | Regexp) name, ?ignoreCase: bool, ?timeout: Float) -> void
575
579
  def not_to_have_accessible_error_message: ((String | Regexp) errorMessage, ?ignoreCase: bool, ?timeout: Float) -> void
@@ -595,6 +599,7 @@ module Playwright
595
599
  def to_be_hidden: (?timeout: Float) -> void
596
600
  def to_be_in_viewport: (?ratio: Float, ?timeout: Float) -> void
597
601
  def to_be_visible: (?timeout: Float, ?visible: bool) -> void
602
+ def to_contain_class: ((String | Array[untyped]) expected, ?timeout: Float) -> void
598
603
  def to_contain_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
599
604
  def to_have_accessible_description: ((String | Regexp) description, ?ignoreCase: bool, ?timeout: Float) -> void
600
605
  def to_have_accessible_error_message: ((String | Regexp) errorMessage, ?ignoreCase: bool, ?timeout: Float) -> void
@@ -621,6 +626,8 @@ module Playwright
621
626
 
622
627
  class Android
623
628
  def devices: (?host: String, ?omitDriverInstall: bool, ?port: Integer) -> Array[untyped]
629
+ def set_default_timeout: (Float timeout) -> void
630
+ def default_timeout=: (Float timeout) -> void
624
631
  end
625
632
 
626
633
  class AndroidDevice
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.51.0
4
+ version: 1.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: concurrent-ruby
@@ -303,7 +303,6 @@ files:
303
303
  - lib/playwright/channel_owners/request.rb
304
304
  - lib/playwright/channel_owners/response.rb
305
305
  - lib/playwright/channel_owners/route.rb
306
- - lib/playwright/channel_owners/selectors.rb
307
306
  - lib/playwright/channel_owners/stream.rb
308
307
  - lib/playwright/channel_owners/tracing.rb
309
308
  - lib/playwright/channel_owners/web_socket.rb
@@ -339,6 +338,7 @@ files:
339
338
  - lib/playwright/raw_headers.rb
340
339
  - lib/playwright/route_handler.rb
341
340
  - lib/playwright/select_option_values.rb
341
+ - lib/playwright/selectors_impl.rb
342
342
  - lib/playwright/test.rb
343
343
  - lib/playwright/timeout_settings.rb
344
344
  - lib/playwright/touchscreen_impl.rb
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0'
409
409
  requirements: []
410
- rubygems_version: 3.6.2
410
+ rubygems_version: 3.6.9
411
411
  specification_version: 4
412
- summary: The Ruby binding of playwright driver 1.51.0
412
+ summary: The Ruby binding of playwright driver 1.53.0
413
413
  test_files: []
@@ -1,26 +0,0 @@
1
- module Playwright
2
- # https://github.com/microsoft/playwright-python/blob/master/playwright/_impl/_selectors.py
3
- define_channel_owner :Selectors do
4
- def register(name, contentScript: nil, path: nil, script: nil)
5
- source =
6
- if path
7
- File.read(path)
8
- elsif script
9
- script
10
- else
11
- raise ArgumentError.new('Either path or script parameter must be specified')
12
- end
13
- params = { name: name, source: source }
14
- if contentScript
15
- params[:contentScript] = true
16
- end
17
- @channel.send_message_to_server('register', params)
18
-
19
- nil
20
- end
21
-
22
- def text_id_attribute=(attribute_name)
23
- ::Playwright::LocatorUtils.instance_variable_set(:@test_id_attribute_name, attribute_name)
24
- end
25
- end
26
- end