Reload the page in your Cucumber features

Updated . Posted . Visible to the public.

Both these approaches will keep your GET parameters -- and will only work for GET requests.

  • Capybara:

    When /^I reload the page$/ do
      visit [ current_path, page.driver.request.env['QUERY_STRING'] ].reject(&:blank?).join('?')
    end
    
  • Webrat:

    When /^I reload the page$/ do
      visit url_for(request.params)
    end
    

For a step that distinguishes between drivers (Selenium, Rack::Test, Culerity), check n4k3d.com Show archive.org snapshot .

Arne Hartherz
Last edit
Keywords
step, definition, trigger
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2010-09-28 09:55)