PhantomJS runner project proposal
lfryc Nov 13, 2012 6:10 AMIn order to run your UI tests headlessly, you can always use HtmlUnitDriver as Selenium backend.
However HtmlUnit suffers from real-world issues:
- artifical JavaScript runtime (Rhino)
- hard time with debugging
In order to solve those issues, I have identified PhantomJS as good candidate to replace HtmlUnit:
- implements V8 engine (forked from Chromium project)
- theoretically tests should run same in Chromium and PhantomJS
- contains remote debugger
- equivalent Chrome Developer Tools
- usage is same as when you are debugging Android or Safari browsers
There is also project called GhostDriver which runs on top of PhantomJS and implements Selenium remote protocol
(currently all important aspects of protocol implemented).
----
That's why I'm coming with idea for new project, which should contain from three parts:
- PhantomJS runner
- including Java process wrapper
- wrapping phantomjs binary (platform dependent)
proof of concept: https://github.com/lfryc/phantomjs-java
- GhostDriver runner
- runner forked from GhostDriver
- runs PhantomJS runner interpreting ghostdriver.js, exposed as Selenium remote hub
- proof of concept: https://github.com/lfryc/ghostdriver-java
This way, we could use PhantomJS as another WebDriver implementation,
allowing to run your Selenium tests against (nearly-) real implementation
headlessly.
Tracking issue: https://issues.jboss.org/browse/ARQGRA-210
----
This will provide us with ability to run:
- functional tests as part of regular continuous integration build (without need for real browsers)
- JavaScript tests driven by Selenium
- ... etc.
----
The are plans to integrate GhostDriver into PhantomJS core.
Both runners can be contributed to upstream projects.
There is similar project to our one: phantom-runner
The plan is to reach the authors and share common implementation.
----
Technical difficulties:
PhantomJS runner needs to use platform dependent binaries
- those can be generated during project build
- right version of binary can be selected using Maven POM (os.arch)
Both, PhantomJS and GhostDriver binaries needs to be extracted into filesystem in order to start native process