Search This Blog

Tuesday, September 16, 2014

Headless Testing [Codeception+Phantomjs]

Installation

  • phantomjs can be downloaded from http://phantomjs.org/
  • Once downloaded,unzip it and update the path variable under 'Env Variables > user variables' to path of 'phantomjs.exe'. Eg : C:\Download\phantomjs-1.9.7-windows\phantomjs-1.9.7-windows










  • Check the installation from a command prompt using:
     phantomjs –version  








  • Start the ghost driver , it needs to run on the port on which selenium server is running using this command :
  •  phantomjs --webdriver=4444  
    






Configurations needed in Codeception

  • Change 'browser' parameter inside 'acceptance.suite.yml.template' to specify 'phantomjs'

Run Tests

  • Tests can be run as usual using :
     php codecept.php run <cept structure> --steps  
    
Note: When applications are browse via 'https' , Please include phantomjs commandline option of turning the ignore ssl errors ON. Use below command : 
 phantomjs –ignore-ssl-errors=true –webdriver=4444  

No comments:

Post a Comment