playwright-ruby-client 0.2.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/docs/api_coverage.md +116 -74
  4. data/lib/playwright.rb +48 -9
  5. data/lib/playwright/channel.rb +12 -2
  6. data/lib/playwright/channel_owners/artifact.rb +30 -0
  7. data/lib/playwright/channel_owners/binding_call.rb +3 -0
  8. data/lib/playwright/channel_owners/browser.rb +21 -0
  9. data/lib/playwright/channel_owners/browser_context.rb +154 -3
  10. data/lib/playwright/channel_owners/browser_type.rb +28 -0
  11. data/lib/playwright/channel_owners/dialog.rb +28 -0
  12. data/lib/playwright/channel_owners/element_handle.rb +1 -1
  13. data/lib/playwright/channel_owners/frame.rb +25 -2
  14. data/lib/playwright/channel_owners/js_handle.rb +2 -2
  15. data/lib/playwright/channel_owners/page.rb +141 -25
  16. data/lib/playwright/channel_owners/playwright.rb +24 -27
  17. data/lib/playwright/channel_owners/request.rb +26 -2
  18. data/lib/playwright/channel_owners/response.rb +60 -0
  19. data/lib/playwright/channel_owners/route.rb +78 -0
  20. data/lib/playwright/channel_owners/selectors.rb +19 -1
  21. data/lib/playwright/channel_owners/stream.rb +15 -0
  22. data/lib/playwright/connection.rb +11 -32
  23. data/lib/playwright/download.rb +27 -0
  24. data/lib/playwright/errors.rb +6 -0
  25. data/lib/playwright/events.rb +2 -5
  26. data/lib/playwright/keyboard_impl.rb +1 -1
  27. data/lib/playwright/mouse_impl.rb +41 -0
  28. data/lib/playwright/route_handler_entry.rb +28 -0
  29. data/lib/playwright/transport.rb +27 -6
  30. data/lib/playwright/url_matcher.rb +1 -1
  31. data/lib/playwright/utils.rb +9 -0
  32. data/lib/playwright/version.rb +1 -1
  33. data/lib/playwright/video.rb +51 -0
  34. data/lib/playwright/wait_helper.rb +2 -2
  35. data/lib/playwright_api/accessibility.rb +39 -1
  36. data/lib/playwright_api/android.rb +74 -2
  37. data/lib/playwright_api/android_device.rb +141 -23
  38. data/lib/playwright_api/android_input.rb +17 -13
  39. data/lib/playwright_api/android_socket.rb +16 -0
  40. data/lib/playwright_api/android_web_view.rb +21 -0
  41. data/lib/playwright_api/browser.rb +77 -2
  42. data/lib/playwright_api/browser_context.rb +182 -29
  43. data/lib/playwright_api/browser_type.rb +40 -9
  44. data/lib/playwright_api/dialog.rb +54 -7
  45. data/lib/playwright_api/element_handle.rb +105 -31
  46. data/lib/playwright_api/file_chooser.rb +6 -1
  47. data/lib/playwright_api/frame.rb +229 -36
  48. data/lib/playwright_api/js_handle.rb +23 -0
  49. data/lib/playwright_api/keyboard.rb +48 -1
  50. data/lib/playwright_api/mouse.rb +26 -5
  51. data/lib/playwright_api/page.rb +491 -81
  52. data/lib/playwright_api/playwright.rb +21 -4
  53. data/lib/playwright_api/request.rb +30 -2
  54. data/lib/playwright_api/response.rb +21 -11
  55. data/lib/playwright_api/route.rb +51 -5
  56. data/lib/playwright_api/selectors.rb +27 -1
  57. data/lib/playwright_api/touchscreen.rb +1 -1
  58. data/lib/playwright_api/worker.rb +25 -1
  59. data/playwright.gemspec +4 -2
  60. metadata +42 -14
  61. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  62. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  63. data/lib/playwright/channel_owners/download.rb +0 -27
  64. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  65. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  66. data/lib/playwright_api/binding_call.rb +0 -27
  67. data/lib/playwright_api/chromium_browser_context.rb +0 -59
  68. data/lib/playwright_api/download.rb +0 -95
  69. 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,27 +0,0 @@
1
- module Playwright
2
- # @nodoc
3
- class BindingCall < PlaywrightApi
4
-
5
- # -- inherited from EventEmitter --
6
- # @nodoc
7
- def once(event, callback)
8
- event_emitter_proxy.once(event, callback)
9
- end
10
-
11
- # -- inherited from EventEmitter --
12
- # @nodoc
13
- def on(event, callback)
14
- event_emitter_proxy.on(event, callback)
15
- end
16
-
17
- # -- inherited from EventEmitter --
18
- # @nodoc
19
- def off(event, callback)
20
- event_emitter_proxy.off(event, callback)
21
- end
22
-
23
- private def event_emitter_proxy
24
- @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
25
- end
26
- end
27
- 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 once(event, callback)
40
- event_emitter_proxy.once(event, callback)
41
- end
42
-
43
- # -- inherited from EventEmitter --
44
- # @nodoc
45
- def on(event, callback)
46
- event_emitter_proxy.on(event, callback)
47
- end
48
-
49
- # -- inherited from EventEmitter --
50
- # @nodoc
51
- def off(event, callback)
52
- event_emitter_proxy.off(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 once(event, callback)
76
- event_emitter_proxy.once(event, callback)
77
- end
78
-
79
- # -- inherited from EventEmitter --
80
- # @nodoc
81
- def on(event, callback)
82
- event_emitter_proxy.on(event, callback)
83
- end
84
-
85
- # -- inherited from EventEmitter --
86
- # @nodoc
87
- def off(event, callback)
88
- event_emitter_proxy.off(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