2
votes

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.
1
Did you already download geckodriver as described above in your error log? If you already did but still had errors, try this potential duplicate question: stackoverflow.com/questions/41310586/…Jay-Ar Polidario
@Jay-ArPolidario I download archive from this link GitHub release page, but I don't know what I need do nextNikolay Lipovtsev
If you are using Ubuntu, try this on how to install geckodriver askubuntu.com/questions/870530/…Jay-Ar Polidario
Oh, sorry. Forgot to specify the path to the file. It work.Nikolay Lipovtsev
Good to hear it worked! :)Jay-Ar Polidario

1 Answers

2
votes

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