Method: Rundoc::CodeCommand::Website::Screenshot#call

Defined in:
lib/rundoc/code_command/website/screenshot.rb

#call(env = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rundoc/code_command/website/screenshot.rb', line 12

def call(env = {})
  puts "Taking screenshot: #{@driver.current_url}"
  filename = @driver.screenshot(
    upload: @upload,
    screenshots_dir: env[:context].screenshots_dir
  )

  relative_filename = filename.relative_path_from(env[:context].output_dir)
  env[:before] << "![Screenshot of #{@driver.current_url}](#{relative_filename})"
  ""
end