Read more

Perform HTTP basic authentication in Cucumber (with or without Selenium)

Henning Koch
February 01, 2011Software engineer at makandra GmbH

This card describes a Cucumber step that lets you say:

When I perform basic authentication as "username/password" and I visit the admin area
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

The path component ("... the admin area") is parsed through your path_to helper in features/support/paths.rb.

Capybara

The step definition is part of Spreewald Show archive.org snapshot . The step has been tested with multiple versions of Capybara, Rack::Test and Selenium.

Webrat (legacy)

This is a simpler version of the step above:

When /^I perform HTTP authentication as "([^\"]*)\/([^\"]*)"$/ do |email, password|
  basic_auth email, password
end
Posted by Henning Koch to makandra dev (2011-02-01 11:15)