Class: LookbookVisualTester::Configuration
- Inherits:
-
Object
- Object
- LookbookVisualTester::Configuration
- Defined in:
- lib/lookbook_visual_tester/configuration.rb
Constant Summary collapse
- DEFAULT_THREADS =
4
Instance Attribute Summary collapse
-
#automatic_run ⇒ Object
Returns the value of attribute automatic_run.
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#baseline_dir ⇒ Object
Returns the value of attribute baseline_dir.
-
#browser_options ⇒ Object
Returns the value of attribute browser_options.
-
#browser_path ⇒ Object
Returns the value of attribute browser_path.
-
#browser_timeout ⇒ Object
Returns the value of attribute browser_timeout.
-
#components_folder ⇒ Object
Returns the value of attribute components_folder.
-
#copy_to_clipboard ⇒ Object
Returns the value of attribute copy_to_clipboard.
-
#current_dir ⇒ Object
Returns the value of attribute current_dir.
-
#diff_dir ⇒ Object
Returns the value of attribute diff_dir.
-
#driver_adapter ⇒ Object
Returns the value of attribute driver_adapter.
-
#history_dir ⇒ Object
Returns the value of attribute history_dir.
-
#history_keep_last_n ⇒ Object
Returns the value of attribute history_keep_last_n.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#lookbook_host ⇒ Object
Returns the value of attribute lookbook_host.
-
#mask_selectors ⇒ Object
Returns the value of attribute mask_selectors.
-
#preview_checker_setup ⇒ Object
Returns the value of attribute preview_checker_setup.
-
#process_timeout ⇒ Object
Returns the value of attribute process_timeout.
-
#threads ⇒ Object
Returns the value of attribute threads.
-
#tolerance ⇒ Object
Returns the value of attribute tolerance.
-
#ui_comparison ⇒ Object
Returns the value of attribute ui_comparison.
-
#wait_time ⇒ Object
Returns the value of attribute wait_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 12 def initialize root_path = if defined?(Rails) && Rails.respond_to?(:root) && Rails.root Rails.root else Pathname.new(Dir.pwd) end @base_path = root_path.join('coverage/screenshots') @baseline_dir = @base_path.join('baseline') @current_dir = @base_path.join('current_run') @diff_dir = @base_path.join('diff') @history_dir = @base_path.join('history') @threads = ENV.fetch('LOOKBOOK_THREADS', DEFAULT_THREADS).to_i @history_keep_last_n = 5 @copy_to_clipboard = false @components_folder = 'app/components' @automatic_run = ENV.fetch('LOOKBOOK_AUTOMATIC_RUN', 'false') == 'true' @mask_selectors = [] @driver_adapter = :ferrum @preview_checker_setup = nil @wait_time = 0.5 @tolerance = 0.0 @logger = if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger Rails.logger else require 'logger' Logger.new($stdout).tap { |l| l.level = Logger::INFO } end @lookbook_host = ENV.fetch('LOOKBOOK_HOST', 'http://localhost:5000') # Browser (Ferrum/Chrome) configuration. Defaults target modern Chrome's # `--headless=new` mode; the old `--headless` flag is rejected by current # Chrome builds ("Multiple targets are not supported in headless mode"). @browser_path = ENV['LOOKBOOK_BROWSER_PATH'] || LookbookVisualTester::BrowserDiscovery.find_binary @browser_options = { 'headless' => 'new' } @browser_timeout = ENV.fetch('LOOKBOOK_BROWSER_TIMEOUT', '10').to_i @process_timeout = ENV.fetch('LOOKBOOK_PROCESS_TIMEOUT', '10').to_i end |
Instance Attribute Details
#automatic_run ⇒ Object
Returns the value of attribute automatic_run.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def automatic_run @automatic_run end |
#base_path ⇒ Object
Returns the value of attribute base_path.
3 4 5 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 3 def base_path @base_path end |
#baseline_dir ⇒ Object
Returns the value of attribute baseline_dir.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def baseline_dir @baseline_dir end |
#browser_options ⇒ Object
Returns the value of attribute browser_options.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def @browser_options end |
#browser_path ⇒ Object
Returns the value of attribute browser_path.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def browser_path @browser_path end |
#browser_timeout ⇒ Object
Returns the value of attribute browser_timeout.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def browser_timeout @browser_timeout end |
#components_folder ⇒ Object
Returns the value of attribute components_folder.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def components_folder @components_folder end |
#copy_to_clipboard ⇒ Object
Returns the value of attribute copy_to_clipboard.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def copy_to_clipboard @copy_to_clipboard end |
#current_dir ⇒ Object
Returns the value of attribute current_dir.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def current_dir @current_dir end |
#diff_dir ⇒ Object
Returns the value of attribute diff_dir.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def diff_dir @diff_dir end |
#driver_adapter ⇒ Object
Returns the value of attribute driver_adapter.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def driver_adapter @driver_adapter end |
#history_dir ⇒ Object
Returns the value of attribute history_dir.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def history_dir @history_dir end |
#history_keep_last_n ⇒ Object
Returns the value of attribute history_keep_last_n.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def history_keep_last_n @history_keep_last_n end |
#logger ⇒ Object
Returns the value of attribute logger.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def logger @logger end |
#lookbook_host ⇒ Object
Returns the value of attribute lookbook_host.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def lookbook_host @lookbook_host end |
#mask_selectors ⇒ Object
Returns the value of attribute mask_selectors.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def mask_selectors @mask_selectors end |
#preview_checker_setup ⇒ Object
Returns the value of attribute preview_checker_setup.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def preview_checker_setup @preview_checker_setup end |
#process_timeout ⇒ Object
Returns the value of attribute process_timeout.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def process_timeout @process_timeout end |
#threads ⇒ Object
Returns the value of attribute threads.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def threads @threads end |
#tolerance ⇒ Object
Returns the value of attribute tolerance.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def tolerance @tolerance end |
#ui_comparison ⇒ Object
Returns the value of attribute ui_comparison.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def ui_comparison @ui_comparison end |
#wait_time ⇒ Object
Returns the value of attribute wait_time.
4 5 6 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 4 def wait_time @wait_time end |
Class Method Details
.config ⇒ Object
59 60 61 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 59 def config @config ||= new end |
.configure {|config| ... } ⇒ Object
63 64 65 |
# File 'lib/lookbook_visual_tester/configuration.rb', line 63 def configure yield(config) end |