Recently we made the switch from Bootstrap to Foundation and naturally a bunch of our feature tests are breaking with Capybara (with a Poltergeist driver). When I run my "suite" (only using one test example here), I get the following error:
1) AccountManagement adding a new account and skipping payments integration
Failure/Error: sign_in_with www_sign_in_url, account.owner.email, 'valid_password'
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
SyntaxError: Parse error
SyntaxError: Parse error
# /Users/.rvm/gems/ruby-2.1.2/gems/poltergeist-1.5.1/lib/capybara/poltergeist/browser.rb:275:in `command'
# /Users/.rvm/gems/ruby-2.1.2/gems/poltergeist-1.5.1/lib/capybara/poltergeist/browser.rb:29:in `visit'
# /Users/.rvm/gems/ruby-2.1.2/gems/poltergeist-1.5.1/lib/capybara/poltergeist/driver.rb:89:in `visit'
# /Users/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
# /Users/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/support/features/session_helpers.rb:12:in `sign_in_with'
# ./spec/features/account_management_spec.rb:19:in `block (2 levels) in <top (required)>'
# ./spec/rails_helper.rb:115:in `block (3 levels) in <top (required)>'
# ./spec/rails_helper.rb:112:in `times'
# ./spec/rails_helper.rb:112:in `block (2 levels) in <top (required)>'
Unfortunately, when I checkout the "www_sign_in_url" I don't see any JS errors in the chrome console.
This is what the suite looks like:
require 'rails_helper'
feature "AccountManagement", :type => :feature do
let!(:port_number) { 3001 }
let!(:account) { create(:account, owner: create(:owner, password: 'valid_password', confirmed_at: Time.now, tour: true)) }
let!(:sign_in_url) { "http://#{account.subdomain}.lvh.me:#{port_number}/admin/sign_in" }
let!(:www_sign_in_url) { "http://ift.tt/1zR5VLw" }
let!(:store_url) { "http://#{account.subdomain}.lvh.me:#{port_number}/" }
let!(:sign_up_with_stripe) { "http://#{account.subdomain}.lvh.me:#{port_number}/admin/payment_integration" }
before(:each) do
Capybara.server_port = port_number
Capybara.app_host = root_url
Capybara.default_wait_time = 15
end
scenario 'adding a new account and skipping payments integration', :js => true do
sign_in_with www_sign_in_url, account.owner.email, 'valid_password'
expect(page).to have_content('Manage stores')
click_on 'Add store'
expect(page).to have_content('Basic Store Info')
fill_in "account[business_attributes][name]", with: 'newstore'
fill_in "account[subdomain]", with: 'newstore'
click_on 'Skip payment setup'
expect(page).to have_content('Welcome')
end
This is what the sign_in_with method looks like:
def sign_in_with(sign_in_url, email, password, user_type = 'user')
visit sign_in_url
fill_in "#{user_type}[email]", with: email
fill_in "#{user_type}[password]", with: password
click_button 'SIGN IN'
end
Where else can I check for a JS error if not the chrome console?
Aucun commentaire:
Enregistrer un commentaire