Files
camoufox/tests
Ruben Vereecken 0830d36e47 Add config_overrides to generate_context_fingerprint(), fix font spacing disable (#601)
* Add system-ui font spoofing patch

GetSystemUIFontFamilies() now reads navigator.platform from MaskConfig
and returns the appropriate system font (Helvetica for macOS, Segoe UI
for Windows) before falling through to LookAndFeel::GetFont. Fixes the
CreepJS headless.systemFonts "Sans:Linux" leak when spoofing macOS from
Linux.

* Add patch verification test for system-ui font spoofing

Tests macOS and Windows presets: launches Camoufox with a fingerprint,
measures canvas text width with unquoted system-ui, asserts it matches
the expected system font (Helvetica / Segoe UI).

* Rename test to match patch naming convention

tests/patches/ files should mirror patch names, not use dated prefixes.

* Add config_overrides param to generate_context_fingerprint()

There was no clean way to override config values (like disabling font
spacing perturbation with fonts:spacing_seed=0) because init_script is
rendered inside generate_context_fingerprint() — by the time the caller
gets the config dict back, the init_script string is already baked.

config_overrides is applied after all config building (preset/seeds/
timezone/locale) but before init_script rendering, giving callers a
clean override point without touching the preset (which represents
real device data, not perturbation config).

The longer-term fix is separating config building from init_script
rendering so callers can modify config and re-render. config_overrides
is the minimal API addition that unblocks the use case without that
refactor.

* Rename test to match patch naming convention
2026-05-08 19:04:14 -04:00
..
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00
2024-11-03 06:14:39 -06:00

Camoufox Tests

Ensures that Playwright functionality is not broken.


This directory is based on the original Playwright-Python tests.

It has been modified to skip tests that use the following features:

  • Injecting JavaScript into the page or writing to DOM. Camoufox's page.evaluate only supports reading values, not executing within the page context.
  • Overriding the User-Agent.
  • Any tests specific to Chromium or Webkit.

Usage

Setting up the environment

Cd to this directory and run the following command to setup the venv and install the dependencies:

bash setup-venv.sh

Running the tests

Run via the shell script:

bash run-tests.sh --headful --executable-path /path/to/camoufox-bin

Or through the Makefile:

make tests headful=true