Class: IntegrationDiff::Runner
- Inherits:
-
Object
- Object
- IntegrationDiff::Runner
- Includes:
- Capybara::DSL
- Defined in:
- lib/integration_diff/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project_name, javascript_driver) ⇒ Runner
constructor
A new instance of Runner.
- #screenshot(identifier) ⇒ Object
-
#start_run ⇒ Object
TODO: Improve error handling here for network timeouts.
-
#wrap_run ⇒ Object
TODO: Improve error handling here for network timeouts.
Constructor Details
#initialize(project_name, javascript_driver) ⇒ Runner
Returns a new instance of Runner.
16 17 18 19 20 21 22 23 |
# File 'lib/integration_diff/runner.rb', line 16 def initialize(project_name, javascript_driver) @project_name = project_name @javascript_driver = javascript_driver dir = IntegrationDiff::Utils.images_dir Dir.mkdir('tmp') unless Dir.exist?('tmp') Dir.mkdir(dir) unless Dir.exist?(dir) end |
Class Method Details
.instance ⇒ Object
11 12 13 14 |
# File 'lib/integration_diff/runner.rb', line 11 def self.instance @runner ||= Runner.new(IntegrationDiff.project_name, IntegrationDiff.javascript_driver) end |
Instance Method Details
#screenshot(identifier) ⇒ Object
44 45 46 47 48 |
# File 'lib/integration_diff/runner.rb', line 44 def screenshot(identifier) screenshot_name = IntegrationDiff::Utils.image_file(identifier) page.save_screenshot(screenshot_name, full: true) @uploader.enqueue(identifier) end |
#start_run ⇒ Object
TODO: Improve error handling here for network timeouts
26 27 28 29 30 31 32 |
# File 'lib/integration_diff/runner.rb', line 26 def start_run draft_run @uploader = IntegrationDiff::Uploader.build(@run_id) rescue StandardError => e IntegrationDiff.logger.fatal e. raise e end |
#wrap_run ⇒ Object
TODO: Improve error handling here for network timeouts
35 36 37 38 39 40 41 42 |
# File 'lib/integration_diff/runner.rb', line 35 def wrap_run @uploader.wrapup complete_run if @run_id rescue StandardError => e IntegrationDiff.logger.fatal e. raise e end |