Skip to content

Instantly share code, notes, and snippets.

@max2320
Last active January 8, 2016 19:00
Show Gist options
  • Save max2320/d9f711abe0ce818312e8 to your computer and use it in GitHub Desktop.
Save max2320/d9f711abe0ce818312e8 to your computer and use it in GitHub Desktop.
HTML5 Validator support for ruby tests with rspec.
module HTMLValidator
def filled_field_is_valid(selector)
page.evaluate_script "document.querySelector('#{selector}').validity.valid"
end
def filled_field_validity(selector)
page.evaluate_script "document.querySelector('#{selector}').validity"
end
end
RSpec.configure do |config|
config.include HTMLValidator, type: :feature
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment