I am trying to run integration tests in a PlayFramework 2.3.8 application that uses jQuery 2.1.3 and I am getting this error:
[error] Caused by net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot find function addEventListener in object [object HTMLDocument].
The test code is as following:
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
import play.api.test.Helpers._
@RunWith(classOf[JUnitRunner])
class IntegrationSpec extends Specification {
"Application" should {
"work from within a browser" in new WithBrowser {
browser.goTo("http://localhost:" + port)
browser.pageSource must contain("ScalaTest")
}
}
}
And the view is:
@(message: String)
<!DOCTYPE html>
<html>
<h1>ScalaTest</h1>
<p>
@message
</p>
<!-- vendor -->
<script src="//code.jquery.com/jquery-2.0.0.min.js"></script>
</html>
Is there any way to solve that, apart from downgrading jQuery?