browser-tools 0.4.0__tar.gz → 0.5.0__tar.gz

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 (163) hide show
  1. {browser_tools-0.4.0 → browser_tools-0.5.0}/PKG-INFO +5 -2
  2. {browser_tools-0.4.0 → browser_tools-0.5.0}/README.md +2 -0
  3. {browser_tools-0.4.0 → browser_tools-0.5.0}/pyproject.toml +3 -2
  4. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/GUIDE.txt +37 -3
  5. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/cli.py +24 -0
  6. browser_tools-0.5.0/tests/parity/test_camoufox_live_launch.py +160 -0
  7. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_e2e_camoufox.py +14 -4
  8. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_guide.py +67 -0
  9. {browser_tools-0.4.0 → browser_tools-0.5.0}/.gitignore +0 -0
  10. {browser_tools-0.4.0 → browser_tools-0.5.0}/LICENSE +0 -0
  11. {browser_tools-0.4.0 → browser_tools-0.5.0}/NOTICE +0 -0
  12. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/__init__.py +0 -0
  13. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/camoufox_runner.py +0 -0
  14. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/cdp_client.py +0 -0
  15. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/cdp_constants.py +0 -0
  16. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/cdp_handler.py +0 -0
  17. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/__init__.py +0 -0
  18. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/attach.py +0 -0
  19. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/cdp_client.py +0 -0
  20. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/connection.py +0 -0
  21. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/__init__.py +0 -0
  22. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/accessibility.py +0 -0
  23. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/animation.py +0 -0
  24. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/audits.py +0 -0
  25. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/autofill.py +0 -0
  26. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/background_service.py +0 -0
  27. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/bluetooth_emulation.py +0 -0
  28. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/browser.py +0 -0
  29. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/cache_storage.py +0 -0
  30. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/cast.py +0 -0
  31. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/console.py +0 -0
  32. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/css.py +0 -0
  33. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/debugger.py +0 -0
  34. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/device_access.py +0 -0
  35. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/device_orientation.py +0 -0
  36. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/dom.py +0 -0
  37. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/dom_debugger.py +0 -0
  38. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/dom_snapshot.py +0 -0
  39. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/dom_storage.py +0 -0
  40. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/emulation.py +0 -0
  41. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/event_breakpoints.py +0 -0
  42. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/extensions.py +0 -0
  43. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/fed_cm.py +0 -0
  44. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/fetch.py +0 -0
  45. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/file_system.py +0 -0
  46. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/headless_experimental.py +0 -0
  47. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/heap_profiler.py +0 -0
  48. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/indexed_db.py +0 -0
  49. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/input.py +0 -0
  50. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/inspector.py +0 -0
  51. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/io.py +0 -0
  52. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/layer_tree.py +0 -0
  53. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/log.py +0 -0
  54. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/media.py +0 -0
  55. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/memory.py +0 -0
  56. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/network.py +0 -0
  57. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/overlay.py +0 -0
  58. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/page.py +0 -0
  59. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/performance.py +0 -0
  60. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/performance_timeline.py +0 -0
  61. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/preload.py +0 -0
  62. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/profiler.py +0 -0
  63. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/pwa.py +0 -0
  64. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/runtime.py +0 -0
  65. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/schema.py +0 -0
  66. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/security.py +0 -0
  67. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/service_worker.py +0 -0
  68. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/smart_card_emulation.py +0 -0
  69. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/storage.py +0 -0
  70. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/system_info.py +0 -0
  71. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/target.py +0 -0
  72. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/tethering.py +0 -0
  73. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/tracing.py +0 -0
  74. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/web_audio.py +0 -0
  75. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/domains/web_authn.py +0 -0
  76. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/errors.py +0 -0
  77. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/fingerprint.py +0 -0
  78. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/instance_status.py +0 -0
  79. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/launcher.py +0 -0
  80. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/protocol.py +0 -0
  81. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/registry.py +0 -0
  82. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/supervisor.py +0 -0
  83. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/core/utils.py +0 -0
  84. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/curated.py +0 -0
  85. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/detect_interstitial.js +0 -0
  86. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/endpoint.py +0 -0
  87. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/events.py +0 -0
  88. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/extras.py +0 -0
  89. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/frame_manager.py +0 -0
  90. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/interstitial.py +0 -0
  91. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/lifecycle.py +0 -0
  92. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/list_verbs.py +0 -0
  93. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/mcp_response.py +0 -0
  94. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/native_interaction.py +0 -0
  95. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/native_snapshot.py +0 -0
  96. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/one_shot.py +0 -0
  97. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/passthrough.py +0 -0
  98. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/process_utils.py +0 -0
  99. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/profiler.py +0 -0
  100. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/screencast.py +0 -0
  101. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/screenshot_utils.py +0 -0
  102. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/tool_registry.py +0 -0
  103. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/usage.py +0 -0
  104. {browser_tools-0.4.0 → browser_tools-0.5.0}/src/browser_tools/user_settings.py +0 -0
  105. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/conftest.py +0 -0
  106. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/CORPUS.md +0 -0
  107. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/camoufox_session.py +0 -0
  108. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/conftest.py +0 -0
  109. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/dynamic.html +0 -0
  110. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/form.html +0 -0
  111. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/iframe.html +0 -0
  112. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/iframe_child.html +0 -0
  113. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/plain.html +0 -0
  114. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/fixtures/shadow.html +0 -0
  115. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/live_chromium.py +0 -0
  116. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/node_broker.py +0 -0
  117. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/parity_comparison.py +0 -0
  118. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/parity_corpus.py +0 -0
  119. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/parity_engines.py +0 -0
  120. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/run_baseline.py +0 -0
  121. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_camoufox_session.py +0 -0
  122. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_node_broker.py +0 -0
  123. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_baseline.py +0 -0
  124. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_corpus.py +0 -0
  125. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_engine.py +0 -0
  126. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_gate.py +0 -0
  127. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_native.py +0 -0
  128. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_native_interaction.py +0 -0
  129. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/parity/test_parity_operator.py +0 -0
  130. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_async_discovery.py +0 -0
  131. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_cdp_client.py +0 -0
  132. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_cli_grammar.py +0 -0
  133. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_cli_lifecycle.py +0 -0
  134. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_cli_surface.py +0 -0
  135. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_core_launcher.py +0 -0
  136. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_curated_verbs.py +0 -0
  137. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_detached_tasks.py +0 -0
  138. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_diagnostics_name_real_verbs.py +0 -0
  139. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_endpoint.py +0 -0
  140. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_events.py +0 -0
  141. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_frame_manager.py +0 -0
  142. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_interaction_targeting.py +0 -0
  143. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_interstitial.py +0 -0
  144. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_list_verbs.py +0 -0
  145. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_native_backend.py +0 -0
  146. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_native_interaction.py +0 -0
  147. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_native_snapshot.py +0 -0
  148. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_new_tools.py +0 -0
  149. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_one_shot.py +0 -0
  150. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_packaging.py +0 -0
  151. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_passthrough.py +0 -0
  152. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_profile_liveness.py +0 -0
  153. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_profile_path_hardening.py +0 -0
  154. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_profile_root_move.py +0 -0
  155. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_profile_verbs.py +0 -0
  156. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_profiler.py +0 -0
  157. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_retained_contracts.py +0 -0
  158. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_stop_target.py +0 -0
  159. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_supervisor_document_liveness.py +0 -0
  160. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_supervisor_never_pauses.py +0 -0
  161. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_supervisor_profile_preservation.py +0 -0
  162. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_supervisor_visibility.py +0 -0
  163. {browser_tools-0.4.0 → browser_tools-0.5.0}/tests/test_window_marking.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: browser-tools
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Browser automation, debugging, and anti-detect browsing CLI
5
5
  Project-URL: Homepage, https://github.com/dungle-scrubs/browser-tools
6
6
  Project-URL: Repository, https://github.com/dungle-scrubs/browser-tools
7
7
  Project-URL: Issues, https://github.com/dungle-scrubs/browser-tools/issues
8
- Project-URL: Changelog, https://github.com/dungle-scrubs/browser-tools/blob/main/CHANGELOG.md
8
+ Project-URL: Changelog, https://github.com/dungle-scrubs/browser-tools/releases
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE
11
11
  License-File: NOTICE
@@ -19,6 +19,7 @@ Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Programming Language :: Python :: 3
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
21
  Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
22
23
  Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
23
24
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
25
  Classifier: Topic :: Software Development :: Testing
@@ -63,6 +64,8 @@ Browser automation, debugging, and anti-detect browsing CLI. Provides:
63
64
  - **Anything else CDP can do** - File upload, viewport emulation, cookies,
64
65
  PDF export and page management have no curated verb and need none; `bt
65
66
  guide` has a worked example of each
67
+ - **CPU profiling** - `browser-tools-profiler`, a second command installed
68
+ alongside `bt`, with timed capture and threshold-triggered capture
66
69
 
67
70
  ## Quick Start
68
71
 
@@ -24,6 +24,8 @@ Browser automation, debugging, and anti-detect browsing CLI. Provides:
24
24
  - **Anything else CDP can do** - File upload, viewport emulation, cookies,
25
25
  PDF export and page management have no curated verb and need none; `bt
26
26
  guide` has a worked example of each
27
+ - **CPU profiling** - `browser-tools-profiler`, a second command installed
28
+ alongside `bt`, with timed capture and threshold-triggered capture
27
29
 
28
30
  ## Quick Start
29
31
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "browser-tools"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Browser automation, debugging, and anti-detect browsing CLI"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -23,6 +23,7 @@ classifiers = [
23
23
  "Operating System :: POSIX :: Linux",
24
24
  "Programming Language :: Python :: 3",
25
25
  "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
26
27
  "Programming Language :: Python :: 3 :: Only",
27
28
  "Topic :: Internet :: WWW/HTTP :: Browsers",
28
29
  "Topic :: Software Development :: Libraries :: Python Modules",
@@ -65,7 +66,7 @@ all = [
65
66
  Homepage = "https://github.com/dungle-scrubs/browser-tools"
66
67
  Repository = "https://github.com/dungle-scrubs/browser-tools"
67
68
  Issues = "https://github.com/dungle-scrubs/browser-tools/issues"
68
- Changelog = "https://github.com/dungle-scrubs/browser-tools/blob/main/CHANGELOG.md"
69
+ Changelog = "https://github.com/dungle-scrubs/browser-tools/releases"
69
70
 
70
71
  [project.scripts]
71
72
  browser-tools = "browser_tools.cli:main"
@@ -1,7 +1,14 @@
1
1
  browser-tools / bt -- the agent manual
2
2
 
3
- This is the whole CLI. Reading it is enough to drive a browser with this tool;
4
- nothing else needs to be read first. `bt guide` prints it.
3
+ This is the whole of `bt`. Reading it is enough to drive a browser with this
4
+ tool; nothing else needs to be read first. `bt guide` prints it.
5
+
6
+ The install also puts down `browser-tools-profiler`, a separate command for
7
+ CPU profiling. It is the last section here.
8
+
9
+ `bt --version` prints the installed version. Check it first when behaviour
10
+ does not match this manual: an older copy earlier on PATH answers the same
11
+ verbs and answers them differently.
5
12
 
6
13
  The tool tracks named browser instances in a registry. Each instance is one
7
14
  running browser process, named after the directory it was launched from.
@@ -291,7 +298,8 @@ WHAT DOES NOT CARRY BETWEEN INVOCATIONS
291
298
  (exit 1). Any enable-then-collect pair split across two commands fails the
292
299
  same way. This is why console-list and network-list take a --duration and
293
300
  do their own enable inside one invocation, rather than offering a start
294
- and a stop.
301
+ and a stop, and why CPU profiling is its own command rather than a verb
302
+ here. See CPU PROFILING at the end.
295
303
 
296
304
  A JavaScript dialog, and there is no way around this one. A dialog opened
297
305
  by one invocation is invisible to the next: Page.handleJavaScriptDialog
@@ -459,6 +467,32 @@ EXTERNAL BROWSERS
459
467
  process holds.
460
468
 
461
469
 
470
+ CPU PROFILING
471
+
472
+ `browser-tools-profiler` is installed next to `bt` and profiles the page's
473
+ JavaScript. It is a separate command because a profile is an
474
+ enable-start-stop sequence, and those cannot be split across `bt`
475
+ invocations; see WHAT DOES NOT CARRY BETWEEN INVOCATIONS.
476
+
477
+ It takes a debug port, not an instance name, so read the port out of
478
+ `bt status` or the JSON `bt launch` printed. The default is 9222, which is
479
+ whatever happens to be on that port rather than an instance you named, so
480
+ pass --port.
481
+
482
+ browser-tools-profiler --port PORT [--format text|json] timed
483
+ [--duration SECONDS]
484
+ Profile for a fixed window, 5 seconds by default, and print the
485
+ functions by self time.
486
+
487
+ browser-tools-profiler --port PORT [--format text|json] watch
488
+ [--threshold PERCENT] [--timeout SECONDS] [--window SECONDS]
489
+ Wait until CPU crosses the threshold (80 percent by default), then
490
+ capture for --window seconds. Gives up after --timeout.
491
+
492
+ --format json prints a JSON array of {name, url, line, selfTime,
493
+ hitCount}. --format text is the default and is for a person.
494
+
495
+
462
496
  OUTPUT AND EXIT CODES
463
497
 
464
498
  Machine-readable output goes to stdout; diagnostics go to stderr.
@@ -87,12 +87,36 @@ def _add_endpoint(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
87
87
  return parser
88
88
 
89
89
 
90
+ def _installed_version() -> str:
91
+ """The running build's version, read from the installed distribution.
92
+
93
+ Never a literal here. `__version__` was hardcoded once and read "0.1.0"
94
+ through two releases, which is the failure this flag exists to expose.
95
+ """
96
+ from importlib import metadata
97
+
98
+ try:
99
+ return metadata.version("browser-tools")
100
+ except metadata.PackageNotFoundError: # a source checkout, never installed
101
+ return "0.0.0+unknown"
102
+
103
+
90
104
  def build_parser() -> argparse.ArgumentParser:
91
105
  """Build the top-level parser and its lifecycle subcommands."""
92
106
  parser = argparse.ArgumentParser(
93
107
  prog=PROG,
94
108
  description="Registry-backed browser lifecycle (launch, status, stop, cleanup, guide).",
95
109
  )
110
+ # Which build is on PATH is the first thing to establish when behaviour
111
+ # does not match the manual. A stale copy from an older install answers
112
+ # the same verbs and answers them differently, and without this the only
113
+ # way to tell was to read a UID and recognise the format.
114
+ parser.add_argument(
115
+ "--version",
116
+ action="version",
117
+ version=f"%(prog)s {_installed_version()}",
118
+ help="Print the installed version and exit",
119
+ )
96
120
  sub = parser.add_subparsers(dest="command", metavar="VERB")
97
121
 
98
122
  launch = sub.add_parser("launch", help="Launch a browser and register it")
@@ -0,0 +1,160 @@
1
+ """A real `launch --engine camoufox`, against the product path.
2
+
3
+ Camoufox is a headline capability and nothing exercised it live. What
4
+ coverage existed was mocked in three separate ways, none of which starts a
5
+ browser:
6
+
7
+ - ``test_cli_lifecycle.py::test_camoufox_engine_launches_and_registers``
8
+ stubs ``_spawn_camoufox_process``, so the spawn itself never runs.
9
+ - ``tests/parity/test_e2e_camoufox.py`` says it launches a real browser, and
10
+ ``tests/parity/conftest.py`` patches ``camoufox_session.Camoufox`` out from
11
+ under it. It drives ``CamoufoxSession``, which its own docstring calls a
12
+ test oracle and not a product surface: ``launch --engine camoufox`` goes
13
+ through ``lifecycle`` into ``camoufox_runner`` and never touches it.
14
+ - The parity suite compares snapshot engines, not the launcher.
15
+
16
+ So the path a user takes had no test proving a Camoufox process starts,
17
+ registers with ``engine="camoufox"``, reports alive through the engine-aware
18
+ liveness rule, and stops cleanly.
19
+
20
+ This test takes it. It skips when the Camoufox browser is not fetched,
21
+ because fetching it is a large download CI should not carry, so CI reports a
22
+ skip rather than a false pass. Run it where the browser exists:
23
+
24
+ camoufox fetch
25
+ pytest tests/parity/test_camoufox_live_launch.py -v
26
+
27
+ TWO LAUNCHES, NOT FIVE. Camoufox is a Firefox build and takes seconds to
28
+ reach readiness; ``_CAMOUFOX_READY_TIMEOUT`` bounds the wait. A
29
+ function-scoped fixture launched one browser per test, which passed alone
30
+ and hit the timeout when this module ran beside the rest of the parity
31
+ suite. The read-only assertions therefore share one module-scoped browser,
32
+ and only the stop test launches its own, because it destroys what it
33
+ launches.
34
+ """
35
+
36
+ from __future__ import annotations
37
+
38
+ import contextlib
39
+ import json
40
+ import os
41
+ import subprocess
42
+ from pathlib import Path
43
+ from typing import TYPE_CHECKING, Any
44
+
45
+ import pytest
46
+
47
+ from browser_tools import lifecycle
48
+
49
+ if TYPE_CHECKING:
50
+ from collections.abc import Iterator
51
+
52
+ pytestmark = pytest.mark.parity
53
+
54
+
55
+ def _camoufox_is_fetched() -> bool:
56
+ """True when the Camoufox browser itself is on disk, not just the package.
57
+
58
+ The Python package importing is not enough: ``camoufox fetch`` downloads
59
+ the browser separately, and a launch without it fails at spawn.
60
+ """
61
+ try:
62
+ import camoufox # noqa: F401
63
+ except ImportError:
64
+ return False
65
+ candidates = [
66
+ Path.home() / ".cache" / "camoufox",
67
+ Path.home() / "Library" / "Caches" / "camoufox",
68
+ Path(os.environ.get("XDG_CACHE_HOME", "/nonexistent")) / "camoufox",
69
+ ]
70
+ return any(path.is_dir() and any(path.iterdir()) for path in candidates)
71
+
72
+
73
+ requires_camoufox = pytest.mark.skipif(
74
+ not _camoufox_is_fetched(),
75
+ reason="the Camoufox browser is not fetched; run `camoufox fetch`",
76
+ )
77
+
78
+
79
+ def _process_alive(pid: int) -> bool:
80
+ return subprocess.run(["ps", "-p", str(pid)], capture_output=True).returncode == 0
81
+
82
+
83
+ @pytest.fixture(scope="module")
84
+ def live(tmp_path_factory: pytest.TempPathFactory) -> Iterator[dict[str, Any]]:
85
+ """One real headless Camoufox for the read-only assertions.
86
+
87
+ Module-scoped, so ``monkeypatch`` is unavailable and the environment is
88
+ set through ``MonkeyPatch`` directly. The registry is a temp file, so
89
+ nothing here can see or stop an instance the user is running.
90
+ """
91
+ if not _camoufox_is_fetched():
92
+ pytest.skip("the Camoufox browser is not fetched")
93
+ base = tmp_path_factory.mktemp("camoufox-live")
94
+ registry = str(base / "registry.json")
95
+ patch = pytest.MonkeyPatch()
96
+ patch.setenv(lifecycle.PROFILES_ENV_VAR, str(base / "profiles"))
97
+ instance = None
98
+ try:
99
+ instance = lifecycle.launch(engine="camoufox", headless=True, registry_path=registry)
100
+ yield {"instance": instance, "registry": registry, "base": base}
101
+ finally:
102
+ # Teardown must not mask a failure, and must not leave a browser
103
+ # running when the test already failed for its own reason.
104
+ if instance is not None:
105
+ with contextlib.suppress(Exception):
106
+ lifecycle.stop(instance.name, registry_path=registry)
107
+ patch.undo()
108
+
109
+
110
+ @requires_camoufox
111
+ class TestARealCamoufoxLaunch:
112
+ def test_it_registers_as_camoufox(self, live):
113
+ instance, registry = live["instance"], live["registry"]
114
+ assert instance.engine == "camoufox"
115
+ assert instance.pid > 0
116
+ raw = json.loads(Path(registry).read_text())
117
+ assert raw[instance.name]["engine"] == "camoufox"
118
+ assert raw[instance.name]["pid"] == instance.pid
119
+
120
+ def test_the_process_is_actually_running(self, live):
121
+ """A registry row is not a browser. Ask the operating system."""
122
+ assert _process_alive(live["instance"].pid), "no process with that pid"
123
+
124
+ def test_liveness_reports_it_alive(self, live):
125
+ """Engine-aware liveness: process identity plus a user-data-dir hold."""
126
+ rows = lifecycle.status(registry_path=live["registry"])
127
+ row = next(r for r in rows if r["name"] == live["instance"].name)
128
+ assert row["alive"] is True
129
+ assert row["engine"] == "camoufox"
130
+
131
+ def test_an_unbound_session_dir_stays_out_of_the_profile_root(self, live):
132
+ """CONTEXT.md, Profile Root: nothing throwaway lands in durable storage."""
133
+ profile_root = live["base"] / "profiles"
134
+ assert profile_root not in Path(live["instance"].user_data_dir).parents
135
+ assert live["instance"].profile is None
136
+
137
+
138
+ @requires_camoufox
139
+ def test_stop_retires_the_entry_and_ends_the_process(
140
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
141
+ ) -> None:
142
+ """Its own browser, because it destroys the one it launches."""
143
+ monkeypatch.setenv(lifecycle.PROFILES_ENV_VAR, str(tmp_path / "profiles"))
144
+ registry = str(tmp_path / "registry.json")
145
+ instance = lifecycle.launch(engine="camoufox", headless=True, registry_path=registry)
146
+ try:
147
+ assert _process_alive(instance.pid)
148
+ lifecycle.stop(instance.name, registry_path=registry)
149
+ rows = lifecycle.status(registry_path=registry)
150
+ assert all(r["name"] != instance.name for r in rows), "entry survived stop"
151
+ assert not _process_alive(instance.pid), "process outlived stop"
152
+ finally:
153
+ with contextlib.suppress(Exception):
154
+ lifecycle.stop(instance.name, registry_path=registry)
155
+
156
+
157
+ def test_the_skip_guard_can_say_no():
158
+ """A guard that cannot refuse would make every skip above meaningless."""
159
+ assert isinstance(_camoufox_is_fetched(), bool)
160
+ assert requires_camoufox.args[0] is not _camoufox_is_fetched()
@@ -1,7 +1,17 @@
1
- """E2E tests — launches real Camoufox browser. Requires `camoufox fetch`.
2
-
3
- Run with: pytest tests/test_e2e_camoufox.py -v
4
- Skip with: pytest tests/ --ignore=tests/test_e2e_camoufox.py
1
+ """CamoufoxSession's tool surface, against a mocked browser.
2
+
3
+ The name says e2e and this launches nothing. ``tests/parity/conftest.py``
4
+ patches ``camoufox_session.Camoufox``, so every test here runs against a
5
+ mock and the module completes in about a second. It was excluded from CI on
6
+ the belief that it needed a real browser; it does not, and the exclusion is
7
+ gone.
8
+
9
+ What it does cover is ``CamoufoxSession``'s ``call_tool`` contract. That
10
+ class is a test oracle for the ARIA parity baseline, not a product surface:
11
+ ``launch --engine camoufox`` goes through ``lifecycle`` into
12
+ ``camoufox_runner`` and never touches it. A real launch is covered by
13
+ ``test_camoufox_live_launch.py``, which skips when the browser is not
14
+ fetched.
5
15
  """
6
16
 
7
17
  from __future__ import annotations
@@ -382,6 +382,73 @@ class TestTheManualStatesWhatDoesNotCarry:
382
382
  # --------------------------------------------------------------------------- #
383
383
 
384
384
 
385
+ class TestTheSecondBinaryIsDocumented:
386
+ """`browser-tools-profiler` ships beside `bt` and the manual omitted it.
387
+
388
+ The manual opens by claiming to be everything a reader needs. It
389
+ described one of the two commands the install puts down, so CPU
390
+ profiling looked impossible when it is one command away.
391
+ """
392
+
393
+ def test_the_manual_names_it_in_the_opening(self, flat):
394
+ opening = flat[: flat.index("WHAT THIS IS FOR")]
395
+ assert "browser-tools-profiler" in opening
396
+
397
+ def test_there_is_a_section_for_it(self, flat):
398
+ assert "CPU PROFILING" in flat
399
+
400
+ @pytest.mark.parametrize("piece", ["timed", "watch", "--threshold", "--duration"])
401
+ def test_the_section_covers_its_surface(self, flat, piece):
402
+ section = flat[flat.index("CPU PROFILING"):]
403
+ assert piece in section
404
+
405
+ def test_it_says_the_port_is_not_an_instance_name(self, flat):
406
+ section = flat[flat.index("CPU PROFILING"):]
407
+ assert "takes a debug port, not an instance name" in section
408
+
409
+ def test_every_installed_console_script_is_documented(self):
410
+ """Read the entry points from pyproject, never from a list here."""
411
+ import tomllib
412
+ from pathlib import Path
413
+
414
+ pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
415
+ scripts = tomllib.loads(pyproject.read_text())["project"]["scripts"]
416
+ manual = flatten(lifecycle.guide_text())
417
+ missing = [name for name in scripts if name not in manual]
418
+ assert missing == [], f"console scripts with no manual entry: {missing}"
419
+
420
+
421
+ class TestTheVersionFlagIsDocumented:
422
+ """`--version` exists so a stale build on PATH is one command to find.
423
+
424
+ A copy from an older install answers every verb and answers some of
425
+ them differently. Before this flag the only way to tell was to run a
426
+ verb and recognise the shape of its output.
427
+ """
428
+
429
+ def test_the_manual_mentions_it(self, flat):
430
+ assert "`bt --version` prints the installed version" in flat
431
+
432
+ def test_the_manual_says_why_to_check_it(self, flat):
433
+ assert "older copy earlier on PATH" in flat
434
+
435
+ def test_the_flag_prints_the_installed_version(self):
436
+ from importlib import metadata
437
+
438
+ result = subprocess.run(
439
+ [sys.executable, "-m", "browser_tools.cli", "--version"],
440
+ capture_output=True,
441
+ text=True,
442
+ check=False,
443
+ )
444
+ assert result.returncode == 0
445
+ assert metadata.version("browser-tools") in result.stdout
446
+
447
+ def test_it_is_not_a_verb_and_needs_no_verb_entry(self, phrases):
448
+ """A flag, so the verb enumeration must not demand a section for it."""
449
+ assert "--version" not in phrases
450
+
451
+
385
452
  class TestGuidePrintsPlainText:
386
453
  def test_it_prints_plain_text_and_nothing_on_stderr(self):
387
454
  result = subprocess.run(
File without changes
File without changes
File without changes