playwright-ruby-client 1.52.0 → 1.54.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.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser_context.md +1 -1
- data/documentation/docs/api/console_message.md +0 -3
- data/documentation/docs/api/experimental/android.md +10 -0
- data/documentation/docs/api/frame.md +1 -0
- data/documentation/docs/api/frame_locator.md +1 -0
- data/documentation/docs/api/locator.md +25 -1
- data/documentation/docs/api/locator_assertions.md +4 -7
- data/documentation/docs/api/mouse.md +2 -0
- data/documentation/docs/api/page.md +2 -1
- data/documentation/docs/api/selectors.md +10 -0
- data/documentation/docs/api/tracing.md +8 -0
- data/documentation/docs/include/api_coverage.md +3 -2
- data/lib/playwright/channel.rb +6 -3
- data/lib/playwright/channel_owners/android.rb +12 -0
- data/lib/playwright/channel_owners/android_device.rb +6 -5
- data/lib/playwright/channel_owners/api_request_context.rb +6 -1
- data/lib/playwright/channel_owners/browser.rb +37 -6
- data/lib/playwright/channel_owners/browser_context.rb +44 -23
- data/lib/playwright/channel_owners/browser_type.rb +45 -12
- data/lib/playwright/channel_owners/element_handle.rb +22 -17
- data/lib/playwright/channel_owners/frame.rb +65 -34
- data/lib/playwright/channel_owners/page.rb +19 -8
- data/lib/playwright/channel_owners/playwright.rb +10 -4
- data/lib/playwright/channel_owners/web_socket.rb +1 -1
- data/lib/playwright/connection.rb +3 -0
- data/lib/playwright/file_chooser_impl.rb +3 -2
- data/lib/playwright/frame_locator_impl.rb +5 -8
- data/lib/playwright/locator_assertions_impl.rb +64 -34
- data/lib/playwright/locator_impl.rb +27 -38
- data/lib/playwright/page_assertions_impl.rb +11 -9
- data/lib/playwright/selectors_impl.rb +45 -0
- data/lib/playwright/test.rb +21 -3
- data/lib/playwright/timeout_settings.rb +5 -0
- data/lib/playwright/transport.rb +1 -1
- data/lib/playwright/utils.rb +0 -33
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +12 -7
- data/lib/playwright_api/android_device.rb +8 -8
- data/lib/playwright_api/api_request_context.rb +6 -6
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +11 -11
- data/lib/playwright_api/browser_type.rb +6 -6
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +0 -4
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +14 -8
- data/lib/playwright_api/frame_locator.rb +1 -0
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +31 -4
- data/lib/playwright_api/locator_assertions.rb +3 -3
- data/lib/playwright_api/mouse.rb +2 -0
- data/lib/playwright_api/page.rb +14 -8
- data/lib/playwright_api/playwright.rb +8 -8
- data/lib/playwright_api/request.rb +8 -8
- data/lib/playwright_api/response.rb +8 -8
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +1 -28
- data/lib/playwright_api/tracing.rb +14 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- data/sig/playwright.rbs +11 -2
- metadata +4 -4
- data/lib/playwright/channel_owners/selectors.rb +0 -26
data/lib/playwright/test.rb
CHANGED
@@ -2,10 +2,28 @@ module Playwright
|
|
2
2
|
# this module is responsible for running playwright assertions and integrating
|
3
3
|
# with test frameworks.
|
4
4
|
module Test
|
5
|
+
@@expect_timeout = nil
|
6
|
+
|
7
|
+
def self.expect_timeout
|
8
|
+
@@expect_timeout || 5000 # default timeout is 5000ms
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.expect_timeout=(timeout)
|
12
|
+
@@expect_timeout = timeout
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.with_timeout(expect_timeout, &block)
|
16
|
+
old_timeout = @@expect_timeout
|
17
|
+
@@expect_timeout = expect_timeout
|
18
|
+
block.call
|
19
|
+
ensure
|
20
|
+
@@expect_timeout = old_timeout
|
21
|
+
end
|
22
|
+
|
5
23
|
# ref: https://github.com/microsoft/playwright-python/blob/main/playwright/sync_api/__init__.py#L90
|
6
24
|
class Expect
|
7
25
|
def initialize
|
8
|
-
@
|
26
|
+
@default_expect_timeout = ::Playwright::Test.expect_timeout
|
9
27
|
end
|
10
28
|
|
11
29
|
def call(actual, is_not)
|
@@ -14,7 +32,7 @@ module Playwright
|
|
14
32
|
PageAssertions.new(
|
15
33
|
PageAssertionsImpl.new(
|
16
34
|
actual,
|
17
|
-
@
|
35
|
+
@default_expect_timeout,
|
18
36
|
is_not,
|
19
37
|
nil,
|
20
38
|
)
|
@@ -23,7 +41,7 @@ module Playwright
|
|
23
41
|
LocatorAssertions.new(
|
24
42
|
LocatorAssertionsImpl.new(
|
25
43
|
actual,
|
26
|
-
@
|
44
|
+
@default_expect_timeout,
|
27
45
|
is_not,
|
28
46
|
nil,
|
29
47
|
)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Playwright
|
2
2
|
class TimeoutSettings
|
3
3
|
DEFAULT_TIMEOUT = 30000
|
4
|
+
DEFAULT_LAUNCH_TIMEOUT = 180000 # 3 minutes
|
4
5
|
|
5
6
|
def initialize(parent = nil)
|
6
7
|
@parent = parent
|
@@ -15,5 +16,9 @@ module Playwright
|
|
15
16
|
def timeout(timeout_override = nil)
|
16
17
|
timeout_override || @default_timeout || @parent&.timeout || DEFAULT_TIMEOUT
|
17
18
|
end
|
19
|
+
|
20
|
+
def launch_timeout(timeout_override = nil)
|
21
|
+
timeout_override || @default_timeout || @parent&.launch_timeout || DEFAULT_LAUNCH_TIMEOUT
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
data/lib/playwright/transport.rb
CHANGED
data/lib/playwright/utils.rb
CHANGED
@@ -3,36 +3,6 @@ require 'base64'
|
|
3
3
|
module Playwright
|
4
4
|
module Utils
|
5
5
|
module PrepareBrowserContextOptions
|
6
|
-
private def prepare_record_har_options(params)
|
7
|
-
out_params = {
|
8
|
-
path: params.delete(:record_har_path)
|
9
|
-
}
|
10
|
-
if params[:record_har_url_filter]
|
11
|
-
opt = params.delete(:record_har_url_filter)
|
12
|
-
if opt.is_a?(Regexp)
|
13
|
-
regex = ::Playwright::JavaScript::Regex.new(opt)
|
14
|
-
out_params[:urlRegexSource] = regex.source
|
15
|
-
out_params[:urlRegexFlags] = regex.flag
|
16
|
-
elsif opt.is_a?(String)
|
17
|
-
out_params[:urlGlob] = opt
|
18
|
-
end
|
19
|
-
end
|
20
|
-
if params[:record_har_mode]
|
21
|
-
out_params[:mode] = params.delete(:record_har_mode)
|
22
|
-
end
|
23
|
-
if params[:record_har_content]
|
24
|
-
out_params[:content] = params.delete(:record_har_content)
|
25
|
-
end
|
26
|
-
if params[:record_har_omit_content]
|
27
|
-
old_api_omit_content = params.delete(:record_har_omit_content)
|
28
|
-
if old_api_omit_content
|
29
|
-
out_params[:content] ||= 'omit'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
out_params
|
34
|
-
end
|
35
|
-
|
36
6
|
# @see https://github.com/microsoft/playwright/blob/5a2cfdbd47ed3c3deff77bb73e5fac34241f649d/src/client/browserContext.ts#L265
|
37
7
|
private def prepare_browser_context_options(params)
|
38
8
|
if params[:noViewport] == 0
|
@@ -42,9 +12,6 @@ module Playwright
|
|
42
12
|
if params[:extraHTTPHeaders]
|
43
13
|
params[:extraHTTPHeaders] = ::Playwright::HttpHeaders.new(params[:extraHTTPHeaders]).as_serialized
|
44
14
|
end
|
45
|
-
if params[:record_har_path]
|
46
|
-
params[:recordHar] = prepare_record_har_options(params)
|
47
|
-
end
|
48
15
|
if params[:record_video_dir]
|
49
16
|
params[:recordVideo] = {
|
50
17
|
dir: params.delete(:record_video_dir)
|
data/lib/playwright/version.rb
CHANGED
@@ -34,26 +34,31 @@ module Playwright
|
|
34
34
|
#
|
35
35
|
# This setting will change the default maximum time for all the methods accepting `timeout` option.
|
36
36
|
def set_default_timeout(timeout)
|
37
|
-
|
37
|
+
wrap_impl(@impl.set_default_timeout(unwrap_impl(timeout)))
|
38
38
|
end
|
39
39
|
alias_method :default_timeout=, :set_default_timeout
|
40
40
|
|
41
|
+
# @nodoc
|
42
|
+
def set_default_navigation_timeout(timeout)
|
43
|
+
wrap_impl(@impl.set_default_navigation_timeout(unwrap_impl(timeout)))
|
44
|
+
end
|
45
|
+
|
41
46
|
# -- inherited from EventEmitter --
|
42
47
|
# @nodoc
|
43
|
-
def
|
44
|
-
event_emitter_proxy.
|
48
|
+
def once(event, callback)
|
49
|
+
event_emitter_proxy.once(event, callback)
|
45
50
|
end
|
46
51
|
|
47
52
|
# -- inherited from EventEmitter --
|
48
53
|
# @nodoc
|
49
|
-
def
|
50
|
-
event_emitter_proxy.
|
54
|
+
def on(event, callback)
|
55
|
+
event_emitter_proxy.on(event, callback)
|
51
56
|
end
|
52
57
|
|
53
58
|
# -- inherited from EventEmitter --
|
54
59
|
# @nodoc
|
55
|
-
def
|
56
|
-
event_emitter_proxy.
|
60
|
+
def off(event, callback)
|
61
|
+
event_emitter_proxy.off(event, callback)
|
57
62
|
end
|
58
63
|
|
59
64
|
private def event_emitter_proxy
|
@@ -194,14 +194,20 @@ module Playwright
|
|
194
194
|
raise NotImplementedError.new('web_views is not implemented yet.')
|
195
195
|
end
|
196
196
|
|
197
|
+
# @nodoc
|
198
|
+
def tap_on(selector, duration: nil, timeout: nil)
|
199
|
+
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
200
|
+
end
|
201
|
+
|
197
202
|
# @nodoc
|
198
203
|
def should_close_connection_on_close!
|
199
204
|
wrap_impl(@impl.should_close_connection_on_close!)
|
200
205
|
end
|
201
206
|
|
207
|
+
# -- inherited from EventEmitter --
|
202
208
|
# @nodoc
|
203
|
-
def
|
204
|
-
|
209
|
+
def once(event, callback)
|
210
|
+
event_emitter_proxy.once(event, callback)
|
205
211
|
end
|
206
212
|
|
207
213
|
# -- inherited from EventEmitter --
|
@@ -216,12 +222,6 @@ module Playwright
|
|
216
222
|
event_emitter_proxy.off(event, callback)
|
217
223
|
end
|
218
224
|
|
219
|
-
# -- inherited from EventEmitter --
|
220
|
-
# @nodoc
|
221
|
-
def once(event, callback)
|
222
|
-
event_emitter_proxy.once(event, callback)
|
223
|
-
end
|
224
|
-
|
225
225
|
private def event_emitter_proxy
|
226
226
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
227
227
|
end
|
@@ -288,20 +288,20 @@ module Playwright
|
|
288
288
|
|
289
289
|
# -- inherited from EventEmitter --
|
290
290
|
# @nodoc
|
291
|
-
def
|
292
|
-
event_emitter_proxy.
|
291
|
+
def once(event, callback)
|
292
|
+
event_emitter_proxy.once(event, callback)
|
293
293
|
end
|
294
294
|
|
295
295
|
# -- inherited from EventEmitter --
|
296
296
|
# @nodoc
|
297
|
-
def
|
298
|
-
event_emitter_proxy.
|
297
|
+
def on(event, callback)
|
298
|
+
event_emitter_proxy.on(event, callback)
|
299
299
|
end
|
300
300
|
|
301
301
|
# -- inherited from EventEmitter --
|
302
302
|
# @nodoc
|
303
|
-
def
|
304
|
-
event_emitter_proxy.
|
303
|
+
def off(event, callback)
|
304
|
+
event_emitter_proxy.off(event, callback)
|
305
305
|
end
|
306
306
|
|
307
307
|
private def event_emitter_proxy
|
@@ -205,20 +205,20 @@ module Playwright
|
|
205
205
|
|
206
206
|
# -- inherited from EventEmitter --
|
207
207
|
# @nodoc
|
208
|
-
def
|
209
|
-
event_emitter_proxy.
|
208
|
+
def once(event, callback)
|
209
|
+
event_emitter_proxy.once(event, callback)
|
210
210
|
end
|
211
211
|
|
212
212
|
# -- inherited from EventEmitter --
|
213
213
|
# @nodoc
|
214
|
-
def
|
215
|
-
event_emitter_proxy.
|
214
|
+
def on(event, callback)
|
215
|
+
event_emitter_proxy.on(event, callback)
|
216
216
|
end
|
217
217
|
|
218
218
|
# -- inherited from EventEmitter --
|
219
219
|
# @nodoc
|
220
|
-
def
|
221
|
-
event_emitter_proxy.
|
220
|
+
def off(event, callback)
|
221
|
+
event_emitter_proxy.off(event, callback)
|
222
222
|
end
|
223
223
|
|
224
224
|
private def event_emitter_proxy
|
@@ -80,7 +80,7 @@ module Playwright
|
|
80
80
|
end
|
81
81
|
|
82
82
|
#
|
83
|
-
#
|
83
|
+
# Gets the browser instance that owns the context. Returns `null` if the context is created outside of normal browser, e.g. Android or Electron.
|
84
84
|
def browser
|
85
85
|
wrap_impl(@impl.browser)
|
86
86
|
end
|
@@ -474,8 +474,8 @@ module Playwright
|
|
474
474
|
end
|
475
475
|
|
476
476
|
# @nodoc
|
477
|
-
def
|
478
|
-
wrap_impl(@impl.
|
477
|
+
def owner_page=(req)
|
478
|
+
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
479
479
|
end
|
480
480
|
|
481
481
|
# @nodoc
|
@@ -484,26 +484,26 @@ module Playwright
|
|
484
484
|
end
|
485
485
|
|
486
486
|
# @nodoc
|
487
|
-
def
|
488
|
-
wrap_impl(@impl.
|
487
|
+
def browser=(req)
|
488
|
+
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
489
489
|
end
|
490
490
|
|
491
491
|
# -- inherited from EventEmitter --
|
492
492
|
# @nodoc
|
493
|
-
def
|
494
|
-
event_emitter_proxy.
|
493
|
+
def once(event, callback)
|
494
|
+
event_emitter_proxy.once(event, callback)
|
495
495
|
end
|
496
496
|
|
497
497
|
# -- inherited from EventEmitter --
|
498
498
|
# @nodoc
|
499
|
-
def
|
500
|
-
event_emitter_proxy.
|
499
|
+
def on(event, callback)
|
500
|
+
event_emitter_proxy.on(event, callback)
|
501
501
|
end
|
502
502
|
|
503
503
|
# -- inherited from EventEmitter --
|
504
504
|
# @nodoc
|
505
|
-
def
|
506
|
-
event_emitter_proxy.
|
505
|
+
def off(event, callback)
|
506
|
+
event_emitter_proxy.off(event, callback)
|
507
507
|
end
|
508
508
|
|
509
509
|
private def event_emitter_proxy
|
@@ -182,20 +182,20 @@ module Playwright
|
|
182
182
|
|
183
183
|
# -- inherited from EventEmitter --
|
184
184
|
# @nodoc
|
185
|
-
def
|
186
|
-
event_emitter_proxy.
|
185
|
+
def once(event, callback)
|
186
|
+
event_emitter_proxy.once(event, callback)
|
187
187
|
end
|
188
188
|
|
189
189
|
# -- inherited from EventEmitter --
|
190
190
|
# @nodoc
|
191
|
-
def
|
192
|
-
event_emitter_proxy.
|
191
|
+
def on(event, callback)
|
192
|
+
event_emitter_proxy.on(event, callback)
|
193
193
|
end
|
194
194
|
|
195
195
|
# -- inherited from EventEmitter --
|
196
196
|
# @nodoc
|
197
|
-
def
|
198
|
-
event_emitter_proxy.
|
197
|
+
def off(event, callback)
|
198
|
+
event_emitter_proxy.off(event, callback)
|
199
199
|
end
|
200
200
|
|
201
201
|
private def event_emitter_proxy
|
@@ -33,20 +33,20 @@ module Playwright
|
|
33
33
|
|
34
34
|
# -- inherited from EventEmitter --
|
35
35
|
# @nodoc
|
36
|
-
def
|
37
|
-
event_emitter_proxy.
|
36
|
+
def once(event, callback)
|
37
|
+
event_emitter_proxy.once(event, callback)
|
38
38
|
end
|
39
39
|
|
40
40
|
# -- inherited from EventEmitter --
|
41
41
|
# @nodoc
|
42
|
-
def
|
43
|
-
event_emitter_proxy.
|
42
|
+
def on(event, callback)
|
43
|
+
event_emitter_proxy.on(event, callback)
|
44
44
|
end
|
45
45
|
|
46
46
|
# -- inherited from EventEmitter --
|
47
47
|
# @nodoc
|
48
|
-
def
|
49
|
-
event_emitter_proxy.
|
48
|
+
def off(event, callback)
|
49
|
+
event_emitter_proxy.off(event, callback)
|
50
50
|
end
|
51
51
|
|
52
52
|
private def event_emitter_proxy
|
@@ -45,10 +45,6 @@ module Playwright
|
|
45
45
|
wrap_impl(@impl.text)
|
46
46
|
end
|
47
47
|
|
48
|
-
#
|
49
|
-
# One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,
|
50
|
-
# `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`,
|
51
|
-
# `'count'`, `'timeEnd'`.
|
52
48
|
def type
|
53
49
|
wrap_impl(@impl.type)
|
54
50
|
end
|
@@ -70,20 +70,20 @@ module Playwright
|
|
70
70
|
|
71
71
|
# -- inherited from EventEmitter --
|
72
72
|
# @nodoc
|
73
|
-
def
|
74
|
-
event_emitter_proxy.
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
75
75
|
end
|
76
76
|
|
77
77
|
# -- inherited from EventEmitter --
|
78
78
|
# @nodoc
|
79
|
-
def
|
80
|
-
event_emitter_proxy.
|
79
|
+
def on(event, callback)
|
80
|
+
event_emitter_proxy.on(event, callback)
|
81
81
|
end
|
82
82
|
|
83
83
|
# -- inherited from EventEmitter --
|
84
84
|
# @nodoc
|
85
|
-
def
|
86
|
-
event_emitter_proxy.
|
85
|
+
def off(event, callback)
|
86
|
+
event_emitter_proxy.off(event, callback)
|
87
87
|
end
|
88
88
|
|
89
89
|
private def event_emitter_proxy
|
@@ -574,20 +574,20 @@ module Playwright
|
|
574
574
|
|
575
575
|
# -- inherited from EventEmitter --
|
576
576
|
# @nodoc
|
577
|
-
def
|
578
|
-
event_emitter_proxy.
|
577
|
+
def once(event, callback)
|
578
|
+
event_emitter_proxy.once(event, callback)
|
579
579
|
end
|
580
580
|
|
581
581
|
# -- inherited from EventEmitter --
|
582
582
|
# @nodoc
|
583
|
-
def
|
584
|
-
event_emitter_proxy.
|
583
|
+
def on(event, callback)
|
584
|
+
event_emitter_proxy.on(event, callback)
|
585
585
|
end
|
586
586
|
|
587
587
|
# -- inherited from EventEmitter --
|
588
588
|
# @nodoc
|
589
|
-
def
|
590
|
-
event_emitter_proxy.
|
589
|
+
def off(event, callback)
|
590
|
+
event_emitter_proxy.off(event, callback)
|
591
591
|
end
|
592
592
|
|
593
593
|
private def event_emitter_proxy
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -487,6 +487,7 @@ module Playwright
|
|
487
487
|
def get_by_test_id(testId)
|
488
488
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
489
489
|
end
|
490
|
+
alias_method :get_by_testid, :get_by_test_id
|
490
491
|
|
491
492
|
#
|
492
493
|
# Allows locating elements that contain given text.
|
@@ -1038,32 +1039,37 @@ module Playwright
|
|
1038
1039
|
wrap_impl(@impl.wait_for_url(unwrap_impl(url), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
|
1039
1040
|
end
|
1040
1041
|
|
1042
|
+
# @nodoc
|
1043
|
+
def detached=(req)
|
1044
|
+
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
1045
|
+
end
|
1046
|
+
|
1041
1047
|
# @nodoc
|
1042
1048
|
def highlight(selector)
|
1043
1049
|
wrap_impl(@impl.highlight(unwrap_impl(selector)))
|
1044
1050
|
end
|
1045
1051
|
|
1046
1052
|
# @nodoc
|
1047
|
-
def
|
1048
|
-
wrap_impl(@impl.
|
1053
|
+
def expect(selector, expression, options, title)
|
1054
|
+
wrap_impl(@impl.expect(unwrap_impl(selector), unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
1049
1055
|
end
|
1050
1056
|
|
1051
1057
|
# -- inherited from EventEmitter --
|
1052
1058
|
# @nodoc
|
1053
|
-
def
|
1054
|
-
event_emitter_proxy.
|
1059
|
+
def once(event, callback)
|
1060
|
+
event_emitter_proxy.once(event, callback)
|
1055
1061
|
end
|
1056
1062
|
|
1057
1063
|
# -- inherited from EventEmitter --
|
1058
1064
|
# @nodoc
|
1059
|
-
def
|
1060
|
-
event_emitter_proxy.
|
1065
|
+
def on(event, callback)
|
1066
|
+
event_emitter_proxy.on(event, callback)
|
1061
1067
|
end
|
1062
1068
|
|
1063
1069
|
# -- inherited from EventEmitter --
|
1064
1070
|
# @nodoc
|
1065
|
-
def
|
1066
|
-
event_emitter_proxy.
|
1071
|
+
def off(event, callback)
|
1072
|
+
event_emitter_proxy.off(event, callback)
|
1067
1073
|
end
|
1068
1074
|
|
1069
1075
|
private def event_emitter_proxy
|
@@ -100,20 +100,20 @@ module Playwright
|
|
100
100
|
|
101
101
|
# -- inherited from EventEmitter --
|
102
102
|
# @nodoc
|
103
|
-
def
|
104
|
-
event_emitter_proxy.
|
103
|
+
def once(event, callback)
|
104
|
+
event_emitter_proxy.once(event, callback)
|
105
105
|
end
|
106
106
|
|
107
107
|
# -- inherited from EventEmitter --
|
108
108
|
# @nodoc
|
109
|
-
def
|
110
|
-
event_emitter_proxy.
|
109
|
+
def on(event, callback)
|
110
|
+
event_emitter_proxy.on(event, callback)
|
111
111
|
end
|
112
112
|
|
113
113
|
# -- inherited from EventEmitter --
|
114
114
|
# @nodoc
|
115
|
-
def
|
116
|
-
event_emitter_proxy.
|
115
|
+
def off(event, callback)
|
116
|
+
event_emitter_proxy.off(event, callback)
|
117
117
|
end
|
118
118
|
|
119
119
|
private def event_emitter_proxy
|
@@ -103,8 +103,8 @@ module Playwright
|
|
103
103
|
# - listitem:
|
104
104
|
# - link "About"
|
105
105
|
# ```
|
106
|
-
def aria_snapshot(
|
107
|
-
wrap_impl(@impl.aria_snapshot(
|
106
|
+
def aria_snapshot(timeout: nil)
|
107
|
+
wrap_impl(@impl.aria_snapshot(timeout: unwrap_impl(timeout)))
|
108
108
|
end
|
109
109
|
|
110
110
|
#
|
@@ -274,6 +274,20 @@ module Playwright
|
|
274
274
|
wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
275
275
|
end
|
276
276
|
|
277
|
+
#
|
278
|
+
# Describes the locator, description is used in the trace viewer and reports.
|
279
|
+
# Returns the locator pointing to the same element.
|
280
|
+
#
|
281
|
+
# **Usage**
|
282
|
+
#
|
283
|
+
# ```python sync
|
284
|
+
# button = page.get_by_test_id("btn-sub").describe("Subscribe button")
|
285
|
+
# button.click()
|
286
|
+
# ```
|
287
|
+
def describe(description)
|
288
|
+
wrap_impl(@impl.describe(unwrap_impl(description)))
|
289
|
+
end
|
290
|
+
|
277
291
|
#
|
278
292
|
# Programmatically dispatch an event on the matching element.
|
279
293
|
#
|
@@ -393,6 +407,13 @@ module Playwright
|
|
393
407
|
# If `expression` throws or rejects, this method throws.
|
394
408
|
#
|
395
409
|
# **Usage**
|
410
|
+
#
|
411
|
+
# Passing argument to `expression`:
|
412
|
+
#
|
413
|
+
# ```python sync
|
414
|
+
# result = page.get_by_testid("myId").evaluate("(element, [x, y]) => element.textContent + ' ' + x * y", [7, 8])
|
415
|
+
# print(result) # prints "myId text 56"
|
416
|
+
# ```
|
396
417
|
def evaluate(expression, arg: nil, timeout: nil)
|
397
418
|
wrap_impl(@impl.evaluate(unwrap_impl(expression), arg: unwrap_impl(arg), timeout: unwrap_impl(timeout)))
|
398
419
|
end
|
@@ -640,6 +661,7 @@ module Playwright
|
|
640
661
|
def get_by_test_id(testId)
|
641
662
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
642
663
|
end
|
664
|
+
alias_method :get_by_testid, :get_by_test_id
|
643
665
|
|
644
666
|
#
|
645
667
|
# Allows locating elements that contain given text.
|
@@ -1246,8 +1268,13 @@ module Playwright
|
|
1246
1268
|
end
|
1247
1269
|
|
1248
1270
|
# @nodoc
|
1249
|
-
def expect(expression, options)
|
1250
|
-
wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options)))
|
1271
|
+
def expect(expression, options, title)
|
1272
|
+
wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
1273
|
+
end
|
1274
|
+
|
1275
|
+
# @nodoc
|
1276
|
+
def generate_locator_string
|
1277
|
+
wrap_impl(@impl.generate_locator_string)
|
1251
1278
|
end
|
1252
1279
|
|
1253
1280
|
# @nodoc
|
@@ -355,7 +355,7 @@ module Playwright
|
|
355
355
|
# When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class lists. Each element's class attribute is matched against the corresponding class in the array:
|
356
356
|
#
|
357
357
|
# ```html
|
358
|
-
# <div class='list'
|
358
|
+
# <div class='list'>
|
359
359
|
# <div class='component inactive'></div>
|
360
360
|
# <div class='component active'></div>
|
361
361
|
# <div class='component inactive'></div>
|
@@ -365,7 +365,7 @@ module Playwright
|
|
365
365
|
# ```python sync
|
366
366
|
# from playwright.sync_api import expect
|
367
367
|
#
|
368
|
-
# locator = page.locator("list > .component")
|
368
|
+
# locator = page.locator(".list > .component")
|
369
369
|
# await expect(locator).to_contain_class(["inactive", "active", "inactive"])
|
370
370
|
# ```
|
371
371
|
def to_contain_class(expected, timeout: nil)
|
@@ -504,7 +504,7 @@ module Playwright
|
|
504
504
|
# ```python sync
|
505
505
|
# from playwright.sync_api import expect
|
506
506
|
#
|
507
|
-
# locator = page.locator("list > .component")
|
507
|
+
# locator = page.locator(".list > .component")
|
508
508
|
# expect(locator).to_have_class(["component", "component selected", "component"])
|
509
509
|
# ```
|
510
510
|
def to_have_class(expected, timeout: nil)
|
data/lib/playwright_api/mouse.rb
CHANGED
@@ -2,6 +2,8 @@ module Playwright
|
|
2
2
|
#
|
3
3
|
# The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
|
4
4
|
#
|
5
|
+
# **NOTE**: If you want to debug where the mouse moved, you can use the [Trace viewer](../trace-viewer-intro.md) or [Playwright Inspector](../running-tests.md). A red dot showing the location of the mouse will be shown for every mouse action.
|
6
|
+
#
|
5
7
|
# Every `page` object has its own Mouse, accessible with [`property: Page.mouse`].
|
6
8
|
#
|
7
9
|
# ```python sync
|