Class: Maximus::Wraith
- Defined in:
- lib/maximus/statistics/wraith.rb
Overview
Instance Attribute Summary
Attributes inherited from Statistic
Instance Method Summary collapse
-
#result ⇒ Object
Generates screenshots for visual regression testing.
Methods inherited from Statistic
Methods included from Helper
#check_default_config_path, #edit_yaml, #file_count, #file_list, #is_rails?, #lines_added_to_range, #node_module_exists, #path_exists?, #prompt, #reporter_path, #root_dir, #truthy?
Constructor Details
This class inherits a constructor from Maximus::Statistic
Instance Method Details
#result ⇒ Object
Generates screenshots for visual regression testing
WARNING: If you call this class from a script,
you should delete the images generated after they've been
created.
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 49 |
# File 'lib/maximus/statistics/wraith.rb', line 21 def result return if @settings[:wraith].blank? node_module_exists('phantomjs', 'brew install') puts 'Starting visual regression tests with wraith...'.color(:blue) # Run history or latest depending on the existence of a history directory as defined # in each wraith config file. # @yieldparam browser [String] headless browser name # @yieldparam configpath [String] path to temp config file (see Config#wraith_setup) @settings[:wraith].each do |browser, configpath| next unless File.file?(configpath) # prevents abortive YAML error if it can't find the file wraith_yaml = YAML.load_file(configpath) if File.directory?("#{@settings[:root_dir]}/#{wraith_yaml['history_dir']}") puts `wraith latest #{configpath}` # Reset history dir # It puts the new shots in the history folder, even with absolute paths in the config. # Could be a bug in wraith. FileUtils.remove_dir("#{@settings[:root_dir]}/#{wraith_yaml['history_dir']}") end wraith_parse browser unless @config.is_dev? puts `wraith history #{configpath}` end @output end |