[probes] Add more typing information to probes

- Annotate more function params with types
- Conditionally import crossbench in probes only for type checking

- fix mock browser setup

Change-Id: Iaf81b71afd6c19e257be9afc4660753c42dcac93
Reviewed-on: https://chromium-review.googlesource.com/c/crossbench/+/3902051
Reviewed-by: Alexander Schulze <alexschulze@chromium.org>
12 files changed
tree: 5f52d6dfa3cf873b816fe0fa56448148d76541d3
  1. crossbench/
  2. docs/
  3. tests/
  4. .gitignore
  5. .pylintrc
  6. .style.yapf
  7. browser.config.example.hjson
  10. poetry.lock
  11. pyproject.toml
  12. README.chromium
  13. README.md
  14. scripts.py


Crossbench is a cross-browser/cross-benchmark runner to extract performance numbers.

This project uses poetry deps and package scripts to setup the correct environment for testing and debugging.

pip3 install poetry

Example usage:

poetry run crossbench speedometer_2.0 \
    --browser=/path/to/chromium \
    --stories=VanillaJS.* \
    --probe=profiling \

Describe all subcommands with stories and all probes:

poetry run crossbench describe

Main Components

Browsers : Interface to start, interact and stop browsers. The main implementions use selenium for maximum system independence.

Probes : Probes define a way to extract arbitrary (performance) numbers from a host or running browser. This can reach from running simple JS-snippets to extract page-specific numbers to system-wide profiling.

Stories : Stories define sequences of browser interactions. This can be simply loading a URL and waiting for a given period of time, or in more complex scenarios, actively interact with a page and navigate multiple times.