I'm trying to upgrade my Grails app from 2.2.1 to 2.3.0. One issue I've facing is my Geb functional tests are having issues running. The HtmlUnit tests hang, but that appears to be because HtmlUnit isn't recommended for Geb with Grails 2.2+. So I tried the PhantomJS driver according to the following instructions:
http://fbflex.wordpress.com/2013/03/18/how-to-configure-webdriver-in-grails-for-your-geb-tests/ Using Selenium 2.31.0 and phantomjsdriver 1.0.1, this results in: | geb.driver.DriverCreationException: failed to create driver from callback 'script13798898672681154509289$_run_closure1@2a93a1c6' at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35) at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80) at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30) at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79) at geb.Configuration.createDriver(Configuration.groovy:346) at geb.Configuration.getDriver(Configuration.groovy:335) at geb.Browser.getDriver(Browser.groovy:105) at geb.Browser.clearCookies(Browser.groovy:462) at geb.Browser.clearCookiesQuietly(Browser.groovy:470) at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45) at geb.spock.GebSpec.cleanupSpec(GebSpec.groovy:71) Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the phantomjs.binary.path capability/system property/PATH variable; for more information, see https://github.com/ariya/phantomjs/wiki. The latest version can be downloaded from http://phantomjs.org/download.html at com.google.common.base.Preconditions.checkState(Preconditions.java:176) at org.openqa.selenium.phantomjs.PhantomJSDriverService.findPhantomJS(PhantomJSDriverService.java:171) at org.openqa.selenium.phantomjs.PhantomJSDriverService.createDefaultService(PhantomJSDriverService.java:122) at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:85) at script13798898672681154509289.run_closure1(script13798898672681154509289.groovy:14) at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29) ... 10 more If I change the selenium-remote-driver to be 2.34.0 (as suggested in the last comment in the aforementioned post), I get: | geb.driver.DriverCreationException: failed to create driver from callback 'script13798899550331154509289$_run_closure1@7ef8f87a' at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35) at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80) at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30) at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79) at geb.Configuration.createDriver(Configuration.groovy:346) at geb.Configuration.getDriver(Configuration.groovy:335) at geb.Browser.getDriver(Browser.groovy:105) at geb.Browser.clearCookies(Browser.groovy:462) at geb.Browser.clearCookiesQuietly(Browser.groovy:470) at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45) at geb.spock.GebSpec.cleanupSpec(GebSpec.groovy:71) Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Keyboard at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) at java.lang.Class.getDeclaredConstructors(Class.java:1853) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at script13798899550331154509289.run_closure1(script13798899550331154509289.groovy:14) at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29) ... 10 more Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Keyboard at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 16 more If I take out transitive=false, I get the same issue. Even stranger, for the Chrome and Firefox Drivers, I get assertion errors about titles. Chrome doesn't find them. Starting ChromeDriver (v2.3) on port 3522 | Failure: view homepage(happytrails.AnonymousUserSpec) | Assertion failed: $('title').text() ==~ /Welcome to Happy Trails!.+/ | | | | "" false [[[[[ChromeDriver: chrome on MAC (19b9eac62b9fd1d1a9d3aea53655d077)] -> tag name: html]] -> css selector: title]] at happytrails.pages.HomePage._clinit__closure1(HomePage.groovy:6) at geb.Page.verifyAt(Page.groovy:135) at geb.Browser.doAt(Browser.groovy:341) at geb.Browser.at(Browser.groovy:287) at geb.Browser.to(Browser.groovy:415) at geb.Browser.to(Browser.groovy:391) at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51) at happytrails.AnonymousUserSpec.view homepage(AnonymousUserSpec.groovy:14) | Running 11 spock tests... 2 of 11 Firefox finds the title, but still fails: | Failure: browse regions(happytrails.AnonymousUserSpec) | Assertion failed: title ==~ /Regions/ | | | false Regions | Über Tracks at happytrails.pages.RegionsPage._clinit__closure1(RegionsPage.groovy:9) at geb.Page.verifyAt(Page.groovy:135) at geb.Browser.doAt(Browser.groovy:341) at geb.Browser.at(Browser.groovy:287) at geb.Browser.to(Browser.groovy:415) at geb.Browser.to(Browser.groovy:391) at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51) at happytrails.AnonymousUserSpec.browse regions(AnonymousUserSpec.groovy:23) | Failure: signup as a new user(happytrails.AuthenticatedUserSpec) | Assertion failed: $('.ui-dialog-title').text() ==~ /Create Account!.+/ | | | | | false | Create Account [[[[[FirefoxDriver: firefox on MAC (ce5efed8-1080-5047-9e5f-a4b6ba73d45e)] -> tag name: html]] -> css selector: .ui-dialog-title]] Has anyone got their Geb functional tests to work reliably with Grails 2.3.0? If so, what versions of libraries are you using? Thanks, Matt |
Did you install phantomjs? I got the phantomjs error until I did: ‘brew install phantomjs’ On Mon, Sep 23, 2013 at 12:59 AM, mraible <[hidden email]> wrote: I'm trying to upgrade my Grails app from 2.2.1 to 2.3.0. One issue I've Graeme Rocher
Grails Project Lead SpringSource |
I also get the same title issue with phantomjs: On Mon, Sep 23, 2013 at 10:40 AM, Graeme Rocher <[hidden email]> wrote:
Graeme Rocher
Grails Project Lead SpringSource |
Yes, I'm able to reproduce the same title issue with PhantomJS. However, I don't see what the problem is. The error message seems to say the title exists, but the regex I'm looking for is not in it. But it is, isn't it?
| Error --Output from browse regions-- | Failure: browse regions(happytrails.AnonymousUserSpec) | Assertion failed: title ==~ /Regions/ | | | false Regions | Über Tracks On Sep 23, 2013, at 1:48 AM, "Graeme Rocher-2 [via Grails]" <[hidden email]> wrote:
|
Have you seen Lari's fix?: Seems Phantom JS syntax is different? On Tue, Sep 24, 2013 at 9:27 AM, mraible <[hidden email]> wrote: Yes, I'm able to reproduce the same title issue with PhantomJS. However, I don't see what the problem is. The error message seems to say the title exists, but the regex I'm looking for is not in it. But it is, isn't it? Graeme Rocher
Grails Project Lead SpringSource |
Yeah, I saw that. However, I don't seem to have an issue with HomePage as a class, so I don't see how Lari's fix can help. The good news is I did get things to work. I had to change my "at" in RegionsPage.groovy from:
static at = { title ==~ /Regions/ } to: static at = { title.startsWith('Regions') } Also, strangely enough - I had to revert the suggested UserDetailsService change (from 'as User' to casting to User). It seems to work fine now w/o any changes. My last Geb-related issue is that Signup (with Spring Security UI's plugin) fails with PhantomJS. It works fine with Chrome and Firefox, but apparently the "submit" isn't fired when running under Phantom. I tried upgrading Selenium and phantomjsdriver (from 1.0.1 to 1.0.4), but this make things better. On Sep 24, 2013, at 12:43 AM, "Graeme Rocher-2 [via Grails]" <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |