playwright-ruby-client 1.15.beta2 → 1.16.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +10 -0
  3. data/documentation/docs/api/browser_context.md +1 -1
  4. data/documentation/docs/api/locator.md +18 -0
  5. data/documentation/docs/api/mouse.md +11 -0
  6. data/documentation/docs/api/page.md +2 -1
  7. data/documentation/docs/api/request.md +10 -3
  8. data/documentation/docs/api/response.md +20 -2
  9. data/documentation/docs/include/api_coverage.md +17 -0
  10. data/documentation/package.json +2 -2
  11. data/documentation/yarn.lock +1430 -1486
  12. data/lib/playwright/channel_owners/api_request_context.rb +4 -0
  13. data/lib/playwright/channel_owners/browser_context.rb +5 -0
  14. data/lib/playwright/channel_owners/fetch_request.rb +6 -0
  15. data/lib/playwright/channel_owners/frame.rb +3 -1
  16. data/lib/playwright/channel_owners/page.rb +5 -0
  17. data/lib/playwright/channel_owners/request.rb +19 -16
  18. data/lib/playwright/channel_owners/response.rb +16 -13
  19. data/lib/playwright/http_headers.rb +0 -11
  20. data/lib/playwright/locator_impl.rb +4 -0
  21. data/lib/playwright/mouse_impl.rb +9 -0
  22. data/lib/playwright/raw_headers.rb +61 -0
  23. data/lib/playwright/route_handler.rb +13 -1
  24. data/lib/playwright/version.rb +2 -2
  25. data/lib/playwright.rb +1 -0
  26. data/lib/playwright_api/android.rb +6 -6
  27. data/lib/playwright_api/android_device.rb +6 -6
  28. data/lib/playwright_api/api_request_context.rb +146 -0
  29. data/lib/playwright_api/browser.rb +6 -6
  30. data/lib/playwright_api/browser_context.rb +7 -7
  31. data/lib/playwright_api/browser_type.rb +6 -6
  32. data/lib/playwright_api/cdp_session.rb +7 -7
  33. data/lib/playwright_api/console_message.rb +6 -6
  34. data/lib/playwright_api/dialog.rb +6 -6
  35. data/lib/playwright_api/element_handle.rb +6 -6
  36. data/lib/playwright_api/frame.rb +6 -6
  37. data/lib/playwright_api/js_handle.rb +6 -6
  38. data/lib/playwright_api/locator.rb +13 -0
  39. data/lib/playwright_api/mouse.rb +8 -0
  40. data/lib/playwright_api/page.rb +8 -7
  41. data/lib/playwright_api/playwright.rb +8 -8
  42. data/lib/playwright_api/request.rb +15 -11
  43. data/lib/playwright_api/response.rb +20 -13
  44. data/lib/playwright_api/route.rb +6 -6
  45. data/lib/playwright_api/selectors.rb +6 -6
  46. data/lib/playwright_api/web_socket.rb +6 -6
  47. data/lib/playwright_api/worker.rb +8 -8
  48. metadata +10 -5
@@ -58,12 +58,6 @@ module Playwright
58
58
  wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
59
59
  end
60
60
 
61
- # -- inherited from EventEmitter --
62
- # @nodoc
63
- def off(event, callback)
64
- event_emitter_proxy.off(event, callback)
65
- end
66
-
67
61
  # -- inherited from EventEmitter --
68
62
  # @nodoc
69
63
  def once(event, callback)
@@ -76,6 +70,12 @@ module Playwright
76
70
  event_emitter_proxy.on(event, callback)
77
71
  end
78
72
 
73
+ # -- inherited from EventEmitter --
74
+ # @nodoc
75
+ def off(event, callback)
76
+ event_emitter_proxy.off(event, callback)
77
+ end
78
+
79
79
  private def event_emitter_proxy
80
80
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
81
81
  end
@@ -552,12 +552,6 @@ module Playwright
552
552
  wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
553
553
  end
554
554
 
555
- # -- inherited from EventEmitter --
556
- # @nodoc
557
- def off(event, callback)
558
- event_emitter_proxy.off(event, callback)
559
- end
560
-
561
555
  # -- inherited from EventEmitter --
562
556
  # @nodoc
563
557
  def once(event, callback)
@@ -570,6 +564,12 @@ module Playwright
570
564
  event_emitter_proxy.on(event, callback)
571
565
  end
572
566
 
567
+ # -- inherited from EventEmitter --
568
+ # @nodoc
569
+ def off(event, callback)
570
+ event_emitter_proxy.off(event, callback)
571
+ end
572
+
573
573
  private def event_emitter_proxy
574
574
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
575
575
  end
@@ -763,12 +763,6 @@ module Playwright
763
763
  wrap_impl(@impl.detached=(unwrap_impl(req)))
764
764
  end
765
765
 
766
- # -- inherited from EventEmitter --
767
- # @nodoc
768
- def off(event, callback)
769
- event_emitter_proxy.off(event, callback)
770
- end
771
-
772
766
  # -- inherited from EventEmitter --
773
767
  # @nodoc
774
768
  def once(event, callback)
@@ -781,6 +775,12 @@ module Playwright
781
775
  event_emitter_proxy.on(event, callback)
782
776
  end
783
777
 
778
+ # -- inherited from EventEmitter --
779
+ # @nodoc
780
+ def off(event, callback)
781
+ event_emitter_proxy.off(event, callback)
782
+ end
783
+
784
784
  private def event_emitter_proxy
785
785
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
786
786
  end
@@ -88,12 +88,6 @@ module Playwright
88
88
  wrap_impl(@impl.to_s)
89
89
  end
90
90
 
91
- # -- inherited from EventEmitter --
92
- # @nodoc
93
- def off(event, callback)
94
- event_emitter_proxy.off(event, callback)
95
- end
96
-
97
91
  # -- inherited from EventEmitter --
98
92
  # @nodoc
99
93
  def once(event, callback)
@@ -106,6 +100,12 @@ module Playwright
106
100
  event_emitter_proxy.on(event, callback)
107
101
  end
108
102
 
103
+ # -- inherited from EventEmitter --
104
+ # @nodoc
105
+ def off(event, callback)
106
+ event_emitter_proxy.off(event, callback)
107
+ end
108
+
109
109
  private def event_emitter_proxy
110
110
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
111
111
  end
@@ -540,6 +540,19 @@ module Playwright
540
540
  wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
541
541
  end
542
542
 
543
+ # Returns when element specified by locator satisfies the `state` option.
544
+ #
545
+ # If target element already satisfies the condition, the method returns immediately. Otherwise, waits for up to `timeout`
546
+ # milliseconds until the condition is met.
547
+ #
548
+ # ```python sync
549
+ # order_sent = page.locator("#order-sent")
550
+ # order_sent.wait_for()
551
+ # ```
552
+ def wait_for(state: nil, timeout: nil)
553
+ wrap_impl(@impl.wait_for(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
554
+ end
555
+
543
556
  # @nodoc
544
557
  def to_s
545
558
  wrap_impl(@impl.to_s)
@@ -45,5 +45,13 @@ module Playwright
45
45
  def up(button: nil, clickCount: nil)
46
46
  wrap_impl(@impl.up(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount)))
47
47
  end
48
+
49
+ # Dispatches a `wheel` event.
50
+ #
51
+ # > NOTE: Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to
52
+ # finish before returning.
53
+ def wheel(deltaX, deltaY)
54
+ wrap_impl(@impl.wheel(unwrap_impl(deltaX), unwrap_impl(deltaY)))
55
+ end
48
56
  end
49
57
  end
@@ -990,7 +990,8 @@ module Playwright
990
990
  # [`method: Browser.newContext`] allows to set viewport size (and more) for all pages in the context at once.
991
991
  #
992
992
  # `page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the
993
- # viewport size before navigating to the page.
993
+ # viewport size before navigating to the page. [`method: Page.setViewportSize`] will also reset `screen` size, use
994
+ # [`method: Browser.newContext`] with `screen` and `viewport` parameters if you need better control of these properties.
994
995
  #
995
996
  # ```python sync
996
997
  # page = browser.new_page()
@@ -1380,12 +1381,6 @@ module Playwright
1380
1381
  wrap_impl(@impl.guid)
1381
1382
  end
1382
1383
 
1383
- # -- inherited from EventEmitter --
1384
- # @nodoc
1385
- def off(event, callback)
1386
- event_emitter_proxy.off(event, callback)
1387
- end
1388
-
1389
1384
  # -- inherited from EventEmitter --
1390
1385
  # @nodoc
1391
1386
  def once(event, callback)
@@ -1398,6 +1393,12 @@ module Playwright
1398
1393
  event_emitter_proxy.on(event, callback)
1399
1394
  end
1400
1395
 
1396
+ # -- inherited from EventEmitter --
1397
+ # @nodoc
1398
+ def off(event, callback)
1399
+ event_emitter_proxy.off(event, callback)
1400
+ end
1401
+
1401
1402
  private def event_emitter_proxy
1402
1403
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1403
1404
  end
@@ -81,20 +81,14 @@ module Playwright
81
81
  raise NotImplementedError.new('stop is not implemented yet.')
82
82
  end
83
83
 
84
- # @nodoc
85
- def android
86
- wrap_impl(@impl.android)
87
- end
88
-
89
84
  # @nodoc
90
85
  def electron
91
86
  wrap_impl(@impl.electron)
92
87
  end
93
88
 
94
- # -- inherited from EventEmitter --
95
89
  # @nodoc
96
- def off(event, callback)
97
- event_emitter_proxy.off(event, callback)
90
+ def android
91
+ wrap_impl(@impl.android)
98
92
  end
99
93
 
100
94
  # -- inherited from EventEmitter --
@@ -109,6 +103,12 @@ module Playwright
109
103
  event_emitter_proxy.on(event, callback)
110
104
  end
111
105
 
106
+ # -- inherited from EventEmitter --
107
+ # @nodoc
108
+ def off(event, callback)
109
+ event_emitter_proxy.off(event, callback)
110
+ end
111
+
112
112
  private def event_emitter_proxy
113
113
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
114
114
  end
@@ -41,11 +41,16 @@ module Playwright
41
41
  end
42
42
 
43
43
  # An array with all the request HTTP headers associated with this request. Unlike [`method: Request.allHeaders`], header
44
- # names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
44
+ # names are NOT lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
45
45
  def headers_array
46
46
  wrap_impl(@impl.headers_array)
47
47
  end
48
48
 
49
+ # Returns the value of the header matching the name. The name is case insensitive.
50
+ def header_value(name)
51
+ wrap_impl(@impl.header_value(unwrap_impl(name)))
52
+ end
53
+
49
54
  # Whether this request is driving frame's navigation.
50
55
  def navigation_request?
51
56
  wrap_impl(@impl.navigation_request?)
@@ -120,8 +125,7 @@ module Playwright
120
125
  wrap_impl(@impl.response)
121
126
  end
122
127
 
123
- # Returns resource size information for given request. Requires the response to be finished via
124
- # [`method: Response.finished`] to ensure the info is available.
128
+ # Returns resource size information for given request.
125
129
  def sizes
126
130
  wrap_impl(@impl.sizes)
127
131
  end
@@ -146,14 +150,8 @@ module Playwright
146
150
  end
147
151
 
148
152
  # @nodoc
149
- def parse_headers_as_array(serialized_headers, downcase)
150
- wrap_impl(@impl.parse_headers_as_array(unwrap_impl(serialized_headers), unwrap_impl(downcase)))
151
- end
152
-
153
- # -- inherited from EventEmitter --
154
- # @nodoc
155
- def off(event, callback)
156
- event_emitter_proxy.off(event, callback)
153
+ def header_values(name)
154
+ wrap_impl(@impl.header_values(unwrap_impl(name)))
157
155
  end
158
156
 
159
157
  # -- inherited from EventEmitter --
@@ -168,6 +166,12 @@ module Playwright
168
166
  event_emitter_proxy.on(event, callback)
169
167
  end
170
168
 
169
+ # -- inherited from EventEmitter --
170
+ # @nodoc
171
+ def off(event, callback)
172
+ event_emitter_proxy.off(event, callback)
173
+ end
174
+
171
175
  private def event_emitter_proxy
172
176
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
173
177
  end
@@ -12,7 +12,7 @@ module Playwright
12
12
  wrap_impl(@impl.body)
13
13
  end
14
14
 
15
- # Waits for this response to finish, returns failure error if request failed.
15
+ # Waits for this response to finish, returns always `null`.
16
16
  def finished
17
17
  wrap_impl(@impl.finished)
18
18
  end
@@ -28,11 +28,23 @@ module Playwright
28
28
  end
29
29
 
30
30
  # An array with all the request HTTP headers associated with this response. Unlike [`method: Response.allHeaders`], header
31
- # names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
31
+ # names are NOT lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
32
32
  def headers_array
33
33
  wrap_impl(@impl.headers_array)
34
34
  end
35
35
 
36
+ # Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name
37
+ # (except `set-cookie`), they are returned as a list separated by `, `. For `set-cookie`, the `\n` separator is used. If
38
+ # no headers are found, `null` is returned.
39
+ def header_value(name)
40
+ wrap_impl(@impl.header_value(unwrap_impl(name)))
41
+ end
42
+
43
+ # Returns all values of the headers matching the name, for example `set-cookie`. The name is case insensitive.
44
+ def header_values(name)
45
+ wrap_impl(@impl.header_values(unwrap_impl(name)))
46
+ end
47
+
36
48
  # Returns the JSON representation of response body.
37
49
  #
38
50
  # This method will throw if the response body is not parsable via `JSON.parse`.
@@ -85,17 +97,6 @@ module Playwright
85
97
  wrap_impl(@impl.ok?)
86
98
  end
87
99
 
88
- # @nodoc
89
- def parse_headers_as_array(serialized_headers, downcase)
90
- wrap_impl(@impl.parse_headers_as_array(unwrap_impl(serialized_headers), unwrap_impl(downcase)))
91
- end
92
-
93
- # -- inherited from EventEmitter --
94
- # @nodoc
95
- def off(event, callback)
96
- event_emitter_proxy.off(event, callback)
97
- end
98
-
99
100
  # -- inherited from EventEmitter --
100
101
  # @nodoc
101
102
  def once(event, callback)
@@ -108,6 +109,12 @@ module Playwright
108
109
  event_emitter_proxy.on(event, callback)
109
110
  end
110
111
 
112
+ # -- inherited from EventEmitter --
113
+ # @nodoc
114
+ def off(event, callback)
115
+ event_emitter_proxy.off(event, callback)
116
+ end
117
+
111
118
  private def event_emitter_proxy
112
119
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
113
120
  end
@@ -56,12 +56,6 @@ module Playwright
56
56
  wrap_impl(@impl.request)
57
57
  end
58
58
 
59
- # -- inherited from EventEmitter --
60
- # @nodoc
61
- def off(event, callback)
62
- event_emitter_proxy.off(event, callback)
63
- end
64
-
65
59
  # -- inherited from EventEmitter --
66
60
  # @nodoc
67
61
  def once(event, callback)
@@ -74,6 +68,12 @@ module Playwright
74
68
  event_emitter_proxy.on(event, callback)
75
69
  end
76
70
 
71
+ # -- inherited from EventEmitter --
72
+ # @nodoc
73
+ def off(event, callback)
74
+ event_emitter_proxy.off(event, callback)
75
+ end
76
+
77
77
  private def event_emitter_proxy
78
78
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
79
79
  end
@@ -43,12 +43,6 @@ module Playwright
43
43
  wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
44
44
  end
45
45
 
46
- # -- inherited from EventEmitter --
47
- # @nodoc
48
- def off(event, callback)
49
- event_emitter_proxy.off(event, callback)
50
- end
51
-
52
46
  # -- inherited from EventEmitter --
53
47
  # @nodoc
54
48
  def once(event, callback)
@@ -61,6 +55,12 @@ module Playwright
61
55
  event_emitter_proxy.on(event, callback)
62
56
  end
63
57
 
58
+ # -- inherited from EventEmitter --
59
+ # @nodoc
60
+ def off(event, callback)
61
+ event_emitter_proxy.off(event, callback)
62
+ end
63
+
64
64
  private def event_emitter_proxy
65
65
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
66
66
  end
@@ -27,12 +27,6 @@ module Playwright
27
27
  wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
28
28
  end
29
29
 
30
- # -- inherited from EventEmitter --
31
- # @nodoc
32
- def off(event, callback)
33
- event_emitter_proxy.off(event, callback)
34
- end
35
-
36
30
  # -- inherited from EventEmitter --
37
31
  # @nodoc
38
32
  def once(event, callback)
@@ -45,6 +39,12 @@ module Playwright
45
39
  event_emitter_proxy.on(event, callback)
46
40
  end
47
41
 
42
+ # -- inherited from EventEmitter --
43
+ # @nodoc
44
+ def off(event, callback)
45
+ event_emitter_proxy.off(event, callback)
46
+ end
47
+
48
48
  private def event_emitter_proxy
49
49
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
50
50
  end
@@ -43,20 +43,14 @@ module Playwright
43
43
  wrap_impl(@impl.url)
44
44
  end
45
45
 
46
- # @nodoc
47
- def page=(req)
48
- wrap_impl(@impl.page=(unwrap_impl(req)))
49
- end
50
-
51
46
  # @nodoc
52
47
  def context=(req)
53
48
  wrap_impl(@impl.context=(unwrap_impl(req)))
54
49
  end
55
50
 
56
- # -- inherited from EventEmitter --
57
51
  # @nodoc
58
- def off(event, callback)
59
- event_emitter_proxy.off(event, callback)
52
+ def page=(req)
53
+ wrap_impl(@impl.page=(unwrap_impl(req)))
60
54
  end
61
55
 
62
56
  # -- inherited from EventEmitter --
@@ -71,6 +65,12 @@ module Playwright
71
65
  event_emitter_proxy.on(event, callback)
72
66
  end
73
67
 
68
+ # -- inherited from EventEmitter --
69
+ # @nodoc
70
+ def off(event, callback)
71
+ event_emitter_proxy.off(event, callback)
72
+ end
73
+
74
74
  private def event_emitter_proxy
75
75
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
76
76
  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: 1.15.beta2
4
+ version: 1.16.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-09-09 00:00:00.000000000 Z
11
+ date: 2021-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -210,6 +210,7 @@ files:
210
210
  - documentation/README.md
211
211
  - documentation/babel.config.js
212
212
  - documentation/docs/api/accessibility.md
213
+ - documentation/docs/api/api_request_context.md
213
214
  - documentation/docs/api/browser.md
214
215
  - documentation/docs/api/browser_context.md
215
216
  - documentation/docs/api/browser_type.md
@@ -277,6 +278,7 @@ files:
277
278
  - lib/playwright/channel_owner.rb
278
279
  - lib/playwright/channel_owners/android.rb
279
280
  - lib/playwright/channel_owners/android_device.rb
281
+ - lib/playwright/channel_owners/api_request_context.rb
280
282
  - lib/playwright/channel_owners/artifact.rb
281
283
  - lib/playwright/channel_owners/binding_call.rb
282
284
  - lib/playwright/channel_owners/browser.rb
@@ -287,6 +289,7 @@ files:
287
289
  - lib/playwright/channel_owners/dialog.rb
288
290
  - lib/playwright/channel_owners/electron.rb
289
291
  - lib/playwright/channel_owners/element_handle.rb
292
+ - lib/playwright/channel_owners/fetch_request.rb
290
293
  - lib/playwright/channel_owners/frame.rb
291
294
  - lib/playwright/channel_owners/js_handle.rb
292
295
  - lib/playwright/channel_owners/page.rb
@@ -315,6 +318,7 @@ files:
315
318
  - lib/playwright/locator_impl.rb
316
319
  - lib/playwright/mouse_impl.rb
317
320
  - lib/playwright/playwright_api.rb
321
+ - lib/playwright/raw_headers.rb
318
322
  - lib/playwright/route_handler.rb
319
323
  - lib/playwright/select_option_values.rb
320
324
  - lib/playwright/timeout_settings.rb
@@ -334,6 +338,7 @@ files:
334
338
  - lib/playwright_api/android_input.rb
335
339
  - lib/playwright_api/android_socket.rb
336
340
  - lib/playwright_api/android_web_view.rb
341
+ - lib/playwright_api/api_request_context.rb
337
342
  - lib/playwright_api/browser.rb
338
343
  - lib/playwright_api/browser_context.rb
339
344
  - lib/playwright_api/browser_type.rb
@@ -374,12 +379,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
374
379
  version: '2.4'
375
380
  required_rubygems_version: !ruby/object:Gem::Requirement
376
381
  requirements:
377
- - - ">"
382
+ - - ">="
378
383
  - !ruby/object:Gem::Version
379
- version: 1.3.1
384
+ version: '0'
380
385
  requirements: []
381
386
  rubygems_version: 3.2.22
382
387
  signing_key:
383
388
  specification_version: 4
384
- summary: The Ruby binding of playwright driver 1.15.0
389
+ summary: The Ruby binding of playwright driver 1.16.0
385
390
  test_files: []