google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.89k stars 815 forks source link

enable complex arguments for fidelity test command #4544

Closed bhouston closed 11 months ago

bhouston commented 11 months ago

This is very similar to this other PR where I add CLI options to the "update-screenshots" command: #4542

This implements this idea #4536, but for the "test" command:

Options:
      --version   Show version number                                  [boolean]
  -c, --config    Path to configuration json                 [string] [required]
  -s, --scenario  Limit to specific scenarios                            [array]
  -p, --port      Port for web server                   [number] [default: 9030]
  -d, --dry-run   Checks that all comparison images exist
                                                      [boolean] [default: false]
  -q, --quiet     Hide the puppeteer controlled browser
                                                      [boolean] [default: false]
  -h, --help      Show help                                            [boolean]

To run the new test ci command, use this command line:

% npm run test -- --scenario=texture --quiet

Explanation of the new features: --scenario, this now also allows you to specify multiple scenarios in the whitelist, rather than only one. It now also selects scenarios based on being a subset of the config.json scenario name, thus you can run all tests that contain say "transform" or "clearcoat". --missing-only is very useful when I add new tests and I don't want to render all other tests just to get goldens for the new ones. --dry-run, when I want to figure out which goldens are missing. --quiet, I can run the test in the background. Also gives about a 10% speed boost on my machine. --port, allows me to run two of these at the same time, useful when I want to run two different renderers at the same time, or work on two separate branches simultaneously.

bhouston commented 11 months ago

I've merged this PR into here: https://github.com/google/model-viewer/pull/4542