playwright-ruby-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api_coverage.md +102 -49
  3. data/lib/playwright.rb +1 -0
  4. data/lib/playwright/channel.rb +10 -10
  5. data/lib/playwright/channel_owners/binding_call.rb +3 -0
  6. data/lib/playwright/channel_owners/browser_context.rb +149 -3
  7. data/lib/playwright/channel_owners/dialog.rb +28 -0
  8. data/lib/playwright/channel_owners/page.rb +47 -10
  9. data/lib/playwright/channel_owners/playwright.rb +4 -0
  10. data/lib/playwright/channel_owners/request.rb +26 -2
  11. data/lib/playwright/channel_owners/response.rb +60 -0
  12. data/lib/playwright/channel_owners/route.rb +78 -0
  13. data/lib/playwright/channel_owners/selectors.rb +19 -1
  14. data/lib/playwright/route_handler_entry.rb +36 -0
  15. data/lib/playwright/utils.rb +1 -0
  16. data/lib/playwright/version.rb +1 -1
  17. data/lib/playwright_api/android.rb +80 -8
  18. data/lib/playwright_api/android_device.rb +145 -28
  19. data/lib/playwright_api/android_input.rb +17 -13
  20. data/lib/playwright_api/android_socket.rb +16 -0
  21. data/lib/playwright_api/android_web_view.rb +21 -0
  22. data/lib/playwright_api/binding_call.rb +11 -6
  23. data/lib/playwright_api/browser.rb +6 -6
  24. data/lib/playwright_api/browser_context.rb +33 -28
  25. data/lib/playwright_api/browser_type.rb +14 -14
  26. data/lib/playwright_api/chromium_browser_context.rb +6 -6
  27. data/lib/playwright_api/console_message.rb +6 -6
  28. data/lib/playwright_api/dialog.rb +32 -5
  29. data/lib/playwright_api/download.rb +6 -6
  30. data/lib/playwright_api/element_handle.rb +6 -6
  31. data/lib/playwright_api/file_chooser.rb +1 -1
  32. data/lib/playwright_api/frame.rb +13 -11
  33. data/lib/playwright_api/js_handle.rb +6 -6
  34. data/lib/playwright_api/page.rb +48 -46
  35. data/lib/playwright_api/playwright.rb +7 -7
  36. data/lib/playwright_api/request.rb +8 -8
  37. data/lib/playwright_api/response.rb +27 -17
  38. data/lib/playwright_api/route.rb +27 -5
  39. data/lib/playwright_api/selectors.rb +7 -7
  40. metadata +7 -2
@@ -1,55 +1,178 @@
1
1
  module Playwright
2
- # @nodoc
2
+ # `AndroidDevice` represents a connected device, either real hardware or emulated. Devices can be obtained using
3
+ # [`method: Android.devices`].
3
4
  class AndroidDevice < PlaywrightApi
4
5
 
5
- # @nodoc
6
- def tree
7
- wrap_impl(@impl.tree)
6
+ def input # property
7
+ wrap_impl(@impl.input)
8
8
  end
9
9
 
10
- # @nodoc
10
+ # Disconnects from the device.
11
11
  def close
12
12
  wrap_impl(@impl.close)
13
13
  end
14
14
 
15
- # @nodoc
16
- def tap_on(selector, duration: nil, timeout: nil)
17
- wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
15
+ # Drags the widget defined by `selector` towards `dest` point.
16
+ def drag(selector, dest, speed: nil)
17
+ raise NotImplementedError.new('drag is not implemented yet.')
18
18
  end
19
19
 
20
- # @nodoc
20
+ # Fills the specific `selector` input box with `text`.
21
+ def fill(selector, text)
22
+ raise NotImplementedError.new('fill is not implemented yet.')
23
+ end
24
+
25
+ # Flings the widget defined by `selector` in the specified `direction`.
26
+ def fling(selector, direction, speed: nil)
27
+ raise NotImplementedError.new('fling is not implemented yet.')
28
+ end
29
+
30
+ # Returns information about a widget defined by `selector`.
31
+ def info(selector)
32
+ wrap_impl(@impl.info(unwrap_impl(selector)))
33
+ end
34
+
35
+ # Installs an apk on the device.
36
+ def install_apk(file, args: nil)
37
+ raise NotImplementedError.new('install_apk is not implemented yet.')
38
+ end
39
+
40
+ # Launches Chrome browser on the device, and returns its persistent context.
41
+ def launch_browser(
42
+ acceptDownloads: nil,
43
+ bypassCSP: nil,
44
+ colorScheme: nil,
45
+ command: nil,
46
+ deviceScaleFactor: nil,
47
+ extraHTTPHeaders: nil,
48
+ geolocation: nil,
49
+ hasTouch: nil,
50
+ httpCredentials: nil,
51
+ ignoreHTTPSErrors: nil,
52
+ isMobile: nil,
53
+ javaScriptEnabled: nil,
54
+ locale: nil,
55
+ noViewport: nil,
56
+ offline: nil,
57
+ permissions: nil,
58
+ record_har_omit_content: nil,
59
+ record_har_path: nil,
60
+ record_video_dir: nil,
61
+ record_video_size: nil,
62
+ timezoneId: nil,
63
+ userAgent: nil,
64
+ viewport: nil,
65
+ &block)
66
+ wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
67
+ end
68
+
69
+ # Performs a long tap on the widget defined by `selector`.
70
+ def long_tap(selector)
71
+ raise NotImplementedError.new('long_tap is not implemented yet.')
72
+ end
73
+
74
+ # Device model.
75
+ def model
76
+ wrap_impl(@impl.model)
77
+ end
78
+
79
+ # Launches a process in the shell on the device and returns a socket to communicate with the launched process.
80
+ def open(command)
81
+ raise NotImplementedError.new('open is not implemented yet.')
82
+ end
83
+
84
+ # Pinches the widget defined by `selector` in the closing direction.
85
+ def pinch_close(selector, percent, speed: nil)
86
+ raise NotImplementedError.new('pinch_close is not implemented yet.')
87
+ end
88
+
89
+ # Pinches the widget defined by `selector` in the open direction.
90
+ def pinch_open(selector, percent, speed: nil)
91
+ raise NotImplementedError.new('pinch_open is not implemented yet.')
92
+ end
93
+
94
+ # Presses the specific `key` in the widget defined by `selector`.
95
+ def press(selector, key)
96
+ raise NotImplementedError.new('press is not implemented yet.')
97
+ end
98
+
99
+ # Copies a file to the device.
100
+ def push(file, path, mode: nil)
101
+ raise NotImplementedError.new('push is not implemented yet.')
102
+ end
103
+
104
+ # Returns the buffer with the captured screenshot of the device.
21
105
  def screenshot(path: nil)
22
106
  wrap_impl(@impl.screenshot(path: unwrap_impl(path)))
23
107
  end
24
108
 
25
- # @nodoc
109
+ # Scrolls the widget defined by `selector` in the specified `direction`.
110
+ def scroll(selector, direction, percent, speed: nil)
111
+ raise NotImplementedError.new('scroll is not implemented yet.')
112
+ end
113
+
114
+ # Device serial number.
115
+ def serial
116
+ wrap_impl(@impl.serial)
117
+ end
118
+
119
+ # This setting will change the default maximum time for all the methods accepting `timeout` option.
120
+ def set_default_timeout(timeout)
121
+ raise NotImplementedError.new('set_default_timeout is not implemented yet.')
122
+ end
123
+ alias_method :default_timeout=, :set_default_timeout
124
+
125
+ # Executes a shell command on the device and returns its output.
26
126
  def shell(command)
27
127
  wrap_impl(@impl.shell(unwrap_impl(command)))
28
128
  end
29
129
 
30
- # @nodoc
31
- def input
32
- wrap_impl(@impl.input)
130
+ # Swipes the widget defined by `selector` in the specified `direction`.
131
+ def swipe(selector, direction, percent, speed: nil)
132
+ raise NotImplementedError.new('swipe is not implemented yet.')
33
133
  end
34
134
 
35
- # @nodoc
36
- def launch_browser(pkg: nil, acceptDownloads: nil, bypassCSP: nil, colorScheme: nil, deviceScaleFactor: nil, extraHTTPHeaders: nil, geolocation: nil, hasTouch: nil, httpCredentials: nil, ignoreHTTPSErrors: nil, isMobile: nil, javaScriptEnabled: nil, locale: nil, noViewport: nil, offline: nil, permissions: nil, proxy: nil, record_har_omit_content: nil, record_har_path: nil, record_video_dir: nil, record_video_size: nil, storageState: nil, timezoneId: nil, userAgent: nil, viewport: nil, &block)
37
- wrap_impl(@impl.launch_browser(pkg: unwrap_impl(pkg), acceptDownloads: unwrap_impl(acceptDownloads), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), storageState: unwrap_impl(storageState), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
135
+ # Taps on the widget defined by `selector`.
136
+ def tap_point(selector, duration: nil)
137
+ raise NotImplementedError.new('tap_point is not implemented yet.')
138
+ end
139
+
140
+ # Waits for the specific `selector` to either appear or disappear, depending on the `state`.
141
+ def wait(selector, state: nil)
142
+ raise NotImplementedError.new('wait is not implemented yet.')
143
+ end
144
+
145
+ # Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
146
+ # value.
147
+ def wait_for_event(event, optionsOrPredicate: nil)
148
+ raise NotImplementedError.new('wait_for_event is not implemented yet.')
149
+ end
150
+
151
+ # This method waits until `AndroidWebView` matching the `selector` is opened and returns it. If there is already an open
152
+ # `AndroidWebView` matching the `selector`, returns immediately.
153
+ def web_view(selector)
154
+ raise NotImplementedError.new('web_view is not implemented yet.')
155
+ end
156
+
157
+ # Currently open WebViews.
158
+ def web_views
159
+ raise NotImplementedError.new('web_views is not implemented yet.')
38
160
  end
39
161
 
40
162
  # @nodoc
41
- def info(selector)
42
- wrap_impl(@impl.info(unwrap_impl(selector)))
163
+ def tree
164
+ wrap_impl(@impl.tree)
43
165
  end
44
166
 
45
167
  # @nodoc
46
- def serial
47
- wrap_impl(@impl.serial)
168
+ def tap_on(selector, duration: nil, timeout: nil)
169
+ wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
48
170
  end
49
171
 
172
+ # -- inherited from EventEmitter --
50
173
  # @nodoc
51
- def model
52
- wrap_impl(@impl.model)
174
+ def off(event, callback)
175
+ event_emitter_proxy.off(event, callback)
53
176
  end
54
177
 
55
178
  # -- inherited from EventEmitter --
@@ -64,12 +187,6 @@ module Playwright
64
187
  event_emitter_proxy.on(event, callback)
65
188
  end
66
189
 
67
- # -- inherited from EventEmitter --
68
- # @nodoc
69
- def off(event, callback)
70
- event_emitter_proxy.off(event, callback)
71
- end
72
-
73
190
  private def event_emitter_proxy
74
191
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
75
192
  end
@@ -1,25 +1,29 @@
1
1
  module Playwright
2
- # @nodoc
3
2
  class AndroidInput < PlaywrightApi
4
3
 
5
- # @nodoc
6
- def type(text)
7
- wrap_impl(@impl.type(unwrap_impl(text)))
8
- end
9
-
10
- # @nodoc
11
- def tap_point(point)
12
- wrap_impl(@impl.tap_point(unwrap_impl(point)))
13
- end
14
-
15
- # @nodoc
4
+ # Performs a drag between `from` and `to` points.
16
5
  def drag(from, to, steps)
17
6
  wrap_impl(@impl.drag(unwrap_impl(from), unwrap_impl(to), unwrap_impl(steps)))
18
7
  end
19
8
 
20
- # @nodoc
9
+ # Presses the `key`.
21
10
  def press(key)
22
11
  wrap_impl(@impl.press(unwrap_impl(key)))
23
12
  end
13
+
14
+ # Swipes following the path defined by `segments`.
15
+ def swipe(from, segments, steps)
16
+ raise NotImplementedError.new('swipe is not implemented yet.')
17
+ end
18
+
19
+ # Taps at the specified `point`.
20
+ def tap_point(point)
21
+ wrap_impl(@impl.tap_point(unwrap_impl(point)))
22
+ end
23
+
24
+ # Types `text` into currently focused widget.
25
+ def type(text)
26
+ wrap_impl(@impl.type(unwrap_impl(text)))
27
+ end
24
28
  end
25
29
  end
@@ -0,0 +1,16 @@
1
+ module Playwright
2
+ # `AndroidSocket` is a way to communicate with a process launched on the `AndroidDevice`. Use
3
+ # [`method: AndroidDevice.open`] to open a socket.
4
+ class AndroidSocket < PlaywrightApi
5
+
6
+ # Closes the socket.
7
+ def close
8
+ raise NotImplementedError.new('close is not implemented yet.')
9
+ end
10
+
11
+ # Writes some `data` to the socket.
12
+ def write(data)
13
+ raise NotImplementedError.new('write is not implemented yet.')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ module Playwright
2
+ # `AndroidWebView` represents a WebView open on the `AndroidDevice`. WebView is usually obtained using
3
+ # [`method: AndroidDevice.webView`].
4
+ class AndroidWebView < PlaywrightApi
5
+
6
+ # Connects to the WebView and returns a regular Playwright `Page` to interact with.
7
+ def page
8
+ raise NotImplementedError.new('page is not implemented yet.')
9
+ end
10
+
11
+ # WebView process PID.
12
+ def pid
13
+ raise NotImplementedError.new('pid is not implemented yet.')
14
+ end
15
+
16
+ # WebView package identifier.
17
+ def pkg
18
+ raise NotImplementedError.new('pkg is not implemented yet.')
19
+ end
20
+ end
21
+ end
@@ -2,22 +2,27 @@ module Playwright
2
2
  # @nodoc
3
3
  class BindingCall < PlaywrightApi
4
4
 
5
+ # @nodoc
6
+ def name
7
+ wrap_impl(@impl.name)
8
+ end
9
+
5
10
  # -- inherited from EventEmitter --
6
11
  # @nodoc
7
- def once(event, callback)
8
- event_emitter_proxy.once(event, callback)
12
+ def off(event, callback)
13
+ event_emitter_proxy.off(event, callback)
9
14
  end
10
15
 
11
16
  # -- inherited from EventEmitter --
12
17
  # @nodoc
13
- def on(event, callback)
14
- event_emitter_proxy.on(event, callback)
18
+ def once(event, callback)
19
+ event_emitter_proxy.once(event, callback)
15
20
  end
16
21
 
17
22
  # -- inherited from EventEmitter --
18
23
  # @nodoc
19
- def off(event, callback)
20
- event_emitter_proxy.off(event, callback)
24
+ def on(event, callback)
25
+ event_emitter_proxy.on(event, callback)
21
26
  end
22
27
 
23
28
  private def event_emitter_proxy
@@ -191,20 +191,20 @@ module Playwright
191
191
 
192
192
  # -- inherited from EventEmitter --
193
193
  # @nodoc
194
- def once(event, callback)
195
- event_emitter_proxy.once(event, callback)
194
+ def off(event, callback)
195
+ event_emitter_proxy.off(event, callback)
196
196
  end
197
197
 
198
198
  # -- inherited from EventEmitter --
199
199
  # @nodoc
200
- def on(event, callback)
201
- event_emitter_proxy.on(event, callback)
200
+ def once(event, callback)
201
+ event_emitter_proxy.once(event, callback)
202
202
  end
203
203
 
204
204
  # -- inherited from EventEmitter --
205
205
  # @nodoc
206
- def off(event, callback)
207
- event_emitter_proxy.off(event, callback)
206
+ def on(event, callback)
207
+ event_emitter_proxy.on(event, callback)
208
208
  end
209
209
 
210
210
  private def event_emitter_proxy
@@ -57,7 +57,7 @@ module Playwright
57
57
  # browser_context.add_cookies([cookie_object1, cookie_object2])
58
58
  # ```
59
59
  def add_cookies(cookies)
60
- raise NotImplementedError.new('add_cookies is not implemented yet.')
60
+ wrap_impl(@impl.add_cookies(unwrap_impl(cookies)))
61
61
  end
62
62
 
63
63
  # Adds a script which would be evaluated in one of the following scenarios:
@@ -97,17 +97,17 @@ module Playwright
97
97
  # > NOTE: The order of evaluation of multiple scripts installed via [`method: BrowserContext.addInitScript`] and
98
98
  # [`method: Page.addInitScript`] is not defined.
99
99
  def add_init_script(path: nil, script: nil)
100
- raise NotImplementedError.new('add_init_script is not implemented yet.')
100
+ wrap_impl(@impl.add_init_script(path: unwrap_impl(path), script: unwrap_impl(script)))
101
101
  end
102
102
 
103
103
  # Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
104
104
  def browser
105
- raise NotImplementedError.new('browser is not implemented yet.')
105
+ wrap_impl(@impl.browser)
106
106
  end
107
107
 
108
108
  # Clears context cookies.
109
109
  def clear_cookies
110
- raise NotImplementedError.new('clear_cookies is not implemented yet.')
110
+ wrap_impl(@impl.clear_cookies)
111
111
  end
112
112
 
113
113
  # Clears all permission overrides for the browser context.
@@ -134,7 +134,7 @@ module Playwright
134
134
  # context.clear_permissions()
135
135
  # ```
136
136
  def clear_permissions
137
- raise NotImplementedError.new('clear_permissions is not implemented yet.')
137
+ wrap_impl(@impl.clear_permissions)
138
138
  end
139
139
 
140
140
  # Closes the browser context. All the pages that belong to the browser context will be closed.
@@ -147,7 +147,7 @@ module Playwright
147
147
  # If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs
148
148
  # are returned.
149
149
  def cookies(urls: nil)
150
- raise NotImplementedError.new('cookies is not implemented yet.')
150
+ wrap_impl(@impl.cookies(urls: unwrap_impl(urls)))
151
151
  end
152
152
 
153
153
  # The method adds a function called `name` on the `window` object of every frame in every page in the context. When
@@ -278,7 +278,7 @@ module Playwright
278
278
  # """)
279
279
  # ```
280
280
  def expose_binding(name, callback, handle: nil)
281
- raise NotImplementedError.new('expose_binding is not implemented yet.')
281
+ wrap_impl(@impl.expose_binding(unwrap_impl(name), unwrap_impl(callback), handle: unwrap_impl(handle)))
282
282
  end
283
283
 
284
284
  # The method adds a function called `name` on the `window` object of every frame in every page in the context. When
@@ -379,13 +379,13 @@ module Playwright
379
379
  # run(playwright)
380
380
  # ```
381
381
  def expose_function(name, callback)
382
- raise NotImplementedError.new('expose_function is not implemented yet.')
382
+ wrap_impl(@impl.expose_function(unwrap_impl(name), unwrap_impl(callback)))
383
383
  end
384
384
 
385
385
  # Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
386
386
  # specified.
387
387
  def grant_permissions(permissions, origin: nil)
388
- raise NotImplementedError.new('grant_permissions is not implemented yet.')
388
+ wrap_impl(@impl.grant_permissions(unwrap_impl(permissions), origin: unwrap_impl(origin)))
389
389
  end
390
390
 
391
391
  # Creates a new page in the browser context.
@@ -464,7 +464,7 @@ module Playwright
464
464
  #
465
465
  # > NOTE: Enabling routing disables http cache.
466
466
  def route(url, handler)
467
- raise NotImplementedError.new('route is not implemented yet.')
467
+ wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler)))
468
468
  end
469
469
 
470
470
  # This setting will change the default maximum navigation time for the following methods and related shortcuts:
@@ -478,7 +478,7 @@ module Playwright
478
478
  # > NOTE: [`method: Page.setDefaultNavigationTimeout`] and [`method: Page.setDefaultTimeout`] take priority over
479
479
  # [`method: BrowserContext.setDefaultNavigationTimeout`].
480
480
  def set_default_navigation_timeout(timeout)
481
- raise NotImplementedError.new('set_default_navigation_timeout is not implemented yet.')
481
+ wrap_impl(@impl.set_default_navigation_timeout(unwrap_impl(timeout)))
482
482
  end
483
483
  alias_method :default_navigation_timeout=, :set_default_navigation_timeout
484
484
 
@@ -487,7 +487,7 @@ module Playwright
487
487
  # > NOTE: [`method: Page.setDefaultNavigationTimeout`], [`method: Page.setDefaultTimeout`] and
488
488
  # [`method: BrowserContext.setDefaultNavigationTimeout`] take priority over [`method: BrowserContext.setDefaultTimeout`].
489
489
  def set_default_timeout(timeout)
490
- raise NotImplementedError.new('set_default_timeout is not implemented yet.')
490
+ wrap_impl(@impl.set_default_timeout(unwrap_impl(timeout)))
491
491
  end
492
492
  alias_method :default_timeout=, :set_default_timeout
493
493
 
@@ -497,7 +497,7 @@ module Playwright
497
497
  #
498
498
  # > NOTE: [`method: BrowserContext.setExtraHTTPHeaders`] does not guarantee the order of headers in the outgoing requests.
499
499
  def set_extra_http_headers(headers)
500
- raise NotImplementedError.new('set_extra_http_headers is not implemented yet.')
500
+ wrap_impl(@impl.set_extra_http_headers(unwrap_impl(headers)))
501
501
  end
502
502
  alias_method :extra_http_headers=, :set_extra_http_headers
503
503
 
@@ -519,12 +519,12 @@ module Playwright
519
519
  # > NOTE: Consider using [`method: BrowserContext.grantPermissions`] to grant permissions for the browser context pages to
520
520
  # read its geolocation.
521
521
  def set_geolocation(geolocation)
522
- raise NotImplementedError.new('set_geolocation is not implemented yet.')
522
+ wrap_impl(@impl.set_geolocation(unwrap_impl(geolocation)))
523
523
  end
524
524
  alias_method :geolocation=, :set_geolocation
525
525
 
526
526
  def set_offline(offline)
527
- raise NotImplementedError.new('set_offline is not implemented yet.')
527
+ wrap_impl(@impl.set_offline(unwrap_impl(offline)))
528
528
  end
529
529
  alias_method :offline=, :set_offline
530
530
 
@@ -536,7 +536,7 @@ module Playwright
536
536
  # Removes a route created with [`method: BrowserContext.route`]. When `handler` is not specified, removes all routes for
537
537
  # the `url`.
538
538
  def unroute(url, handler: nil)
539
- raise NotImplementedError.new('unroute is not implemented yet.')
539
+ wrap_impl(@impl.unroute(unwrap_impl(url), handler: unwrap_impl(handler)))
540
540
  end
541
541
 
542
542
  # Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
@@ -561,15 +561,15 @@ module Playwright
561
561
  # page.click("button")
562
562
  # page = event_info.value
563
563
  # ```
564
- def expect_event(event, predicate: nil, timeout: nil)
565
- raise NotImplementedError.new('expect_event is not implemented yet.')
564
+ def expect_event(event, predicate: nil, timeout: nil, &block)
565
+ wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
566
566
  end
567
567
 
568
- # Performs action and waits for `page` event to fire. If predicate is provided, it passes `Page` value into the
569
- # `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
570
- # closed before the worker event is fired.
568
+ # Performs action and waits for a new `Page` to be created in the context. If predicate is provided, it passes `Page`
569
+ # value into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if
570
+ # the context closes before new `Page` is created.
571
571
  def expect_page(predicate: nil, timeout: nil)
572
- raise NotImplementedError.new('expect_page is not implemented yet.')
572
+ wrap_impl(@impl.expect_page(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout)))
573
573
  end
574
574
 
575
575
  # > NOTE: In most cases, you should use [`method: BrowserContext.waitForEvent`].
@@ -596,22 +596,27 @@ module Playwright
596
596
  wrap_impl(@impl.options=(unwrap_impl(req)))
597
597
  end
598
598
 
599
+ # @nodoc
600
+ def pause
601
+ wrap_impl(@impl.pause)
602
+ end
603
+
599
604
  # -- inherited from EventEmitter --
600
605
  # @nodoc
601
- def once(event, callback)
602
- event_emitter_proxy.once(event, callback)
606
+ def off(event, callback)
607
+ event_emitter_proxy.off(event, callback)
603
608
  end
604
609
 
605
610
  # -- inherited from EventEmitter --
606
611
  # @nodoc
607
- def on(event, callback)
608
- event_emitter_proxy.on(event, callback)
612
+ def once(event, callback)
613
+ event_emitter_proxy.once(event, callback)
609
614
  end
610
615
 
611
616
  # -- inherited from EventEmitter --
612
617
  # @nodoc
613
- def off(event, callback)
614
- event_emitter_proxy.off(event, callback)
618
+ def on(event, callback)
619
+ event_emitter_proxy.on(event, callback)
615
620
  end
616
621
 
617
622
  private def event_emitter_proxy