Sha256: 63e3acb8db9d0cdf86f687fd966c3e8c7d9b476572cfec8e8522ae0239eb1521
Contents?: true
Size: 826 Bytes
Versions: 19
Compression:
Stored size: 826 Bytes
Contents
# frozen_string_literal: true module FormHelpers def setup_form_tracking(driver) driver.execute_script <<~JS window.lastSubmittedForm = null; document.addEventListener('submit', (e) => { e.preventDefault(); window.lastSubmittedForm = e.target.id; }); JS end end RSpec.configure do |config| config.include FormHelpers, type: :feature end RSpec::Matchers.define :be_invalid do match do |element| element[:validity] == 'false' || element.evaluate_script('!this.validity.valid') end end RSpec::Matchers.define :have_been_submitted do match do |form| page.evaluate_script('window.lastSubmittedForm') == form['id'] end end RSpec::Matchers.define :have_invisible_textarea do match do |element| element.has_css?('textarea', visible: :hidden) end end
Version data entries
19 entries across 19 versions & 1 rubygems