Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument-less $() can no longer be used in module functions to access module base navigator #360

Closed
geb-bot opened this issue Jan 5, 2015 · 6 comments
Assignees

Comments

@geb-bot
Copy link

geb-bot commented Jan 5, 2015

Originally created by Benjamin Bentmann.

Consider this example snippet:

class MyModule
    extends Module
{
  static content = {
    myBase { $() }   // this seems to work
  }

  Navigator theBase() {
    return $()       // this fails
  }
}

In Geb 0.9.2, all this worked fine. After trying to update to 0.10.0, the reference to $() from a module function (like theBase()) yields an exception instead:
{noformat}
org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method $() to invoke from this list:
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.lang.String)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.lang.String, groovy.lang.Range)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.lang.String, int)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map, groovy.lang.Range)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map, int)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map, java.lang.String)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map, java.lang.String, groovy.lang.Range)
public abstract geb.navigator.Navigator geb.navigator.Navigator#$(java.util.Map, java.lang.String, int)
{noformat}
Geb 0.9.3 seems equally broken in this regard, though the exact error is slightly different for that version:
{noformat}
groovy.lang.MissingMethodException: No signature of method: geb.navigator.NonEmptyNavigator.$() is applicable for argument types: () values: []
Possible solutions: eq(int), is(java.lang.String), is(java.lang.Object), tag(), max(), min()
at geb.navigator.NonEmptyNavigator.methodMissing(NonEmptyNavigator.groovy:483)
at geb.content.PageContentSupport.methodMissing(PageContentSupport.groovy:53)
at geb.Module.methodMissing(Module.groovy:65)
{noformat}

One can workaround this by using find() instead but AFAIU, $() should be equivalent.

Oddly (for me at least), $() seems still to work when used in content definitions.

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

This issue is related to #361

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

Originally posted by Marcin Erdmann.

Since 0.9.3 [Module implements Navigator|http://jira.codehaus.org/browse/GEB-181] and thus there is no need for the $() method on Module anymore. The "backing" Navigator instance is the base navigator for the module. You can simply call Navigator methods on Module now without having to obtain the base navigator beforehand.

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

Resolved

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

Originally posted by Benjamin Bentmann.

I see. In that case, it might be nice to list GEB-181 in the "Breaking Changes" section of the changelog for 0.9.3 for clarity.

On a related note, having breaking changes in a patch release is somewhat odd (cf. http://semver.org/).

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

Originally posted by Marcin Erdmann.

I have created https://jira.codehaus.org/browse/GEB-361 for the docs update.

Fair enough, but please note that we are still pre-1.0 for the exact reason that we still have a lot of breaking changes in the API (see section 4 of Semantic Versioning Specification). The goal is to get to 1.0 ASAP because Geb will be 5 years old this year but we're not there yet.

@geb-bot
Copy link
Author

geb-bot commented Jan 5, 2015

Originally posted by Benjamin Bentmann.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants