1

有没有人设法让 Geb 和 Spock 插件与 Grails 2.2 一起使用?

如果是这样,您使用的是什么版本的 Geb、Selenium 和 Spock?

4

2 回答 2

3

Grails Geb 示例中有一个更新到 2.2的拉取请求

该版本可以在“文件已更改”选项卡中找到:

def gebVersion = '0.9.0-RC-1'
def seleniumVersion = '2.27.0'
def spockVersion = '0.7'
于 2013-02-18T19:21:10.217 回答
0

我的配置适用于 2.2.3

在 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"
        }

在测试/功能/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() }
    }

}
于 2013-07-25T15:10:30.467 回答