Add e2e testing fixes and phantomjs compatibility