有没有人设法让Geb和Spock插件与Grails 2.2一起使用?
如果是这样,您使用的是Geb,Selenium和Spock的确切版本?
答案 0 :(得分:3)
Grails Geb示例中有pull request更新为2.2
该版本可在“已更改文件”标签中找到:
def gebVersion = '0.9.0-RC-1'
def seleniumVersion = '2.27.0'
def spockVersion = '0.7'
答案 1 :(得分:0)
我的配置适用于2.2.3
in grails-app / Config / BuildConfig.groovy
def gebVersion = '0.9.0'
def seleniumVersion = '2.21.0'
def spockVersion = '0.7
dependencies {
test("org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion") {
exclude "xml-apis"
}
test("org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion")
test("org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion")
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
test "org.gebish:geb-spock:$gebVersion"
}
plugins {
test ":spock:$spockVersion"
test ":geb:$gebVersion"
}
在test / functional / GebConfig.groovy
中/*
This is the Geb configuration file.
See: http://www.gebish.org/manual/current/configuration.html
*/
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.chrome.ChromeDriver
// Use htmlunit as the default
// See: http://code.google.com/p/selenium/wiki/HtmlUnitDriver
driver = {
def driver = new HtmlUnitDriver()
driver.javascriptEnabled = true
driver
}
environments {
// run as “grails -Dgeb.env=chrome test-app”
// See: http://code.google.com/p/selenium/wiki/ChromeDriver
chrome {
driver = { new ChromeDriver() }
}
// run as “grails -Dgeb.env=firefox test-app”
// See: http://code.google.com/p/selenium/wiki/FirefoxDriver
firefox {
driver = { new FirefoxDriver() }
}
}