playwright-ruby-client 0.0.8 → 1.58.1.alpha1

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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/AGENTS.md +4 -0
  3. data/CLAUDE/api_generation.md +28 -0
  4. data/CLAUDE/ci_expectations.md +23 -0
  5. data/CLAUDE/gem_release_flow.md +39 -0
  6. data/CLAUDE/past_upgrade_pr_patterns.md +42 -0
  7. data/CLAUDE/playwright_upgrade_workflow.md +35 -0
  8. data/CLAUDE/rspec_debugging.md +30 -0
  9. data/CLAUDE/unimplemented_examples.md +18 -0
  10. data/CLAUDE.md +32 -0
  11. data/CONTRIBUTING.md +5 -0
  12. data/README.md +60 -16
  13. data/documentation/README.md +33 -0
  14. data/documentation/babel.config.js +3 -0
  15. data/documentation/docs/api/api_request.md +7 -0
  16. data/documentation/docs/api/api_request_context.md +298 -0
  17. data/documentation/docs/api/api_response.md +114 -0
  18. data/documentation/docs/api/browser.md +237 -0
  19. data/documentation/docs/api/browser_context.md +503 -0
  20. data/documentation/docs/api/browser_type.md +184 -0
  21. data/documentation/docs/api/cdp_session.md +44 -0
  22. data/documentation/docs/api/clock.md +154 -0
  23. data/documentation/docs/api/console_message.md +85 -0
  24. data/documentation/docs/api/dialog.md +84 -0
  25. data/documentation/docs/api/download.md +111 -0
  26. data/documentation/docs/api/element_handle.md +694 -0
  27. data/documentation/docs/api/experimental/_category_.yml +3 -0
  28. data/documentation/docs/api/experimental/android.md +42 -0
  29. data/documentation/docs/api/experimental/android_device.md +109 -0
  30. data/documentation/docs/api/experimental/android_input.md +43 -0
  31. data/documentation/docs/api/experimental/android_socket.md +7 -0
  32. data/documentation/docs/api/experimental/android_web_view.md +7 -0
  33. data/documentation/docs/api/file_chooser.md +53 -0
  34. data/documentation/docs/api/frame.md +1218 -0
  35. data/documentation/docs/api/frame_locator.md +348 -0
  36. data/documentation/docs/api/js_handle.md +121 -0
  37. data/documentation/docs/api/keyboard.md +170 -0
  38. data/documentation/docs/api/locator.md +1495 -0
  39. data/documentation/docs/api/locator_assertions.md +827 -0
  40. data/documentation/docs/api/mouse.md +86 -0
  41. data/documentation/docs/api/page.md +1946 -0
  42. data/documentation/docs/api/page_assertions.md +65 -0
  43. data/documentation/docs/api/playwright.md +66 -0
  44. data/documentation/docs/api/request.md +255 -0
  45. data/documentation/docs/api/response.md +176 -0
  46. data/documentation/docs/api/route.md +205 -0
  47. data/documentation/docs/api/selectors.md +63 -0
  48. data/documentation/docs/api/touchscreen.md +22 -0
  49. data/documentation/docs/api/tracing.md +129 -0
  50. data/documentation/docs/api/web_socket.md +51 -0
  51. data/documentation/docs/api/worker.md +83 -0
  52. data/documentation/docs/article/api_coverage.mdx +11 -0
  53. data/documentation/docs/article/getting_started.md +161 -0
  54. data/documentation/docs/article/guides/_category_.yml +3 -0
  55. data/documentation/docs/article/guides/download_playwright_driver.md +55 -0
  56. data/documentation/docs/article/guides/inspector.md +31 -0
  57. data/documentation/docs/article/guides/launch_browser.md +121 -0
  58. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +112 -0
  59. data/documentation/docs/article/guides/rails_integration.md +278 -0
  60. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +145 -0
  61. data/documentation/docs/article/guides/recording_video.md +79 -0
  62. data/documentation/docs/article/guides/rspec_integration.md +59 -0
  63. data/documentation/docs/article/guides/semi_automation.md +71 -0
  64. data/documentation/docs/article/guides/use_storage_state.md +78 -0
  65. data/documentation/docs/include/api_coverage.md +671 -0
  66. data/documentation/docusaurus.config.js +114 -0
  67. data/documentation/package.json +39 -0
  68. data/documentation/sidebars.js +15 -0
  69. data/documentation/src/components/HomepageFeatures.js +61 -0
  70. data/documentation/src/components/HomepageFeatures.module.css +13 -0
  71. data/documentation/src/css/custom.css +44 -0
  72. data/documentation/src/pages/index.js +49 -0
  73. data/documentation/src/pages/index.module.css +41 -0
  74. data/documentation/src/pages/markdown-page.md +7 -0
  75. data/documentation/static/.nojekyll +0 -0
  76. data/documentation/static/img/playwright-logo.svg +9 -0
  77. data/documentation/static/img/playwright-ruby-client.png +0 -0
  78. data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
  79. data/documentation/static/img/undraw_web_development.svg +1 -0
  80. data/documentation/static/img/undraw_windows.svg +1 -0
  81. data/documentation/yarn.lock +9005 -0
  82. data/lib/playwright/{input_types/android_input.rb → android_input_impl.rb} +5 -1
  83. data/lib/playwright/api_implementation.rb +18 -0
  84. data/lib/playwright/api_response_impl.rb +77 -0
  85. data/lib/playwright/channel.rb +62 -1
  86. data/lib/playwright/channel_owner.rb +70 -7
  87. data/lib/playwright/channel_owners/android.rb +16 -3
  88. data/lib/playwright/channel_owners/android_device.rb +22 -66
  89. data/lib/playwright/channel_owners/api_request_context.rb +247 -0
  90. data/lib/playwright/channel_owners/artifact.rb +40 -0
  91. data/lib/playwright/channel_owners/binding_call.rb +70 -0
  92. data/lib/playwright/channel_owners/browser.rb +114 -22
  93. data/lib/playwright/channel_owners/browser_context.rb +589 -15
  94. data/lib/playwright/channel_owners/browser_type.rb +90 -1
  95. data/lib/playwright/channel_owners/cdp_session.rb +19 -0
  96. data/lib/playwright/channel_owners/dialog.rb +32 -0
  97. data/lib/playwright/channel_owners/element_handle.rb +107 -43
  98. data/lib/playwright/channel_owners/fetch_request.rb +8 -0
  99. data/lib/playwright/channel_owners/frame.rb +334 -104
  100. data/lib/playwright/channel_owners/js_handle.rb +9 -13
  101. data/lib/playwright/channel_owners/local_utils.rb +82 -0
  102. data/lib/playwright/channel_owners/page.rb +778 -95
  103. data/lib/playwright/channel_owners/playwright.rb +25 -30
  104. data/lib/playwright/channel_owners/request.rb +120 -18
  105. data/lib/playwright/channel_owners/response.rb +113 -0
  106. data/lib/playwright/channel_owners/route.rb +181 -0
  107. data/lib/playwright/channel_owners/stream.rb +30 -0
  108. data/lib/playwright/channel_owners/tracing.rb +117 -0
  109. data/lib/playwright/channel_owners/web_socket.rb +96 -0
  110. data/lib/playwright/channel_owners/worker.rb +46 -0
  111. data/lib/playwright/channel_owners/writable_stream.rb +14 -0
  112. data/lib/playwright/clock_impl.rb +67 -0
  113. data/lib/playwright/connection.rb +111 -63
  114. data/lib/playwright/console_message_impl.rb +29 -0
  115. data/lib/playwright/download_impl.rb +32 -0
  116. data/lib/playwright/errors.rb +42 -5
  117. data/lib/playwright/event_emitter.rb +17 -3
  118. data/lib/playwright/event_emitter_proxy.rb +49 -0
  119. data/lib/playwright/events.rb +10 -5
  120. data/lib/playwright/file_chooser_impl.rb +24 -0
  121. data/lib/playwright/frame_locator_impl.rb +66 -0
  122. data/lib/playwright/har_router.rb +89 -0
  123. data/lib/playwright/http_headers.rb +14 -0
  124. data/lib/playwright/input_files.rb +102 -15
  125. data/lib/playwright/javascript/expression.rb +7 -11
  126. data/lib/playwright/javascript/regex.rb +23 -0
  127. data/lib/playwright/javascript/source_url.rb +16 -0
  128. data/lib/playwright/javascript/value_parser.rb +108 -19
  129. data/lib/playwright/javascript/value_serializer.rb +47 -8
  130. data/lib/playwright/javascript/visitor_info.rb +26 -0
  131. data/lib/playwright/javascript.rb +2 -10
  132. data/lib/playwright/{input_types/keyboard.rb → keyboard_impl.rb} +6 -2
  133. data/lib/playwright/locator_assertions_impl.rb +571 -0
  134. data/lib/playwright/locator_impl.rb +544 -0
  135. data/lib/playwright/locator_utils.rb +136 -0
  136. data/lib/playwright/mouse_impl.rb +57 -0
  137. data/lib/playwright/page_assertions_impl.rb +154 -0
  138. data/lib/playwright/playwright_api.rb +102 -30
  139. data/lib/playwright/raw_headers.rb +61 -0
  140. data/lib/playwright/route_handler.rb +78 -0
  141. data/lib/playwright/select_option_values.rb +34 -13
  142. data/lib/playwright/selectors_impl.rb +45 -0
  143. data/lib/playwright/test.rb +102 -0
  144. data/lib/playwright/timeout_settings.rb +9 -4
  145. data/lib/playwright/touchscreen_impl.rb +14 -0
  146. data/lib/playwright/transport.rb +61 -10
  147. data/lib/playwright/url_matcher.rb +24 -2
  148. data/lib/playwright/utils.rb +48 -13
  149. data/lib/playwright/version.rb +2 -1
  150. data/lib/playwright/video.rb +54 -0
  151. data/lib/playwright/waiter.rb +166 -0
  152. data/lib/playwright/web_socket_client.rb +167 -0
  153. data/lib/playwright/web_socket_transport.rb +116 -0
  154. data/lib/playwright.rb +188 -11
  155. data/lib/playwright_api/android.rb +46 -11
  156. data/lib/playwright_api/android_device.rb +182 -31
  157. data/lib/playwright_api/android_input.rb +22 -13
  158. data/lib/playwright_api/android_socket.rb +18 -0
  159. data/lib/playwright_api/android_web_view.rb +24 -0
  160. data/lib/playwright_api/api_request.rb +26 -0
  161. data/lib/playwright_api/api_request_context.rb +311 -0
  162. data/lib/playwright_api/api_response.rb +92 -0
  163. data/lib/playwright_api/browser.rb +116 -103
  164. data/lib/playwright_api/browser_context.rb +290 -389
  165. data/lib/playwright_api/browser_type.rb +96 -118
  166. data/lib/playwright_api/cdp_session.rb +36 -39
  167. data/lib/playwright_api/clock.rb +121 -0
  168. data/lib/playwright_api/console_message.rb +35 -19
  169. data/lib/playwright_api/dialog.rb +53 -50
  170. data/lib/playwright_api/download.rb +49 -43
  171. data/lib/playwright_api/element_handle.rb +354 -402
  172. data/lib/playwright_api/file_chooser.rb +15 -18
  173. data/lib/playwright_api/frame.rb +703 -603
  174. data/lib/playwright_api/frame_locator.rb +285 -0
  175. data/lib/playwright_api/js_handle.rb +50 -76
  176. data/lib/playwright_api/keyboard.rb +67 -146
  177. data/lib/playwright_api/locator.rb +1304 -0
  178. data/lib/playwright_api/locator_assertions.rb +704 -0
  179. data/lib/playwright_api/mouse.rb +23 -29
  180. data/lib/playwright_api/page.rb +1196 -1176
  181. data/lib/playwright_api/page_assertions.rb +60 -0
  182. data/lib/playwright_api/playwright.rb +54 -122
  183. data/lib/playwright_api/request.rb +112 -74
  184. data/lib/playwright_api/response.rb +92 -20
  185. data/lib/playwright_api/route.rb +152 -62
  186. data/lib/playwright_api/selectors.rb +47 -61
  187. data/lib/playwright_api/touchscreen.rb +8 -2
  188. data/lib/playwright_api/tracing.rb +128 -0
  189. data/lib/playwright_api/web_socket.rb +43 -5
  190. data/lib/playwright_api/worker.rb +74 -34
  191. data/playwright.gemspec +14 -9
  192. data/sig/playwright.rbs +658 -0
  193. metadata +216 -50
  194. data/docs/api_coverage.md +0 -354
  195. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  196. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  197. data/lib/playwright/channel_owners/console_message.rb +0 -21
  198. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  199. data/lib/playwright/channel_owners/selectors.rb +0 -4
  200. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  201. data/lib/playwright/input_type.rb +0 -19
  202. data/lib/playwright/input_types/mouse.rb +0 -4
  203. data/lib/playwright/input_types/touchscreen.rb +0 -4
  204. data/lib/playwright/javascript/function.rb +0 -67
  205. data/lib/playwright/wait_helper.rb +0 -73
  206. data/lib/playwright_api/accessibility.rb +0 -93
  207. data/lib/playwright_api/binding_call.rb +0 -23
  208. data/lib/playwright_api/chromium_browser_context.rb +0 -57
  209. data/lib/playwright_api/video.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04f50e523a846e243058cbb53a44e0f4a6ecce32aa843a02ace9b855b2264862
4
- data.tar.gz: a8c99b7550206d0ff90ad033e0391a9224f780ae1e009a8cab48441070adabaa
3
+ metadata.gz: 78c64e38b462ad2449eda1349128c44ae6dbe7adae66570b76cd886e005f418f
4
+ data.tar.gz: d410ab0adf418bbf8f43925984a95663b7f947519b85e9afa93bec64daf76f06
5
5
  SHA512:
6
- metadata.gz: d5e089555dc0d1ee2a86980d14d8310e338fa1d23b529a3d711895532dba64101300a198ed55b80f90342116b86baae8937c7526f992bc7ea9816297e385c436
7
- data.tar.gz: d1da5e4e141043a37f3eccdd300865437264c795e343fa5652534d2fa04168d6f1326f7311c1f8c0212c98fd0d365b5b8f684b18b4b615b8825d5d65fa185562
6
+ metadata.gz: 319787778e82280859a291247e01b4fc5626b12974e9d7e08fd7331beb596696f15cc83c09d9b6f2cb5a76c15ef30308cc9e9eb7f2f16462188d08bc72546ddc
7
+ data.tar.gz: df5b988a9124a42006720bee860c3ebc91804ebc9ce396a922b0dbd0e1a1c81798912cd42530f91dcde49da83432b60be17cded55408548d7e795a7991b8276b
data/AGENTS.md ADDED
@@ -0,0 +1,4 @@
1
+ # AGENTS.md
2
+
3
+ When working in this repository, read `CLAUDE.md` first and follow its mandatory checks.
4
+ For detailed rules and workflows, refer to `CLAUDE/*.md`.
@@ -0,0 +1,28 @@
1
+ # API Generation
2
+
3
+ ## Source of generated artifacts
4
+
5
+ - Input: `development/api.json`
6
+ - Generator script: `development/generate_api.rb`
7
+
8
+ ## Generated outputs
9
+
10
+ - `lib/playwright_api/*.rb`
11
+ - `documentation/docs/api/**/*.md`
12
+ - `documentation/docs/include/api_coverage.md`
13
+ - `sig/playwright.rbs`
14
+ - `development/unimplemented_examples.md`
15
+
16
+ ## Critical rules
17
+
18
+ - `lib/playwright_api/` is not tracked by Git (`lib/playwright_api/.gitignore` only).
19
+ - Do not manually edit `lib/playwright_api/*.rb`.
20
+ - Re-run `development/generate_api.rb` whenever API specs change.
21
+
22
+ ## Typical command set
23
+
24
+ ```sh
25
+ rm lib/playwright_api/*.rb
26
+ find documentation/docs -name "*.md" | grep -v documentation/docs/article/ | xargs rm
27
+ bundle exec ruby development/generate_api.rb
28
+ ```
@@ -0,0 +1,23 @@
1
+ # CI Expectations
2
+
3
+ ## Main guardrails
4
+
5
+ `/.github/workflows/check.yml` detects stale generated artifacts.
6
+
7
+ Checked paths:
8
+
9
+ - `development/api.json`
10
+ - `documentation/docs/**`
11
+ - `development/unimplemented_examples.md`
12
+
13
+ ## Practical implication
14
+
15
+ - If API-related code changes, regenerate artifacts before finishing.
16
+ - If you open a PR without regeneration, `check.yml` will likely fail.
17
+
18
+ ## Related workflows
19
+
20
+ - `/.github/workflows/rspec.yml`
21
+ - `/.github/workflows/deploy.yml`
22
+
23
+ These workflows also depend on `bundle exec ruby development/generate_api.rb`.
@@ -0,0 +1,39 @@
1
+ # Gem Release Flow
2
+
3
+ ## Overview
4
+
5
+ Pushing a Git tag triggers `.github/workflows/deploy.yml`, which builds and publishes the gem to RubyGems.
6
+
7
+ ## Tag format
8
+
9
+ The deploy workflow triggers on tags matching these patterns:
10
+
11
+ - `X.Y.Z` — stable release (e.g. `1.58.0`)
12
+ - `X.Y.betaN` — beta release (e.g. `1.58.beta1`)
13
+ - `X.Y.Z.alphaN` — alpha release (e.g. `1.58.1.alpha1`)
14
+
15
+ ## Steps to release
16
+
17
+ 1. Update `lib/playwright/version.rb`:
18
+ - Set `Playwright::VERSION` to the target version string.
19
+ - `COMPATIBLE_PLAYWRIGHT_VERSION` stays at the base Playwright version.
20
+
21
+ 2. Commit the version change.
22
+
23
+ 3. Create and push a Git tag matching the version exactly:
24
+ ```sh
25
+ git tag 1.58.1.alpha1
26
+ git push origin 1.58.1.alpha1
27
+ ```
28
+
29
+ 4. The deploy workflow will:
30
+ - Check out the tagged commit.
31
+ - Verify `Playwright::VERSION == RELEASE_TAG` (must match exactly).
32
+ - Run `bundle exec ruby development/generate_api.rb` to generate API code.
33
+ - Run `rake build` to build the gem.
34
+ - Push the gem to RubyGems using the `RUBYGEMS_API_KEY` secret.
35
+
36
+ ## Important notes
37
+
38
+ - The `Playwright::VERSION` in `lib/playwright/version.rb` **must exactly match** the Git tag name. If they differ, the deploy job fails at the version check step.
39
+ - Alpha/beta tags do NOT require a separate branch — they can be tagged on any commit.
@@ -0,0 +1,42 @@
1
+ # Past Upgrade PR Patterns
2
+
3
+ Common patterns observed from `Update Playwright driver to 1.xx.x` PRs reviewed with `gh`.
4
+
5
+ ## PR sample
6
+
7
+ - `#366` (1.58.0)
8
+ - `#360` (1.57.0)
9
+ - `#354` (1.56.1)
10
+ - `#348` (1.55.0)
11
+ - `#341` (1.54.1)
12
+ - `#336` (1.53.0)
13
+ - `#331` (1.52.0)
14
+ - `#327` (1.51.0)
15
+
16
+ ## Frequently changed files
17
+
18
+ Almost every time:
19
+
20
+ - `development/CLI_VERSION`
21
+ - `development/api.json`
22
+ - `lib/playwright/version.rb`
23
+
24
+ High frequency:
25
+
26
+ - `documentation/docs/api/*.md`
27
+ - `documentation/docs/include/api_coverage.md`
28
+ - `development/generate_api/example_codes.rb`
29
+ - `spec/integration/example_spec.rb`
30
+ - `lib/playwright/channel_owners/page.rb`
31
+ - `lib/playwright/locator_impl.rb`
32
+
33
+ Sometimes:
34
+
35
+ - `development/generate_api.rb`
36
+ - `development/unimplemented_examples.md`
37
+
38
+ ## Work style trend
39
+
40
+ - The first commit often updates version files and generated API artifacts.
41
+ - Follow-up commits often add/update specs and then implement `lib/playwright/**` changes.
42
+ - Broader upstream changes usually increase docs/example/assets updates.
@@ -0,0 +1,35 @@
1
+ # Playwright Upgrade Workflow
2
+
3
+ ## Scope
4
+
5
+ Standard process for `Update Playwright driver to 1.xx.x` tasks.
6
+
7
+ ## Order (Do not reorder)
8
+
9
+ 1. Update versions
10
+ - `development/CLI_VERSION`
11
+ - `lib/playwright/version.rb` (`VERSION`, `COMPATIBLE_PLAYWRIGHT_VERSION`)
12
+
13
+ 2. Update API definition
14
+ - Set `PLAYWRIGHT_CLI_EXECUTABLE_PATH`
15
+ - `$PLAYWRIGHT_CLI_EXECUTABLE_PATH print-api-json | jq . > development/api.json`
16
+
17
+ 3. Clean before generation + regenerate
18
+ - `rm lib/playwright_api/*.rb`
19
+ - `find documentation/docs -name "*.md" | grep -v documentation/docs/article/ | xargs rm`
20
+ - `bundle exec ruby development/generate_api.rb`
21
+
22
+ 4. Update tests first
23
+ - Add/update `spec/` changes that represent upstream behavior differences.
24
+
25
+ 5. Implement
26
+ - Apply minimal implementation changes in `lib/playwright/**`.
27
+
28
+ 6. Run tests
29
+ - `bundle exec rspec`
30
+ - Run focused specs first while iterating, then run the full suite.
31
+
32
+ ## Notes
33
+
34
+ - During upgrade work, prefer the steps in `development/README.md`.
35
+ - `development/update_playwright_driver.sh` can be used as a helper script.
@@ -0,0 +1,30 @@
1
+ # RSpec Debugging
2
+
3
+ ## Critical execution rule
4
+
5
+ - Run RSpec via `rbenv exec`.
6
+ - Some environments fail with plain `bundle exec rspec`, so always use `rbenv exec bundle exec rspec ...`.
7
+
8
+ ## Debug rule when spec fails
9
+
10
+ - On failure, rerun with `DEBUG=1`.
11
+ - Use `DEBUG=1` output to inspect Playwright protocol logs and isolate the issue.
12
+
13
+ ## Example
14
+
15
+ ```sh
16
+ rbenv exec bundle exec rspec spec/integration/page/aria_snapshot_ai_spec.rb
17
+ ```
18
+
19
+ ```sh
20
+ DEBUG=1 rbenv exec bundle exec rspec spec/integration/page/aria_snapshot_ai_spec.rb
21
+ ```
22
+
23
+ ## Node.js Playwright protocol log
24
+
25
+ - Node.js Playwright protocol logs can be captured with `DEBUG=pw:*`.
26
+ - This is useful when comparing behavior against the Ruby client.
27
+
28
+ ```sh
29
+ DEBUG=pw:* node script.mjs 2>&1 | head -200
30
+ ```
@@ -0,0 +1,18 @@
1
+ # unimplemented_examples.md
2
+
3
+ ## What it is
4
+
5
+ - `development/unimplemented_examples.md` is a generated artifact.
6
+ - It lists examples from API docs that could not be converted to Ruby examples.
7
+
8
+ ## How examples are converted
9
+
10
+ - Source: API doc comments
11
+ - Conversion rules: `development/generate_api/example_codes.rb`
12
+ - Unmapped examples remain in Python in docs and are listed in `development/unimplemented_examples.md`.
13
+
14
+ ## When this file changes
15
+
16
+ 1. Review the diff to identify unmapped examples.
17
+ 2. Add conversion mappings to `development/generate_api/example_codes.rb` when needed.
18
+ 3. Re-run `bundle exec ruby development/generate_api.rb`.
data/CLAUDE.md ADDED
@@ -0,0 +1,32 @@
1
+ # CLAUDE.md
2
+
3
+ This file contains only the checks that must be verified first.
4
+ For detailed rules, see `CLAUDE/*.md`.
5
+
6
+ ## Must Check First
7
+
8
+ 1. Determine first whether the task is a Playwright version upgrade.
9
+ 2. Confirm generated-code handling.
10
+ - `lib/playwright_api/*.rb` is auto-generated by `development/generate_api.rb`.
11
+ - `lib/playwright_api/` is not tracked by Git. Do not edit generated files manually.
12
+ 3. Confirm change order.
13
+ - For version upgrade work, update tests first, then implement `lib/playwright/**`.
14
+ 4. Confirm generation and diff consistency.
15
+ - Update `development/api.json`, run generation, and verify generated diffs.
16
+ 5. Confirm CI-required generated files.
17
+ - `development/api.json`
18
+ - `documentation/docs/**`
19
+ - `development/unimplemented_examples.md`
20
+ 6. Confirm RSpec execution mode (critical).
21
+ - Run RSpec via `rbenv exec`.
22
+ - On failure, rerun with `DEBUG=1` and inspect protocol logs.
23
+
24
+ ## Topic Docs
25
+
26
+ - `CLAUDE/playwright_upgrade_workflow.md`
27
+ - `CLAUDE/api_generation.md`
28
+ - `CLAUDE/unimplemented_examples.md`
29
+ - `CLAUDE/ci_expectations.md`
30
+ - `CLAUDE/past_upgrade_pr_patterns.md`
31
+ - `CLAUDE/rspec_debugging.md`
32
+ - `CLAUDE/gem_release_flow.md`
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,5 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing to `playwright-ruby-client`!
4
+
5
+ For development setup instructions and guidelines, please see [development/README.md](development/README.md).
data/README.md CHANGED
@@ -1,30 +1,36 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/playwright-ruby-client.svg)](https://badge.fury.io/rb/playwright-ruby-client)
2
2
 
3
- # playwright-ruby-client
3
+ # 🎭 Playwright client for Ruby
4
4
 
5
- A Ruby client for Playwright driver.
6
-
7
- Note: Currently, this Gem is just a PoC (Proof of Concept). If you want to develop browser-automation for Chrome with Ruby, consider using [puppeteer-ruby](https://github.com/YusukeIwaki/puppeteer-ruby). The list of the available APIs of playwright-ruby-client is [here](./docs/api_coverage.md)
5
+ #### [Docs](https://playwright-ruby-client.vercel.app/docs/article/getting_started) | [API](https://playwright-ruby-client.vercel.app/docs/api/playwright)
8
6
 
9
7
  ## Getting Started
10
8
 
11
- At this point, playwright-ruby-client doesn't include the downloader of playwright driver, so **we have to install [playwright](https://github.com/microsoft/playwright) in advance**.
9
+ ```
10
+ gem 'playwright-ruby-client'
11
+ ```
12
12
 
13
- ```sh
13
+ and then 'bundle install'.
14
+
15
+ Since playwright-ruby-client doesn't include the playwright driver, **we have to install [playwright](https://github.com/microsoft/playwright) in advance**.
16
+
17
+ ```
14
18
  npm install playwright
15
19
  ./node_modules/.bin/playwright install
16
20
  ```
17
21
 
18
- and then, set `playwright_cli_executable_path: ./node_modules/.bin/playwright` at `Playwright.create`.
22
+ And set `playwright_cli_executable_path: './node_modules/.bin/playwright'`
19
23
 
20
- Instead of npm install, you can also directly download playwright driver from playwright.azureedge.net/builds/. The URL can be easily detected from [here](https://github.com/microsoft/playwright-python/blob/79f6ce0a6a69c480573372706df84af5ef99c4a4/setup.py#L56-L61)
24
+ **Prefer playwrighting without Node.js?**
25
+
26
+ Instead of npm, you can also directly download playwright driver from playwright.azureedge.net/builds/. The URL can be easily detected from [here](https://github.com/microsoft/playwright-python/blob/cb5409934629adaabc0cff1891080de2052fa778/setup.py#L73-L77)
21
27
 
22
28
  ### Capture a site
23
29
 
24
30
  ```ruby
25
31
  require 'playwright'
26
32
 
27
- Playwright.create(playwright_cli_executable_path: '/path/to/playwright') do |playwright|
33
+ Playwright.create(playwright_cli_executable_path: './node_modules/.bin/playwright') do |playwright|
28
34
  playwright.chromium.launch(headless: false) do |browser|
29
35
  page = browser.new_page
30
36
  page.goto('https://github.com/YusukeIwaki')
@@ -45,18 +51,24 @@ Playwright.create(playwright_cli_executable_path: './node_modules/.bin/playwrigh
45
51
  page = browser.new_page
46
52
  page.goto('https://github.com/')
47
53
 
48
- form = page.query_selector("form.js-site-search-form")
49
- search_input = form.query_selector("input.header-search-input")
50
- search_input.click
54
+ page.get_by_placeholder("Search or jump to...").click
55
+ page.locator('input[name="query-builder-test"]').click
56
+
57
+ expect(page.keyboard).to be_a(::Playwright::Keyboard)
58
+
51
59
  page.keyboard.type("playwright")
52
60
  page.expect_navigation {
53
61
  page.keyboard.press("Enter")
54
62
  }
55
63
 
56
- list = page.query_selector("ul.repo-list")
57
- items = list.query_selector_all("div.f4")
58
- items.each do |item|
59
- title = item.eval_on_selector("a", "a => a.innerText")
64
+ list = page.get_by_test_id('results-list').locator('.search-title')
65
+
66
+ # wait for item to appear
67
+ list.first.wait_for
68
+
69
+ # list them
70
+ list.locator('.search-title').all.each do |item|
71
+ title = item.text_content
60
72
  puts("==> #{title}")
61
73
  end
62
74
  end
@@ -147,6 +159,38 @@ end
147
159
 
148
160
  ```
149
161
 
162
+ ### Communicate with Playwright server
163
+
164
+ If your environment doesn't accept installing browser or creating browser process, consider separating Ruby client and Playwright server.
165
+
166
+ ![structure](https://user-images.githubusercontent.com/11763113/124934448-ad4d0700-e03f-11eb-942e-b9f3282bb703.png)
167
+
168
+ For launching Playwright server, just execute:
169
+
170
+ ```
171
+ npx playwright install && npx playwright run-server --port 8080 --path /ws
172
+ ```
173
+
174
+ and we can connect to the server with the code like this:
175
+
176
+ ```ruby
177
+ Playwright.connect_to_playwright_server('ws://127.0.0.1:8080/ws?browser=chromium') do |playwright|
178
+ playwright.chromium.launch do |browser|
179
+ page = browser.new_page
180
+ page.goto('https://github.com/YusukeIwaki')
181
+ page.screenshot(path: './YusukeIwaki.png')
182
+ end
183
+ end
184
+ ```
185
+
186
+ When `Playwright.connect_to_playwright_server` is used, playwright_cli_executable_path is not required.
187
+
188
+ For more detailed instraction, refer this article: https://playwright-ruby-client.vercel.app/docs/article/guides/playwright_on_alpine_linux
189
+
190
+ ## Contributing
191
+
192
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contributing guidelines.
193
+
150
194
  ## License
151
195
 
152
196
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,33 @@
1
+ # Website
2
+
3
+ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4
+
5
+ ## Installation
6
+
7
+ ```console
8
+ yarn install
9
+ ```
10
+
11
+ ## Local Development
12
+
13
+ ```console
14
+ yarn start
15
+ ```
16
+
17
+ This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18
+
19
+ ## Build
20
+
21
+ ```console
22
+ yarn build
23
+ ```
24
+
25
+ This command generates static content into the `build` directory and can be served using any static contents hosting service.
26
+
27
+ ## Deployment
28
+
29
+ ```console
30
+ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31
+ ```
32
+
33
+ If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3
+ };
@@ -0,0 +1,7 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # APIRequest
6
+
7
+ Not Implemented