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

class attribute selector does not work in GEB 0.12.0 #390

Closed
fabriziofortino opened this issue Jul 14, 2015 · 3 comments
Closed

class attribute selector does not work in GEB 0.12.0 #390

fabriziofortino opened this issue Jul 14, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@fabriziofortino
Copy link

@fabriziofortino fabriziofortino commented Jul 14, 2015

I am trying to migrate to 0.12.0 but I stumbled in a problem with the class attribute selector. I have a Module with the following content:

static content = {
  userMenuButton { $('a', class: 'user-menu-button') }
}

The above code works with GEB 0.10.0 but throws the following exception with 0.12.0:

geb.error.RequiredPageContentNotPresent: The required page content 'userMenuButton - SimplePageContent (owner: module.UserMenuModule@4c2d6108, args: [], value: null)' is not present
at geb.content.TemplateDerivedPageContent.require(TemplateDerivedPageContent.groovy:68)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:67)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:86)
at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:58)
at geb.content.DefaultPageContentSupport.getContent(DefaultPageContentSupport.groovy:42)
at geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:39)
at geb.Module.propertyMissing(Module.groovy:101)
at module.UserMenuModule.logout(UserMenuModule.groovy:17)
at geb.content.TemplateDerivedPageContent.methodMissing(TemplateDerivedPageContent.groovy:128)
at spec.authentication.LoginLogoutSpec.can logout from MyApp(LoginLogoutSpec.groovy:37)

It works if I change the code without using the class attribute:

static content = {
  userMenuButton { $('a.user-menu-button') }
}

Please notice that the element has multiple classes.

@treyturner
Copy link

@treyturner treyturner commented Jul 14, 2015

I'm just finding my way around Geb, so I apologize if I'm out of line here, but shouldn't that be:

static content = {
    userMenuButton { $('a', class:contains('user-menu-button') }
}

I believe that looking for class as you have in your OP fails because of the additional classes.

@erdi
Copy link
Member

@erdi erdi commented Jul 14, 2015

No @treyturner, it should work the way @fabriziofortino expects it to work. That was the behaviour prior to 0.12.0 and it is a bug I introduced while working on #280.

@treyturner
Copy link

@treyturner treyturner commented Jul 14, 2015

Doh, I could swear I had problems selecting this way in 0.10.0. Good to know though, I'll stay at 0.10.0 for now, thanks.

@erdi erdi added this to the 0.12.1 milestone Jul 14, 2015
@erdi erdi closed this in 45df5cf Aug 2, 2015
@erdi erdi added the Bug label Aug 2, 2015
@erdi erdi self-assigned this Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants