#25 ✓resolved
gaffo

allow clicking link by id

Reported by gaffo | October 28th, 2008 @ 09:16 PM

I can select things by link and id, but I cannot click links by id.

Comments and changes to this ticket

  • gaffo

    gaffo October 28th, 2008 @ 10:37 PM

    This is implemented in: git@github.com:gaffo/webrat.git master

  • Amos King

    Amos King October 29th, 2008 @ 06:16 PM

    This is good stuff. I've been wanting something like this.

  • Bryan Helmkamp

    Bryan Helmkamp November 14th, 2008 @ 12:05 AM

    • State changed from “new” to “open”

    (from [275829d382140f42e7688c246b2a76140c953cc5]) [#25 state:open] Added tests to create matches_id? function in link http://github.com/brynary/webrat...

  • Bryan Helmkamp

    Bryan Helmkamp November 14th, 2008 @ 12:05 AM

    (from [7b254be895419e7f96909843c1efc21e2fc20d03]) [#25 state:closed] updated history http://github.com/brynary/webrat...

  • Bryan Helmkamp

    Bryan Helmkamp November 15th, 2008 @ 08:19 PM

    Instead of extending click_link to work with IDs, what if the API to do this was instead:

    
    click_link link_with_id("something")
    

    Would that work? I realize it's a bit more verbose. I'm trying to avoid overloading the semantics of locating an element given a string. Each change to those risks breaking backwards compatibility.

    Instead, I'm leaning towards having to explicitly use methods to indicate what sort of search you want if it's different from the default. For example:

    
    fill_in "Username", :with => "foo" # Searches by username only
    fill_in field_labeled("Username"), :with => "foo" # Same as the above
    fill_in field_with_id("user_username"), :with => "foo" # ID
    fill_in field_named("user[username]"), :with => "foo" # name
    

    Long term, I think this will let us add and change locator strategies more freely without breaking existing test suites.

    WDYT?

  • gaffo

    gaffo November 15th, 2008 @ 11:22 PM

    I agree that the apis should become more specific. The current ambiguity is annoying. I had been along very similar lines recently. My proposal would be:

    click_link(:id||:text||:title => "" || //) click_button(:id||:text||:title||:value => "" || //)

    I would recommend that we change the clicks_link and clicks_button fuction to take (args*) and issue a deprecation warning if they use the old parameter style. Then give people a while to update.

    I think your or my api difference are just a matter of style. Yours seems more in line with typical RSpec syntax. I think mine is a bit faster to type and looks more like active_record finder syntax.

    All in all I think it would be a good upgrade to the api.

  • Bryan Helmkamp

    Bryan Helmkamp December 27th, 2008 @ 03:05 PM

    • Tag set to featurerequest
    • State changed from “open” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages