sauce_whisk
sauce_whisk copied to clipboard
undefined method `browser' for nil:NilClass for @driver
We have set up our specs based on this example, yet we run into this error as soon as we have more than a single spec:
Failure/Error: SauceWhisk::Jobs.change_status(@driver.browser.session_id, !example.exception)
NoMethodError: undefined method `browser' for nil:NilClass
our sauce_spec_helper.rb
has the following (ie the same stuff as the example with the addition of a flag we use specifically for Travis):
config.after(:each, skip: do_not_run_on_sauce?) do |example|
SauceWhisk::Jobs.change_status(@driver.browser.session_id, !example.exception)
@driver.quit
end
Any idea on what could be causing this?
So this behaviour only happens for more then one spec? Hmm. I suspect the reset logic in Capybara is removing the driver object before the after block is run. Can you share a copy of your Gemfile?
Sure thing, we're using capybara 3.14.0 and sauce_whisk 0.1.0:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
ruby '~> 2.6.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2'
# Use postgresql as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
gem 'autoprefixer-rails', '8.6.5'
gem 'bootsnap', require: false
gem 'carrierwave', '~> 1.0'
gem 'devise'
gem 'dropzonejs-rails'
gem 'fog-aws'
gem 'hashie'
gem 'kaminari'
gem 'less-rails-semantic_ui'
gem 'mini_magick'
gem 'omniauth'
gem 'omniauth-google-oauth2'
gem 'pg_search'
gem 'react-rails', '2.1.0'
gem 'therubyracer'
gem 'webpacker'
gem 'scout_apm', '~> 3.0.x'
gem 'ruby-odbc'
gem 'sequel'
gem 'paranoia'
group :development, :test do
gem 'awesome_print'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'figaro'
gem 'letter_opener'
gem 'rspec-rails'
end
group :test do
gem 'capybara'
gem 'codeclimate-test-reporter', require: false
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'faker'
gem 'poltergeist'
gem 'rails-controller-testing'
gem 'simplecov', require: false
gem 'vcr', require: false
gem 'webmock', require: false
gem 'selenium-webdriver'
gem 'sauce_whisk'
gem 'chromedriver-helper'
end
group :development do
gem 'better_errors'
gem 'bullet'
gem 'listen', '~> 3.1.5'
gem 'rubocop'
gem 'solargraph'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
# Access an IRB console on exception pages or by using <%= console %>
# anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
gem 'aws-sdk', '~> 3'
gem 'google-protobuf', '~> 3.7'
gem 'honeybadger'
gem 'httparty'
gem 'lograge'