【问题标题】:What Spock, Geb and Selenium versions should be used with Grails 2.2?Grails 2.2 应该使用哪些 Spock、Geb 和 Selenium 版本?
【发布时间】:2013-02-18 18:38:36
【问题描述】:

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

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

【问题讨论】:

    标签: grails selenium spock geb


    【解决方案1】:

    Grails Geb 示例中有一个 pull request 更新到 2.2

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

    def gebVersion = '0.9.0-RC-1'
    def seleniumVersion = '2.27.0'
    def spockVersion = '0.7'
    

    【讨论】:

    • 是的,2.28 兼容 Firefox 版本 18。
    【解决方案2】:

    我的配置适用于 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"
            }
    

    在 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() }
        }
    
    }
    

    【讨论】:

    • 酷,感谢您的回复。 Selenium 2.28.0 也适用于 2.2.3。
    • 我正在使用 latest.release
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 1970-01-01
    相关资源
    最近更新 更多