Hi all,
**** play 2.2.1 built with Scala 2.10.2 (running Java 1.7.0_40) ****
I'm trying to do some integration testing on the application I'm working on. I created the skeleton application using Typesafe Activator, ran the tests and all was fine.
However, as I'm starting to add content (specifically JavaScript files), the integration tests are failing with errors similar to:
Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25' Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:376)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:355)
at org.fluentlenium.core.Fluent.goTo(Fluent.java:228)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1$delayedInit$body.apply(IntegrationSpec.scala:30)
at play.api.test.WithBrowser$$anonfun$around$3.apply(Specs.scala:57)
at play.api.test.WithBrowser$$anonfun$around$3.apply(Specs.scala:57)
Following some Googling, it seems that perhaps HtmlUnit isn't the best to use when there are JavaScript files involved, so I'm trying PhantomJS to see if that solves the problem.
@RunWith(classOf[JUnitRunner])
class IntegrationSpec extends Specification {
implicit val webDriver: WebDriver = {
val capabilities = new DesiredCapabilities
capabilities.setJavascriptEnabled(false)
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "C:/phantomjs.exe")
new PhantomJSDriver(capabilities)
}
"Application" should {
"work from within a browser" in new WithBrowser {
browser.pageSource must contain("Hello Play Framework")
}
}
}
Now the test starts the PhantomJS part, but it still runs HtmlUnit and the test fails.
Any ideas what I am doing wrong?
Thanks.
Paul Abraham.