Skip to content

Command Line Options

Mark Watson edited this page Oct 11, 2016 · 5 revisions

PizzaScript Editor

pizzascript-ide [options] [filename]

  -console / -c   start on the console (no gui)
  -har            save a HTTP Archive file after running console script
  -help / -h      print this help
  -version / -v   print the version number

Open File in the Editor

bin/pizzascript-ide scripts/google.js

A new editor will be launched each time.

Open Scripting Console

If you don't want to open the editor, but still want to control the browser interactively you can type the following:

bin/pizzascript-ide -console
>> var b = pizza.open("www.google.com")
Launched Chrome version 51.0.2704.103
>> b.query("input[name='q']")
[
  {
    "path": "#lst-ib",
    "visible": true,
    "pos": {
      "top": 328,
      "left": 291.5,
      "width": 425,
      "height": 26
    },
    "attributes": {
      "aria-autocomplete": "both",
      "role": "combobox",
      "autocomplete": "off",
      "maxlength": "2048",
      "aria-haspopup": "false",
      "dir": "ltr",
      "title": "Search",
      "type": "text",
      "spellcheck": "false",
      "name": "q",
      "id": "lst-ib",
      "class": "gsfi lst-d-f",
      "value": "",
      "aria-label": "Search"
    },
    "tag": "input",
    "zIndex": "6"
  }
]
>> b.close();
Closing Chrome...
>> exit()

This can be useful if you want to run the browser headless, or only have SSH access to a machine.

PizzaScript Test Runner

PizzaScript: 0.2.6

pizzascript [options] [file]|[directory]

  --help / -h          print this help
  --junit              save output in junit format junit.xml under directory specified by -output
                       defaults to results-<timestamp>/junit.xml
  --output / -o <dir>  output screenshots and other results to this directory
                       output dir can be specified in json file
                       defaults to results-<timestamp>
  --set / -s <setting> override a setting from settings.ini
                       --set / -s can be repeated to override multiple settings
  --timeout / -t <t>   specify a per test timeout in seconds
                       default is no timeout
  --version / -v       print the version number

Run a file:
  pizzascript filename.js

Run all files in a directory (each file is ran as a separate test):
  pizzascript dir

Run all tests specified by json config file (must end with .json):
  pizzascript tests.json

Run all files in a directory with a timeout of 7.5 secs per test:
  pizzascript dir -t 7.5

Run a Script

To run a script and generate a screenshot, HAR file and log files:

bin/pizzascript scripts/google.js

If the script fails the command will exit with a status code of 1 and the error will be printed to <stderr>.

TypeError: Cannot find function doesNotExist

Details of all the pages and HTTP items downloaded can be saved off into a Http Archive file.

Clone this wiki locally