Laravel + Codeception + PhantomJS 2.1.1 : Failed Acceptance tests after upgrading to 14.0

codeception
phantomjs

#1

Automated tests run fine locally but fail on circle CI. This started happening once it was upgraded to 14.0 (to resolve a different issue). I’m running phantomjs 2.1.1 both locally and on circle. On circle, I get errors and blank screenshots.

Here’s the log from the test run on circle:

Acceptance Tests (11) --------------------------------------------------------
Modules: WebDriver, \Helper\Acceptance
------------------------------------------------------------------------------
⏺ Recording ⏺ step-by-step screenshots will be saved to /home/ubuntu/screaming-eagle/tests/_output/
Directory Format: record_5851932730e0f_{testname} ----
AdminCest: Create a Transaction for a user and see it reflected in the admin
Signature: AdminCest:testOneTime
Test: tests/acceptance/AdminCest.php:testOneTime
Scenario --
 As an an admin
 I am on page "/"
  [GET] http://eagle.app/
 I wait for element visible "#authentication-form",10
  [Selenium har Logs] 
  18:45:06.19 INFO - {"log":{"version":"1.2","creator":{"name":"PhantomJS","version":"2.1.1"},"pages":[{"startedDateTime":"2016-12-14T18:44:55.306Z","id":"http://eagle.app/","title":"Apache2 Ubuntu Default Page: It works","pageTimings":{"onLoad":63}}],"entries":[{"startedDateTime":"2016-12-14T18:44:55.306Z","time":10,"request":{"method":"GET","url":"http://eagle.app/","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"},{"name":"User-Agent","value":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1"}],"queryString":[],"headersSize":-1,"bodySize":-1},"response":{"status":200,"statusText":"OK","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Date","value":"Wed, 14 Dec 2016 18:44:55 GMT"},{"name":"Server","value":"Apache/2.4.7 (Ubuntu)"},{"name":"Last-Modified","value":"Thu, 06 Oct 2016 23:56:37 GMT"},{"name":"ETag","value":"\"2cf6-53e3b0b4ad740-gzip\""},{"name":"Accept-Ranges","value":"bytes"},{"name":"Vary","value":"Accept-Encoding"},{"name":"Content-Encoding","value":"gzip"},{"name":"Keep-Alive","value":"timeout=5, max=100"},{"name":"Connection","value":"Keep-Alive"},{"name":"Content-Type","value":"text/html"}],"redirectURL":"","headersSize":-1,"bodySize":11510,"content":{"size":11510,"mimeType":"text/html"}},"cache":{},"timings":{"blocked":0,"dns":-1,"connect":-1,"send":0,"wait":4,"receive":6,"ssl":-1},"pageref":"http://eagle.app/"},{"startedDateTime":"2016-12-14T18:44:55.315Z","time":32,"request":{"method":"GET","url":"http://www.w3.org/Icons/valid-xhtml10","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Referer","value":"http://eagle.app/"},{"name":"User-Agent","value":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1"},{"name":"Accept","value":"*/*"}],"queryString":[],"headersSize":-1,"bodySize":-1},"response":{"status":200,"statusText":"OK","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Content-Location","value":"valid-xhtml10.png"},{"name":"Vary","value":"negotiate,accept,upgrade-insecure-requests"},{"name":"TCN","value":"choice"},{"name":"Last-Modified","value":"Fri, 14 Jul 2006 01:43:32 GMT"},{"name":"ETag","value":"\"75a-41880ced83900;528b03b45b0c4\""},{"name":"Cache-Control","value":"max-age=2592000"},{"name":"Expires","value":"Tue, 27 Dec 2016 22:08:18 GMT"},{"name":"P3P","value":"policyref=\"http://www.w3.org/2014/08/p3p.xml\""},{"name":"Content-Type","value":"image/png; qs=0.7"},{"name":"Content-Length","value":"1882"},{"name":"Accept-Ranges","value":"bytes"},{"name":"Date","value":"Wed, 14 Dec 2016 18:44:55 GMT"}],"redirectURL":"","headersSize":-1,"bodySize":1882,"content":{"size":1882,"mimeType":"image/png; qs=0.7"}},"cache":{},"timings":{"blocked":0,"dns":-1,"connect":-1,"send":0,"wait":31,"receive":1,"ssl":-1},"pageref":"http://eagle.app/"},{"startedDateTime":"2016-12-14T18:44:55.315Z","time":2,"request":{"method":"GET","url":"http://eagle.app/icons/ubuntu-logo.png","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Referer","value":"http://eagle.app/"},{"name":"User-Agent","value":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1"},{"name":"Accept","value":"*/*"}],"queryString":[],"headersSize":-1,"bodySize":-1},"response":{"status":200,"statusText":"OK","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Date","value":"Wed, 14 Dec 2016 18:44:55 GMT"},{"name":"Server","value":"Apache/2.4.7 (Ubuntu)"},{"name":"Last-Modified","value":"Fri, 15 Jul 2016 15:34:57 GMT"},{"name":"ETag","value":"\"d4c-537ae5c5d2a40\""},{"name":"Accept-Ranges","value":"bytes"},{"name":"Content-Length","value":"3404"},{"name":"Keep-Alive","value":"timeout=5, max=99"},{"name":"Connection","value":"Keep-Alive"},{"name":"Content-Type","value":"image/png"}],"redirectURL":"","headersSize":-1,"bodySize":3404,"content":{"size":3404,"mimeType":"image/png"}},"cache":{},"timings":{"blocked":0,"dns":-1,"connect":-1,"send":0,"wait":2,"receive":0,"ssl":-1},"pageref":"http://eagle.app/"}]}}
  
  [Selenium browser Logs]  EMPTY 
  Screenshot and page source were saved into '/home/ubuntu/screaming-eagle/tests/_output/' dir
 ERROR 

AdminCest: Create a Subscription for a user and see it reflected in the admin
Signature: AdminCest:grantAndRemoveSubscriptions
Test: tests/acceptance/AdminCest.php:grantAndRemoveSubscriptions
Scenario --
 As an an admin
 I am on page "/"
  [GET] http://eagle.app/
 I wait for element visible "#authentication-form"
  [Selenium har Logs] 
  18:45:16.949 INFO - {"log":{"version":"1.2","creator":{"name":"PhantomJS","version":"2.1.1"},"pages":[{"startedDateTime":"2016-12-14T18:44:55.306Z","id":"http://eagle.app/","title":"Apache2 Ubuntu Default Page: It works","pageTimings":{"onLoad":63}}],"entries":[]}}
  
  [Selenium browser Logs]  EMPTY 
  Screenshot and page source were saved into '/home/ubuntu/screaming-eagle/tests/_output/' dir
 ERROR 

This is my circle.yml config:

machine:
  php:
    version: 7.0.11
  hosts:
    eagle.app: 127.0.0.1
dependencies:
  pre:
    - composer update --no-scripts
    - composer dump-autoload -o
  post:
    - wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.3.2/elasticsearch-2.3.2.tar.gz
    - tar -xvf elasticsearch-2.3.2.tar.gz
    - elasticsearch-2.3.2/bin/elasticsearch:
        background: true
    - sudo rm /etc/apache2/mods-enabled/php5.load
    - sudo service apache2 restart
    - sudo chmod 777 -Rf ~/screaming-eagle/
    - sudo cp ~/screaming-eagle/.env.example .env
    - /usr/local/bin/phantomjs --webdriver=4444 --remote-debugger-port=9000  --ignore-ssl-errors=true --ssl-protocol=any:
        background: true
    - sudo redis-server:
        background: true
    - sudo node resources/server.js:
        background: true

#2