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 UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
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)