Class: IntransientCapybaraTest

Inherits:
ActionDispatch::IntegrationTest
  • Object
show all
Extended by:
Minitest::OptionalRetry
Includes:
Capybara::DSL, IntransientCapybaraHelper
Defined in:
lib/intransient_capybara/intransient_capybara_test.rb

Constant Summary collapse

@@warm_asset_cache =
Atomic.new(false)
@@warming_asset_cache =
Atomic.new(false)

Constants included from Minitest::OptionalRetry

Minitest::OptionalRetry::GLOBAL_RETRY_LIMIT

Instance Method Summary collapse

Methods included from Minitest::OptionalRetry

run_one_method

Methods included from IntransientCapybaraHelper

#allow_rack_requests!, #block_rack_requests!, #report_traffic, #resize_window_by, #stop_client, #teardown_wait_for_requests_complete!, #wait_for, #wait_for_ajax!, #wait_for_page_load!, #wait_for_response!

Instance Method Details

#setupObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/intransient_capybara/intransient_capybara_test.rb', line 22

def setup
  super

  @setup_called = true

  if ENV.fetch('TRACE_TEST_FRAMEWORK', false) == 'true'
    puts 'I am in capybara setup method'
  end

  page.driver.browser.url_blacklist = self.class.blacklisted_urls

  resize_window_by default_window_size

  warm_asset_cache

  allow_rack_requests!
end

#teardownObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/intransient_capybara/intransient_capybara_test.rb', line 40

def teardown
  if ENV.fetch('TRACE_TEST_FRAMEWORK', false) == 'true'
    puts 'I am in capybara teardown method'
  end

  @teardown_called = true

  # Wait on outstanding requests (but tests should not do stuff at the end, why bother clicking stuff you don't assert on?)
  # If you don't do this, the next time will fail because the server is busy
  wait_for_response!
  teardown_wait_for_requests_complete!

  report_traffic
  page.driver.clear_network_traffic

  page.driver.clear_cookies
  Capybara.reset_sessions!

  super
end