playwright-ruby-client 1.48.1 → 1.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser.md +1 -1
- data/documentation/docs/api/browser_type.md +2 -0
- data/documentation/docs/api/clock.md +13 -1
- data/documentation/docs/api/element_handle.md +0 -1
- data/documentation/docs/api/experimental/android_device.md +1 -1
- data/documentation/docs/api/frame.md +0 -1
- data/documentation/docs/api/keyboard.md +5 -2
- data/documentation/docs/api/locator.md +49 -4
- data/documentation/docs/api/locator_assertions.md +59 -7
- data/documentation/docs/api/page.md +1 -5
- data/documentation/docs/api/route.md +1 -1
- data/documentation/docs/api/tracing.md +34 -0
- data/documentation/docs/include/api_coverage.md +7 -0
- data/lib/playwright/channel_owners/tracing.rb +12 -0
- data/lib/playwright/locator_assertions_impl.rb +45 -5
- data/lib/playwright/locator_impl.rb +7 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +4 -4
- data/lib/playwright_api/android_device.rb +10 -10
- data/lib/playwright_api/api_request_context.rb +4 -4
- data/lib/playwright_api/browser.rb +5 -5
- data/lib/playwright_api/browser_context.rb +13 -13
- data/lib/playwright_api/browser_type.rb +10 -11
- data/lib/playwright_api/cdp_session.rb +4 -4
- data/lib/playwright_api/clock.rb +13 -1
- data/lib/playwright_api/dialog.rb +4 -4
- data/lib/playwright_api/element_handle.rb +4 -4
- data/lib/playwright_api/frame.rb +8 -8
- data/lib/playwright_api/js_handle.rb +4 -4
- data/lib/playwright_api/keyboard.rb +1 -4
- data/lib/playwright_api/locator.rb +46 -4
- data/lib/playwright_api/locator_assertions.rb +48 -8
- data/lib/playwright_api/page.rb +12 -15
- data/lib/playwright_api/playwright.rb +4 -4
- data/lib/playwright_api/request.rb +4 -4
- data/lib/playwright_api/response.rb +4 -4
- data/lib/playwright_api/route.rb +5 -5
- data/lib/playwright_api/selectors.rb +4 -4
- data/lib/playwright_api/tracing.rb +29 -4
- data/lib/playwright_api/web_socket.rb +4 -4
- data/lib/playwright_api/worker.rb +4 -4
- data/sig/playwright.rbs +9 -2
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 495885bd9a517ab41add673d1855ea2d3aaf892c396c3422ded05bc0867f9c8e
|
4
|
+
data.tar.gz: c5e2dc6ad6f41f9675eefec747faef96537e78c2af550db2fe4d496c1ba76a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 141cef34e7039d7c04709eb99ca1cc5693bc9c17625616daf964bffe80e8103bdd9a976353f5c2137335048a9d4324e564e30bb993a9e3bd0197154ad457e988
|
7
|
+
data.tar.gz: d1e2ee7c636a328621f9228c2b44f050e066ef5eeb5532b47434a45849152840e7e534c8fb76556d437aa90337b0c2e83ae7569062825cf11f67bc8f5a87d275
|
@@ -40,7 +40,7 @@ were opened).
|
|
40
40
|
In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
|
41
41
|
browser server.
|
42
42
|
|
43
|
-
**NOTE**: This is similar to force
|
43
|
+
**NOTE**: This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call [BrowserContext#close](./browser_context#close) on any [BrowserContext](./browser_context) instances you explicitly created earlier using [Browser#new_context](./browser#new_context) **before** calling [Browser#close](./browser#close).
|
44
44
|
|
45
45
|
The [Browser](./browser) object itself is considered to be disposed and cannot be used anymore.
|
46
46
|
|
@@ -37,6 +37,8 @@ The default browser context is accessible via [Browser#contexts](./browser#conte
|
|
37
37
|
|
38
38
|
**NOTE**: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
|
39
39
|
|
40
|
+
**NOTE**: This connection is significantly lower fidelity than the Playwright protocol connection via [BrowserType#connect](./browser_type#connect). If you are experiencing issues or attempting to use advanced functionality, you probably want to use [BrowserType#connect](./browser_type#connect).
|
41
|
+
|
40
42
|
**Usage**
|
41
43
|
|
42
44
|
```ruby
|
@@ -85,6 +85,16 @@ page.clock.pause_at(Time.parse("2020-02-02"))
|
|
85
85
|
page.clock.pause_at("2020-02-02")
|
86
86
|
```
|
87
87
|
|
88
|
+
For best results, install the clock before navigating the page and set it to a time slightly before the intended test time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the page has fully loaded, you can safely use [Clock#pause_at](./clock#pause_at) to pause the clock.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
# Initialize clock with some time before the test time and let the page load
|
92
|
+
# naturally. `Date.now` will progress as the timers fire.
|
93
|
+
page.clock.install(Time.parse("2024-12-10T08:00:00Z"))
|
94
|
+
page.goto("http://localhost:3333")
|
95
|
+
page.clock.pause_at(Time.parse("2024-12-10T10:00:00Z"))
|
96
|
+
```
|
97
|
+
|
88
98
|
## resume
|
89
99
|
|
90
100
|
```
|
@@ -105,6 +115,8 @@ alias: `fixed_time=`
|
|
105
115
|
Makes `Date.now` and `new Date()` return fixed fake time at all times,
|
106
116
|
keeps all the timers running.
|
107
117
|
|
118
|
+
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.
|
119
|
+
|
108
120
|
**Usage**
|
109
121
|
|
110
122
|
```ruby
|
@@ -126,7 +138,7 @@ def set_system_time(time)
|
|
126
138
|
alias: `system_time=`
|
127
139
|
|
128
140
|
|
129
|
-
Sets
|
141
|
+
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
142
|
|
131
143
|
**Usage**
|
132
144
|
|
@@ -192,7 +192,6 @@ properties:
|
|
192
192
|
You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
|
193
193
|
|
194
194
|
```ruby
|
195
|
-
# note you can only create data_transfer in chromium and firefox
|
196
195
|
data_transfer = page.evaluate_handle("new DataTransfer()")
|
197
196
|
element_handle.dispatch_event("dragstart", eventInit: { dataTransfer: data_transfer })
|
198
197
|
```
|
@@ -34,7 +34,6 @@ def launch_browser(
|
|
34
34
|
baseURL: nil,
|
35
35
|
bypassCSP: nil,
|
36
36
|
colorScheme: nil,
|
37
|
-
command: nil,
|
38
37
|
deviceScaleFactor: nil,
|
39
38
|
extraHTTPHeaders: nil,
|
40
39
|
forcedColors: nil,
|
@@ -48,6 +47,7 @@ def launch_browser(
|
|
48
47
|
noViewport: nil,
|
49
48
|
offline: nil,
|
50
49
|
permissions: nil,
|
50
|
+
pkg: nil,
|
51
51
|
proxy: nil,
|
52
52
|
record_har_content: nil,
|
53
53
|
record_har_mode: nil,
|
@@ -190,7 +190,6 @@ properties:
|
|
190
190
|
You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
|
191
191
|
|
192
192
|
```ruby
|
193
|
-
# note you can only create data_transfer in chromium and firefox
|
194
193
|
data_transfer = frame.evaluate_handle("new DataTransfer()")
|
195
194
|
frame.dispatch_event("#source", "dragstart", eventInit: { dataTransfer: data_transfer })
|
196
195
|
```
|
@@ -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
|
-
#
|
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
|
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
|
```
|
@@ -315,7 +358,6 @@ properties:
|
|
315
358
|
You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
|
316
359
|
|
317
360
|
```ruby
|
318
|
-
# note you can only create data_transfer in chromium and firefox
|
319
361
|
data_transfer = page.evaluate_handle("new DataTransfer()")
|
320
362
|
locator.dispatch_event("dragstart", eventInit: { dataTransfer: data_transfer })
|
321
363
|
```
|
@@ -902,7 +944,7 @@ def editable?(timeout: nil)
|
|
902
944
|
```
|
903
945
|
|
904
946
|
|
905
|
-
Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable).
|
947
|
+
Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable). If the target element is not an `<input>`, `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method throws an error.
|
906
948
|
|
907
949
|
**NOTE**: If you need to assert that an element is editable, prefer [LocatorAssertions#to_be_editable](./locator_assertions#to_be_editable) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
908
950
|
|
@@ -1018,16 +1060,19 @@ def or(locator)
|
|
1018
1060
|
|
1019
1061
|
Creates a locator matching all elements that match one or both of the two locators.
|
1020
1062
|
|
1021
|
-
Note that when both locators match something, the resulting locator will have multiple matches
|
1063
|
+
Note that when both locators match something, the resulting locator will have multiple matches, potentially causing a [locator strictness](https://playwright.dev/python/docs/locators#strictness) violation.
|
1022
1064
|
|
1023
1065
|
**Usage**
|
1024
1066
|
|
1025
1067
|
Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
|
1026
1068
|
|
1069
|
+
**NOTE**: If both "New email" button and security dialog appear on screen, the "or" locator will match both of them,
|
1070
|
+
possibly throwing the ["strict mode violation" error](https://playwright.dev/python/docs/locators#strictness). In this case, you can use [Locator#first](./locator#first) to only match one of them.
|
1071
|
+
|
1027
1072
|
```ruby
|
1028
1073
|
new_email = page.get_by_role("button", name: "New")
|
1029
1074
|
dialog = page.get_by_text("Confirm security settings")
|
1030
|
-
new_email.or(dialog).wait_for(state: 'visible')
|
1075
|
+
new_email.or(dialog).first.wait_for(state: 'visible')
|
1031
1076
|
if dialog.visible?
|
1032
1077
|
page.get_by_role("button", name: "Dismiss").click
|
1033
1078
|
end
|
@@ -134,6 +134,15 @@ expect(locator).not_to have_accessible_description(name, ignoreCase: nil, timeou
|
|
134
134
|
|
135
135
|
The opposite of [LocatorAssertions#to_have_accessible_description](./locator_assertions#to_have_accessible_description).
|
136
136
|
|
137
|
+
## not_to_have_accessible_error_message
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
expect(locator).not_to have_accessible_error_message(errorMessage, ignoreCase: nil, timeout: nil)
|
141
|
+
```
|
142
|
+
|
143
|
+
|
144
|
+
The opposite of [LocatorAssertions#to_have_accessible_error_message](./locator_assertions#to_have_accessible_error_message).
|
145
|
+
|
137
146
|
## not_to_have_accessible_name
|
138
147
|
|
139
148
|
```ruby
|
@@ -233,6 +242,15 @@ expect(locator).not_to have_values(values, timeout: nil)
|
|
233
242
|
|
234
243
|
The opposite of [LocatorAssertions#to_have_values](./locator_assertions#to_have_values).
|
235
244
|
|
245
|
+
## not_to_match_aria_snapshot
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
expect(locator).not_to match_aria_snapshot(expected, timeout: nil)
|
249
|
+
```
|
250
|
+
|
251
|
+
|
252
|
+
The opposite of [LocatorAssertions#to_match_aria_snapshot](./locator_assertions#to_match_aria_snapshot).
|
253
|
+
|
236
254
|
## to_be_attached
|
237
255
|
|
238
256
|
```ruby
|
@@ -257,7 +275,7 @@ expect(page.get_by_text("Hidden text")).to be_attached
|
|
257
275
|
## to_be_checked
|
258
276
|
|
259
277
|
```ruby
|
260
|
-
expect(locator).to be_checked(checked: nil, timeout: nil)
|
278
|
+
expect(locator).to be_checked(checked: nil, indeterminate: nil, timeout: nil)
|
261
279
|
```
|
262
280
|
|
263
281
|
|
@@ -488,6 +506,22 @@ locator = page.get_by_test_id("save-button")
|
|
488
506
|
expect(locator).to have_accessible_description("Save results to disk")
|
489
507
|
```
|
490
508
|
|
509
|
+
## to_have_accessible_error_message
|
510
|
+
|
511
|
+
```ruby
|
512
|
+
expect(locator).to have_accessible_error_message(errorMessage, ignoreCase: nil, timeout: nil)
|
513
|
+
```
|
514
|
+
|
515
|
+
|
516
|
+
Ensures the [Locator](./locator) points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage).
|
517
|
+
|
518
|
+
**Usage**
|
519
|
+
|
520
|
+
```ruby
|
521
|
+
locator = page.get_by_test_id("username-input")
|
522
|
+
expect(locator).to have_accessible_error_message("Username is required.")
|
523
|
+
```
|
524
|
+
|
491
525
|
## to_have_accessible_name
|
492
526
|
|
493
527
|
```ruby
|
@@ -527,22 +561,21 @@ expect(locator).to have_class(expected, timeout: nil)
|
|
527
561
|
```
|
528
562
|
|
529
563
|
|
530
|
-
Ensures the [Locator](./locator) points to an element with given CSS classes.
|
531
|
-
or using a relaxed regular expression.
|
564
|
+
Ensures the [Locator](./locator) points to an element with given CSS classes. When a string is provided, it must fully match the element's `class` attribute. To match individual classes or perform partial matches, use a regular expression:
|
532
565
|
|
533
566
|
**Usage**
|
534
567
|
|
535
568
|
```html
|
536
|
-
<div class='selected row' id='component'></div>
|
569
|
+
<div class='middle selected row' id='component'></div>
|
537
570
|
```
|
538
571
|
|
539
572
|
```ruby
|
540
573
|
locator = page.locator("#component")
|
541
|
-
expect(locator).to have_class(/selected/)
|
542
|
-
expect(locator).to have_class("selected row")
|
574
|
+
expect(locator).to have_class(/(^|\s)selected(\s|$)/)
|
575
|
+
expect(locator).to have_class("middle selected row")
|
543
576
|
```
|
544
577
|
|
545
|
-
|
578
|
+
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
|
546
579
|
|
547
580
|
```ruby
|
548
581
|
locator = page.locator("list > .component")
|
@@ -727,3 +760,22 @@ locator = page.locator("id=favorite-colors")
|
|
727
760
|
locator.select_option(["R", "G"])
|
728
761
|
expect(locator).to have_values([/R/, /G/])
|
729
762
|
```
|
763
|
+
|
764
|
+
## to_match_aria_snapshot
|
765
|
+
|
766
|
+
```ruby
|
767
|
+
expect(locator).to match_aria_snapshot(expected, timeout: nil)
|
768
|
+
```
|
769
|
+
|
770
|
+
|
771
|
+
Asserts that the target element matches the given [accessibility snapshot](https://playwright.dev/python/docs/aria-snapshots).
|
772
|
+
|
773
|
+
**Usage**
|
774
|
+
|
775
|
+
```ruby
|
776
|
+
page.goto('https://demo.playwright.dev/todomvc/')
|
777
|
+
expect(page.locator('body')).to match_aria_snapshot(<<~YAML)
|
778
|
+
- heading "todos"
|
779
|
+
- textbox "What needs to be done?"
|
780
|
+
YAML
|
781
|
+
```
|
@@ -253,7 +253,6 @@ You can also specify [JSHandle](./js_handle) as the property value if you want l
|
|
253
253
|
```ruby
|
254
254
|
page.content = '<div id="source">Drag</div>'
|
255
255
|
|
256
|
-
# note you can only create data_transfer in chromium and firefox
|
257
256
|
data_transfer = page.evaluate_handle("new DataTransfer()")
|
258
257
|
page.dispatch_event("#source", "dragstart", eventInit: { dataTransfer: data_transfer })
|
259
258
|
```
|
@@ -316,10 +315,9 @@ page.evaluate("matchMedia('print').matches") # => false
|
|
316
315
|
```
|
317
316
|
|
318
317
|
```ruby
|
319
|
-
page.emulate_media(colorScheme
|
318
|
+
page.emulate_media(colorScheme: "dark")
|
320
319
|
page.evaluate("matchMedia('(prefers-color-scheme: dark)').matches") # => true
|
321
320
|
page.evaluate("matchMedia('(prefers-color-scheme: light)').matches") # => false
|
322
|
-
page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches") # => false
|
323
321
|
```
|
324
322
|
|
325
323
|
## eval_on_selector
|
@@ -1064,8 +1062,6 @@ def pdf(
|
|
1064
1062
|
|
1065
1063
|
Returns the PDF buffer.
|
1066
1064
|
|
1067
|
-
**NOTE**: Generating a pdf is currently only supported in Chromium headless.
|
1068
|
-
|
1069
1065
|
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
|
1070
1066
|
[Page#emulate_media](./page#emulate_media) before calling `page.pdf()`:
|
1071
1067
|
|
@@ -45,7 +45,7 @@ page.route("**/*", method(:handle))
|
|
45
45
|
|
46
46
|
**Details**
|
47
47
|
|
48
|
-
|
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
|
@@ -562,6 +565,7 @@
|
|
562
565
|
* not_to_be_visible
|
563
566
|
* not_to_contain_text
|
564
567
|
* not_to_have_accessible_description
|
568
|
+
* not_to_have_accessible_error_message
|
565
569
|
* not_to_have_accessible_name
|
566
570
|
* not_to_have_attribute
|
567
571
|
* not_to_have_class
|
@@ -573,6 +577,7 @@
|
|
573
577
|
* not_to_have_text
|
574
578
|
* not_to_have_value
|
575
579
|
* not_to_have_values
|
580
|
+
* not_to_match_aria_snapshot
|
576
581
|
* to_be_attached
|
577
582
|
* to_be_checked
|
578
583
|
* to_be_disabled
|
@@ -585,6 +590,7 @@
|
|
585
590
|
* to_be_visible
|
586
591
|
* to_contain_text
|
587
592
|
* to_have_accessible_description
|
593
|
+
* to_have_accessible_error_message
|
588
594
|
* to_have_accessible_name
|
589
595
|
* to_have_attribute
|
590
596
|
* to_have_class
|
@@ -596,6 +602,7 @@
|
|
596
602
|
* to_have_text
|
597
603
|
* to_have_value
|
598
604
|
* to_have_values
|
605
|
+
* to_match_aria_snapshot
|
599
606
|
|
600
607
|
## PageAssertions
|
601
608
|
|
@@ -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
|
@@ -149,7 +149,7 @@ module Playwright
|
|
149
149
|
_define_negation :to_contain_text
|
150
150
|
|
151
151
|
def to_have_accessible_name(name, ignoreCase: nil, timeout: nil)
|
152
|
-
expected_text = to_expected_text_values([name], ignore_case: ignoreCase)
|
152
|
+
expected_text = to_expected_text_values([name], ignore_case: ignoreCase, normalize_white_space: true)
|
153
153
|
expect_impl(
|
154
154
|
"to.have.accessible.name",
|
155
155
|
{
|
@@ -163,7 +163,7 @@ module Playwright
|
|
163
163
|
_define_negation :to_have_accessible_name
|
164
164
|
|
165
165
|
def to_have_accessible_description(name, ignoreCase: nil, timeout: nil)
|
166
|
-
expected_text = to_expected_text_values([name], ignore_case: ignoreCase)
|
166
|
+
expected_text = to_expected_text_values([name], ignore_case: ignoreCase, normalize_white_space: true)
|
167
167
|
expect_impl(
|
168
168
|
"to.have.accessible.description",
|
169
169
|
{
|
@@ -176,6 +176,20 @@ module Playwright
|
|
176
176
|
end
|
177
177
|
_define_negation :to_have_accessible_description
|
178
178
|
|
179
|
+
def to_have_accessible_error_message(errorMessage, ignoreCase: nil, timeout: nil)
|
180
|
+
expected_text = to_expected_text_values([errorMessage], ignore_case: ignoreCase, normalize_white_space: true)
|
181
|
+
expect_impl(
|
182
|
+
"to.have.accessible.error.message",
|
183
|
+
{
|
184
|
+
expectedText: expected_text,
|
185
|
+
timeout: timeout,
|
186
|
+
},
|
187
|
+
errorMessage,
|
188
|
+
"Locator expected to have accessible error message"
|
189
|
+
)
|
190
|
+
end
|
191
|
+
_define_negation :to_have_accessible_error_message
|
192
|
+
|
179
193
|
def to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
|
180
194
|
expected_text = to_expected_text_values([value], ignore_case: ignoreCase)
|
181
195
|
expect_impl(
|
@@ -361,6 +375,19 @@ module Playwright
|
|
361
375
|
end
|
362
376
|
_define_negation :to_have_text
|
363
377
|
|
378
|
+
def to_match_aria_snapshot(expected, timeout: nil)
|
379
|
+
expect_impl(
|
380
|
+
'to.match.aria',
|
381
|
+
{
|
382
|
+
expectedValue: expected,
|
383
|
+
timeout: timeout,
|
384
|
+
},
|
385
|
+
expected,
|
386
|
+
'Locator expected to match Aria snapshot',
|
387
|
+
)
|
388
|
+
end
|
389
|
+
_define_negation :to_match_aria_snapshot
|
390
|
+
|
364
391
|
def to_be_attached(attached: nil, timeout: nil)
|
365
392
|
expect_impl(
|
366
393
|
(attached || attached.nil?) ? "to.be.attached" : "to.be.detached",
|
@@ -371,10 +398,23 @@ module Playwright
|
|
371
398
|
end
|
372
399
|
_define_negation :to_be_attached
|
373
400
|
|
374
|
-
def to_be_checked(checked: nil, timeout: nil)
|
401
|
+
def to_be_checked(checked: nil, indeterminate: nil, timeout: nil)
|
402
|
+
expected_value = {
|
403
|
+
indeterminate: indeterminate,
|
404
|
+
checked: checked,
|
405
|
+
}.compact
|
406
|
+
checked_string =
|
407
|
+
if indeterminate
|
408
|
+
"indeterminate"
|
409
|
+
elsif checked
|
410
|
+
"checked"
|
411
|
+
else
|
412
|
+
"unchecked"
|
413
|
+
end
|
414
|
+
|
375
415
|
expect_impl(
|
376
|
-
|
377
|
-
{ timeout: timeout },
|
416
|
+
"to.be.checked",
|
417
|
+
{ timeout: timeout, expectedValue: expected_value },
|
378
418
|
nil,
|
379
419
|
"Locator expected to be checked"
|
380
420
|
)
|
@@ -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])
|
data/lib/playwright/version.rb
CHANGED
@@ -46,14 +46,14 @@ module Playwright
|
|
46
46
|
|
47
47
|
# -- inherited from EventEmitter --
|
48
48
|
# @nodoc
|
49
|
-
def
|
50
|
-
event_emitter_proxy.
|
49
|
+
def on(event, callback)
|
50
|
+
event_emitter_proxy.on(event, callback)
|
51
51
|
end
|
52
52
|
|
53
53
|
# -- inherited from EventEmitter --
|
54
54
|
# @nodoc
|
55
|
-
def
|
56
|
-
event_emitter_proxy.
|
55
|
+
def once(event, callback)
|
56
|
+
event_emitter_proxy.once(event, callback)
|
57
57
|
end
|
58
58
|
|
59
59
|
private def event_emitter_proxy
|
@@ -51,7 +51,6 @@ module Playwright
|
|
51
51
|
baseURL: nil,
|
52
52
|
bypassCSP: nil,
|
53
53
|
colorScheme: nil,
|
54
|
-
command: nil,
|
55
54
|
deviceScaleFactor: nil,
|
56
55
|
extraHTTPHeaders: nil,
|
57
56
|
forcedColors: nil,
|
@@ -65,6 +64,7 @@ module Playwright
|
|
65
64
|
noViewport: nil,
|
66
65
|
offline: nil,
|
67
66
|
permissions: nil,
|
67
|
+
pkg: nil,
|
68
68
|
proxy: nil,
|
69
69
|
record_har_content: nil,
|
70
70
|
record_har_mode: nil,
|
@@ -81,7 +81,7 @@ module Playwright
|
|
81
81
|
userAgent: nil,
|
82
82
|
viewport: nil,
|
83
83
|
&block)
|
84
|
-
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme),
|
84
|
+
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), 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), pkg: unwrap_impl(pkg), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
85
85
|
end
|
86
86
|
|
87
87
|
#
|
@@ -194,13 +194,13 @@ module Playwright
|
|
194
194
|
end
|
195
195
|
|
196
196
|
# @nodoc
|
197
|
-
def
|
198
|
-
wrap_impl(@impl.
|
197
|
+
def should_close_connection_on_close!
|
198
|
+
wrap_impl(@impl.should_close_connection_on_close!)
|
199
199
|
end
|
200
200
|
|
201
201
|
# @nodoc
|
202
|
-
def
|
203
|
-
wrap_impl(@impl.
|
202
|
+
def tap_on(selector, duration: nil, timeout: nil)
|
203
|
+
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
204
204
|
end
|
205
205
|
|
206
206
|
# -- inherited from EventEmitter --
|
@@ -211,14 +211,14 @@ module Playwright
|
|
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 once(event, callback)
|
221
|
+
event_emitter_proxy.once(event, callback)
|
222
222
|
end
|
223
223
|
|
224
224
|
private def event_emitter_proxy
|