我的工作环境是Grails 2.4.5,我按以下方式配置它:
BuildConfig.groovy:
...
def gebVersion = "0.12.1"
def seleniumVersion = "2.45.0"
dependencies {
test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
test "org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion"
test "org.gebish:geb-spock:$gebVersion"
}
plugins {
build ":tomcat:7.0.55.2" // or ":tomcat:8.0.20"
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile ":asset-pipeline:2.4.3"
runtime ":hibernate4:4.3.8.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
test ":geb:$gebVersion"
}
基本上,我刚添加了Geb和selenium!
在功能测试期间,我试图下载文件
import geb.spock.GebReportingSpec
import spock.lang.*
class FileDownloadSpec extends GebReportingSpec {
def "DownloadController renders file"() {
go ""
expect: ""
downloadContent("http://somethinghere.com/file.zip")
}
}
`
我得到了:
| Error 2015-08-06 16:35:26,598 [main] ERROR javascript.StrictErrorReporter - runtimeError: message=[An invalid or illegal selector was specified (selector: ':checked' error: Invalid selector: *:checked).] sourceName=[http://localhost:8080/deleteme/assets/jquery/jquery-1.11.1.js?compile=false] line=[1228] lineSource=[null] lineOffset=[0]
| Error 2015-08-06 16:35:26,609 [main] ERROR javascript.StrictErrorReporter - runtimeError: message=[An invalid or illegal selector was specified (selector: ':enabled' error: Invalid selector: *:enabled).] sourceName=[http://localhost:8080/deleteme/assets/jquery/jquery-1.11.1.js?compile=false] line=[1248] lineSource=[null] lineOffset=[0]
| Error 2015-08-06 16:35:26,648 [main] ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/deleteme/assets/jquery/jquery-1.11.1.js?compile=false] line=[3521] lineSource=[null] lineOffset=[0]
| Error 2015-08-06 16:35:27,198 [JS executor for com.gargoylesoftware.htmlunit.WebClient@39779e4b] ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/deleteme/assets/jquery/jquery-1.11.1.js?compile=false] line=[3521] lineSource=[null] lineOffset=[0]
| Error 2015-08-06 16:35:27,254 [JS executor for com.gargoylesoftware.htmlunit.WebClient@39779e4b] ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/deleteme/assets/jquery/jquery-1.11.1.js?compile=false] line=[3521] lineSource=[null] lineOffset=[0]
显然,Grails正在使用资产管道插件。有谁知道geb + grails + asset-pipeline是否存在冲突?知道发生了什么事吗?