Sha256: 9cdeb9e7d3b7495cb4632a5b1d5302af51a41c2d90da0dd8a5dd9e3d6dac982a

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

require 'rspec'
require 'capybara/rspec'

# Use Rack config exactly as shipped in the GEM
Capybara.app = Rack::Builder.new_from_string(File.read('config.ru'))

describe 'browser formatter', type: :feature do
  RSpec.shared_examples :browser do |driver, error_fetcher|
    context "in #{driver}", driver: driver do
      before do
        visit '/'
        # Specs should run in 12 seconds but in case Travis takes longer, provide some cushion
        Capybara.default_wait_time = 40
      end

      after do
        js_errors = error_fetcher[page]
        puts "Javascript errors: #{js_errors}" if js_errors.any?
      end

      it 'matches test results' do
        expect(page).to have_content '142 examples, 40 failures, 12 pending'
      end
    end
  end

  include_examples :browser, :selenium, lambda {|page| page.evaluate_script('window.jsErrors') }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-rspec-0.6.0 spec/mri/integration/browser_spec.rb
opal-rspec-0.6.0.beta1 spec/mri/integration/browser_spec.rb