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 =
"<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"turbo-visit-control\" content=\"reload\">\n    <%= csrf_meta_tags %>\n    <%= csp_meta_tag %>\n\n    <!-- If there are stylesheets to include, include them here for testing. -->\n    <!-- E.g. The line below loads a stylesheet file located in app/assets/stylesheets/app.css -->\n    <%#= stylesheet_link_tag :app, \"data-turbo-track\": \"reload\" %>\n\n    <%= javascript_importmap_tags %>\n\n    <!-- If there are JavaScript libraries not globally available, include them here for testing.-->\n    <!-- E.g. The block below shows how to import a JavaScript module and attach it to the window object. -->\n    <!-- The file is located in app/javascripts/libs/my_library.js -->\n    <!--\n    <script type=\"module\">\n      import MyLibrary from 'libs/my_library';\n      window.MyLibrary = MyLibrary;\n    </script>\n    -->\n  </head>\n  <body>\n    <!-- Include JavaScript libraries here instead if they need to be loaded much later. -->\n    <!-- E.g. The line below loads a JavaScript file located in app/assets/javascripts/plugins/vendor.min.js -->\n    <%#= javascript_include_tag 'plugins/vendor.min' %>\n  </body>\n</html>\n".squish

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/integration_tests_rails/configuration.rb', line 44

def initialize
  @backup_dir = 'tmp/js_backup'
  @chrome_url = nil
  @coverage_path = 'coverage/nyc'
  @experimental_features = false
  @max_server_retries = 1000
  @output_dir = 'tmp/instrumented_js'
  @puma_threads = '1:1'
  @remote = false
  @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

#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

#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

#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



71
72
73
# File 'lib/integration_tests_rails/configuration.rb', line 71

def backup_path
  Rails.root.join(backup_dir)
end

#coverage_dirObject



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

def coverage_dir
  Rails.root.join(coverage_path)
end

#coverage_fileObject



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

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

#output_pathObject



67
68
69
# File 'lib/integration_tests_rails/configuration.rb', line 67

def output_path
  Rails.root.join(output_dir)
end

#source_pathObject



63
64
65
# File 'lib/integration_tests_rails/configuration.rb', line 63

def source_path
  Rails.root.join(source_dir)
end