playwright-ruby-client 1.39.0 → 1.40.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/api_request_context.md +1 -2
- data/documentation/docs/api/browser.md +10 -14
- data/documentation/docs/api/browser_context.md +32 -51
- data/documentation/docs/api/browser_type.md +8 -12
- data/documentation/docs/api/dialog.md +15 -18
- data/documentation/docs/api/download.md +10 -12
- data/documentation/docs/api/element_handle.md +9 -7
- data/documentation/docs/api/frame.md +28 -55
- data/documentation/docs/api/locator.md +24 -23
- data/documentation/docs/api/locator_assertions.md +652 -0
- data/documentation/docs/api/page.md +53 -103
- data/documentation/docs/api/playwright.md +20 -23
- data/documentation/docs/api/selectors.md +29 -34
- data/documentation/docs/article/guides/rails_integration.md +80 -51
- data/documentation/docs/article/guides/rspec_integration.md +59 -0
- data/documentation/docs/include/api_coverage.md +43 -0
- data/documentation/docusaurus.config.js +1 -1
- data/documentation/package.json +7 -7
- data/documentation/yarn.lock +4641 -5023
- data/lib/playwright/api_response_impl.rb +2 -2
- data/lib/playwright/channel.rb +1 -1
- data/lib/playwright/channel_owners/api_request_context.rb +12 -3
- data/lib/playwright/channel_owners/browser.rb +11 -7
- data/lib/playwright/channel_owners/browser_context.rb +35 -15
- data/lib/playwright/channel_owners/frame.rb +38 -14
- data/lib/playwright/channel_owners/page.rb +29 -16
- data/lib/playwright/channel_owners/web_socket.rb +8 -13
- data/lib/playwright/connection.rb +18 -2
- data/lib/playwright/errors.rb +22 -2
- data/lib/playwright/input_files.rb +4 -4
- data/lib/playwright/javascript/value_serializer.rb +1 -1
- data/lib/playwright/locator_assertions_impl.rb +417 -0
- data/lib/playwright/locator_impl.rb +24 -5
- data/lib/playwright/test.rb +68 -0
- data/lib/playwright/utils.rb +3 -10
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/waiter.rb +146 -0
- data/lib/playwright.rb +1 -1
- data/lib/playwright_api/api_request_context.rb +1 -2
- data/lib/playwright_api/browser.rb +2 -2
- data/lib/playwright_api/browser_context.rb +3 -3
- data/lib/playwright_api/browser_type.rb +2 -1
- data/lib/playwright_api/download.rb +1 -2
- data/lib/playwright_api/element_handle.rb +4 -1
- data/lib/playwright_api/frame.rb +4 -1
- data/lib/playwright_api/locator.rb +9 -1
- data/lib/playwright_api/locator_assertions.rb +561 -0
- data/lib/playwright_api/page.rb +16 -13
- data/lib/playwright_api/request.rb +4 -4
- data/lib/playwright_api/worker.rb +4 -4
- data/sig/playwright.rbs +48 -5
- metadata +9 -4
- data/lib/playwright/wait_helper.rb +0 -73
data/sig/playwright.rbs
CHANGED
@@ -242,7 +242,7 @@ module Playwright
|
|
242
242
|
def delete: -> void
|
243
243
|
def failure: -> (nil | String)
|
244
244
|
def page: -> Page
|
245
|
-
def path: -> (
|
245
|
+
def path: -> (String | File)
|
246
246
|
def save_as: ((String | File) path) -> void
|
247
247
|
def suggested_filename: -> String
|
248
248
|
def url: -> String
|
@@ -255,7 +255,7 @@ module Playwright
|
|
255
255
|
def bring_to_front: -> void
|
256
256
|
def check: (String selector, ?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
257
257
|
def click: (String selector, ?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
258
|
-
def close: (?runBeforeUnload: bool) -> void
|
258
|
+
def close: (?reason: String, ?runBeforeUnload: bool) -> void
|
259
259
|
def content: -> String
|
260
260
|
def context: -> BrowserContext
|
261
261
|
def dblclick: (String selector, ?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
@@ -361,7 +361,7 @@ module Playwright
|
|
361
361
|
def browser: -> (nil | Browser)
|
362
362
|
def clear_cookies: -> void
|
363
363
|
def clear_permissions: -> void
|
364
|
-
def close: -> void
|
364
|
+
def close: (?reason: String) -> void
|
365
365
|
def cookies: (?urls: (String | Array[untyped])) -> Array[untyped]
|
366
366
|
def expose_binding: (String name, function callback, ?handle: bool) -> void
|
367
367
|
def expose_function: (String name, function callback) -> void
|
@@ -399,7 +399,7 @@ module Playwright
|
|
399
399
|
|
400
400
|
class Browser
|
401
401
|
def browser_type: -> BrowserType
|
402
|
-
def close: -> void
|
402
|
+
def close: (?reason: String) -> void
|
403
403
|
def contexts: -> Array[untyped]
|
404
404
|
def connected?: -> bool
|
405
405
|
def new_browser_cdp_session: -> CDPSession
|
@@ -414,7 +414,7 @@ module Playwright
|
|
414
414
|
def connect_over_cdp: (String endpointURL, ?headers: Hash[untyped, untyped], ?slowMo: Float, ?timeout: Float) ?{ (untyped) -> untyped } -> Browser
|
415
415
|
def executable_path: -> String
|
416
416
|
def launch: (?args: Array[untyped], ?channel: String, ?chromiumSandbox: bool, ?devtools: bool, ?downloadsPath: (String | File), ?env: Hash[untyped, untyped], ?executablePath: (String | File), ?firefoxUserPrefs: Hash[untyped, untyped], ?handleSIGHUP: bool, ?handleSIGINT: bool, ?handleSIGTERM: bool, ?headless: bool, ?ignoreDefaultArgs: (bool | Array[untyped]), ?proxy: Hash[untyped, untyped], ?slowMo: Float, ?timeout: Float, ?tracesDir: (String | File)) ?{ (Browser) -> untyped } -> Browser
|
417
|
-
def launch_persistent_context: ((String | File) userDataDir, ?acceptDownloads: bool, ?args: Array[untyped], ?baseURL: String, ?bypassCSP: bool, ?channel: String, ?chromiumSandbox: bool, ?colorScheme: ("light" | "dark" | "no-preference" | "null"), ?deviceScaleFactor: Float, ?devtools: bool, ?downloadsPath: (String | File), ?env: Hash[untyped, untyped], ?executablePath: (String | File), ?extraHTTPHeaders: Hash[untyped, untyped], ?forcedColors: ("active" | "none" | "null"), ?geolocation: Hash[untyped, untyped], ?handleSIGHUP: bool, ?handleSIGINT: bool, ?handleSIGTERM: bool, ?hasTouch: bool, ?headless: bool, ?httpCredentials: Hash[untyped, untyped], ?ignoreDefaultArgs: (bool | Array[untyped]), ?ignoreHTTPSErrors: bool, ?isMobile: bool, ?javaScriptEnabled: bool, ?locale: String, ?noViewport: bool, ?offline: bool, ?permissions: Array[untyped], ?proxy: Hash[untyped, untyped], ?record_har_content: ("omit" | "embed" | "attach"), ?record_har_mode: ("full" | "minimal"), ?record_har_omit_content: bool, ?record_har_path: (String | File), ?record_har_url_filter: (String | Regexp), ?record_video_dir: (String | File), ?record_video_size: Hash[untyped, untyped], ?reducedMotion: ("reduce" | "no-preference" | "null"), ?screen: Hash[untyped, untyped], ?serviceWorkers: ("allow" | "block"), ?slowMo: Float, ?strictSelectors: bool, ?timeout: Float, ?timezoneId: String, ?tracesDir: (String | File), ?userAgent: String, ?viewport: (nil | Hash[untyped, untyped])) ?{ (untyped) -> untyped } -> BrowserContext
|
417
|
+
def launch_persistent_context: ((String | File) userDataDir, ?acceptDownloads: bool, ?args: Array[untyped], ?baseURL: String, ?bypassCSP: bool, ?channel: String, ?chromiumSandbox: bool, ?colorScheme: ("light" | "dark" | "no-preference" | "null"), ?deviceScaleFactor: Float, ?devtools: bool, ?downloadsPath: (String | File), ?env: Hash[untyped, untyped], ?executablePath: (String | File), ?extraHTTPHeaders: Hash[untyped, untyped], ?firefoxUserPrefs: Hash[untyped, untyped], ?forcedColors: ("active" | "none" | "null"), ?geolocation: Hash[untyped, untyped], ?handleSIGHUP: bool, ?handleSIGINT: bool, ?handleSIGTERM: bool, ?hasTouch: bool, ?headless: bool, ?httpCredentials: Hash[untyped, untyped], ?ignoreDefaultArgs: (bool | Array[untyped]), ?ignoreHTTPSErrors: bool, ?isMobile: bool, ?javaScriptEnabled: bool, ?locale: String, ?noViewport: bool, ?offline: bool, ?permissions: Array[untyped], ?proxy: Hash[untyped, untyped], ?record_har_content: ("omit" | "embed" | "attach"), ?record_har_mode: ("full" | "minimal"), ?record_har_omit_content: bool, ?record_har_path: (String | File), ?record_har_url_filter: (String | Regexp), ?record_video_dir: (String | File), ?record_video_size: Hash[untyped, untyped], ?reducedMotion: ("reduce" | "no-preference" | "null"), ?screen: Hash[untyped, untyped], ?serviceWorkers: ("allow" | "block"), ?slowMo: Float, ?strictSelectors: bool, ?timeout: Float, ?timezoneId: String, ?tracesDir: (String | File), ?userAgent: String, ?viewport: (nil | Hash[untyped, untyped])) ?{ (untyped) -> untyped } -> BrowserContext
|
418
418
|
def name: -> String
|
419
419
|
end
|
420
420
|
|
@@ -538,6 +538,49 @@ module Playwright
|
|
538
538
|
def put: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
|
539
539
|
end
|
540
540
|
|
541
|
+
class LocatorAssertions
|
542
|
+
def not_to_be_attached: (?attached: bool, ?timeout: Float) -> void
|
543
|
+
def not_to_be_checked: (?timeout: Float) -> void
|
544
|
+
def not_to_be_disabled: (?timeout: Float) -> void
|
545
|
+
def not_to_be_editable: (?editable: bool, ?timeout: Float) -> void
|
546
|
+
def not_to_be_empty: (?timeout: Float) -> void
|
547
|
+
def not_to_be_enabled: (?enabled: bool, ?timeout: Float) -> void
|
548
|
+
def not_to_be_focused: (?timeout: Float) -> void
|
549
|
+
def not_to_be_hidden: (?timeout: Float) -> void
|
550
|
+
def not_to_be_in_viewport: (?ratio: Float, ?timeout: Float) -> void
|
551
|
+
def not_to_be_visible: (?timeout: Float, ?visible: bool) -> void
|
552
|
+
def not_to_contain_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
|
553
|
+
def not_to_have_attribute: (String name, (String | Regexp) value, ?timeout: Float) -> void
|
554
|
+
def not_to_have_class: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?timeout: Float) -> void
|
555
|
+
def not_to_have_count: (Integer count, ?timeout: Float) -> void
|
556
|
+
def not_to_have_css: (String name, (String | Regexp) value, ?timeout: Float) -> void
|
557
|
+
def not_to_have_id: ((String | Regexp) id, ?timeout: Float) -> void
|
558
|
+
def not_to_have_js_property: (String name, untyped value, ?timeout: Float) -> void
|
559
|
+
def not_to_have_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
|
560
|
+
def not_to_have_value: ((String | Regexp) value, ?timeout: Float) -> void
|
561
|
+
def not_to_have_values: ((Array[untyped] | Array[untyped] | Array[untyped]) values, ?timeout: Float) -> void
|
562
|
+
def to_be_attached: (?attached: bool, ?timeout: Float) -> void
|
563
|
+
def to_be_checked: (?checked: bool, ?timeout: Float) -> void
|
564
|
+
def to_be_disabled: (?timeout: Float) -> void
|
565
|
+
def to_be_editable: (?editable: bool, ?timeout: Float) -> void
|
566
|
+
def to_be_empty: (?timeout: Float) -> void
|
567
|
+
def to_be_enabled: (?enabled: bool, ?timeout: Float) -> void
|
568
|
+
def to_be_focused: (?timeout: Float) -> void
|
569
|
+
def to_be_hidden: (?timeout: Float) -> void
|
570
|
+
def to_be_in_viewport: (?ratio: Float, ?timeout: Float) -> void
|
571
|
+
def to_be_visible: (?timeout: Float, ?visible: bool) -> void
|
572
|
+
def to_contain_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
|
573
|
+
def to_have_attribute: (String name, (String | Regexp) value, ?ignoreCase: bool, ?timeout: Float) -> void
|
574
|
+
def to_have_class: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?timeout: Float) -> void
|
575
|
+
def to_have_count: (Integer count, ?timeout: Float) -> void
|
576
|
+
def to_have_css: (String name, (String | Regexp) value, ?timeout: Float) -> void
|
577
|
+
def to_have_id: ((String | Regexp) id, ?timeout: Float) -> void
|
578
|
+
def to_have_js_property: (String name, untyped value, ?timeout: Float) -> void
|
579
|
+
def to_have_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
|
580
|
+
def to_have_value: ((String | Regexp) value, ?timeout: Float) -> void
|
581
|
+
def to_have_values: ((Array[untyped] | Array[untyped] | Array[untyped]) values, ?timeout: Float) -> void
|
582
|
+
end
|
583
|
+
|
541
584
|
class Android
|
542
585
|
def devices: (?host: String, ?omitDriverInstall: bool, ?port: Integer) -> Array[untyped]
|
543
586
|
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.
|
4
|
+
version: 1.40.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10
|
11
|
+
date: 2023-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- documentation/docs/api/js_handle.md
|
234
234
|
- documentation/docs/api/keyboard.md
|
235
235
|
- documentation/docs/api/locator.md
|
236
|
+
- documentation/docs/api/locator_assertions.md
|
236
237
|
- documentation/docs/api/mouse.md
|
237
238
|
- documentation/docs/api/page.md
|
238
239
|
- documentation/docs/api/playwright.md
|
@@ -254,6 +255,7 @@ files:
|
|
254
255
|
- documentation/docs/article/guides/rails_integration.md
|
255
256
|
- documentation/docs/article/guides/rails_integration_with_null_driver.md
|
256
257
|
- documentation/docs/article/guides/recording_video.md
|
258
|
+
- documentation/docs/article/guides/rspec_integration.md
|
257
259
|
- documentation/docs/article/guides/semi_automation.md
|
258
260
|
- documentation/docs/article/guides/use_storage_state.md
|
259
261
|
- documentation/docs/include/api_coverage.md
|
@@ -326,6 +328,7 @@ files:
|
|
326
328
|
- lib/playwright/javascript/value_serializer.rb
|
327
329
|
- lib/playwright/javascript/visitor_info.rb
|
328
330
|
- lib/playwright/keyboard_impl.rb
|
331
|
+
- lib/playwright/locator_assertions_impl.rb
|
329
332
|
- lib/playwright/locator_impl.rb
|
330
333
|
- lib/playwright/locator_utils.rb
|
331
334
|
- lib/playwright/mouse_impl.rb
|
@@ -333,6 +336,7 @@ files:
|
|
333
336
|
- lib/playwright/raw_headers.rb
|
334
337
|
- lib/playwright/route_handler.rb
|
335
338
|
- lib/playwright/select_option_values.rb
|
339
|
+
- lib/playwright/test.rb
|
336
340
|
- lib/playwright/timeout_settings.rb
|
337
341
|
- lib/playwright/touchscreen_impl.rb
|
338
342
|
- lib/playwright/transport.rb
|
@@ -340,7 +344,7 @@ files:
|
|
340
344
|
- lib/playwright/utils.rb
|
341
345
|
- lib/playwright/version.rb
|
342
346
|
- lib/playwright/video.rb
|
343
|
-
- lib/playwright/
|
347
|
+
- lib/playwright/waiter.rb
|
344
348
|
- lib/playwright/web_socket_client.rb
|
345
349
|
- lib/playwright/web_socket_transport.rb
|
346
350
|
- lib/playwright_api/accessibility.rb
|
@@ -366,6 +370,7 @@ files:
|
|
366
370
|
- lib/playwright_api/js_handle.rb
|
367
371
|
- lib/playwright_api/keyboard.rb
|
368
372
|
- lib/playwright_api/locator.rb
|
373
|
+
- lib/playwright_api/locator_assertions.rb
|
369
374
|
- lib/playwright_api/mouse.rb
|
370
375
|
- lib/playwright_api/page.rb
|
371
376
|
- lib/playwright_api/playwright.rb
|
@@ -401,5 +406,5 @@ requirements: []
|
|
401
406
|
rubygems_version: 3.3.26
|
402
407
|
signing_key:
|
403
408
|
specification_version: 4
|
404
|
-
summary: The Ruby binding of playwright driver 1.
|
409
|
+
summary: The Ruby binding of playwright driver 1.40.1
|
405
410
|
test_files: []
|
@@ -1,73 +0,0 @@
|
|
1
|
-
module Playwright
|
2
|
-
# ref: https://github.com/microsoft/playwright-python/blob/30946ae3099d51f9b7f355f9ae7e8c04d748ce36/playwright/_impl/_wait_helper.py
|
3
|
-
# ref: https://github.com/microsoft/playwright/blob/01fb3a6045cbdb4b5bcba0809faed85bd917ab87/src/client/waiter.ts#L21
|
4
|
-
class WaitHelper
|
5
|
-
def initialize
|
6
|
-
@promise = Concurrent::Promises.resolvable_future
|
7
|
-
@registered_listeners = Set.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def reject_on_event(emitter, event, error, predicate: nil)
|
11
|
-
listener = -> (*args) {
|
12
|
-
if !predicate || predicate.call(*args)
|
13
|
-
reject(error)
|
14
|
-
end
|
15
|
-
}
|
16
|
-
emitter.on(event, listener)
|
17
|
-
@registered_listeners << [emitter, event, listener]
|
18
|
-
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def reject_on_timeout(timeout_ms, message)
|
23
|
-
return if timeout_ms <= 0
|
24
|
-
|
25
|
-
Concurrent::Promises.schedule(timeout_ms / 1000.0) do
|
26
|
-
reject(TimeoutError.new(message: message))
|
27
|
-
end
|
28
|
-
|
29
|
-
self
|
30
|
-
end
|
31
|
-
|
32
|
-
# @param [Playwright::EventEmitter]
|
33
|
-
# @param
|
34
|
-
def wait_for_event(emitter, event, predicate: nil)
|
35
|
-
listener = -> (*args) {
|
36
|
-
begin
|
37
|
-
if !predicate || predicate.call(*args)
|
38
|
-
fulfill(*args)
|
39
|
-
end
|
40
|
-
rescue => err
|
41
|
-
reject(err)
|
42
|
-
end
|
43
|
-
}
|
44
|
-
emitter.on(event, listener)
|
45
|
-
@registered_listeners << [emitter, event, listener]
|
46
|
-
|
47
|
-
self
|
48
|
-
end
|
49
|
-
|
50
|
-
attr_reader :promise
|
51
|
-
|
52
|
-
private def cleanup
|
53
|
-
@registered_listeners.each do |emitter, event, listener|
|
54
|
-
emitter.off(event, listener)
|
55
|
-
end
|
56
|
-
@registered_listeners.clear
|
57
|
-
end
|
58
|
-
|
59
|
-
private def fulfill(*args)
|
60
|
-
cleanup
|
61
|
-
unless @promise.resolved?
|
62
|
-
@promise.fulfill(args.first)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
private def reject(error)
|
67
|
-
cleanup
|
68
|
-
unless @promise.resolved?
|
69
|
-
@promise.reject(error)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|