playwright-ruby-client 1.56.0 → 1.57.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/console_message.md +9 -0
  3. data/documentation/docs/api/element_handle.md +2 -0
  4. data/documentation/docs/api/frame.md +1 -0
  5. data/documentation/docs/api/locator.md +22 -0
  6. data/documentation/docs/api/page.md +1 -2
  7. data/documentation/docs/api/worker.md +20 -0
  8. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +19 -0
  9. data/documentation/docs/article/guides/rails_integration.md +43 -2
  10. data/documentation/docs/include/api_coverage.md +3 -5
  11. data/documentation/package.json +2 -2
  12. data/documentation/yarn.lock +9003 -12370
  13. data/lib/playwright/channel_owners/api_request_context.rb +24 -2
  14. data/lib/playwright/channel_owners/browser_context.rb +5 -2
  15. data/lib/playwright/channel_owners/element_handle.rb +6 -2
  16. data/lib/playwright/channel_owners/frame.rb +9 -3
  17. data/lib/playwright/channel_owners/page.rb +30 -10
  18. data/lib/playwright/channel_owners/worker.rb +19 -0
  19. data/lib/playwright/console_message_impl.rb +3 -4
  20. data/lib/playwright/events.rb +1 -0
  21. data/lib/playwright/locator_impl.rb +25 -5
  22. data/lib/playwright/version.rb +2 -2
  23. data/lib/playwright/web_socket_transport.rb +1 -1
  24. data/lib/playwright.rb +4 -0
  25. data/lib/playwright_api/android.rb +4 -4
  26. data/lib/playwright_api/android_device.rb +4 -4
  27. data/lib/playwright_api/api_request_context.rb +4 -4
  28. data/lib/playwright_api/browser.rb +4 -4
  29. data/lib/playwright_api/browser_context.rb +4 -4
  30. data/lib/playwright_api/browser_type.rb +4 -4
  31. data/lib/playwright_api/cdp_session.rb +4 -4
  32. data/lib/playwright_api/console_message.rb +6 -0
  33. data/lib/playwright_api/dialog.rb +4 -4
  34. data/lib/playwright_api/element_handle.rb +8 -6
  35. data/lib/playwright_api/frame.rb +6 -5
  36. data/lib/playwright_api/js_handle.rb +4 -4
  37. data/lib/playwright_api/locator.rb +22 -3
  38. data/lib/playwright_api/page.rb +15 -18
  39. data/lib/playwright_api/playwright.rb +4 -4
  40. data/lib/playwright_api/request.rb +4 -4
  41. data/lib/playwright_api/response.rb +8 -8
  42. data/lib/playwright_api/route.rb +4 -4
  43. data/lib/playwright_api/tracing.rb +4 -4
  44. data/lib/playwright_api/web_socket.rb +4 -4
  45. data/lib/playwright_api/worker.rb +21 -4
  46. data/playwright.gemspec +2 -0
  47. data/sig/playwright.rbs +10 -12
  48. metadata +30 -5
  49. data/documentation/docs/api/accessibility.md +0 -66
  50. data/lib/playwright/accessibility_impl.rb +0 -50
  51. data/lib/playwright_api/accessibility.rb +0 -57
@@ -1,50 +0,0 @@
1
- module Playwright
2
- define_api_implementation :AccessibilityImpl do
3
- def initialize(channel)
4
- @channel = channel
5
- end
6
-
7
- def snapshot(interestingOnly: nil, root: nil)
8
- params = {
9
- interestingOnly: interestingOnly,
10
- root: root&.channel,
11
- }.compact
12
- result = @channel.send_message_to_server('accessibilitySnapshot', params)
13
- format_ax_node_from_protocol(result) if result
14
- result
15
- end
16
-
17
- # original JS implementation create a new Hash from ax_node,
18
- # but this implementation directly modify ax_node and don't return hash.
19
- private def format_ax_node_from_protocol(ax_node)
20
- value = ax_node.delete('valueNumber') || ax_node.delete('valueString')
21
- ax_node['value'] = value unless value.nil?
22
-
23
- checked =
24
- case ax_node['checked']
25
- when 'checked'
26
- true
27
- when 'unchecked'
28
- false
29
- else
30
- ax_node['checked']
31
- end
32
- ax_node['checked'] = checked unless checked.nil?
33
-
34
- pressed =
35
- case ax_node['pressed']
36
- when 'pressed'
37
- true
38
- when 'released'
39
- false
40
- else
41
- ax_node['pressed']
42
- end
43
- ax_node['pressed'] = pressed unless pressed.nil?
44
-
45
- ax_node['children']&.each do |child|
46
- format_ax_node_from_protocol(child)
47
- end
48
- end
49
- end
50
- end
@@ -1,57 +0,0 @@
1
- module Playwright
2
- #
3
- # The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
4
- # assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
5
- # [switches](https://en.wikipedia.org/wiki/Switch_access).
6
- #
7
- # Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
8
- # have wildly different output.
9
- #
10
- # Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into different
11
- # platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
12
- #
13
- # Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific AX-Tree or by
14
- # assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the
15
- # "interesting" nodes of the tree.
16
- class Accessibility < PlaywrightApi
17
-
18
- #
19
- # Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
20
- # page.
21
- #
22
- # **NOTE**: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright
23
- # will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
24
- #
25
- # **Usage**
26
- #
27
- # An example of dumping the entire accessibility tree:
28
- #
29
- # ```python sync
30
- # snapshot = page.accessibility.snapshot()
31
- # print(snapshot)
32
- # ```
33
- #
34
- # An example of logging the focused node's name:
35
- #
36
- # ```python sync
37
- # def find_focused_node(node):
38
- # if node.get("focused"):
39
- # return node
40
- # for child in (node.get("children") or []):
41
- # found_node = find_focused_node(child)
42
- # if found_node:
43
- # return found_node
44
- # return None
45
- #
46
- # snapshot = page.accessibility.snapshot()
47
- # node = find_focused_node(snapshot)
48
- # if node:
49
- # print(node["name"])
50
- # ```
51
- #
52
- # @deprecated This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
53
- def snapshot(interestingOnly: nil, root: nil)
54
- wrap_impl(@impl.snapshot(interestingOnly: unwrap_impl(interestingOnly), root: unwrap_impl(root)))
55
- end
56
- end
57
- end