playwright-ruby-client 1.40.0 → 1.42.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/browser_context.md +17 -10
  3. data/documentation/docs/api/element_handle.md +3 -2
  4. data/documentation/docs/api/experimental/android.md +0 -6
  5. data/documentation/docs/api/frame.md +1 -1
  6. data/documentation/docs/api/keyboard.md +1 -1
  7. data/documentation/docs/api/locator.md +2 -1
  8. data/documentation/docs/api/locator_assertions.md +5 -5
  9. data/documentation/docs/api/page.md +21 -11
  10. data/documentation/docs/api/tracing.md +2 -2
  11. data/documentation/docs/include/api_coverage.md +3 -0
  12. data/documentation/docusaurus.config.js +6 -0
  13. data/documentation/package.json +2 -2
  14. data/documentation/yarn.lock +1732 -1815
  15. data/lib/playwright/channel_owners/browser_context.rb +6 -1
  16. data/lib/playwright/channel_owners/element_handle.rb +2 -0
  17. data/lib/playwright/channel_owners/frame.rb +8 -1
  18. data/lib/playwright/channel_owners/page.rb +13 -2
  19. data/lib/playwright/connection.rb +4 -2
  20. data/lib/playwright/har_router.rb +7 -0
  21. data/lib/playwright/javascript/source_url.rb +16 -0
  22. data/lib/playwright/javascript.rb +1 -0
  23. data/lib/playwright/locator_impl.rb +2 -0
  24. data/lib/playwright/version.rb +2 -2
  25. data/lib/playwright/waiter.rb +8 -6
  26. data/lib/playwright_api/android.rb +0 -6
  27. data/lib/playwright_api/browser_context.rb +7 -1
  28. data/lib/playwright_api/element_handle.rb +4 -3
  29. data/lib/playwright_api/frame.rb +1 -1
  30. data/lib/playwright_api/keyboard.rb +1 -1
  31. data/lib/playwright_api/locator.rb +3 -2
  32. data/lib/playwright_api/locator_assertions.rb +6 -6
  33. data/lib/playwright_api/page.rb +80 -10
  34. data/lib/playwright_api/request.rb +4 -4
  35. data/lib/playwright_api/response.rb +4 -4
  36. data/lib/playwright_api/tracing.rb +2 -2
  37. data/playwright.gemspec +3 -3
  38. data/sig/playwright.rbs +7 -5
  39. metadata +15 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d2ac0187f243c1e1f408f9b2733a4c9f8bd2ea24b95667127ad9e991ae09a61
4
- data.tar.gz: cf860a1ea1f67bb33a13041eb5b87ea79035065a374e5f2c099d3f1207ef94a3
3
+ metadata.gz: 79e99154b04a3b18273674554754ce1b06e49ae03f334b7e780f89d3b2b8c50c
4
+ data.tar.gz: e0939e8cde7fd6e57ec24896bf26cf0c19a371a500be3f79fa5f284ca7b047b8
5
5
  SHA512:
6
- metadata.gz: 75db55fb24aea5a6a92ab54d2f50e62a7444b4438eb6a745d0ec8981d04984c6704ef403a3b86e659953fced1b729798d296d516947ee7c9dba12a1e742f572e
7
- data.tar.gz: 2c5918e7878c96c5d1ed7ab728757a996006d1a4c47d96f8b2503051a18986da2cf766a91623b005368017a0841404ab938fe5540219f84e2905166d8a2f414c
6
+ metadata.gz: 3b9a52e358b44a45294c244e88f1a7646011db15cf02d14f717b69bbaca4a81df90607a3425079a00c63bc185c8a1e4d5859244da007e67a84d9d399a40a5211
7
+ data.tar.gz: 1f3a94d32ce82afdd196b2cd928f590bd0278f1ea0eb1cf2cc8ae22a31fbaa5a5ab4414b6dbb0916fd0f42cc6c5609d73da48bcb960b4299215516cbe9b1ac99
@@ -311,16 +311,14 @@ page.goto("https://example.com")
311
311
 
312
312
  It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
313
313
 
314
- ```ruby
315
- def handle_route(route, request)
316
- if request.post_data["my-string"]
317
- mocked_data = request.post_data.merge({ "my-string" => 'mocked-data'})
318
- route.fulfill(postData: mocked_data)
319
- else
320
- route.continue
321
- end
322
- end
323
- context.route("/api/**", method(:handle_route))
314
+ ```python sync title=example_c78483d1434363f907c28aecef3a1c6d83c0136d98bb07c2bd326cd19e006aa9.py
315
+ def handle_route(route: Route):
316
+ if ("my-string" in route.request.post_data):
317
+ route.fulfill(body="mocked-data")
318
+ else:
319
+ route.continue_()
320
+ context.route("/api/**", handle_route)
321
+
324
322
  ```
325
323
 
326
324
  Page routes (set up with [Page#route](./page#route)) take precedence over browser context routes when request matches both
@@ -441,6 +439,15 @@ def storage_state(path: nil)
441
439
 
442
440
  Returns storage state for this browser context, contains current cookies and local storage snapshot.
443
441
 
442
+ ## unroute_all
443
+
444
+ ```
445
+ def unroute_all(behavior: nil)
446
+ ```
447
+
448
+
449
+ Removes all routes created with [BrowserContext#route](./browser_context#route) and [BrowserContext#route_from_har](./browser_context#route_from_har).
450
+
444
451
  ## unroute
445
452
 
446
453
  ```
@@ -423,7 +423,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
423
423
  If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
424
424
  respective texts.
425
425
 
426
- Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
426
+ Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
427
427
  modifier, modifier is pressed and being held while the subsequent key is being pressed.
428
428
 
429
429
  ## query_selector
@@ -458,6 +458,7 @@ def screenshot(
458
458
  path: nil,
459
459
  quality: nil,
460
460
  scale: nil,
461
+ style: nil,
461
462
  timeout: nil,
462
463
  type: nil)
463
464
  ```
@@ -654,7 +655,7 @@ Returns when the element satisfies the `state`.
654
655
  Depending on the `state` parameter, this method waits for one of the [actionability](https://playwright.dev/python/docs/actionability) checks
655
656
  to pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
656
657
  - `"visible"` Wait until the element is [visible](https://playwright.dev/python/docs/actionability#visible).
657
- - `"hidden"` Wait until the element is [not visible](https://playwright.dev/python/docs/actionability#visible) or [not attached](https://playwright.dev/python/docs/actionability#attached). Note that waiting for hidden does not throw when the element detaches.
658
+ - `"hidden"` Wait until the element is [not visible](https://playwright.dev/python/docs/actionability#visible) or not attached. Note that waiting for hidden does not throw when the element detaches.
658
659
  - `"stable"` Wait until the element is both [visible](https://playwright.dev/python/docs/actionability#visible) and [stable](https://playwright.dev/python/docs/actionability#stable).
659
660
  - `"enabled"` Wait until the element is [enabled](https://playwright.dev/python/docs/actionability#enabled).
660
661
  - `"disabled"` Wait until the element is [not enabled](https://playwright.dev/python/docs/actionability#enabled).
@@ -22,12 +22,6 @@ Playwright has **experimental** support for Android automation. This includes Ch
22
22
 
23
23
  An example of the Android automation script would be:
24
24
 
25
- Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:
26
-
27
- ```bash js
28
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
29
- ```
30
-
31
25
  ## devices
32
26
 
33
27
  ```
@@ -857,7 +857,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
857
857
  If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
858
858
  respective texts.
859
859
 
860
- Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
860
+ Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
861
861
  modifier, modifier is pressed and being held while the subsequent key is being pressed.
862
862
 
863
863
  ## query_selector
@@ -114,7 +114,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
114
114
  If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
115
115
  respective texts.
116
116
 
117
- Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
117
+ Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
118
118
  modifier, modifier is pressed and being held while the subsequent key is being pressed.
119
119
 
120
120
  **Usage**
@@ -1056,7 +1056,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
1056
1056
  If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
1057
1057
  respective texts.
1058
1058
 
1059
- Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
1059
+ Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
1060
1060
  modifier, modifier is pressed and being held while the subsequent key is being pressed.
1061
1061
 
1062
1062
  ## press_sequentially
@@ -1099,6 +1099,7 @@ def screenshot(
1099
1099
  path: nil,
1100
1100
  quality: nil,
1101
1101
  scale: nil,
1102
+ style: nil,
1102
1103
  timeout: nil,
1103
1104
  type: nil)
1104
1105
  ```
@@ -128,7 +128,7 @@ The opposite of [LocatorAssertions#to_contain_text](./locator_assertions#to_cont
128
128
  ## not_to_have_attribute
129
129
 
130
130
  ```ruby
131
- expect(locator).not_to have_attribute(name, value, timeout: nil)
131
+ expect(locator).not_to have_attribute(name, value, ignoreCase: nil, timeout: nil)
132
132
  ```
133
133
 
134
134
 
@@ -213,7 +213,7 @@ expect(locator).to be_attached(attached: nil, timeout: nil)
213
213
  ```
214
214
 
215
215
 
216
- Ensures that [Locator](./locator) points to an [attached](https://playwright.dev/python/docs/actionability#attached) DOM node.
216
+ Ensures that [Locator](./locator) points to an element that is [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
217
217
 
218
218
  **Usage**
219
219
 
@@ -372,7 +372,7 @@ expect(locator).to be_visible(timeout: nil, visible: nil)
372
372
  ```
373
373
 
374
374
 
375
- Ensures that [Locator](./locator) points to an [attached](https://playwright.dev/python/docs/actionability#attached) and [visible](https://playwright.dev/python/docs/actionability#visible) DOM node.
375
+ Ensures that [Locator](./locator) points to an attached and [visible](https://playwright.dev/python/docs/actionability#visible) DOM node.
376
376
 
377
377
  To check that at least one element from the list is visible, use [Locator#first](./locator#first).
378
378
 
@@ -398,7 +398,7 @@ expect(locator).to contain_text(expected, ignoreCase: nil, timeout: nil, useInne
398
398
  ```
399
399
 
400
400
 
401
- Ensures the [Locator](./locator) points to an element that contains the given text. You can use regular expressions for the value as well.
401
+ Ensures the [Locator](./locator) points to an element that contains the given text. All nested elements will be considered when computing the text content of the element. You can use regular expressions for the value as well.
402
402
 
403
403
  **Details**
404
404
 
@@ -562,7 +562,7 @@ expect(locator).to have_text(expected, ignoreCase: nil, timeout: nil, useInnerTe
562
562
  ```
563
563
 
564
564
 
565
- Ensures the [Locator](./locator) points to an element with the given text. You can use regular expressions for the value as well.
565
+ Ensures the [Locator](./locator) points to an element with the given text. All nested elements will be considered when computing the text content of the element. You can use regular expressions for the value as well.
566
566
 
567
567
  **Details**
568
568
 
@@ -1077,11 +1077,13 @@ def pdf(
1077
1077
  height: nil,
1078
1078
  landscape: nil,
1079
1079
  margin: nil,
1080
+ outline: nil,
1080
1081
  pageRanges: nil,
1081
1082
  path: nil,
1082
1083
  preferCSSPageSize: nil,
1083
1084
  printBackground: nil,
1084
1085
  scale: nil,
1086
+ tagged: nil,
1085
1087
  width: nil)
1086
1088
  ```
1087
1089
 
@@ -1165,7 +1167,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
1165
1167
  If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
1166
1168
  respective texts.
1167
1169
 
1168
- Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
1170
+ Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
1169
1171
  modifier, modifier is pressed and being held while the subsequent key is being pressed.
1170
1172
 
1171
1173
  **Usage**
@@ -1244,16 +1246,14 @@ page.goto("https://example.com")
1244
1246
 
1245
1247
  It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
1246
1248
 
1247
- ```ruby
1248
- def handle_route(route, request)
1249
- if request.post_data["my-string"]
1250
- mocked_data = request.post_data.merge({ "my-string" => 'mocked-data'})
1251
- route.fulfill(postData: mocked_data)
1252
- else
1253
- route.continue
1254
- end
1255
- end
1256
- page.route("/api/**", method(:handle_route))
1249
+ ```python sync title=example_0ef62eead1348f28a69716a047f3b75c979d3230569d3720d4e7bdd0a22ef647.py
1250
+ def handle_route(route: Route):
1251
+ if ("my-string" in route.request.post_data):
1252
+ route.fulfill(body="mocked-data")
1253
+ else:
1254
+ route.continue_()
1255
+ page.route("/api/**", handle_route)
1256
+
1257
1257
  ```
1258
1258
 
1259
1259
  Page routes take precedence over browser context routes (set up with [BrowserContext#route](./browser_context#route)) when request
@@ -1294,6 +1294,7 @@ def screenshot(
1294
1294
  path: nil,
1295
1295
  quality: nil,
1296
1296
  scale: nil,
1297
+ style: nil,
1297
1298
  timeout: nil,
1298
1299
  type: nil)
1299
1300
  ```
@@ -1548,6 +1549,15 @@ This method unchecks an element matching `selector` by performing the following
1548
1549
  When all steps combined have not finished during the specified `timeout`, this method throws a
1549
1550
  `TimeoutError`. Passing zero timeout disables this.
1550
1551
 
1552
+ ## unroute_all
1553
+
1554
+ ```
1555
+ def unroute_all(behavior: nil)
1556
+ ```
1557
+
1558
+
1559
+ Removes all routes created with [Page#route](./page#route) and [Page#route_from_har](./page#route_from_har).
1560
+
1551
1561
  ## unroute
1552
1562
 
1553
1563
  ```
@@ -35,7 +35,7 @@ Start tracing.
35
35
  **Usage**
36
36
 
37
37
  ```ruby
38
- context.tracing.start(name: 'trace', screenshots: true, snapshots: true)
38
+ context.tracing.start(screenshots: true, snapshots: true)
39
39
  page = context.new_page
40
40
  page.goto('https://playwright.dev')
41
41
  context.tracing.stop(path: 'trace.zip')
@@ -53,7 +53,7 @@ Start a new trace chunk. If you'd like to record multiple traces on the same [Br
53
53
  **Usage**
54
54
 
55
55
  ```ruby
56
- context.tracing.start(name: "trace", screenshots: true, snapshots: true)
56
+ context.tracing.start(screenshots: true, snapshots: true)
57
57
  page = context.new_page
58
58
  page.goto("https://playwright.dev")
59
59
 
@@ -298,6 +298,7 @@
298
298
  * press
299
299
  * query_selector
300
300
  * query_selector_all
301
+ * ~~add_locator_handler~~
301
302
  * reload
302
303
  * route
303
304
  * route_from_har
@@ -315,6 +316,7 @@
315
316
  * title
316
317
  * type
317
318
  * uncheck
319
+ * unroute_all
318
320
  * unroute
319
321
  * url
320
322
  * video
@@ -368,6 +370,7 @@
368
370
  * set_geolocation
369
371
  * set_offline
370
372
  * storage_state
373
+ * unroute_all
371
374
  * unroute
372
375
  * expect_console_message
373
376
  * expect_event
@@ -86,6 +86,12 @@ module.exports = {
86
86
  prism: {
87
87
  additionalLanguages: ['bash', 'ruby'],
88
88
  },
89
+ algolia: {
90
+ appId: '00PBL1OR8R',
91
+ apiKey: '38d9bd4fef84d709547a1ca466ee8241',
92
+ indexName: 'playwright-ruby-client',
93
+ contextualSearch: false,
94
+ }
89
95
  },
90
96
  presets: [
91
97
  [
@@ -14,8 +14,8 @@
14
14
  "write-heading-ids": "docusaurus write-heading-ids"
15
15
  },
16
16
  "dependencies": {
17
- "@docusaurus/core": "^3.0.0",
18
- "@docusaurus/preset-classic": "^3.0.0",
17
+ "@docusaurus/core": "^3.1.1",
18
+ "@docusaurus/preset-classic": "^3.1.1",
19
19
  "@mdx-js/react": "^3.0.0",
20
20
  "@svgr/webpack": "^8.1.0",
21
21
  "clsx": "^2.0.0",