Skip to content

Instantly share code, notes, and snippets.

View nvanselow's full-sized avatar

Nick Vanselow nvanselow

  • MA
View GitHub Profile
@nvanselow
nvanselow / gist:3c6fe71bef68554b1bb0
Last active June 7, 2018 12:36 — forked from antonioribeiro/gist:96ce9675e5660c317bcc
Codeception, Laravel, and PhantomJS

You can use Codeception to test Javascript, like DOM manipulations and Ajax requests. Out of the box it can manipulate DOM elements but can't execute Javascript code, like most testing frameworks. But it gives you the option to use a WebDriver, to connect to a headless browser, and mimic a user browsing your website. It gives you some options: Selenium2, ZombieJS and, the easiest to configure, PhantomJS.

This article covers the installation and usage of PhantomJS, and assumes you are using Laravel Homestead, but it will work on any relatively new Debian based distro, like Ubuntu 14.04.

###Install PhantomJS

Just run those commands to install it:

sudo apt-get update