Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

phantom js

Mario Nebl edited this page Dec 2, 2015 · 1 revision

PhantomJS

Zuul has builtin support for running your tests via PhantomJS allowing for fast test iteration during development using --phantom CLI flag.

Flags

--phantom # Run tests in PhantomJS instance
--phantom-remote-debugger-port=[port] # Wait for remote debugger on [port] before running tests
--phantom-remote-debugger-autorun # Run tests before remote debugger is connected

Usage

zuul --phantom -- test.js

The --phantom flag works much like the --local flag we saw in the quickstart except that it doesn't require you to open a browser and will report all test results on the command line.

In order for the --phantom flag to function, you will need to install the phantomJS node wrapper as a devDependency for your project as shown in the sample package.json file below.

{
  "devDependencies": {
    "zuul": "<zuul version>",
    "phantomjs": "<phantomjs version>"
  }
}

Debugging

In order to debug your PhantomJS runs you can provide the remote-debugger-port flag:

# Start PhantomJS waiting for remote debugger session on port 3000
zuul --phantom --phantom-remote-debugger-port=3000 -- test.js 

This will start a PhantomJS instance waiting for a remote debugger session to connect before executing any tests. See the PhantomJS documentation for directions about debugging.

To run your tests right away but allow for a remote debugging session specify the autorun flag

# Start PhantomJS running tests immediately and allow 
zuul --phantom --phantom-remote-debugger-port=3000 --phantom-remote-debugger-autorun -- test.js 

See PhantomJS Troubleshooting for more information

Clone this wiki locally