我正在尝试在使用jQuery 2.1.3的PlayFramework 2.3.8应用程序中运行集成测试,我收到此错误:
[error] Caused by net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot find function addEventListener in object [object HTMLDocument].
测试代码如下:
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")
}
}
}
观点是:
@(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>
除了降级jQuery之外,还有什么方法可以解决这个问题吗?