Test meta-refresh redirects with Cucumber

Updated . Posted . Visible to the public.

The step definition below allows you to write:

Then I should see an HTML redirect to "http://www.makandracards.com" in the page head

Capybara

Then /^I should see an HTML redirect to "([^\"]*)" in the page head$/ do |redirect_url|
  page.should have_xpath("//meta[@http-equiv=\"refresh\" and contains(@content, \"#{redirect_url}\")]")
end

To find meta tags with Capybara, you can also use page.find('meta', visible: false).

Dominik Schöler
Last edit
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2012-09-12 09:41)