The Codeception extension for automatically starting and stopping PhantomJS when running tests.
- Codeception 1.6.4
- PHP 5.4
Phantoman is available via Composer. Add the
following to the require
section of your project's composer.json
file.
"site5/phantoman": "1.*"
Then run composer update
and composer install
to complete the installation
process.
Be sure to enable the extension in codeception.yml
as shown in
configuration below.
It is highly recommended that you use the PhantomJS
Installer package which will
install PhantomJS locally to your project in vendor/bin
. Please follow the
installation
instructions
provided.
Note: We've found that 1.9.7
is out of date and instead use dev-master
for the package version.
Phantoman uses vendor/bin
by default. If any other installation of PhantomJS
is used, please set the path as shown in the configuration below.
Phantoman supports two configuration options, path
and port
. By default it
will look for PhantomJS to be installed in vendor/bin
and it will use 4444
for the web driver port as per Codeception's requirements.
All enabling and configuration is done in codeception.yml
.
extensions:
enabled:
- Codeception\Extension\Phantoman
extensions:
enabled:
- Codeception\Extension\Phantoman
config:
Codeception\Extension\Phantoman:
path: '{path to PhantomJS}'
port: {port number}
Once installed and enabled, running your tests with php codecept run
will
automatically start the PhantomJS server and wait for it to be accessible before
proceeding with the tests.
Starting PhantomJS Server
Waiting for the PhantomJS server to be reachable..
PhantomJS server now accessible
Once the tests are complete, PhantomJS will be shut down.
Stopping PhantomJS Server