I have this code, I am trying to click on the button to test its functionality using guard and capybara. I get an undefined method error on guard when I have it written like this. It comes back with no errors if I comment out the click_button line. It should render a response that the import was successful as well which is being displayed by an index page.
require 'rails_helper'
require 'spec_helper'
RSpec.describe "Imports", type: :request do
it "checks the import page." do
get '/imports'
click_button "submit"
end
end
how long does the it take to load the element? if > 2 seconds (capybara default wait time is 2s) then it's most likely you will get the undefined method error...
Try increasing capybara's timeout or do it for that element only:
If that doesn't solve your issue then assure "submit" is the correct path to your element...