module Unobtainium::Cucumber::Action
Namespace for built-in status actions
Namespace for built-in status actions
Public Class Methods
store_content(world, scenario)
click to toggle source
Status action function that stores the page content (main page only)
# File lib/unobtainium-cucumber/action/content.rb, line 24 def store_content(world, scenario) # Make sure the content directory exists. basedir = File.join(Dir.pwd, 'content') FileUtils.mkdir_p(basedir) # Store content. Note that not all drivers may support this. filename = File.join(basedir, base_filename(scenario)) filename += '.txt' File.open(filename, 'w') do |file| file.write(world.driver.page_source) end end
store_screenshot(world, scenario)
click to toggle source
Status action function that takes a screenshot.
# File lib/unobtainium-cucumber/action/screenshot.rb, line 24 def store_screenshot(world, scenario) # Make sure the screenshots directory exists. basedir = File.join(Dir.pwd, 'screenshots') FileUtils.mkdir_p(basedir) # Take screenshot. filename = File.join(basedir, base_filename(scenario)) filename += '.png' world.driver.save_screenshot(filename) end