playwright-ruby-client 1.38.0 → 1.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/download.md +9 -10
  3. data/documentation/docs/api/locator.md +33 -9
  4. data/documentation/docs/api/locator_assertions.md +642 -0
  5. data/documentation/docs/api/page.md +1 -1
  6. data/documentation/docs/include/api_coverage.md +43 -0
  7. data/lib/playwright/channel.rb +9 -1
  8. data/lib/playwright/channel_owner.rb +7 -2
  9. data/lib/playwright/channel_owners/browser_context.rb +1 -1
  10. data/lib/playwright/channel_owners/local_utils.rb +27 -0
  11. data/lib/playwright/channel_owners/playwright.rb +1 -24
  12. data/lib/playwright/connection.rb +1 -1
  13. data/lib/playwright/console_message_impl.rb +29 -0
  14. data/lib/playwright/errors.rb +2 -0
  15. data/lib/playwright/javascript/value_serializer.rb +1 -1
  16. data/lib/playwright/locator_assertions_impl.rb +417 -0
  17. data/lib/playwright/locator_impl.rb +24 -5
  18. data/lib/playwright/test.rb +68 -0
  19. data/lib/playwright/version.rb +2 -2
  20. data/lib/playwright_api/browser.rb +2 -2
  21. data/lib/playwright_api/browser_context.rb +4 -4
  22. data/lib/playwright_api/browser_type.rb +2 -2
  23. data/lib/playwright_api/console_message.rb +0 -22
  24. data/lib/playwright_api/dialog.rb +2 -2
  25. data/lib/playwright_api/element_handle.rb +1 -1
  26. data/lib/playwright_api/frame.rb +7 -7
  27. data/lib/playwright_api/locator.rb +31 -0
  28. data/lib/playwright_api/locator_assertions.rb +551 -0
  29. data/lib/playwright_api/page.rb +23 -23
  30. data/lib/playwright_api/playwright.rb +4 -4
  31. data/lib/playwright_api/selectors.rb +2 -2
  32. data/sig/playwright.rbs +43 -0
  33. metadata +8 -4
  34. data/lib/playwright/channel_owners/console_message.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 421d718c0a7b5e649fe2632e9f193ef66722149f63a52ba0c1baa63252a0b99d
4
- data.tar.gz: 0fb410e0d38bff1cd589afa3499ac3938c1897220be2a7c9ebcf7bddfa4c157c
3
+ metadata.gz: e9c0bd246e9fc2ccd9358b60aa056266dfcee1f3fd2ee0174ae7a23173a1a9cb
4
+ data.tar.gz: 7e68e6e420040c24cdb9514dcde89ec6a2fd68ceda91b9590ed367ef5b1e52b7
5
5
  SHA512:
6
- metadata.gz: da207f741063627b79efb045adff0af67c935926f30cc5086da9fcf2ccf80555c2f449dc57b2cd953d939c0117ed4f6050c93c8ad35a3d9e654b0141d75e1c53
7
- data.tar.gz: eac5d5f995949b5e6e925016e2f0ab3ad4dd6c92766e8204023fa84f1a2b50d157659f9bdbb1fcac6500fae64752632b3ed3dfcd6fb042c07706f3ce30c00b48
6
+ metadata.gz: e67763b081ab137ab5da3cfbb0e397a664b4489574a3368e0059566b0e6c519d8685e252bedf76213cd7a8cad34cde3e0b2c4587adcc2241b255095ad1ffa3c7
7
+ data.tar.gz: 675f7ad040dace09c78d5d12672999d7c5a6d2ae067c89a078dd75e6f866db53191d1890a76d816f8aef797d83f0b12ed7d1311c3cbf00c90f62d38cfb407e62
@@ -12,16 +12,16 @@ browser context is closed.
12
12
 
13
13
  Download event is emitted once the download starts. Download path becomes available once download completes.
14
14
 
15
- ```python sync title=example_c247767083cf193df26a39a61a3a8bc19d63ed5c24db91b88c50b7d37975005d.py
16
- # Start waiting for the download
17
- with page.expect_download() as download_info:
18
- # Perform the action that initiates download
19
- page.get_by_text("Download file").click()
20
- download = download_info.value
15
+ ```ruby
16
+ download = page.expect_download do
17
+ page.get_by_text("Download file").click
18
+ end
21
19
 
22
20
  # Wait for the download process to complete and save the downloaded file somewhere
23
- download.save_as("/path/to/save/at/" + download.suggested_filename)
21
+ path = File.join(download_dir, download.suggested_filename)
22
+ download.save_as(path)
24
23
 
24
+ path
25
25
  ```
26
26
 
27
27
  ## cancel
@@ -86,9 +86,8 @@ is still in progress. Will wait for the download to finish if necessary.
86
86
 
87
87
  **Usage**
88
88
 
89
- ```python sync title=example_66ffd4ef7286957e4294d84b8f660ff852c87af27a56b3e4dd9f84562b5ece02.py
90
- download.save_as("/path/to/save/at/" + download.suggested_filename)
91
-
89
+ ```ruby
90
+ download.save_as(File.join(download_dir, download.suggested_filename))
92
91
  ```
93
92
 
94
93
  ## suggested_filename
@@ -42,6 +42,8 @@ def all_inner_texts
42
42
 
43
43
  Returns an array of `node.innerText` values for all matching nodes.
44
44
 
45
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
46
+
45
47
  **Usage**
46
48
 
47
49
  ```ruby
@@ -57,6 +59,8 @@ def all_text_contents
57
59
 
58
60
  Returns an array of `node.textContent` values for all matching nodes.
59
61
 
62
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
63
+
60
64
  **Usage**
61
65
 
62
66
  ```ruby
@@ -232,6 +236,8 @@ def count
232
236
 
233
237
  Returns the number of elements matching the locator.
234
238
 
239
+ **NOTE**: If you need to assert the number of elements on the page, prefer [LocatorAssertions#to_have_count](./locator_assertions#to_have_count) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
240
+
235
241
  **Usage**
236
242
 
237
243
  ```ruby
@@ -526,6 +532,8 @@ alias: `[]`
526
532
 
527
533
  Returns the matching element's attribute value.
528
534
 
535
+ **NOTE**: If you need to assert an element's attribute, prefer [LocatorAssertions#to_have_attribute](./locator_assertions#to_have_attribute) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
536
+
529
537
  ## get_by_alt_text
530
538
 
531
539
  ```
@@ -808,6 +816,8 @@ def inner_text(timeout: nil)
808
816
 
809
817
  Returns the [`element.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText).
810
818
 
819
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
820
+
811
821
  ## input_value
812
822
 
813
823
  ```
@@ -817,6 +827,8 @@ def input_value(timeout: nil)
817
827
 
818
828
  Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
819
829
 
830
+ **NOTE**: If you need to assert input value, prefer [LocatorAssertions#to_have_value](./locator_assertions#to_have_value) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
831
+
820
832
  **Usage**
821
833
 
822
834
  ```ruby
@@ -836,6 +848,8 @@ def checked?(timeout: nil)
836
848
 
837
849
  Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
838
850
 
851
+ **NOTE**: If you need to assert that checkbox is checked, prefer [LocatorAssertions#to_be_checked](./locator_assertions#to_be_checked) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
852
+
839
853
  **Usage**
840
854
 
841
855
  ```ruby
@@ -851,6 +865,8 @@ def disabled?(timeout: nil)
851
865
 
852
866
  Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability#enabled).
853
867
 
868
+ **NOTE**: If you need to assert that an element is disabled, prefer [LocatorAssertions#to_be_disabled](./locator_assertions#to_be_disabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
869
+
854
870
  **Usage**
855
871
 
856
872
  ```ruby
@@ -866,6 +882,8 @@ def editable?(timeout: nil)
866
882
 
867
883
  Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable).
868
884
 
885
+ **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.
886
+
869
887
  **Usage**
870
888
 
871
889
  ```ruby
@@ -881,6 +899,8 @@ def enabled?(timeout: nil)
881
899
 
882
900
  Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability#enabled).
883
901
 
902
+ **NOTE**: If you need to assert that an element is enabled, prefer [LocatorAssertions#to_be_enabled](./locator_assertions#to_be_enabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
903
+
884
904
  **Usage**
885
905
 
886
906
  ```ruby
@@ -896,6 +916,8 @@ def hidden?(timeout: nil)
896
916
 
897
917
  Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability#visible).
898
918
 
919
+ **NOTE**: If you need to assert that element is hidden, prefer [LocatorAssertions#to_be_hidden](./locator_assertions#to_be_hidden) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
920
+
899
921
  **Usage**
900
922
 
901
923
  ```ruby
@@ -911,6 +933,8 @@ def visible?(timeout: nil)
911
933
 
912
934
  Returns whether the element is [visible](https://playwright.dev/python/docs/actionability#visible).
913
935
 
936
+ **NOTE**: If you need to assert that element is visible, prefer [LocatorAssertions#to_be_visible](./locator_assertions#to_be_visible) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
937
+
914
938
  **Usage**
915
939
 
916
940
  ```ruby
@@ -1047,19 +1071,17 @@ To press a special key, like `Control` or `ArrowDown`, use [Locator#press](./loc
1047
1071
 
1048
1072
  **Usage**
1049
1073
 
1050
- ```python sync title=example_1b7781d5527574a18d4b9812e3461203d2acc9ba7e09cbfd0ffbc4154e3f5971.py
1051
- locator.press_sequentially("hello") # types instantly
1052
- locator.press_sequentially("world", delay=100) # types slower, like a user
1053
-
1074
+ ```ruby
1075
+ element.press_sequentially("hello") # types instantly
1076
+ element.press_sequentially("world", delay: 100) # types slower, like a user
1054
1077
  ```
1055
1078
 
1056
1079
  An example of typing into a text field and then submitting the form:
1057
1080
 
1058
- ```python sync title=example_cc0a6b9aa95b97e5c17c4b114da10a29c7f6f793e99aee1ea2703636af6e24f9.py
1059
- locator = page.get_by_label("Password")
1060
- locator.press_sequentially("my password")
1061
- locator.press("Enter")
1062
-
1081
+ ```ruby
1082
+ element = page.get_by_label("Password")
1083
+ element.press_sequentially("my password")
1084
+ element.press("Enter")
1063
1085
  ```
1064
1086
 
1065
1087
  ## screenshot
@@ -1277,6 +1299,8 @@ def text_content(timeout: nil)
1277
1299
 
1278
1300
  Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
1279
1301
 
1302
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
1303
+
1280
1304
  ## type
1281
1305
 
1282
1306
  ```