Class: IntegrationTestsRails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/integration_tests_rails/configuration.rb

Overview

Configuration class for this gem to modify adjustable settings for Capybara, Cuprite and Istanbul.

Constant Summary collapse

DEFAULT_HTML_CONTENT =
<<~HTML.squish
  <!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="turbo-visit-control" content="reload">
      <%= csrf_meta_tags %>
      <%= csp_meta_tag %>

      <!-- If there are stylesheets to include, include them here for testing. -->
      <!-- E.g. The line below loads a stylesheet file located in app/assets/stylesheets/app.css -->
      <%#= stylesheet_link_tag :app, "data-turbo-track": "reload" %>

      <%= javascript_importmap_tags %>

      <!-- If there are JavaScript libraries not globally available, include them here for testing.-->
      <!-- E.g. The block below shows how to import a JavaScript module and attach it to the window object. -->
      <!-- The file is located in app/javascripts/libs/my_library.js -->
      <!--
      <script type="module">
        import MyLibrary from 'libs/my_library';
        window.MyLibrary = MyLibrary;
      </script>
      -->
    </head>
    <body>
      <!-- Include JavaScript libraries here instead if they need to be loaded much later. -->
      <!-- E.g. The line below loads a JavaScript file located in app/assets/javascripts/plugins/vendor.min.js -->
      <%#= javascript_include_tag 'plugins/vendor.min' %>
    </body>
  </html>
HTML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

rubocop:disable Metrics/MethodLength, Metrics/AbcSize



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/integration_tests_rails/configuration.rb', line 45

def initialize # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
  @auto_retry = false
  @backup_dir = 'tmp/js_backup'
  @chrome_url = nil
  @coverage_path = 'coverage/nyc'
  @experimental_features = false
  @headless = true
  @js_coverage = true
  @max_server_retries = 1000
  @output_dir = 'tmp/instrumented_js'
  @puma_threads = '1:1'
  @remote = false
  @retry_attempts = 1
  @retry_capture_exceptions = [
    'RSpec::Expectations::ExpectationNotMetError',
    'Capybara::ElementNotFound',
    'Ferrum::JavaScriptError'
  ]
  @retry_sleep_duration = 0
  @server_host = '0.0.0.0' # rubocop:disable Style/IpAddresses
  @server_port = nil
  @source_dir = 'app/javascript'
  @tests_page_html = DEFAULT_HTML_CONTENT
  @timeout = 30
  @verbose = false
  @wait_time = 5
  @window_size = [1920, 1080]
end

Instance Attribute Details

#auto_retryObject

Returns the value of attribute auto_retry.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def auto_retry
  @auto_retry
end

#backup_dirObject

Returns the value of attribute backup_dir.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def backup_dir
  @backup_dir
end

#chrome_urlObject

Returns the value of attribute chrome_url.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def chrome_url
  @chrome_url
end

#coverage_pathObject

Returns the value of attribute coverage_path.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def coverage_path
  @coverage_path
end

#experimental_featuresObject

Returns the value of attribute experimental_features.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def experimental_features
  @experimental_features
end

#headlessObject

Returns the value of attribute headless.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def headless
  @headless
end

#js_coverageObject

Returns the value of attribute js_coverage.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def js_coverage
  @js_coverage
end

#max_server_retriesObject

Returns the value of attribute max_server_retries.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def max_server_retries
  @max_server_retries
end

#output_dirObject

Returns the value of attribute output_dir.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def output_dir
  @output_dir
end

#puma_threadsObject

Returns the value of attribute puma_threads.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def puma_threads
  @puma_threads
end

#remoteObject

Returns the value of attribute remote.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def remote
  @remote
end

#retry_attemptsObject

Returns the value of attribute retry_attempts.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def retry_attempts
  @retry_attempts
end

#retry_capture_exceptionsObject

Returns the value of attribute retry_capture_exceptions.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def retry_capture_exceptions
  @retry_capture_exceptions
end

#retry_sleep_durationObject

Returns the value of attribute retry_sleep_duration.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def retry_sleep_duration
  @retry_sleep_duration
end

#server_hostObject

Returns the value of attribute server_host.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def server_host
  @server_host
end

#server_portObject

Returns the value of attribute server_port.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def server_port
  @server_port
end

#source_dirObject

Returns the value of attribute source_dir.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def source_dir
  @source_dir
end

#tests_page_htmlObject

Returns the value of attribute tests_page_html.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def tests_page_html
  @tests_page_html
end

#timeoutObject

Returns the value of attribute timeout.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def timeout
  @timeout
end

#verboseObject

Returns the value of attribute verbose.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def verbose
  @verbose
end

#wait_timeObject

Returns the value of attribute wait_time.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def wait_time
  @wait_time
end

#window_sizeObject

Returns the value of attribute window_size.



40
41
42
# File 'lib/integration_tests_rails/configuration.rb', line 40

def window_size
  @window_size
end

Instance Method Details

#backup_pathObject



82
83
84
# File 'lib/integration_tests_rails/configuration.rb', line 82

def backup_path
  Rails.root.join(backup_dir)
end

#coverage_dirObject



86
87
88
# File 'lib/integration_tests_rails/configuration.rb', line 86

def coverage_dir
  Rails.root.join(coverage_path)
end

#coverage_fileObject



90
91
92
# File 'lib/integration_tests_rails/configuration.rb', line 90

def coverage_file
  coverage_dir.join('coverage.json')
end

#output_pathObject



78
79
80
# File 'lib/integration_tests_rails/configuration.rb', line 78

def output_path
  Rails.root.join(output_dir)
end

#source_pathObject



74
75
76
# File 'lib/integration_tests_rails/configuration.rb', line 74

def source_path
  Rails.root.join(source_dir)
end