Read more

Cucumber step to test that a tooltip text exists in the HTML

Deleted user #6
February 10, 2012Software engineer

Tooltips that are delivered through HTML attributes are encoded. Decode entities before checking for their presence.

Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

Capybara:

Then /^there should( not)? be a(n encoded)? tooltip "([^"]*)"$/ do |negate, encoded, tooltip|
  tooltip = HTMLEntities.new.encode(tooltip) if encoded
  Then "I should#{negate} see \"#{tooltip}\" in the HTML"
end

Note

This step uses the htmlentities Show archive.org snapshot gem described in another card.

Make sure you require 'htmlentities' in your features/support/env.rb

Posted to makandra dev (2012-02-10 11:58)