2

I try test my new gem, with use js. But got errors

  • rails 5.1.5
  • rspec-rails 3.7.2
  • capybara 2.18.0
  • selenium-webdriver 3.10.0

app/spec/rails_helper.rb

require 'spec_helper'

...
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/rails'
require 'support/factory_bot'

app/spec/features/view_helper_spec.rb

require 'rails_helper'

RSpec.describe DynamicNestedForms::ViewHelpers do
  # it "does something" do
  it "displays patient" do
    patient = create(:patient)
    visit edit_patient_path(patient)

    expect(page).to have_selector("input[value='#{patient.name}']")
  end

  it "displays physicians", :js => true do
    patient = create(:patient)
    physician = create(:physician)
    visit edit_patient_path(patient)

    fill_in "autocomplete_nested_content", with: physician[0..2]

    expect(page).to have_selector(".ui-menu-item-wrapper", text: physician.name)
  end
end

I get this error:

Selenium::WebDriver::Error::WebDriverError:
        Unable to find Mozilla geckodriver. Please download the server from https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH. More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.
Nikolay Lipovtsev
  • 657
  • 1
  • 6
  • 15

1 Answers1

3

The easiest solution to this is to add the webdrivers gem to your project which will automatically download/install the relevant driver program and inform selenium-webdriver of its location - https://github.com/titusfortner/webdrivers

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78