playwright-ruby-client 0.3.0 → 0.5.6

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/docs/api_coverage.md +14 -25
  4. data/lib/playwright.rb +47 -9
  5. data/lib/playwright/channel.rb +19 -9
  6. data/lib/playwright/channel_owners/artifact.rb +30 -0
  7. data/lib/playwright/channel_owners/browser.rb +21 -0
  8. data/lib/playwright/channel_owners/browser_context.rb +5 -0
  9. data/lib/playwright/channel_owners/browser_type.rb +28 -0
  10. data/lib/playwright/channel_owners/element_handle.rb +7 -7
  11. data/lib/playwright/channel_owners/frame.rb +26 -5
  12. data/lib/playwright/channel_owners/js_handle.rb +2 -2
  13. data/lib/playwright/channel_owners/page.rb +78 -15
  14. data/lib/playwright/channel_owners/playwright.rb +22 -29
  15. data/lib/playwright/channel_owners/stream.rb +15 -0
  16. data/lib/playwright/connection.rb +11 -32
  17. data/lib/playwright/download.rb +27 -0
  18. data/lib/playwright/errors.rb +6 -0
  19. data/lib/playwright/events.rb +2 -5
  20. data/lib/playwright/keyboard_impl.rb +1 -1
  21. data/lib/playwright/mouse_impl.rb +41 -0
  22. data/lib/playwright/playwright_api.rb +5 -3
  23. data/lib/playwright/route_handler_entry.rb +1 -9
  24. data/lib/playwright/select_option_values.rb +31 -22
  25. data/lib/playwright/transport.rb +29 -7
  26. data/lib/playwright/url_matcher.rb +1 -1
  27. data/lib/playwright/utils.rb +8 -0
  28. data/lib/playwright/version.rb +1 -1
  29. data/lib/playwright/video.rb +51 -0
  30. data/lib/playwright/wait_helper.rb +2 -2
  31. data/lib/playwright_api/accessibility.rb +39 -1
  32. data/lib/playwright_api/android.rb +10 -10
  33. data/lib/playwright_api/android_device.rb +10 -9
  34. data/lib/playwright_api/browser.rb +83 -8
  35. data/lib/playwright_api/browser_context.rb +157 -9
  36. data/lib/playwright_api/browser_type.rb +35 -4
  37. data/lib/playwright_api/console_message.rb +6 -6
  38. data/lib/playwright_api/dialog.rb +28 -8
  39. data/lib/playwright_api/element_handle.rb +111 -37
  40. data/lib/playwright_api/file_chooser.rb +5 -0
  41. data/lib/playwright_api/frame.rb +228 -37
  42. data/lib/playwright_api/js_handle.rb +26 -3
  43. data/lib/playwright_api/keyboard.rb +48 -1
  44. data/lib/playwright_api/mouse.rb +26 -5
  45. data/lib/playwright_api/page.rb +454 -46
  46. data/lib/playwright_api/playwright.rb +26 -9
  47. data/lib/playwright_api/request.rb +34 -6
  48. data/lib/playwright_api/response.rb +6 -6
  49. data/lib/playwright_api/route.rb +30 -6
  50. data/lib/playwright_api/selectors.rb +32 -6
  51. data/lib/playwright_api/touchscreen.rb +1 -1
  52. data/lib/playwright_api/worker.rb +25 -1
  53. data/playwright.gemspec +4 -2
  54. metadata +37 -14
  55. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  56. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  57. data/lib/playwright/channel_owners/download.rb +0 -27
  58. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  59. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  60. data/lib/playwright_api/binding_call.rb +0 -32
  61. data/lib/playwright_api/chromium_browser_context.rb +0 -59
  62. data/lib/playwright_api/download.rb +0 -95
  63. data/lib/playwright_api/video.rb +0 -24
@@ -1,8 +0,0 @@
1
- require_relative './browser'
2
-
3
- module Playwright
4
- module ChannelOwners
5
- class ChromiumBrowser < Browser
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- require_relative './browser_context'
2
-
3
- module Playwright
4
- module ChannelOwners
5
- class ChromiumBrowserContext < BrowserContext
6
- end
7
- end
8
- end
@@ -1,27 +0,0 @@
1
- module Playwright
2
- define_channel_owner :Download do
3
- def url
4
- @initializer['url']
5
- end
6
-
7
- def suggested_filename
8
- @initializer['suggestedFilename']
9
- end
10
-
11
- def delete
12
- @channel.send_message_to_server('delete')
13
- end
14
-
15
- def failure
16
- @channel.send_message_to_server('failure')
17
- end
18
-
19
- def path
20
- @channel.send_message_to_server('path')
21
- end
22
-
23
- def save_as(path)
24
- @channel.send_message_to_server('saveAs', path: path)
25
- end
26
- end
27
- end
@@ -1,8 +0,0 @@
1
- require_relative './browser'
2
-
3
- module Playwright
4
- module ChannelOwners
5
- class FirefoxBrowser < Browser
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- require_relative './browser'
2
-
3
- module Playwright
4
- module ChannelOwners
5
- class WebKitBrowser < Browser
6
- end
7
- end
8
- end
@@ -1,32 +0,0 @@
1
- module Playwright
2
- # @nodoc
3
- class BindingCall < PlaywrightApi
4
-
5
- # @nodoc
6
- def name
7
- wrap_impl(@impl.name)
8
- end
9
-
10
- # -- inherited from EventEmitter --
11
- # @nodoc
12
- def off(event, callback)
13
- event_emitter_proxy.off(event, callback)
14
- end
15
-
16
- # -- inherited from EventEmitter --
17
- # @nodoc
18
- def once(event, callback)
19
- event_emitter_proxy.once(event, callback)
20
- end
21
-
22
- # -- inherited from EventEmitter --
23
- # @nodoc
24
- def on(event, callback)
25
- event_emitter_proxy.on(event, callback)
26
- end
27
-
28
- private def event_emitter_proxy
29
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
30
- end
31
- end
32
- end
@@ -1,59 +0,0 @@
1
- require_relative './browser_context.rb'
2
-
3
- module Playwright
4
- # - extends: `BrowserContext`
5
- #
6
- # Chromium-specific features including background pages, service worker support, etc.
7
- #
8
- #
9
- # ```js
10
- # const backgroundPage = await context.waitForEvent('backgroundpage');
11
- # ```
12
- #
13
- # ```python async
14
- # background_page = await context.wait_for_event("backgroundpage")
15
- # ```
16
- #
17
- # ```python sync
18
- # background_page = context.wait_for_event("backgroundpage")
19
- # ```
20
- class ChromiumBrowserContext < BrowserContext
21
-
22
- # All existing background pages in the context.
23
- def background_pages
24
- raise NotImplementedError.new('background_pages is not implemented yet.')
25
- end
26
-
27
- # Returns the newly created session.
28
- def new_cdp_session(page)
29
- raise NotImplementedError.new('new_cdp_session is not implemented yet.')
30
- end
31
-
32
- # All existing service workers in the context.
33
- def service_workers
34
- raise NotImplementedError.new('service_workers is not implemented yet.')
35
- end
36
-
37
- # -- inherited from EventEmitter --
38
- # @nodoc
39
- def off(event, callback)
40
- event_emitter_proxy.off(event, callback)
41
- end
42
-
43
- # -- inherited from EventEmitter --
44
- # @nodoc
45
- def once(event, callback)
46
- event_emitter_proxy.once(event, callback)
47
- end
48
-
49
- # -- inherited from EventEmitter --
50
- # @nodoc
51
- def on(event, callback)
52
- event_emitter_proxy.on(event, callback)
53
- end
54
-
55
- private def event_emitter_proxy
56
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
57
- end
58
- end
59
- end
@@ -1,95 +0,0 @@
1
- module Playwright
2
- # `Download` objects are dispatched by page via the [`event: Page.download`] event.
3
- #
4
- # All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded
5
- # files are deleted when the browser closes.
6
- #
7
- # Download event is emitted once the download starts. Download path becomes available once download completes:
8
- #
9
- #
10
- # ```js
11
- # const [ download ] = await Promise.all([
12
- # page.waitForEvent('download'), // wait for download to start
13
- # page.click('a')
14
- # ]);
15
- # // wait for download to complete
16
- # const path = await download.path();
17
- # ```
18
- #
19
- # ```python async
20
- # async with page.expect_download() as download_info:
21
- # await page.click("a")
22
- # download = await download_info.value
23
- # # waits for download to complete
24
- # path = await download.path()
25
- # ```
26
- #
27
- # ```python sync
28
- # with page.expect_download() as download_info:
29
- # page.click("a")
30
- # download = download_info.value
31
- # # wait for download to complete
32
- # path = download.path()
33
- # ```
34
- #
35
- # > NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the
36
- # downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not
37
- # performed and user has no access to the downloaded files.
38
- class Download < PlaywrightApi
39
-
40
- # Deletes the downloaded file.
41
- def delete
42
- wrap_impl(@impl.delete)
43
- end
44
-
45
- # Returns download error if any.
46
- def failure
47
- wrap_impl(@impl.failure)
48
- end
49
-
50
- # Returns path to the downloaded file in case of successful download.
51
- def path
52
- wrap_impl(@impl.path)
53
- end
54
-
55
- # Saves the download to a user-specified path.
56
- def save_as(path)
57
- wrap_impl(@impl.save_as(unwrap_impl(path)))
58
- end
59
-
60
- # Returns suggested filename for this download. It is typically computed by the browser from the
61
- # [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
62
- # or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
63
- # browsers can use different logic for computing it.
64
- def suggested_filename
65
- wrap_impl(@impl.suggested_filename)
66
- end
67
-
68
- # Returns downloaded url.
69
- def url
70
- wrap_impl(@impl.url)
71
- end
72
-
73
- # -- inherited from EventEmitter --
74
- # @nodoc
75
- def off(event, callback)
76
- event_emitter_proxy.off(event, callback)
77
- end
78
-
79
- # -- inherited from EventEmitter --
80
- # @nodoc
81
- def once(event, callback)
82
- event_emitter_proxy.once(event, callback)
83
- end
84
-
85
- # -- inherited from EventEmitter --
86
- # @nodoc
87
- def on(event, callback)
88
- event_emitter_proxy.on(event, callback)
89
- end
90
-
91
- private def event_emitter_proxy
92
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
93
- end
94
- end
95
- end
@@ -1,24 +0,0 @@
1
- module Playwright
2
- # When browser context is created with the `videosPath` option, each page has a video object associated with it.
3
- #
4
- #
5
- # ```js
6
- # console.log(await page.video().path());
7
- # ```
8
- #
9
- # ```python async
10
- # print(await page.video.path())
11
- # ```
12
- #
13
- # ```python sync
14
- # print(page.video.path())
15
- # ```
16
- class Video < PlaywrightApi
17
-
18
- # Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem
19
- # upon closing the browser context.
20
- def path
21
- raise NotImplementedError.new('path is not implemented yet.')
22
- end
23
- end
24
- end