Class: ClickSession::WebRunner

Inherits:
Object
  • Object
show all
Includes:
Capybara::DSL
Defined in:
lib/click_session/web_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processor) ⇒ WebRunner

Returns a new instance of WebRunner.



14
15
16
17
18
19
20
# File 'lib/click_session/web_runner.rb', line 14

def initialize(processor)
  Capybara.default_driver = ClickSession.configuration.driver_client
  Capybara.javascript_driver = ClickSession.configuration.driver_client
  Capybara.run_server = false
  page = Capybara::Session.new(ClickSession.configuration.driver_client)
  @processor = processor
end

Instance Attribute Details

#processorObject (readonly)

Returns the value of attribute processor.



12
13
14
# File 'lib/click_session/web_runner.rb', line 12

def processor
  @processor
end

Instance Method Details

#point_of_no_returnObject



37
38
39
# File 'lib/click_session/web_runner.rb', line 37

def point_of_no_return
  processor.stop_processing
end

#resetObject



26
27
28
# File 'lib/click_session/web_runner.rb', line 26

def reset
  clear_cookies
end

#run(model) ⇒ Object



22
23
24
# File 'lib/click_session/web_runner.rb', line 22

def run(model)
  raise NotImplementedError("You need to override the #steps method by sub classing WebRunner")
end

#save_screenshot(file_name_identity = "") ⇒ Object



30
31
32
33
34
35
# File 'lib/click_session/web_runner.rb', line 30

def save_screenshot(file_name_identity = "")
  @file_name = build_file_name_for(file_name_identity)
  page.save_screenshot(screenshot_save_path, full: true)

  S3FileUploader.new.upload_file(@file_name)
end