title: Can't integrate Cucumber with Geb on Grails
body: <p>I'm trying to setup a Grails (2.2) + Cucumber (0.8.0) + Geb (0.9.0-RC-1) environment but my Cucumber step definitions are not finding the Geb pages - hence, I'm getting lots of MissingPropertyExceptions:</p>
  
  <pre><code>| Server running. Browse to http://localhost:8080/weddo
  | Compiling 3 source files.
  | Running 13 cucumber tests...
  groovy.lang.MissingPropertyException: No such property: page for class: WishlistStepDefinitions
      at WishlistStepDefinitions$_run_closure5.doCall(WishlistStepDefinitions.groovy:68)
      at ?.Then the total gifted amount should be 0(ChoosingGift.feature:14)
  groovy.lang.MissingMethodException: No signature of method: WishlistStepDefinitions.wishAmountsFromCategory() is applicable for argument types: (java.lang.Integer) values: [1]
      at WishlistStepDefinitions$_run_closure6.doCall(WishlistStepDefinitions.groovy:72)
      at ?.And I write "1" on every wish on the 1 category(ChoosingGift.feature:25)
  groovy.lang.MissingMethodException: No signature of method: WishlistStepDefinitions.namedWishAmountFromCategory() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [wish_1_2, 0]
      at WishlistStepDefinitions$_run_closure7.doCall(WishlistStepDefinitions.groovy:78)
  ...
  </code></pre>
  
  <p>WishlistStepDefinitions.groovy (the top part):</p>
  
  <pre><code>import static cucumber.api.groovy.EN.*
  
  import weddo.Wish
  import weddo.WishCategory
  
  import pages.WishlistPage
  
  Given(~'^I am on the "([^"]*)" page$') { String pageName -&gt;
      if (pageName.matches(/wishlist/)) {
          to WishlistPage
      }
  }
  
  Then(~'^the total gifted amount should be (\\d+)$') { int expectedTotalAmount -&gt;
      assert page.totalAmount.value() == expectedTotalAmount 
  }
  
  When(~'^I write "([^"]*)" on every wish on the (\\d+) category$') { String amount, int categoryPosition -&gt;
      wishAmountsFromCategory(categoryPosition).each {
          it.value(amount)
      }
  }
  ...
  </code></pre>
  
  <p>WishlistPage.groovy (top part):</p>
  
  <pre><code>package pages
  
  import geb.Page
  import org.openqa.selenium.Keys
  
  class WishlistPage extends Page {
      static url = "/"
      static at = {
          title.startsWith("Wishlist")
      }
  
      static content = {
          totalAmount = {
              $("#amount")
          }
          wishAmountsFromCategory = { categoryIndex -&gt;
              $(".category", categoryIndex).find(".wishes input[data-bind*='currentGiftAmount']")
          }
          wishAmountFromName = { wishName -&gt;
              $(".wishes .control-group").find(".control-label", text: wishName).parent().parent().find("input[data-bind*='currentGiftAmount']")
          }
  ...
  </code></pre>
  
  <p>There's also a GebConfig.groovy, CucumberConfig.groovy and env.groovy. This last one should glue the step definitions to the Geb pages (from what I know). But it seems not be being executed. Here's its contents (env.groovy):</p>
  
  <pre><code>import geb.binding.BindingUpdater
  import geb.Browser
  
  import static cucumber.api.groovy.Hooks.*
  
  def bindingUpdater
  Before () {
      bindingUpdater = new BindingUpdater (binding, new Browser ())
      bindingUpdater.initialize ()
  }
  
  After () {
      bindingUpdater.remove ()
  }
  </code></pre>
  
  <p>I'm running the tests inside Eclipse Groovy/Grails Tool Suite using:</p>
  
  <pre><code>grails test-app functional:cucumber
  </code></pre>
  
  <p>Can someone help?</p>
  
  <p>EDIT:
  The first error (on line 68) refers to the assertion in this code:</p>
  
  <pre><code>67. Then(~'^the total gifted amount should be (\\d+)$') { int expectedTotalAmount -&gt;
  68.     assert page.totalAmount.value() == expectedTotalAmount 
  69. }
  </code></pre>
  
  <p>EDIT 2:
  Inside BuildConfig.groovy, I have (excerpt):</p>
  
  <pre><code>    ...
      def gebVersion = "0.9.0-RC-1" //"0.7.2"
      def cukesVersion = "0.8.0"
      def seleniumVersion = "2.27.0" //"2.25.0"
  
      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.gebish:geb-junit4:$gebVersion"
      }
  
      plugins {
          runtime ":hibernate:$grailsVersion"
          runtime ":jquery:latest.release"
          runtime ":resources:latest.release"
  
          compile ":google-visualization:latest.release"
          compile ":cloud-foundry:1.2.3"
  
          test "org.grails.plugins:geb:$gebVersion"
          test ":cucumber:$cukesVersion"
          // Uncomment these (or add new ones) to enable additional resources capabilities
          //runtime ":zipped-resources:1.0"
          //runtime ":cached-resources:1.0"
          //runtime ":yui-minify-resources:0.1.4"
  
          build ":tomcat:$grailsVersion"
      }
  }
  </code></pre>
  
  <p>And grails-conf/CucumberConfig.groovy:</p>
  
  <pre><code>cucumber {
      features = ["test/cucumber/wishlist"]
      glue = ["test/cucumber/steps"]
  }
  </code></pre>
  
  <p>And test/functional/GebConfig.groovy</p>
  
  <pre><code>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() }
      }
  
  }
  </code></pre>