PhantomJS with Elixir is not detecting visible content after client-side JavaScript change the display of a div

Hello,

I have an application written in Elixir (1.6.6 with OTP 21) where I use Wallaby to call PhantomJS in order to test the rendering of the page. This page contains Javascript that changes the visibility of some content. The tests are working/passing on my machine (I tried both mix test directly and the use of the CircleCI CLI with circleci local execute --job build). Unfortunately, the tests are not passing on CircleCI and I cannot find why.

I have implemented a minimal application reproducing this problem: https://github.com/jpagex/phantomjs-circleci-example. It is working in local but not on CircleCI.

Any idea how to make the test work on the CI?

Thank you very much for your help. Feel free to ask if you have any question.

Try taking a screenshot with PhantomJS, to see if that gives you some clues. Also, PhantomJS allows you to collect console logs and errors, see if they contain anything useful.

I took a screenshot on the CI already, and the hidden div was still hidden as if the JS was not invoked. I can take a look at the console logs from PhantomJS.
What is weird is that it works with the CircleCI cli.

It may be that it is not loading a JS asset, and so is failing. Or PhantomJS does not cope with a particular version of the JavaScript standard (it is now abandoned). Looking at the console logs might be worthwhile.