Read more

Check if a field or button is disabled with Cucumber

Arne Hartherz
December 14, 2010Software engineer at makandra GmbH

Using this step definition you can check if any form field (text field, checkbox, etc) or button is disabled:

Then the "Name" field should be disabled
  And the "Save" button should be disabled
But the "Locked" field should not be disabled

Capybara

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

This step part of Spreewald Show archive.org snapshot .

Webrat

Then /^"([^\"]*)" should( not)? be disabled$/ do |label, negate|
  attributes = field_labeled(label).element.attributes.keys
  attributes.send(negate ? :should_not : :should, include('disabled'))
end
Posted by Arne Hartherz to makandra dev (2010-12-14 15:22)