playwright-ruby-client 0.3.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) 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/channel.rb +19 -9
  5. data/lib/playwright/channel_owners/artifact.rb +30 -0
  6. data/lib/playwright/channel_owners/browser.rb +21 -0
  7. data/lib/playwright/channel_owners/browser_context.rb +5 -0
  8. data/lib/playwright/channel_owners/browser_type.rb +28 -0
  9. data/lib/playwright/channel_owners/element_handle.rb +1 -1
  10. data/lib/playwright/channel_owners/frame.rb +25 -2
  11. data/lib/playwright/channel_owners/js_handle.rb +2 -2
  12. data/lib/playwright/channel_owners/page.rb +78 -15
  13. data/lib/playwright/channel_owners/playwright.rb +22 -29
  14. data/lib/playwright/channel_owners/stream.rb +15 -0
  15. data/lib/playwright/connection.rb +11 -32
  16. data/lib/playwright/download.rb +27 -0
  17. data/lib/playwright/errors.rb +6 -0
  18. data/lib/playwright/events.rb +2 -5
  19. data/lib/playwright/keyboard_impl.rb +1 -1
  20. data/lib/playwright/mouse_impl.rb +41 -0
  21. data/lib/playwright/route_handler_entry.rb +1 -9
  22. data/lib/playwright/transport.rb +27 -6
  23. data/lib/playwright/url_matcher.rb +1 -1
  24. data/lib/playwright/utils.rb +8 -0
  25. data/lib/playwright/version.rb +1 -1
  26. data/lib/playwright/video.rb +51 -0
  27. data/lib/playwright/wait_helper.rb +2 -2
  28. data/lib/playwright.rb +47 -9
  29. data/lib/playwright_api/accessibility.rb +39 -1
  30. data/lib/playwright_api/android.rb +10 -10
  31. data/lib/playwright_api/android_device.rb +10 -9
  32. data/lib/playwright_api/browser.rb +83 -8
  33. data/lib/playwright_api/browser_context.rb +163 -15
  34. data/lib/playwright_api/browser_type.rb +35 -4
  35. data/lib/playwright_api/console_message.rb +6 -6
  36. data/lib/playwright_api/dialog.rb +28 -8
  37. data/lib/playwright_api/element_handle.rb +111 -37
  38. data/lib/playwright_api/file_chooser.rb +5 -0
  39. data/lib/playwright_api/frame.rb +228 -37
  40. data/lib/playwright_api/js_handle.rb +26 -3
  41. data/lib/playwright_api/keyboard.rb +48 -1
  42. data/lib/playwright_api/mouse.rb +26 -5
  43. data/lib/playwright_api/page.rb +456 -48
  44. data/lib/playwright_api/playwright.rb +26 -9
  45. data/lib/playwright_api/request.rb +34 -6
  46. data/lib/playwright_api/response.rb +8 -8
  47. data/lib/playwright_api/route.rb +30 -6
  48. data/lib/playwright_api/selectors.rb +32 -6
  49. data/lib/playwright_api/touchscreen.rb +1 -1
  50. data/lib/playwright_api/worker.rb +25 -1
  51. data/playwright.gemspec +4 -2
  52. metadata +37 -14
  53. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  54. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  55. data/lib/playwright/channel_owners/download.rb +0 -27
  56. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  57. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  58. data/lib/playwright_api/binding_call.rb +0 -32
  59. data/lib/playwright_api/chromium_browser_context.rb +0 -59
  60. data/lib/playwright_api/download.rb +0 -95
  61. data/lib/playwright_api/video.rb +0 -24
@@ -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