[PR #1738] Consolidate Chrome test helpers across all plugin tests #2995

Closed
opened 2026-03-01 18:01:21 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/ArchiveBox/ArchiveBox/pull/1738

State: closed
Merged: Yes


Summary

Related issues

Changes these areas

  • Bugfixes
  • Feature behavior
  • Command line interface
  • Configuration options
  • Internal architecture
  • Snapshot data layout on disk

Summary by cubic

Consolidated Chrome test helpers and centralized path/Chrome logic to chrome_utils.js, removing duplicated code across plugin tests and adding reliable helpers for launching and cleaning up Chrome. Tests are simpler, more consistent, and add SingleFile CDP coverage.

  • New Features

    • chrome_utils.js exposes getMachineType, getLibDir, getNodeModulesDir, getExtensionsDir, getTestEnv, killChrome CLI commands.
    • New Python helpers in chrome_test_helpers.py delegate to JS with Python fallbacks: get_machine_type, get_lib_dir, get_node_modules_dir, get_extensions_dir, find_chromium, kill_chrome, get_test_env.
    • Test utilities: get_plugin_dir, get_hook_script, run_hook, parse_jsonl_output, run_hook_and_parse, chromium_session context manager, setup_test_env, launch_chromium_session, kill_chromium_session, plus lazy LIB_DIR and NODE_MODULES_DIR.
    • SingleFile tests now verify CDP connection to an existing Chrome session and disabled behavior.
  • Refactors

    • Updated all plugin tests (ublock, twocaptcha, istilldontcareaboutcookies, screenshot, dom, pdf, singlefile, favicon, readability, mercury, title) to use shared helpers.
    • Large removal of duplicated setup/teardown, path, and Chrome code across tests.
    • singlefile hook no longer hardcodes Chrome binary search; relies on CHROME_BINARY and centralized findChromium.
    • All Chrome cleanup paths use killChrome from JS for consistent process handling.

Written for commit 1cfb77a355. Summary will update on new commits.

**Original Pull Request:** https://github.com/ArchiveBox/ArchiveBox/pull/1738 **State:** closed **Merged:** Yes --- <!-- IMPORTANT: Do not submit PRs with only formatting / PEP8 / line length changes. --> # Summary <!--e.g. This PR fixes ABC or adds the ability to do XYZ...--> # Related issues <!-- e.g. #123 or Roadmap goal # https://github.com/pirate/ArchiveBox/wiki/Roadmap --> # Changes these areas - [ ] Bugfixes - [ ] Feature behavior - [ ] Command line interface - [ ] Configuration options - [ ] Internal architecture - [ ] Snapshot data layout on disk <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Consolidated Chrome test helpers and centralized path/Chrome logic to chrome_utils.js, removing duplicated code across plugin tests and adding reliable helpers for launching and cleaning up Chrome. Tests are simpler, more consistent, and add SingleFile CDP coverage. - **New Features** - chrome_utils.js exposes getMachineType, getLibDir, getNodeModulesDir, getExtensionsDir, getTestEnv, killChrome CLI commands. - New Python helpers in chrome_test_helpers.py delegate to JS with Python fallbacks: get_machine_type, get_lib_dir, get_node_modules_dir, get_extensions_dir, find_chromium, kill_chrome, get_test_env. - Test utilities: get_plugin_dir, get_hook_script, run_hook, parse_jsonl_output, run_hook_and_parse, chromium_session context manager, setup_test_env, launch_chromium_session, kill_chromium_session, plus lazy LIB_DIR and NODE_MODULES_DIR. - SingleFile tests now verify CDP connection to an existing Chrome session and disabled behavior. - **Refactors** - Updated all plugin tests (ublock, twocaptcha, istilldontcareaboutcookies, screenshot, dom, pdf, singlefile, favicon, readability, mercury, title) to use shared helpers. - Large removal of duplicated setup/teardown, path, and Chrome code across tests. - singlefile hook no longer hardcodes Chrome binary search; relies on CHROME_BINARY and centralized findChromium. - All Chrome cleanup paths use killChrome from JS for consistent process handling. <sup>Written for commit 1cfb77a35598994b4898060a2177f63f40c85d7f. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. -->
kerem 2026-03-01 18:01:21 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#2995
No description provided.