playwright-ruby-client 1.16.beta1 → 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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/{fetch_request.md → api_request_context.md} +2 -2
  3. data/documentation/docs/api/browser_context.md +1 -1
  4. data/documentation/docs/api/page.md +2 -1
  5. data/documentation/docs/include/api_coverage.md +12 -7
  6. data/lib/playwright/channel_owners/api_request_context.rb +4 -0
  7. data/lib/playwright/channel_owners/browser_context.rb +5 -0
  8. data/lib/playwright/channel_owners/fetch_request.rb +3 -1
  9. data/lib/playwright/channel_owners/page.rb +5 -0
  10. data/lib/playwright/channel_owners/request.rb +9 -21
  11. data/lib/playwright/channel_owners/response.rb +0 -4
  12. data/lib/playwright/route_handler.rb +13 -1
  13. data/lib/playwright/version.rb +1 -1
  14. data/lib/playwright_api/android.rb +6 -6
  15. data/lib/playwright_api/android_device.rb +6 -6
  16. data/lib/playwright_api/api_request_context.rb +146 -0
  17. data/lib/playwright_api/browser.rb +6 -6
  18. data/lib/playwright_api/browser_context.rb +7 -7
  19. data/lib/playwright_api/browser_type.rb +6 -6
  20. data/lib/playwright_api/cdp_session.rb +6 -6
  21. data/lib/playwright_api/console_message.rb +6 -6
  22. data/lib/playwright_api/dialog.rb +6 -6
  23. data/lib/playwright_api/element_handle.rb +6 -6
  24. data/lib/playwright_api/frame.rb +6 -6
  25. data/lib/playwright_api/js_handle.rb +6 -6
  26. data/lib/playwright_api/page.rb +8 -7
  27. data/lib/playwright_api/playwright.rb +8 -8
  28. data/lib/playwright_api/request.rb +6 -6
  29. data/lib/playwright_api/response.rb +6 -6
  30. data/lib/playwright_api/route.rb +6 -6
  31. data/lib/playwright_api/selectors.rb +6 -6
  32. data/lib/playwright_api/web_socket.rb +6 -6
  33. data/lib/playwright_api/worker.rb +8 -8
  34. metadata +7 -6
  35. data/lib/playwright_api/fetch_request.rb +0 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac716fcd59a6c1b520004d0c5797dadaf77d8a5ec78dd60903cd424a2d9569ca
4
- data.tar.gz: 6ec8fb266d6ce38229ee17e68dec62e5ba42edb09ddd59814242fe5dd757c157
3
+ metadata.gz: d6230bd49d8e914d2ba9f4d23910e69fcc003f983cf51abb142d4361e1332fd6
4
+ data.tar.gz: 9cf6be0bde1f294a50604f22f8be756040a02af94c61fff376354c5b1ec8d9fe
5
5
  SHA512:
6
- metadata.gz: 3c3fc4e0689b164b90791c9c288895966de3c42275df2c46f89fcd19999df2d830dd9fa081532d106a178ae17cd18807240ab3fe3c07f287f9906777b3bb0c72
7
- data.tar.gz: cec2ee542633b9b7c803de01fc3b700a7b78eeac15e156dca97d99b62f9142c9f749e90a006b44bf9d7108ffeed63329b64003da53603fd02fcb75374f6a33e1
6
+ metadata.gz: 97bcd9185a7ac82910dcbae93c0131cf285b9c73d881705ae9b88b01fef388b999b4001e37f866f229dba2a0cb0d81af65bee34cb4301eaf16389b927aaba334
7
+ data.tar.gz: 047dd6e73800e629a439341d720df9e9281e9456f5f94eeeeaf475de7d439c5b0bf97332242497937684ae919e8b603f1b532a97cf6880f16c77f4f42d400ab2
@@ -2,9 +2,9 @@
2
2
  sidebar_position: 10
3
3
  ---
4
4
 
5
- # FetchRequest
5
+ # APIRequestContext
6
6
 
7
- This API is used for Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
7
+ This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
8
8
  environment or the service to your e2e test. When used on [Page](./page) or a [BrowserContext](./browser_context), this API will automatically use
9
9
  the cookies from the corresponding [BrowserContext](./browser_context). This means that if you log in using this API, your e2e test will be
10
10
  logged in and vice versa.
@@ -11,7 +11,7 @@ BrowserContexts provide a way to operate multiple independent browser sessions.
11
11
  If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser
12
12
  context.
13
13
 
14
- Playwright allows creation of "incognito" browser contexts with [Browser#new_context](./browser#new_context) method. "Incognito" browser
14
+ Playwright allows creating "incognito" browser contexts with [Browser#new_context](./browser#new_context) method. "Incognito" browser
15
15
  contexts don't write any browsing data to disk.
16
16
 
17
17
  ```ruby
@@ -1141,7 +1141,8 @@ In the case of multiple pages in a single browser, each page can have its own vi
1141
1141
  [Browser#new_context](./browser#new_context) allows to set viewport size (and more) for all pages in the context at once.
1142
1142
 
1143
1143
  `page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the
1144
- viewport size before navigating to the page.
1144
+ viewport size before navigating to the page. [Page#set_viewport_size](./page#set_viewport_size) will also reset `screen` size, use
1145
+ [Browser#new_context](./browser#new_context) with `screen` and `viewport` parameters if you need better control of these properties.
1145
1146
 
1146
1147
  ```ruby
1147
1148
  page.viewport_size = { width: 640, height: 480 }
@@ -1,5 +1,17 @@
1
1
  # API coverages
2
2
 
3
+ ## APIRequestContext
4
+
5
+ * ~~delete~~
6
+ * ~~dispose~~
7
+ * ~~fetch~~
8
+ * ~~get~~
9
+ * ~~head~~
10
+ * ~~patch~~
11
+ * ~~post~~
12
+ * ~~put~~
13
+ * ~~storage_state~~
14
+
3
15
  ## Request
4
16
 
5
17
  * all_headers
@@ -48,13 +60,6 @@
48
60
  * fulfill
49
61
  * request
50
62
 
51
- ## FetchRequest
52
-
53
- * ~~dispose~~
54
- * ~~fetch~~
55
- * ~~get~~
56
- * ~~post~~
57
-
58
63
  ## WebSocket
59
64
 
60
65
  * closed?
@@ -0,0 +1,4 @@
1
+ module Playwright
2
+ define_channel_owner :APIRequestContext do
3
+ end
4
+ end
@@ -72,6 +72,11 @@ module Playwright
72
72
 
73
73
  if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
74
74
  route.continue
75
+ else
76
+ @routes.reject!(&:expired?)
77
+ if @routes.count == 0
78
+ @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
79
+ end
75
80
  end
76
81
  end
77
82
 
@@ -1,4 +1,6 @@
1
1
  module Playwright
2
- define_channel_owner :FetchRequest do
2
+ module ChannelOwners
3
+ class FetchRequest < APIRequestContext
4
+ end
3
5
  end
4
6
  end
@@ -100,6 +100,11 @@ module Playwright
100
100
 
101
101
  if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
102
102
  @browser_context.send(:on_route, route, request)
103
+ else
104
+ @routes.reject!(&:expired?)
105
+ if @routes.count == 0
106
+ @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
107
+ end
103
108
  end
104
109
  end
105
110
 
@@ -84,39 +84,27 @@ module Playwright
84
84
 
85
85
  # @return [RawHeaders|nil]
86
86
  private def actual_headers
87
- @actual_headers ||= response&.send(:raw_request_headers)
87
+ @actual_headers ||= raw_request_headers
88
+ end
89
+
90
+ private def raw_request_headers
91
+ RawHeaders.new(@channel.send_message_to_server('rawRequestHeaders'))
88
92
  end
89
93
 
90
94
  def all_headers
91
- if actual_headers
92
- actual_headers.headers
93
- else
94
- @provisional_headers.headers
95
- end
95
+ actual_headers.headers
96
96
  end
97
97
 
98
98
  def headers_array
99
- if actual_headers
100
- actual_headers.headers_array
101
- else
102
- @provisional_headers.headers_array
103
- end
99
+ actual_headers.headers_array
104
100
  end
105
101
 
106
102
  def header_value(name)
107
- if actual_headers
108
- actual_headers.get(name)
109
- else
110
- @provisional_headers.get(name)
111
- end
103
+ actual_headers.get(name)
112
104
  end
113
105
 
114
106
  def header_values(name)
115
- if actual_headers
116
- actual_headers.get_all(name)
117
- else
118
- @provisional_headers.get_all(name)
119
- end
107
+ actual_headers.get_all(name)
120
108
  end
121
109
 
122
110
  def sizes
@@ -48,10 +48,6 @@ module Playwright
48
48
  @actual_headers ||= raw_response_headers
49
49
  end
50
50
 
51
- private def raw_request_headers
52
- RawHeaders.new(@channel.send_message_to_server('rawRequestHeaders'))
53
- end
54
-
55
51
  private def raw_response_headers
56
52
  RawHeaders.new(@channel.send_message_to_server('rawResponseHeaders'))
57
53
  end
@@ -6,17 +6,25 @@ module Playwright
6
6
  end
7
7
 
8
8
  def handle
9
- return false if @count <= 0
9
+ return false if expired?
10
10
 
11
11
  @count = @count - 1
12
12
  true
13
13
  end
14
+
15
+ def expired?
16
+ @count <= 0
17
+ end
14
18
  end
15
19
 
16
20
  class StubCounter
17
21
  def handle
18
22
  true
19
23
  end
24
+
25
+ def expired?
26
+ false
27
+ end
20
28
  end
21
29
 
22
30
  # @param url [String]
@@ -46,6 +54,10 @@ module Playwright
46
54
  end
47
55
  end
48
56
 
57
+ def expired?
58
+ @counter.expired?
59
+ end
60
+
49
61
  def same_value?(url:, handler: nil)
50
62
  if handler
51
63
  @url_value == url && @handler == handler
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.16.beta1'
4
+ VERSION = '1.16.0'
5
5
  COMPATIBLE_PLAYWRIGHT_VERSION = '1.16.0'
6
6
  end
@@ -36,12 +36,6 @@ module Playwright
36
36
  end
37
37
  alias_method :default_timeout=, :set_default_timeout
38
38
 
39
- # -- inherited from EventEmitter --
40
- # @nodoc
41
- def off(event, callback)
42
- event_emitter_proxy.off(event, callback)
43
- end
44
-
45
39
  # -- inherited from EventEmitter --
46
40
  # @nodoc
47
41
  def once(event, callback)
@@ -54,6 +48,12 @@ module Playwright
54
48
  event_emitter_proxy.on(event, callback)
55
49
  end
56
50
 
51
+ # -- inherited from EventEmitter --
52
+ # @nodoc
53
+ def off(event, callback)
54
+ event_emitter_proxy.off(event, callback)
55
+ end
56
+
57
57
  private def event_emitter_proxy
58
58
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
59
59
  end
@@ -174,12 +174,6 @@ module Playwright
174
174
  wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
175
175
  end
176
176
 
177
- # -- inherited from EventEmitter --
178
- # @nodoc
179
- def off(event, callback)
180
- event_emitter_proxy.off(event, callback)
181
- end
182
-
183
177
  # -- inherited from EventEmitter --
184
178
  # @nodoc
185
179
  def once(event, callback)
@@ -192,6 +186,12 @@ module Playwright
192
186
  event_emitter_proxy.on(event, callback)
193
187
  end
194
188
 
189
+ # -- inherited from EventEmitter --
190
+ # @nodoc
191
+ def off(event, callback)
192
+ event_emitter_proxy.off(event, callback)
193
+ end
194
+
195
195
  private def event_emitter_proxy
196
196
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
197
197
  end
@@ -0,0 +1,146 @@
1
+ module Playwright
2
+ # This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
3
+ # environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
4
+ # the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
5
+ # logged in and vice versa.
6
+ class APIRequestContext < PlaywrightApi
7
+
8
+ # Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its
9
+ # response. The method will populate request cookies from the context and update context cookies from the response. The
10
+ # method will automatically follow redirects.
11
+ def delete(
12
+ url,
13
+ failOnStatusCode: nil,
14
+ headers: nil,
15
+ ignoreHTTPSErrors: nil,
16
+ params: nil,
17
+ timeout: nil)
18
+ raise NotImplementedError.new('delete is not implemented yet.')
19
+ end
20
+
21
+ # All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you
22
+ # can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes
23
+ # [`method: APIResponse.body`] throw "Response disposed" error.
24
+ def dispose
25
+ raise NotImplementedError.new('dispose is not implemented yet.')
26
+ end
27
+
28
+ # Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
29
+ # context cookies from the response. The method will automatically follow redirects.
30
+ def fetch(
31
+ urlOrRequest,
32
+ data: nil,
33
+ failOnStatusCode: nil,
34
+ form: nil,
35
+ headers: nil,
36
+ ignoreHTTPSErrors: nil,
37
+ method: nil,
38
+ multipart: nil,
39
+ params: nil,
40
+ timeout: nil)
41
+ raise NotImplementedError.new('fetch is not implemented yet.')
42
+ end
43
+
44
+ # Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
45
+ # method will populate request cookies from the context and update context cookies from the response. The method will
46
+ # automatically follow redirects.
47
+ def get(
48
+ url,
49
+ failOnStatusCode: nil,
50
+ headers: nil,
51
+ ignoreHTTPSErrors: nil,
52
+ params: nil,
53
+ timeout: nil)
54
+ raise NotImplementedError.new('get is not implemented yet.')
55
+ end
56
+
57
+ # Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
58
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
59
+ # automatically follow redirects.
60
+ def head(
61
+ url,
62
+ failOnStatusCode: nil,
63
+ headers: nil,
64
+ ignoreHTTPSErrors: nil,
65
+ params: nil,
66
+ timeout: nil)
67
+ raise NotImplementedError.new('head is not implemented yet.')
68
+ end
69
+
70
+ # Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
71
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
72
+ # automatically follow redirects.
73
+ def patch(
74
+ url,
75
+ data: nil,
76
+ failOnStatusCode: nil,
77
+ form: nil,
78
+ headers: nil,
79
+ ignoreHTTPSErrors: nil,
80
+ multipart: nil,
81
+ params: nil,
82
+ timeout: nil)
83
+ raise NotImplementedError.new('patch is not implemented yet.')
84
+ end
85
+
86
+ # Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
87
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
88
+ # automatically follow redirects.
89
+ def post(
90
+ url,
91
+ data: nil,
92
+ failOnStatusCode: nil,
93
+ form: nil,
94
+ headers: nil,
95
+ ignoreHTTPSErrors: nil,
96
+ multipart: nil,
97
+ params: nil,
98
+ timeout: nil)
99
+ raise NotImplementedError.new('post is not implemented yet.')
100
+ end
101
+
102
+ # Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
103
+ # method will populate request cookies from the context and update context cookies from the response. The method will
104
+ # automatically follow redirects.
105
+ def put(
106
+ url,
107
+ data: nil,
108
+ failOnStatusCode: nil,
109
+ form: nil,
110
+ headers: nil,
111
+ ignoreHTTPSErrors: nil,
112
+ multipart: nil,
113
+ params: nil,
114
+ timeout: nil)
115
+ raise NotImplementedError.new('put is not implemented yet.')
116
+ end
117
+
118
+ # Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to
119
+ # the constructor.
120
+ def storage_state(path: nil)
121
+ raise NotImplementedError.new('storage_state is not implemented yet.')
122
+ end
123
+
124
+ # -- inherited from EventEmitter --
125
+ # @nodoc
126
+ def once(event, callback)
127
+ event_emitter_proxy.once(event, callback)
128
+ end
129
+
130
+ # -- inherited from EventEmitter --
131
+ # @nodoc
132
+ def on(event, callback)
133
+ event_emitter_proxy.on(event, callback)
134
+ end
135
+
136
+ # -- inherited from EventEmitter --
137
+ # @nodoc
138
+ def off(event, callback)
139
+ event_emitter_proxy.off(event, callback)
140
+ end
141
+
142
+ private def event_emitter_proxy
143
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
144
+ end
145
+ end
146
+ end
@@ -166,12 +166,6 @@ module Playwright
166
166
  wrap_impl(@impl.version)
167
167
  end
168
168
 
169
- # -- inherited from EventEmitter --
170
- # @nodoc
171
- def off(event, callback)
172
- event_emitter_proxy.off(event, callback)
173
- end
174
-
175
169
  # -- inherited from EventEmitter --
176
170
  # @nodoc
177
171
  def once(event, callback)
@@ -184,6 +178,12 @@ module Playwright
184
178
  event_emitter_proxy.on(event, callback)
185
179
  end
186
180
 
181
+ # -- inherited from EventEmitter --
182
+ # @nodoc
183
+ def off(event, callback)
184
+ event_emitter_proxy.off(event, callback)
185
+ end
186
+
187
187
  private def event_emitter_proxy
188
188
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
189
189
  end
@@ -6,7 +6,7 @@ module Playwright
6
6
  # If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser
7
7
  # context.
8
8
  #
9
- # Playwright allows creation of "incognito" browser contexts with `browser.newContext()` method. "Incognito" browser
9
+ # Playwright allows creating "incognito" browser contexts with [`method: Browser.newContext`] method. "Incognito" browser
10
10
  # contexts don't write any browsing data to disk.
11
11
  #
12
12
  # ```python sync
@@ -391,12 +391,6 @@ module Playwright
391
391
  wrap_impl(@impl.options=(unwrap_impl(req)))
392
392
  end
393
393
 
394
- # -- inherited from EventEmitter --
395
- # @nodoc
396
- def off(event, callback)
397
- event_emitter_proxy.off(event, callback)
398
- end
399
-
400
394
  # -- inherited from EventEmitter --
401
395
  # @nodoc
402
396
  def once(event, callback)
@@ -409,6 +403,12 @@ module Playwright
409
403
  event_emitter_proxy.on(event, callback)
410
404
  end
411
405
 
406
+ # -- inherited from EventEmitter --
407
+ # @nodoc
408
+ def off(event, callback)
409
+ event_emitter_proxy.off(event, callback)
410
+ end
411
+
412
412
  private def event_emitter_proxy
413
413
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
414
414
  end
@@ -146,12 +146,6 @@ module Playwright
146
146
  wrap_impl(@impl.name)
147
147
  end
148
148
 
149
- # -- inherited from EventEmitter --
150
- # @nodoc
151
- def off(event, callback)
152
- event_emitter_proxy.off(event, callback)
153
- end
154
-
155
149
  # -- inherited from EventEmitter --
156
150
  # @nodoc
157
151
  def once(event, callback)
@@ -164,6 +158,12 @@ module Playwright
164
158
  event_emitter_proxy.on(event, callback)
165
159
  end
166
160
 
161
+ # -- inherited from EventEmitter --
162
+ # @nodoc
163
+ def off(event, callback)
164
+ event_emitter_proxy.off(event, callback)
165
+ end
166
+
167
167
  private def event_emitter_proxy
168
168
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
169
169
  end
@@ -33,12 +33,6 @@ module Playwright
33
33
  wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
34
34
  end
35
35
 
36
- # -- inherited from EventEmitter --
37
- # @nodoc
38
- def off(event, callback)
39
- event_emitter_proxy.off(event, callback)
40
- end
41
-
42
36
  # -- inherited from EventEmitter --
43
37
  # @nodoc
44
38
  def once(event, callback)
@@ -51,6 +45,12 @@ module Playwright
51
45
  event_emitter_proxy.on(event, callback)
52
46
  end
53
47
 
48
+ # -- inherited from EventEmitter --
49
+ # @nodoc
50
+ def off(event, callback)
51
+ event_emitter_proxy.off(event, callback)
52
+ end
53
+
54
54
  private def event_emitter_proxy
55
55
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
56
56
  end
@@ -23,12 +23,6 @@ module Playwright
23
23
  wrap_impl(@impl.type)
24
24
  end
25
25
 
26
- # -- inherited from EventEmitter --
27
- # @nodoc
28
- def off(event, callback)
29
- event_emitter_proxy.off(event, callback)
30
- end
31
-
32
26
  # -- inherited from EventEmitter --
33
27
  # @nodoc
34
28
  def once(event, callback)
@@ -41,6 +35,12 @@ module Playwright
41
35
  event_emitter_proxy.on(event, callback)
42
36
  end
43
37
 
38
+ # -- inherited from EventEmitter --
39
+ # @nodoc
40
+ def off(event, callback)
41
+ event_emitter_proxy.off(event, callback)
42
+ end
43
+
44
44
  private def event_emitter_proxy
45
45
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
46
46
  end
@@ -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
@@ -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
@@ -154,12 +154,6 @@ module Playwright
154
154
  wrap_impl(@impl.header_values(unwrap_impl(name)))
155
155
  end
156
156
 
157
- # -- inherited from EventEmitter --
158
- # @nodoc
159
- def off(event, callback)
160
- event_emitter_proxy.off(event, callback)
161
- end
162
-
163
157
  # -- inherited from EventEmitter --
164
158
  # @nodoc
165
159
  def once(event, callback)
@@ -172,6 +166,12 @@ module Playwright
172
166
  event_emitter_proxy.on(event, callback)
173
167
  end
174
168
 
169
+ # -- inherited from EventEmitter --
170
+ # @nodoc
171
+ def off(event, callback)
172
+ event_emitter_proxy.off(event, callback)
173
+ end
174
+
175
175
  private def event_emitter_proxy
176
176
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
177
177
  end
@@ -97,12 +97,6 @@ module Playwright
97
97
  wrap_impl(@impl.ok?)
98
98
  end
99
99
 
100
- # -- inherited from EventEmitter --
101
- # @nodoc
102
- def off(event, callback)
103
- event_emitter_proxy.off(event, callback)
104
- end
105
-
106
100
  # -- inherited from EventEmitter --
107
101
  # @nodoc
108
102
  def once(event, callback)
@@ -115,6 +109,12 @@ module Playwright
115
109
  event_emitter_proxy.on(event, callback)
116
110
  end
117
111
 
112
+ # -- inherited from EventEmitter --
113
+ # @nodoc
114
+ def off(event, callback)
115
+ event_emitter_proxy.off(event, callback)
116
+ end
117
+
118
118
  private def event_emitter_proxy
119
119
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
120
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.16.beta1
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-10-01 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
@@ -224,7 +225,6 @@ files:
224
225
  - documentation/docs/api/experimental/android_input.md
225
226
  - documentation/docs/api/experimental/android_socket.md
226
227
  - documentation/docs/api/experimental/android_web_view.md
227
- - documentation/docs/api/fetch_request.md
228
228
  - documentation/docs/api/file_chooser.md
229
229
  - documentation/docs/api/frame.md
230
230
  - documentation/docs/api/js_handle.md
@@ -278,6 +278,7 @@ files:
278
278
  - lib/playwright/channel_owner.rb
279
279
  - lib/playwright/channel_owners/android.rb
280
280
  - lib/playwright/channel_owners/android_device.rb
281
+ - lib/playwright/channel_owners/api_request_context.rb
281
282
  - lib/playwright/channel_owners/artifact.rb
282
283
  - lib/playwright/channel_owners/binding_call.rb
283
284
  - lib/playwright/channel_owners/browser.rb
@@ -337,6 +338,7 @@ files:
337
338
  - lib/playwright_api/android_input.rb
338
339
  - lib/playwright_api/android_socket.rb
339
340
  - lib/playwright_api/android_web_view.rb
341
+ - lib/playwright_api/api_request_context.rb
340
342
  - lib/playwright_api/browser.rb
341
343
  - lib/playwright_api/browser_context.rb
342
344
  - lib/playwright_api/browser_type.rb
@@ -345,7 +347,6 @@ files:
345
347
  - lib/playwright_api/dialog.rb
346
348
  - lib/playwright_api/download.rb
347
349
  - lib/playwright_api/element_handle.rb
348
- - lib/playwright_api/fetch_request.rb
349
350
  - lib/playwright_api/file_chooser.rb
350
351
  - lib/playwright_api/frame.rb
351
352
  - lib/playwright_api/js_handle.rb
@@ -378,9 +379,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
378
379
  version: '2.4'
379
380
  required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  requirements:
381
- - - ">"
382
+ - - ">="
382
383
  - !ruby/object:Gem::Version
383
- version: 1.3.1
384
+ version: '0'
384
385
  requirements: []
385
386
  rubygems_version: 3.2.22
386
387
  signing_key:
@@ -1,77 +0,0 @@
1
- module Playwright
2
- # This API is used for Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
3
- # environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
4
- # the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
5
- # logged in and vice versa.
6
- class FetchRequest < PlaywrightApi
7
-
8
- # All responses received through [`method: FetchRequest.fetch`], [`method: FetchRequest.get`],
9
- # [`method: FetchRequest.post`] and other methods are stored in the memory, so that you can later call
10
- # [`method: FetchResponse.body`]. This method discards all stored responses, and makes [`method: FetchResponse.body`]
11
- # throw "Response disposed" error.
12
- def dispose
13
- raise NotImplementedError.new('dispose is not implemented yet.')
14
- end
15
-
16
- # Sends HTTP(S) fetch and returns its response. The method will populate fetch cookies from the context and update context
17
- # cookies from the response. The method will automatically follow redirects.
18
- def fetch(
19
- urlOrRequest,
20
- data: nil,
21
- failOnStatusCode: nil,
22
- headers: nil,
23
- ignoreHTTPSErrors: nil,
24
- method: nil,
25
- params: nil,
26
- timeout: nil)
27
- raise NotImplementedError.new('fetch is not implemented yet.')
28
- end
29
-
30
- # Sends HTTP(S) GET request and returns its response. The method will populate fetch cookies from the context and update
31
- # context cookies from the response. The method will automatically follow redirects.
32
- def get(
33
- urlOrRequest,
34
- failOnStatusCode: nil,
35
- headers: nil,
36
- ignoreHTTPSErrors: nil,
37
- params: nil,
38
- timeout: nil)
39
- raise NotImplementedError.new('get is not implemented yet.')
40
- end
41
-
42
- # Sends HTTP(S) fetch and returns its response. The method will populate fetch cookies from the context and update context
43
- # cookies from the response. The method will automatically follow redirects.
44
- def post(
45
- urlOrRequest,
46
- data: nil,
47
- failOnStatusCode: nil,
48
- headers: nil,
49
- ignoreHTTPSErrors: nil,
50
- params: nil,
51
- timeout: nil)
52
- raise NotImplementedError.new('post is not implemented yet.')
53
- end
54
-
55
- # -- inherited from EventEmitter --
56
- # @nodoc
57
- def off(event, callback)
58
- event_emitter_proxy.off(event, callback)
59
- end
60
-
61
- # -- inherited from EventEmitter --
62
- # @nodoc
63
- def once(event, callback)
64
- event_emitter_proxy.once(event, callback)
65
- end
66
-
67
- # -- inherited from EventEmitter --
68
- # @nodoc
69
- def on(event, callback)
70
- event_emitter_proxy.on(event, callback)
71
- end
72
-
73
- private def event_emitter_proxy
74
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
75
- end
76
- end
77
- end