playwright-ruby-client 1.48.1 → 1.49.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e84153fede0ac5242bc3e0ebd9b13eda2d78b4b6c62db3a619b4cd772fa8e6ae
4
- data.tar.gz: 82595f648261561b21a676c9bb2c64e578bf7ec2a6ec0402531ae8c505ef9da6
3
+ metadata.gz: fb8b0e304afaec4e361b4ac3c267890121a4fa7723356cccf6e853d22f3482a1
4
+ data.tar.gz: 2323dde24b24615d52b3b25d075e62036853877cc1d820b4a4d1da9df1059130
5
5
  SHA512:
6
- metadata.gz: 0d136563ebbcb24d0baf4158848ca2946379933188d7148507ecdfd99f4c830439f9cc30a4487c8ad2e85066b718af613c5879872c1466a86225e98c62295eff
7
- data.tar.gz: 8e778728dea1a2218765a0481cc6bab0901e551114b59eb3b76e8054a4522c578c43ae3c174037fb90224c60e0a1b50c81edc793797471df3f2682ffb05b2d6f
6
+ metadata.gz: 1a1e69cd3f9a84a1e9599eab785e6232c96c5babd98d14f7ff53305eafa3d7487622988f034f9df9632a642c46b1ea0ffbbc6084a3f33f74ea4ef823b3654c8a
7
+ data.tar.gz: c9bfa47bf0be03755aa6df0b01c1c12e23ca8a402a48be1de3eeaa3fd37edf6f5500feadc0e8abde2f71d835c21fc91b965f28157beb5a5d7669e3da063939b7
@@ -105,6 +105,8 @@ alias: `fixed_time=`
105
105
  Makes `Date.now` and `new Date()` return fixed fake time at all times,
106
106
  keeps all the timers running.
107
107
 
108
+ Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios, use [Clock#install](./clock#install) instead. Read docs on [clock emulation](https://playwright.dev/python/docs/clock) to learn more.
109
+
108
110
  **Usage**
109
111
 
110
112
  ```ruby
@@ -126,7 +128,7 @@ def set_system_time(time)
126
128
  alias: `system_time=`
127
129
 
128
130
 
129
- Sets current system time but does not trigger any timers.
131
+ Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example switching from summer to winter time, or changing time zones.
130
132
 
131
133
  **Usage**
132
134
 
@@ -34,9 +34,12 @@ page.keyboard.press("Shift+A")
34
34
  An example to trigger select-all with the keyboard
35
35
 
36
36
  ```ruby
37
- # on windows and linux
37
+ # RECOMMENDED
38
+ page.keyboard.press("ControlOrMeta+A")
39
+
40
+ # or just on windows and linux
38
41
  page.keyboard.press("Control+A")
39
- # on mac_os
42
+ # or just on macOS
40
43
  page.keyboard.press("Meta+A")
41
44
  ```
42
45
 
@@ -84,6 +84,49 @@ The following example finds a button with a specific title.
84
84
  button = page.get_by_role("button").and(page.get_by_title("Subscribe"))
85
85
  ```
86
86
 
87
+ ## aria_snapshot
88
+
89
+ ```
90
+ def aria_snapshot(timeout: nil)
91
+ ```
92
+
93
+
94
+ Captures the aria snapshot of the given element.
95
+ Read more about [aria snapshots](https://playwright.dev/python/docs/aria-snapshots) and [LocatorAssertions#to_match_aria_snapshot](./locator_assertions#to_match_aria_snapshot) for the corresponding assertion.
96
+
97
+ **Usage**
98
+
99
+ ```ruby
100
+ page.get_by_role("link").aria_snapshot
101
+ ```
102
+
103
+ **Details**
104
+
105
+ This method captures the aria snapshot of the given element. The snapshot is a string that represents the state of the element and its children.
106
+ The snapshot can be used to assert the state of the element in the test, or to compare it to state in the future.
107
+
108
+ The ARIA snapshot is represented using [YAML](https://yaml.org/spec/1.2.2/) markup language:
109
+ - The keys of the objects are the roles and optional accessible names of the elements.
110
+ - The values are either text content or an array of child elements.
111
+ - Generic static text can be represented with the `text` key.
112
+
113
+ Below is the HTML markup and the respective ARIA snapshot:
114
+
115
+ ```html
116
+ <ul aria-label="Links">
117
+ <li><a href="/">Home</a></li>
118
+ <li><a href="/about">About</a></li>
119
+ <ul>
120
+ ```
121
+
122
+ ```yml
123
+ - list "Links":
124
+ - listitem:
125
+ - link "Home"
126
+ - listitem:
127
+ - link "About"
128
+ ```
129
+
87
130
  ## blur
88
131
 
89
132
  ```
@@ -727,3 +727,22 @@ locator = page.locator("id=favorite-colors")
727
727
  locator.select_option(["R", "G"])
728
728
  expect(locator).to have_values([/R/, /G/])
729
729
  ```
730
+
731
+ ## to_match_aria_snapshot
732
+
733
+ ```ruby
734
+ expect(locator).to match_aria_snapshot(expected, timeout: nil)
735
+ ```
736
+
737
+
738
+ Asserts that the target element matches the given [accessibility snapshot](https://playwright.dev/python/docs/aria-snapshots).
739
+
740
+ **Usage**
741
+
742
+ ```ruby
743
+ page.goto('https://demo.playwright.dev/todomvc/')
744
+ expect(page.locator('body')).to_match_aria_snapshot(<<~YAML)
745
+ - heading "todos"
746
+ - textbox "What needs to be done?"
747
+ YAML
748
+ ```
@@ -316,10 +316,9 @@ page.evaluate("matchMedia('print').matches") # => false
316
316
  ```
317
317
 
318
318
  ```ruby
319
- page.emulate_media(colorScheme="dark")
319
+ page.emulate_media(colorScheme: "dark")
320
320
  page.evaluate("matchMedia('(prefers-color-scheme: dark)').matches") # => true
321
321
  page.evaluate("matchMedia('(prefers-color-scheme: light)').matches") # => false
322
- page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches") # => false
323
322
  ```
324
323
 
325
324
  ## eval_on_selector
@@ -45,7 +45,7 @@ page.route("**/*", method(:handle))
45
45
 
46
46
  **Details**
47
47
 
48
- Note that any overrides such as `url` or `headers` only apply to the request being routed. If this request results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header through redirects, use the combination of [Route#fetch](./route#fetch) and [Route#fulfill](./route#fulfill) instead.
48
+ The `headers` option applies to both the routed request and any redirects it initiates. However, `url`, `method`, and `postData` only apply to the original request and are not carried over to redirected requests.
49
49
 
50
50
  [Route#continue](./route#continue) will immediately send the request to the network, other matching handlers won't be invoked. Use [Route#fallback](./route#fallback) If you want next matching handler in the chain to be invoked.
51
51
 
@@ -68,6 +68,40 @@ page.goto("http://example.com")
68
68
  context.tracing.stop_chunk(path: "trace2.zip")
69
69
  ```
70
70
 
71
+ ## group
72
+
73
+ ```
74
+ def group(name, location: nil)
75
+ ```
76
+
77
+
78
+ **NOTE**: Use `test.step` instead when available.
79
+
80
+ Creates a new group within the trace, assigning any subsequent API calls to this group, until [Tracing#group_end](./tracing#group_end) is called. Groups can be nested and will be visible in the trace viewer.
81
+
82
+ **Usage**
83
+
84
+ ```ruby
85
+ # All actions between group and group_end
86
+ # will be shown in the trace viewer as a group.
87
+ context.tracing.group("Open Playwright.dev > API")
88
+
89
+ page = context.new_page
90
+ page.goto("https://playwright.dev/")
91
+ page.get_by_role("link", name: "API").click
92
+
93
+ context.tracing.group_end
94
+ ```
95
+
96
+ ## group_end
97
+
98
+ ```
99
+ def group_end
100
+ ```
101
+
102
+
103
+ Closes the last group created by [Tracing#group](./tracing#group).
104
+
71
105
  ## stop
72
106
 
73
107
  ```
@@ -436,6 +436,8 @@
436
436
 
437
437
  * start
438
438
  * start_chunk
439
+ * group
440
+ * group_end
439
441
  * stop
440
442
  * stop_chunk
441
443
 
@@ -445,6 +447,7 @@
445
447
  * all_inner_texts
446
448
  * all_text_contents
447
449
  * and
450
+ * aria_snapshot
448
451
  * blur
449
452
  * bounding_box
450
453
  * check
@@ -596,6 +599,7 @@
596
599
  * to_have_text
597
600
  * to_have_value
598
601
  * to_have_values
602
+ * to_match_aria_snapshot
599
603
 
600
604
  ## PageAssertions
601
605
 
@@ -92,5 +92,17 @@ module Playwright
92
92
  private def update_traces_dir(traces_dir)
93
93
  @traces_dir = traces_dir
94
94
  end
95
+
96
+ def group(name, location: nil)
97
+ params = {
98
+ name: name,
99
+ location: location,
100
+ }.compact
101
+ @channel.send_message_to_server('tracingGroup', params)
102
+ end
103
+
104
+ def group_end
105
+ @channel.send_message_to_server('tracingGroupEnd')
106
+ end
95
107
  end
96
108
  end
@@ -361,6 +361,18 @@ module Playwright
361
361
  end
362
362
  _define_negation :to_have_text
363
363
 
364
+ def to_match_aria_snapshot(expected, timeout: nil)
365
+ expect_impl(
366
+ 'to.match.aria',
367
+ {
368
+ expectedValue: expected,
369
+ timeout: timeout,
370
+ },
371
+ expected,
372
+ 'Locator expected to match Aria snapshot',
373
+ )
374
+ end
375
+
364
376
  def to_be_attached(attached: nil, timeout: nil)
365
377
  expect_impl(
366
378
  (attached || attached.nil?) ? "to.be.attached" : "to.be.detached",
@@ -454,7 +466,7 @@ module Playwright
454
466
  def to_be_in_viewport(ratio: nil, timeout: nil)
455
467
  expect_impl(
456
468
  "to.be.in.viewport",
457
- { timeout: timeout, expectedNumber: ratio },
469
+ { timeout: timeout, expectedNumber: ratio }.compact,
458
470
  nil,
459
471
  "Locator expected to be in viewport"
460
472
  )
@@ -391,6 +391,13 @@ module Playwright
391
391
  end
392
392
  end
393
393
 
394
+ def aria_snapshot(timeout: nil)
395
+ @frame.channel.send_message_to_server('ariaSnapshot', {
396
+ selector: @selector,
397
+ timeout: timeout,
398
+ }.compact)
399
+ end
400
+
394
401
  def scroll_into_view_if_needed(timeout: nil)
395
402
  with_element(timeout: timeout) do |handle, options|
396
403
  handle.scroll_into_view_if_needed(timeout: options[:timeout])
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.48.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.48.2'
4
+ VERSION = '1.49.1'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.49.1'
6
6
  end
@@ -79,6 +79,8 @@ module Playwright
79
79
  # Makes `Date.now` and `new Date()` return fixed fake time at all times,
80
80
  # keeps all the timers running.
81
81
  #
82
+ # Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios, use [`method: Clock.install`] instead. Read docs on [clock emulation](../clock.md) to learn more.
83
+ #
82
84
  # **Usage**
83
85
  #
84
86
  # ```python sync
@@ -92,7 +94,7 @@ module Playwright
92
94
  alias_method :fixed_time=, :set_fixed_time
93
95
 
94
96
  #
95
- # Sets current system time but does not trigger any timers.
97
+ # Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example switching from summer to winter time, or changing time zones.
96
98
  #
97
99
  # **Usage**
98
100
  #
@@ -30,10 +30,7 @@ module Playwright
30
30
  # An example to trigger select-all with the keyboard
31
31
  #
32
32
  # ```python sync
33
- # # on windows and linux
34
- # page.keyboard.press("Control+A")
35
- # # on mac_os
36
- # page.keyboard.press("Meta+A")
33
+ # page.keyboard.press("ControlOrMeta+A")
37
34
  # ```
38
35
  class Keyboard < PlaywrightApi
39
36
 
@@ -67,6 +67,46 @@ module Playwright
67
67
  wrap_impl(@impl.and(unwrap_impl(locator)))
68
68
  end
69
69
 
70
+ #
71
+ # Captures the aria snapshot of the given element.
72
+ # Read more about [aria snapshots](../aria-snapshots.md) and [`method: LocatorAssertions.toMatchAriaSnapshot`] for the corresponding assertion.
73
+ #
74
+ # **Usage**
75
+ #
76
+ # ```python sync
77
+ # page.get_by_role("link").aria_snapshot()
78
+ # ```
79
+ #
80
+ # **Details**
81
+ #
82
+ # This method captures the aria snapshot of the given element. The snapshot is a string that represents the state of the element and its children.
83
+ # The snapshot can be used to assert the state of the element in the test, or to compare it to state in the future.
84
+ #
85
+ # The ARIA snapshot is represented using [YAML](https://yaml.org/spec/1.2.2/) markup language:
86
+ # - The keys of the objects are the roles and optional accessible names of the elements.
87
+ # - The values are either text content or an array of child elements.
88
+ # - Generic static text can be represented with the `text` key.
89
+ #
90
+ # Below is the HTML markup and the respective ARIA snapshot:
91
+ #
92
+ # ```html
93
+ # <ul aria-label="Links">
94
+ # <li><a href="/">Home</a></li>
95
+ # <li><a href="/about">About</a></li>
96
+ # <ul>
97
+ # ```
98
+ #
99
+ # ```yml
100
+ # - list "Links":
101
+ # - listitem:
102
+ # - link "Home"
103
+ # - listitem:
104
+ # - link "About"
105
+ # ```
106
+ def aria_snapshot(timeout: nil)
107
+ wrap_impl(@impl.aria_snapshot(timeout: unwrap_impl(timeout)))
108
+ end
109
+
70
110
  #
71
111
  # Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur) on the element.
72
112
  def blur(timeout: nil)
@@ -616,5 +616,21 @@ module Playwright
616
616
  def to_have_values(values, timeout: nil)
617
617
  wrap_impl(@impl.to_have_values(unwrap_impl(values), timeout: unwrap_impl(timeout)))
618
618
  end
619
+
620
+ #
621
+ # Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).
622
+ #
623
+ # **Usage**
624
+ #
625
+ # ```python sync
626
+ # page.goto('https://demo.playwright.dev/todomvc/')
627
+ # expect(page.locator('body')).to_match_aria_snapshot('''
628
+ # - heading "todos"
629
+ # - textbox "What needs to be done?"
630
+ # ''')
631
+ # ```
632
+ def to_match_aria_snapshot(expected, timeout: nil)
633
+ wrap_impl(@impl.to_match_aria_snapshot(unwrap_impl(expected), timeout: unwrap_impl(timeout)))
634
+ end
619
635
  end
620
636
  end
@@ -315,7 +315,6 @@ module Playwright
315
315
  # # → True
316
316
  # page.evaluate("matchMedia('(prefers-color-scheme: light)').matches")
317
317
  # # → False
318
- # page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
319
318
  # ```
320
319
  def emulate_media(colorScheme: nil, forcedColors: nil, media: nil, reducedMotion: nil)
321
320
  wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), forcedColors: unwrap_impl(forcedColors), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
@@ -1790,11 +1789,6 @@ module Playwright
1790
1789
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
1791
1790
  end
1792
1791
 
1793
- # @nodoc
1794
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1795
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1796
- end
1797
-
1798
1792
  # @nodoc
1799
1793
  def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1800
1794
  wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
@@ -1805,6 +1799,11 @@ module Playwright
1805
1799
  wrap_impl(@impl.stop_js_coverage)
1806
1800
  end
1807
1801
 
1802
+ # @nodoc
1803
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1804
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1805
+ end
1806
+
1808
1807
  # @nodoc
1809
1808
  def stop_css_coverage
1810
1809
  wrap_impl(@impl.stop_css_coverage)
@@ -32,7 +32,7 @@ module Playwright
32
32
  #
33
33
  # **Details**
34
34
  #
35
- # Note that any overrides such as `url` or `headers` only apply to the request being routed. If this request results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header through redirects, use the combination of [`method: Route.fetch`] and [`method: Route.fulfill`] instead.
35
+ # The `headers` option applies to both the routed request and any redirects it initiates. However, `url`, `method`, and `postData` only apply to the original request and are not carried over to redirected requests.
36
36
  #
37
37
  # [`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
38
38
  def continue(headers: nil, method: nil, postData: nil, url: nil)
@@ -58,6 +58,31 @@ module Playwright
58
58
  wrap_impl(@impl.start_chunk(name: unwrap_impl(name), title: unwrap_impl(title)))
59
59
  end
60
60
 
61
+ #
62
+ # **NOTE**: Use `test.step` instead when available.
63
+ #
64
+ # Creates a new group within the trace, assigning any subsequent API calls to this group, until [`method: Tracing.groupEnd`] is called. Groups can be nested and will be visible in the trace viewer.
65
+ #
66
+ # **Usage**
67
+ #
68
+ # ```python sync
69
+ # # All actions between group and group_end
70
+ # # will be shown in the trace viewer as a group.
71
+ # page.context.tracing.group("Open Playwright.dev > API")
72
+ # page.goto("https://playwright.dev/")
73
+ # page.get_by_role("link", name="API").click()
74
+ # page.context.tracing.group_end()
75
+ # ```
76
+ def group(name, location: nil)
77
+ wrap_impl(@impl.group(unwrap_impl(name), location: unwrap_impl(location)))
78
+ end
79
+
80
+ #
81
+ # Closes the last group created by [`method: Tracing.group`].
82
+ def group_end
83
+ wrap_impl(@impl.group_end)
84
+ end
85
+
61
86
  #
62
87
  # Stop tracing.
63
88
  def stop(path: nil)
@@ -47,13 +47,13 @@ module Playwright
47
47
  end
48
48
 
49
49
  # @nodoc
50
- def page=(req)
51
- wrap_impl(@impl.page=(unwrap_impl(req)))
50
+ def context=(req)
51
+ wrap_impl(@impl.context=(unwrap_impl(req)))
52
52
  end
53
53
 
54
54
  # @nodoc
55
- def context=(req)
56
- wrap_impl(@impl.context=(unwrap_impl(req)))
55
+ def page=(req)
56
+ wrap_impl(@impl.page=(unwrap_impl(req)))
57
57
  end
58
58
 
59
59
  # -- inherited from EventEmitter --
data/sig/playwright.rbs CHANGED
@@ -445,6 +445,8 @@ module Playwright
445
445
  class Tracing
446
446
  def start: (?name: String, ?screenshots: bool, ?snapshots: bool, ?sources: bool, ?title: String) -> void
447
447
  def start_chunk: (?name: String, ?title: String) -> void
448
+ def group: (String name, ?location: Hash[untyped, untyped]) -> void
449
+ def group_end: -> void
448
450
  def stop: (?path: (String | File)) -> void
449
451
  def stop_chunk: (?path: (String | File)) -> void
450
452
  end
@@ -454,6 +456,7 @@ module Playwright
454
456
  def all_inner_texts: -> Array[untyped]
455
457
  def all_text_contents: -> Array[untyped]
456
458
  def and: (Locator locator) -> Locator
459
+ def aria_snapshot: (?timeout: Float) -> String
457
460
  def blur: (?timeout: Float) -> void
458
461
  def bounding_box: (?timeout: Float) -> (nil | Hash[untyped, untyped])
459
462
  def check: (?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
@@ -603,6 +606,7 @@ module Playwright
603
606
  def to_have_text: ((String | Regexp | Array[untyped] | Array[untyped] | Array[untyped]) expected, ?ignoreCase: bool, ?timeout: Float, ?useInnerText: bool) -> void
604
607
  def to_have_value: ((String | Regexp) value, ?timeout: Float) -> void
605
608
  def to_have_values: ((Array[untyped] | Array[untyped] | Array[untyped]) values, ?timeout: Float) -> void
609
+ def to_match_aria_snapshot: (String expected, ?timeout: Float) -> void
606
610
  end
607
611
 
608
612
  class PageAssertions
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.48.1
4
+ version: 1.49.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-30 00:00:00.000000000 Z
11
+ date: 2025-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -192,7 +192,7 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description:
195
+ description:
196
196
  email:
197
197
  - q7w8e9w8q7w8e9@yahoo.co.jp
198
198
  executables: []
@@ -395,7 +395,7 @@ homepage: https://github.com/YusukeIwaki/playwright-ruby-client
395
395
  licenses:
396
396
  - MIT
397
397
  metadata: {}
398
- post_install_message:
398
+ post_install_message:
399
399
  rdoc_options: []
400
400
  require_paths:
401
401
  - lib
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
411
  version: '0'
412
412
  requirements: []
413
413
  rubygems_version: 3.3.27
414
- signing_key:
414
+ signing_key:
415
415
  specification_version: 4
416
- summary: The Ruby binding of playwright driver 1.48.2
416
+ summary: The Ruby binding of playwright driver 1.49.1
417
417
  test_files: []